Skip to content

Commit 44155e0

Browse files
committed
ci: refactor dist, build, prepublish scripts
1 parent 0e8ab9c commit 44155e0

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,19 @@
1919
"design-system"
2020
],
2121
"scripts": {
22-
"build": "script/build",
22+
"dist": "script/dist",
2323
"build-storybook": "build-storybook -o build",
2424
"check-links": "script/check-links http://localhost:3000/css -v",
2525
"lint": "stylelint --quiet --syntax scss src/**/*.scss",
26-
"now-build": "next build",
26+
"build": "next build",
2727
"now-start": "next start",
2828
"postlint": "echo 'TODO: eslint docs pages'",
2929
"postpublish": "script/postpublish",
30-
"prepare": "npm run build",
30+
"prepare": "npm run dist",
3131
"prepublishOnly": "script/prepublish",
32+
"postpublish": "script/postpublish",
3233
"publish-storybook": "npm run storybook && gh-pages -d build -b gh-pages -r https://github.com/primer/storybook",
33-
"start": "next",
34+
"start": "script/server",
3435
"start-storybook": "start-storybook -p 8000 -c .storybook",
3536
"sync": "script/sync",
3637
"test": "npm-run-all -s test-jest test-urls",

script/build renamed to script/dist

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
set -e
33

4-
outdir=build
4+
outdir=dist
55
rm -rf $outdir
66
mkdir -p src/$outdir
77

@@ -19,7 +19,7 @@ for index in $indexes; do
1919
fi
2020
file="$outdir/$name.css"
2121
pushd $dir > /dev/null
22-
echo "[build] $index -> $file"
22+
echo "[dist] $index -> $file"
2323
npx node-sass --include-path=$root index.scss > "$root/$file"
2424
npx cssstats "$root/$file" > "$root/$outdir/$name.json"
2525
echo "module.exports = {cssstats: require('./$name.json')}" > "$root/$outdir/$name.js"

script/prepublish

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
22

3+
# generate the build directory
4+
npm run dist
5+
36
files=$(git ls-files src | sed -e 's#^src/##' | sed -e 's#/.*$##' | sort -u)
47
echo $files > publish-files.txt
58
cd src

script/server

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
if [[ "$NODE_ENV" = "production" ]]; then
4+
next
5+
else
6+
next start
7+
fi

0 commit comments

Comments
 (0)