Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
"start": "cross-env NODE_ENV=storybook storybook dev -p 9003 --ci -c '.storybook'",
"build:storybook": "storybook build -c .storybook -o dist/$(git rev-parse HEAD)/storybook",
"start:chromatic": "CHROMATIC=1 NODE_ENV=storybook storybook dev -p 9004 --ci -c '.chromatic'",
"build:chromatic": "CHROMATIC=1 storybook build -c .chromatic -o dist/$(git rev-parse HEAD)/chromatic",
"build:chromatic": "CHROMATIC=1 storybook build -c .chromatic -o dist/$(git rev-parse HEAD)/chromatic --stats-json",
"start:chromatic-fc": "CHROMATIC=1 NODE_ENV=storybook storybook dev -p 9005 --ci -c '.chromatic-fc'",
"build:chromatic-fc": "CHROMATIC=1 storybook build -c .chromatic-fc -o dist/$(git rev-parse HEAD)/chromatic-fc",
"build:chromatic-fc": "CHROMATIC=1 storybook build -c .chromatic-fc -o dist/$(git rev-parse HEAD)/chromatic-fc --stats-json",
"start:s2": "NODE_ENV=storybook storybook dev -p 6006 --ci -c '.storybook-s2'",
"build:storybook-s2": "NODE_ENV=storybook storybook build -c .storybook-s2 -o dist/$(git rev-parse HEAD)/storybook-s2",
"build:s2-storybook-docs": "NODE_ENV=storybook storybook build -c .storybook-s2 --docs",
Expand Down Expand Up @@ -62,8 +62,8 @@
"build:icons": "babel-node --presets @babel/env ./scripts/buildIcons.js",
"clean:icons": "babel-node --presets @babel/env ./scripts/cleanIcons.js",
"postinstall": "patch-package && yarn build:icons",
"chromatic": "NODE_ENV=production CHROMATIC=1 chromatic --project-token $CHROMATIC_PROJECT_TOKEN --build-script-name 'build:chromatic'",
"chromatic:forced-colors": "NODE_ENV=production CHROMATIC=1 chromatic --project-token $CHROMATIC_FC_PROJECT_TOKEN --build-script-name 'build:chromatic-fc'",
"chromatic": "NODE_ENV=production CHROMATIC=1 chromatic --project-token $CHROMATIC_PROJECT_TOKEN --build-script-name 'build:chromatic' --only-changed --trace-changed --externals './packages/**/style/**/*'",
"chromatic:forced-colors": "NODE_ENV=production CHROMATIC=1 chromatic --project-token $CHROMATIC_FC_PROJECT_TOKEN --build-script-name 'build:chromatic-fc' --only-changed --trace-changed --externals './packages/**/style/**/*'",
"merge:css": "babel-node --presets @babel/env ./scripts/merge-spectrum-css.js",
"release": "lerna publish from-package --yes",
"version:nightly": "yarn workspaces foreach --all --no-private -t version -d 3.0.0-nightly-$(git rev-parse --short HEAD)-$(date +'%y%m%d') && yarn apply-nightly --all",
Expand Down Expand Up @@ -142,7 +142,7 @@
"babel-plugin-react-remove-properties": "^0.3.0",
"babel-plugin-transform-glob-import": "^1.0.1",
"chalk": "^4.1.2",
"chromatic": "^15.0.0",
"chromatic": "^17.0.0",
"clsx": "^2.0.0",
"color-space": "^1.16.0",
"concurrently": "^6.0.2",
Expand Down
25 changes: 25 additions & 0 deletions packages/dev/parcel-reporter-turbosnap-stats/StatsReporter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import {addStoryEntries, buildStatsMap, rewriteStoryVirtuals, writeStats} from './helpers';
import {Reporter} from '@parcel/plugin';

const reporter = new Reporter({
async report({event, options, logger}) {
if (event.type !== 'buildSuccess') return;

const statsMap = buildStatsMap(event.bundleGraph, options.projectRoot);
rewriteStoryVirtuals(statsMap);
addStoryEntries(statsMap, logger);

const bundles = event.bundleGraph.getBundles();
const distDir = bundles[0]?.target.distDir;
if (!distDir) {
throw new Error(
'parcel-reporter-turbosnap-stats: no bundles were produced; cannot determine output dir.'
);
}
await writeStats(distDir, statsMap, options.outputFS, logger);
}
});

// Parcel's plugin loader expects `module.exports = <pluginInstance>`,
// not the `.default` wrapper TypeScript would otherwise produce.
module.exports = reporter;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@parcel/config-default"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import {Button} from './Button';
export {Button};
export default {title: 'Button'};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const Button = () => null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!doctype html>
<html>
<body>
<script type="module" src="./preview.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import stories from './storybook-builder-parcel/generated-entries/stories.js';
console.log(stories);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Mirrors what parcel-resolver-storybook emits for each `story:` glob: an object
// of `() => import('./Foo.stories.tsx')` async loaders. rewriteStoryVirtuals
// renames this file's STORY_VIRTUAL_RE-matching path to ./storybook-stories.js
// in the emitted stats.
module.exports = {
'./Button.stories.tsx': () => import('../../Button.stories.tsx')
};
Loading