From b15400e670a977a5c3433449fcc4dc0e6a66bf47 Mon Sep 17 00:00:00 2001 From: Kasper Peulen Date: Mon, 1 Jul 2024 15:13:59 +0200 Subject: [PATCH 1/5] Make sure CRA sandboxes are not transpiling destructuring --- code/lib/cli/src/sandbox-templates.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/code/lib/cli/src/sandbox-templates.ts b/code/lib/cli/src/sandbox-templates.ts index cf3020564924..81a02503de39 100644 --- a/code/lib/cli/src/sandbox-templates.ts +++ b/code/lib/cli/src/sandbox-templates.ts @@ -92,7 +92,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}} && \ + 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', @@ -103,7 +106,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 && \ + 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: { From ac5335326f6f79e5decf51ed253915ffe3ed3d6e Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Mon, 1 Jul 2024 16:32:52 +0200 Subject: [PATCH 2/5] fix binary path --- scripts/sandbox/generate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sandbox/generate.ts b/scripts/sandbox/generate.ts index b95093062601..22c50716cc81 100755 --- a/scripts/sandbox/generate.ts +++ b/scripts/sandbox/generate.ts @@ -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 || [])]; From 2ac723a7549801e190c0e9a1049d8f2aae4afc1f Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Mon, 1 Jul 2024 17:03:35 +0200 Subject: [PATCH 3/5] temporarily add kasper/fix-cra to sandbox generation --- .github/workflows/generate-sandboxes.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/generate-sandboxes.yml b/.github/workflows/generate-sandboxes.yml index 3782aba5d8a8..eeef31814bc7 100644 --- a/.github/workflows/generate-sandboxes.yml +++ b/.github/workflows/generate-sandboxes.yml @@ -6,9 +6,9 @@ on: workflow_dispatch: # To test fixes on push rather than wait for the scheduling, do the following: # 1. Uncomment the lines below and add your branch. - # push: - # branches: - # - + push: + branches: + - kasper/fix-cra # 2. Change the "ref" value to in the actions/checkout step below. # 3. Comment out the whole "generate-main" job starting at line 77 # 4. 👉 DON'T FORGET TO UNDO THE STEPS BEFORE YOU MERGE YOUR CHANGES! @@ -28,12 +28,12 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: next + ref: kasper/fix-cra - uses: oven-sh/setup-bun@v1 with: bun-version: 1.1.1 - + - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" From e40d4ca5afc8b530845d38432370a74d39b3bf94 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Tue, 2 Jul 2024 10:16:21 +0200 Subject: [PATCH 4/5] fix --- code/lib/cli/src/sandbox-templates.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/lib/cli/src/sandbox-templates.ts b/code/lib/cli/src/sandbox-templates.ts index 81a02503de39..10f2998e5258 100644 --- a/code/lib/cli/src/sandbox-templates.ts +++ b/code/lib/cli/src/sandbox-templates.ts @@ -93,7 +93,7 @@ const baseTemplates = { 'cra/default-js': { name: 'Create React App Latest (Webpack | JavaScript)', script: ` - npx create-react-app {{beforeDir}} && \ + npx create-react-app {{beforeDir}} && cd {{beforeDir}} && \ jq '.browserslist.production[0] = ">0.9%"' package.json > tmp.json && mv tmp.json package.json `, expected: { @@ -107,7 +107,7 @@ const baseTemplates = { 'cra/default-ts': { name: 'Create React App Latest (Webpack | TypeScript)', script: ` - npx create-react-app {{beforeDir}} --template typescript && \ + 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. From cd4f0d32577b1438479be6b78c311b2a1082b5d6 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Tue, 2 Jul 2024 11:02:40 +0200 Subject: [PATCH 5/5] Revert "temporarily add kasper/fix-cra to sandbox generation" This reverts commit 2ac723a7549801e190c0e9a1049d8f2aae4afc1f. --- .github/workflows/generate-sandboxes.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/generate-sandboxes.yml b/.github/workflows/generate-sandboxes.yml index eeef31814bc7..3782aba5d8a8 100644 --- a/.github/workflows/generate-sandboxes.yml +++ b/.github/workflows/generate-sandboxes.yml @@ -6,9 +6,9 @@ on: workflow_dispatch: # To test fixes on push rather than wait for the scheduling, do the following: # 1. Uncomment the lines below and add your branch. - push: - branches: - - kasper/fix-cra + # push: + # branches: + # - # 2. Change the "ref" value to in the actions/checkout step below. # 3. Comment out the whole "generate-main" job starting at line 77 # 4. 👉 DON'T FORGET TO UNDO THE STEPS BEFORE YOU MERGE YOUR CHANGES! @@ -28,12 +28,12 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: kasper/fix-cra + ref: next - uses: oven-sh/setup-bun@v1 with: bun-version: 1.1.1 - + - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc"