Skip to content
This repository has been archived by the owner on Mar 25, 2023. It is now read-only.

Commit

Permalink
Give chromatic the correct script and add some more args
Browse files Browse the repository at this point in the history
- Turns out it was calling build-storybook from within docs (makes sense)
- Delete the misleading script at top level package.json
- chromatic: Use `storybook-build` specifically via `--build-script-name`
- chromatic: Use a constant out dir so that we can cache it (doesn't happen yet)
- chromatic: Start fresh after rebase (don't use previous build on branch as baseline)
  • Loading branch information
milesrichardson committed Aug 20, 2021
1 parent c7489f3 commit cd13fc5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
11 changes: 10 additions & 1 deletion .ci/chromatic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,20 @@ if test ! -d docs ; then
exit 1
fi

# Move to the docs directory where storybook is
cd docs || { echo "Failed to cd to docs" ; exit 1 ; }

# Chromatic expects `yarn build-storybook` to exist (we are in docs directory)
# Write the build to a known location (not default /tmp) so that CI can cache it
mkdir -p out-storybook

# https://www.chromatic.com/docs/cli
# note: --ignore-last-build-on-branch is for rebase situations (see above link)
# todo: add --skip argument, if commit msg includes e.g. [skip chromatic]
yarn dlx chromatic \
--build-script-name "storybook-build" \
--output-dir "out-storybook" \
--project-token="$CHROMATIC_PROJECT_TOKEN" \
--ignore-last-build-on-branch \
--auto-accept-changes \
&& exit 0

Expand Down
4 changes: 1 addition & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
"deploy": "cp now.json out/ && yarn run now",
"start": "serve out",
"clean": "./clean.sh",
"hello": "echo Hello from $(pwd)",
"storybook": "start-storybook -p 3000",
"storybook-build": "yarn run build-storybook -o out-storybook",
"storybook-dev": "yarn run storybook --host 0.0.0.0 --port 3000 --no-open",
"storybook-dev": "yarn run start-storybook --host 0.0.0.0 --port 3000 --no-open",
"storybook-diagnostic": "yarn run storybook-dev --loglevel silly --debug-webpack"
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"update-docs": "node ./content-scripts/updateDocs.js",
"dev:@splitgraph/docs": "yarn workspace @splitgraph/docs run dev",
"typecheck-docs": "yarn tsc --build --verbose docs",
"debug-yarn": "NODE_OPTIONS=\"$NODE_OPTIONS --inspect-brk=0.0.0.0:9229\" node .yarn/releases/yarn-berry.js",
"build-storybook": "yarn workspace @splitgraph/docs run build-storybook"
"debug-yarn": "NODE_OPTIONS=\"$NODE_OPTIONS --inspect-brk=0.0.0.0:9229\" node .yarn/releases/yarn-berry.js"
},
"devDependencies": {
"npm-run-all": "4.1.5",
Expand Down

0 comments on commit cd13fc5

Please sign in to comment.