Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build: Add sandbox for react-16 #25199

Merged
merged 9 commits into from
Dec 18, 2023
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -706,30 +706,30 @@ workflows:
requires:
- build
- create-sandboxes:
parallelism: 31
parallelism: 32
requires:
- build
# - smoke-test-sandboxes: # disabled for now
# requires:
# - create-sandboxes
- build-sandboxes:
parallelism: 31
parallelism: 32
requires:
- create-sandboxes
- chromatic-sandboxes:
parallelism: 28
parallelism: 29
requires:
- build-sandboxes
- e2e-production:
parallelism: 26
parallelism: 27
requires:
- build-sandboxes
- e2e-dev:
parallelism: 2
requires:
- create-sandboxes
- test-runner-production:
parallelism: 26
parallelism: 27
requires:
- build-sandboxes

Expand Down
13 changes: 13 additions & 0 deletions code/lib/cli/src/sandbox-templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,18 @@ const internalTemplates = {
},
skipTasks: ['bench'],
},
'internal/react16-webpack': {
name: 'React 16 (Webpack | TypeScript)',
script:
'yarn create webpack5-react {{beforeDir}} --version-react=16 --version-react-dom=16 --version-@types/react=16 --version-@types/react-dom=16',
expected: {
framework: '@storybook/react-webpack5',
renderer: '@storybook/react',
builder: '@storybook/builder-webpack5',
},
skipTasks: ['e2e-tests-dev', 'bench'],
isInternal: true,
},
'internal/server-webpack5': {
name: 'Server Webpack5',
script: 'yarn init -y && echo "module.exports = {}" > webpack.config.js',
Expand Down Expand Up @@ -617,6 +629,7 @@ export const daily: TemplateKey[] = [
'qwik-vite/default-ts',
'preact-vite/default-js',
'html-vite/default-js',
'internal/react16-webpack',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should do it right?

I ran yarn get-template --cadence daily --check but it didn't prompt me to change any numbers, which i was expecting.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's because the template has inDevelopment: true, it gets completely ignored. you need to remove that flag and then to the dance:

  1. Changing the sandbox generator to point at this branch
  2. Trigger the generator
  3. Change the sandbox generator back again
  4. Merge this before the daily generator kicks in

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what should have happened without the inDevelopment flag:
image

I added a small note to the generated message which will show the inDev templates, hopefully will make things less confusing!

];

export const templatesByCadence = { normal, merged, daily };
15 changes: 14 additions & 1 deletion scripts/get-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async function checkParallelism(cadence?: Cadence, scriptName?: TaskKey) {
let isIncorrect = false;

cadences.forEach((cad) => {
summary.push(`\n${cad}`);
summary.push(`\n${chalk.bold(cad)}`);
const cadenceTemplates = Object.entries(allTemplates).filter(([key]) =>
templatesByCadence[cad].includes(key as TemplateKey)
);
Expand All @@ -110,6 +110,7 @@ async function checkParallelism(cadence?: Cadence, scriptName?: TaskKey) {
scripts.forEach((script) => {
const templateKeysPerScript = potentialTemplateKeys.filter((t) => {
const currentTemplate = allTemplates[t] as Template;

return (
currentTemplate.inDevelopment !== true &&
!currentTemplate.skipTasks?.includes(script as SkippableTask)
Expand Down Expand Up @@ -153,6 +154,18 @@ async function checkParallelism(cadence?: Cadence, scriptName?: TaskKey) {
summary.unshift('✅ The parallelism count is correct for all jobs in .circleci/config.yml:');
console.log(summary.concat('\n').join('\n'));
}

const inDevelopmentTemplates = Object.entries(allTemplates)
.filter(([_, t]) => t.inDevelopment)
.map(([k]) => k);

if (inDevelopmentTemplates.length > 0) {
console.log(
`👇 Some templates were skipped as they are flagged to be in development. Please review if they should still contain this flag:\n${inDevelopmentTemplates
.map((k) => `- ${k}`)
.join('\n')}`
);
}
}

type RunOptions = { cadence?: Cadence; task?: TaskKey; check: boolean };
Expand Down