Skip to content

Commit

Permalink
Merge pull request #28411 from storybookjs/kasper/fix-cra
Browse files Browse the repository at this point in the history
Build: Make sure CRA sandboxes are not transpiling destructuring expressions
  • Loading branch information
yannbf authored Jul 2, 2024
2 parents 71d100b + cd4f0d3 commit 6476483
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions code/lib/cli/src/sandbox-templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ type BaseTemplates = Template & {
const baseTemplates = {
'cra/default-js': {
name: 'Create React App Latest (Webpack | JavaScript)',
script: 'npx create-react-app {{beforeDir}}',
script: `
npx create-react-app {{beforeDir}} && cd {{beforeDir}} && \
jq '.browserslist.production[0] = ">0.9%"' package.json > tmp.json && mv tmp.json package.json
`,
expected: {
// TODO: change this to @storybook/cra once that package is created
framework: '@storybook/react-webpack5',
Expand All @@ -120,7 +123,10 @@ const baseTemplates = {
},
'cra/default-ts': {
name: 'Create React App Latest (Webpack | TypeScript)',
script: 'npx create-react-app {{beforeDir}} --template typescript',
script: `
npx create-react-app {{beforeDir}} --template typescript && cd {{beforeDir}} && \
jq '.browserslist.production[0] = ">0.9%"' package.json > tmp.json && mv tmp.json package.json
`,
// Re-enable once https://github.com/storybookjs/storybook/issues/19351 is fixed.
skipTasks: ['smoke-test', 'bench'],
expected: {
Expand Down
2 changes: 1 addition & 1 deletion scripts/sandbox/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const sbInit = async (
flags?: string[],
debug?: boolean
) => {
const sbCliBinaryPath = join(__dirname, `../../code/lib/cli/bin/index.js`);
const sbCliBinaryPath = join(__dirname, `../../code/lib/cli/bin/index.cjs`);
console.log(`🎁 Installing storybook`);
const env = { STORYBOOK_DISABLE_TELEMETRY: 'true', ...envVars };
const fullFlags = ['--yes', ...(flags || [])];
Expand Down

0 comments on commit 6476483

Please sign in to comment.