1
1
mirror of https://github.com/primer/css.git synced 2024-09-20 13:17:29 +03:00

ci: refactor dist, build, prepublish scripts

This commit is contained in:
Shawn Allen 2019-02-04 15:37:52 -08:00
parent 0e8ab9c872
commit 44155e0eaa
4 changed files with 17 additions and 6 deletions

View File

@ -19,18 +19,19 @@
"design-system"
],
"scripts": {
"build": "script/build",
"dist": "script/dist",
"build-storybook": "build-storybook -o build",
"check-links": "script/check-links http://localhost:3000/css -v",
"lint": "stylelint --quiet --syntax scss src/**/*.scss",
"now-build": "next build",
"build": "next build",
"now-start": "next start",
"postlint": "echo 'TODO: eslint docs pages'",
"postpublish": "script/postpublish",
"prepare": "npm run build",
"prepare": "npm run dist",
"prepublishOnly": "script/prepublish",
"postpublish": "script/postpublish",
"publish-storybook": "npm run storybook && gh-pages -d build -b gh-pages -r https://github.com/primer/storybook",
"start": "next",
"start": "script/server",
"start-storybook": "start-storybook -p 8000 -c .storybook",
"sync": "script/sync",
"test": "npm-run-all -s test-jest test-urls",

View File

@ -1,7 +1,7 @@
#!/bin/bash
set -e
outdir=build
outdir=dist
rm -rf $outdir
mkdir -p src/$outdir
@ -19,7 +19,7 @@ for index in $indexes; do
fi
file="$outdir/$name.css"
pushd $dir > /dev/null
echo "[build] $index -> $file"
echo "[dist] $index -> $file"
npx node-sass --include-path=$root index.scss > "$root/$file"
npx cssstats "$root/$file" > "$root/$outdir/$name.json"
echo "module.exports = {cssstats: require('./$name.json')}" > "$root/$outdir/$name.js"

View File

@ -1,5 +1,8 @@
#!/bin/bash
# generate the build directory
npm run dist
files=$(git ls-files src | sed -e 's#^src/##' | sed -e 's#/.*$##' | sort -u)
echo $files > publish-files.txt
cd src

7
script/server Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
if [[ "$NODE_ENV" = "production" ]]; then
next
else
next start
fi