-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
/
sandbox-templates.ts
714 lines (700 loc) · 25 KB
/
sandbox-templates.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
import type { StoriesEntry, StorybookConfigRaw } from '@storybook/core/types';
import type { ConfigFile } from '@storybook/core/csf-tools';
export type SkippableTask =
| 'smoke-test'
| 'test-runner'
| 'test-runner-dev'
| 'chromatic'
| 'e2e-tests'
| 'e2e-tests-dev'
| 'bench';
export type TemplateKey =
| keyof typeof baseTemplates
| keyof typeof internalTemplates
| keyof typeof benchTemplates;
export type Cadence = keyof typeof templatesByCadence;
export type Template = {
/**
* Readable name for the template, which will be used for feedback and the status page
* Follows the naming scheme when it makes sense:
* <framework> <"v"version|"Latest"|"Prerelease"> (<"Webpack"|"Vite"> | <"JavaScript"|"TypeScript">)
* React Latest - Webpack (TS)
* Next.js v12 (JS)
* Angular CLI Prerelease
*/
name: string;
/**
* Script used to generate the base project of a template.
* The Storybook CLI will then initialize Storybook on top of that template.
* This is used to generate projects which are pushed to https://github.com/storybookjs/sandboxes
*/
script: string;
/**
* Environment variables to set when running the script.
*/
env?: Record<string, unknown>;
/**
* Used to assert various things about the generated template.
* If the template is generated with a different expected framework, it will fail, detecting a possible regression.
*/
expected: {
framework: string;
renderer: string;
builder: string;
};
expectedFailures?: Array<{
feature: string;
issues: string[];
}>;
unsupportedFeatures?: Array<{
feature: string;
issues: string[];
}>;
/**
* Some sandboxes might not work properly in specific tasks temporarily, but we might
* still want to run the other tasks. Set the ones to skip in this property.
*/
skipTasks?: SkippableTask[];
/**
* Set this only while developing a newly created framework, to avoid using it in CI.
* NOTE: Make sure to always add a TODO comment to remove this flag in a subsequent PR.
*/
inDevelopment?: boolean;
/**
* Some sandboxes might need extra modifications in the initialized Storybook,
* such as extend main.js, for setting specific feature flags.
*/
modifications?: {
skipTemplateStories?: boolean;
mainConfig?:
| Partial<StorybookConfigRaw>
| ((config: ConfigFile) => Partial<StorybookConfigRaw>);
testBuild?: boolean;
disableDocs?: boolean;
extraDependencies?: string[];
editAddons?: (addons: string[]) => string[];
};
/**
* Flag to indicate that this template is a secondary template, which is used mainly to test rather specific features.
* This means the template might be hidden from the Storybook status page or the repro CLI command.
* */
isInternal?: boolean;
};
type BaseTemplates = Template & {
name: `${string} ${`v${number}` | 'Latest' | 'Prerelease'} (${'Webpack' | 'Vite'} | ${
| 'JavaScript'
| 'TypeScript'})`;
};
const baseTemplates = {
'cra/default-js': {
name: 'Create React App Latest (Webpack | JavaScript)',
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',
renderer: '@storybook/react',
builder: '@storybook/builder-webpack5',
},
skipTasks: ['e2e-tests-dev', 'bench'],
modifications: {
mainConfig: (config) => {
const stories = config.getFieldValue<Array<StoriesEntry>>(['stories']);
return {
stories: stories?.map((s) => {
if (typeof s === 'string') {
return s.replace(/\|(tsx?|ts)\b|\b(tsx?|ts)\|/g, '');
} else {
return s;
}
}),
};
},
},
},
'cra/default-ts': {
name: 'Create React App Latest (Webpack | 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: {
// TODO: change this to @storybook/cra once that package is created
framework: '@storybook/react-webpack5',
renderer: '@storybook/react',
builder: '@storybook/builder-webpack5',
},
},
'nextjs/13-ts': {
name: 'Next.js v13.5 (Webpack | TypeScript)',
script:
'yarn create next-app {{beforeDir}} -e https://github.com/vercel/next.js/tree/next-13/examples/hello-world && cd {{beforeDir}} && npm pkg set "dependencies.next"="^13.5.6" && yarn && git add . && git commit --amend --no-edit && cd ..',
expected: {
framework: '@storybook/nextjs',
renderer: '@storybook/react',
builder: '@storybook/builder-webpack5',
},
modifications: {
mainConfig: {
features: { experimentalRSC: true },
},
extraDependencies: ['server-only'],
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'nextjs/default-js': {
name: 'Next.js Latest (Webpack | JavaScript)',
script:
'yarn create next-app {{beforeDir}} --javascript --eslint --tailwind --app --import-alias="@/*" --src-dir',
expected: {
framework: '@storybook/nextjs',
renderer: '@storybook/react',
builder: '@storybook/builder-webpack5',
},
modifications: {
mainConfig: {
features: { experimentalRSC: true },
},
extraDependencies: ['server-only'],
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'nextjs/default-ts': {
name: 'Next.js Latest (Webpack | TypeScript)',
script:
'yarn create next-app {{beforeDir}} --typescript --eslint --tailwind --app --import-alias="@/*" --src-dir',
expected: {
framework: '@storybook/nextjs',
renderer: '@storybook/react',
builder: '@storybook/builder-webpack5',
},
modifications: {
mainConfig: {
features: { experimentalRSC: true },
},
extraDependencies: ['server-only'],
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'nextjs/prerelease': {
name: 'Next.js Prerelease (Webpack | TypeScript)',
script:
'npx create-next-app@canary {{beforeDir}} --typescript --eslint --tailwind --app --import-alias="@/*" --src-dir',
expected: {
framework: '@storybook/nextjs',
renderer: '@storybook/react',
builder: '@storybook/builder-webpack5',
},
modifications: {
mainConfig: {
features: { experimentalRSC: true },
},
extraDependencies: ['server-only'],
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'react-vite/default-js': {
name: 'React Latest (Vite | JavaScript)',
script: 'npm create vite --yes {{beforeDir}} -- --template react',
expected: {
framework: '@storybook/react-vite',
renderer: '@storybook/react',
builder: '@storybook/builder-vite',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'react-vite/default-ts': {
name: 'React Latest (Vite | TypeScript)',
script: 'npm create vite --yes {{beforeDir}} -- --template react-ts',
expected: {
framework: '@storybook/react-vite',
renderer: '@storybook/react',
builder: '@storybook/builder-vite',
},
skipTasks: ['bench'],
},
'react-vite/prerelease-ts': {
name: 'React Prerelease (Vite | TypeScript)',
/**
* 1. Create a Vite project with the React template
* 2. Add React beta versions
* 3. Add resolutions for @types/react and @types/react-dom, see https://react.dev/blog/2024/04/25/react-19-upgrade-guide#installing
* 4. Add @types/react and @types/react-dom pointing to the beta packages
*/
script: `
npm create vite --yes {{beforeDir}} -- --template react-ts && \
cd {{beforeDir}} && \
yarn add react@beta react-dom@beta && \
jq '.resolutions += {"@types/react": "npm:types-react@beta", "@types/react-dom": "npm:types-react-dom@beta"}' package.json > tmp.json && mv tmp.json package.json && \
yarn add --dev @types/react@npm:types-react@beta @types/react-dom@npm:types-react-dom@beta
`,
expected: {
framework: '@storybook/react-vite',
renderer: '@storybook/react',
builder: '@storybook/builder-vite',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'react-webpack/18-ts': {
name: 'React Latest (Webpack | TypeScript)',
script: 'yarn create webpack5-react {{beforeDir}}',
expected: {
framework: '@storybook/react-webpack5',
renderer: '@storybook/react',
builder: '@storybook/builder-webpack5',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'react-webpack/17-ts': {
name: 'React v17 (Webpack | TypeScript)',
script:
'yarn create webpack5-react {{beforeDir}} --version-react="17" --version-react-dom="17"',
expected: {
framework: '@storybook/react-webpack5',
renderer: '@storybook/react',
builder: '@storybook/builder-webpack5',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'react-webpack/prerelease-ts': {
name: 'React Prerelease (Webpack | TypeScript)',
/**
* 1. Create a Webpack project with React beta versions
* 3. Add resolutions for @types/react and @types/react-dom, see https://react.dev/blog/2024/04/25/react-19-upgrade-guide#installing
* 4. Add @types/react and @types/react-dom pointing to the beta packages
*/
script: `
yarn create webpack5-react {{beforeDir}} --version-react="beta" --version-react-dom="beta" && \
cd {{beforeDir}} && \
jq '.resolutions += {"@types/react": "npm:types-react@beta", "@types/react-dom": "npm:types-react-dom@beta"}' package.json > tmp.json && mv tmp.json package.json && \
yarn add --dev @types/react@npm:types-react@beta @types/react-dom@npm:types-react-dom@beta
`,
expected: {
framework: '@storybook/react-webpack5',
renderer: '@storybook/react',
builder: '@storybook/builder-webpack5',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'solid-vite/default-js': {
name: 'SolidJS Latest (Vite | JavaScript)',
script: 'npx degit solidjs/templates/js {{beforeDir}}',
expected: {
framework: 'storybook-solidjs-vite',
renderer: 'storybook-solidjs',
builder: '@storybook/builder-vite',
},
// TODO: remove this once solid-vite framework is released
inDevelopment: true,
skipTasks: ['e2e-tests-dev', 'bench'],
},
'solid-vite/default-ts': {
name: 'SolidJS Latest (Vite | TypeScript)',
script: 'npx degit solidjs/templates/ts {{beforeDir}}',
expected: {
framework: 'storybook-solidjs-vite',
renderer: 'storybook-solidjs',
builder: '@storybook/builder-vite',
},
// TODO: remove this once solid-vite framework is released
inDevelopment: true,
skipTasks: ['e2e-tests-dev', 'bench'],
},
'vue3-vite/default-js': {
name: 'Vue v3 (Vite | JavaScript)',
script: 'npm create vite --yes {{beforeDir}} -- --template vue',
expected: {
framework: '@storybook/vue3-vite',
renderer: '@storybook/vue3',
builder: '@storybook/builder-vite',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'vue3-vite/default-ts': {
name: 'Vue v3 (Vite | TypeScript)',
script: 'npm create vite --yes {{beforeDir}} -- --template vue-ts',
expected: {
framework: '@storybook/vue3-vite',
renderer: '@storybook/vue3',
builder: '@storybook/builder-vite',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'html-webpack/default': {
name: 'HTML Latest (Webpack | JavaScript)',
script: 'yarn create webpack5-html {{beforeDir}}',
expected: {
framework: '@storybook/html-webpack5',
renderer: '@storybook/html',
builder: '@storybook/builder-webpack5',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'html-vite/default-js': {
name: 'HTML Latest (Vite | JavaScript)',
script:
'npm create vite --yes {{beforeDir}} -- --template vanilla && cd {{beforeDir}} && echo "export default {}" > vite.config.js',
expected: {
framework: '@storybook/html-vite',
renderer: '@storybook/html',
builder: '@storybook/builder-vite',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'html-vite/default-ts': {
name: 'HTML Latest (Vite | TypeScript)',
script:
'npm create vite --yes {{beforeDir}} -- --template vanilla-ts && cd {{beforeDir}} && echo "export default {}" > vite.config.js',
expected: {
framework: '@storybook/html-vite',
renderer: '@storybook/html',
builder: '@storybook/builder-vite',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'svelte-vite/default-js': {
name: 'Svelte Latest (Vite | JavaScript)',
script: 'npm create vite --yes {{beforeDir}} -- --template svelte',
expected: {
framework: '@storybook/svelte-vite',
renderer: '@storybook/svelte',
builder: '@storybook/builder-vite',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'svelte-vite/default-ts': {
name: 'Svelte Latest (Vite | TypeScript)',
script: 'npm create vite --yes {{beforeDir}} -- --template svelte-ts',
expected: {
framework: '@storybook/svelte-vite',
renderer: '@storybook/svelte',
builder: '@storybook/builder-vite',
},
// Remove smoke-test from the list once https://github.com/storybookjs/storybook/issues/19351 is fixed.
skipTasks: ['smoke-test', 'e2e-tests-dev', 'bench'],
},
'angular-cli/prerelease': {
name: 'Angular CLI Prerelease (Webpack | TypeScript)',
script:
'npx -p @angular/cli@next ng new angular-v16 --directory {{beforeDir}} --routing=true --minimal=true --style=scss --strict --skip-git --skip-install --package-manager=yarn --ssr',
expected: {
framework: '@storybook/angular',
renderer: '@storybook/angular',
builder: '@storybook/builder-webpack5',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'angular-cli/default-ts': {
name: 'Angular CLI Latest (Webpack | TypeScript)',
script:
'npx -p @angular/cli ng new angular-latest --directory {{beforeDir}} --routing=true --minimal=true --style=scss --strict --skip-git --skip-install --package-manager=yarn --ssr',
expected: {
framework: '@storybook/angular',
renderer: '@storybook/angular',
builder: '@storybook/builder-webpack5',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'angular-cli/15-ts': {
name: 'Angular CLI v15 (Webpack | TypeScript)',
script:
'npx -p @angular/cli@15 ng new angular-v15 --directory {{beforeDir}} --routing=true --minimal=true --style=scss --strict --skip-git --skip-install --package-manager=yarn',
expected: {
framework: '@storybook/angular',
renderer: '@storybook/angular',
builder: '@storybook/builder-webpack5',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'svelte-kit/skeleton-js': {
name: 'SvelteKit Latest (Vite | JavaScript)',
script:
'yarn create svelte-with-args --name=svelte-kit/skeleton-js --directory={{beforeDir}} --template=skeleton --types=null --no-prettier --no-eslint --no-playwright --no-vitest --no-svelte5',
expected: {
framework: '@storybook/sveltekit',
renderer: '@storybook/svelte',
builder: '@storybook/builder-vite',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'svelte-kit/skeleton-ts': {
name: 'SvelteKit Latest (Vite | TypeScript)',
script:
'yarn create svelte-with-args --name=svelte-kit/skeleton-ts --directory={{beforeDir}} --template=skeleton --types=typescript --no-prettier --no-eslint --no-playwright --no-vitest --no-svelte5',
expected: {
framework: '@storybook/sveltekit',
renderer: '@storybook/svelte',
builder: '@storybook/builder-vite',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'svelte-kit/prerelease-ts': {
name: 'SvelteKit Prerelease (Vite | TypeScript)',
script:
'yarn create svelte-with-args --name=svelte-kit/prerelease-ts --directory={{beforeDir}} --template=skeleton --types=typescript --no-prettier --no-eslint --no-playwright --no-vitest --svelte5',
expected: {
framework: '@storybook/sveltekit',
renderer: '@storybook/svelte',
builder: '@storybook/builder-vite',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'lit-vite/default-js': {
name: 'Lit Latest (Vite | JavaScript)',
script:
'npm create vite --yes {{beforeDir}} -- --template lit && cd {{beforeDir}} && echo "export default {}" > vite.config.js',
expected: {
framework: '@storybook/web-components-vite',
renderer: '@storybook/web-components',
builder: '@storybook/builder-vite',
},
// Remove smoke-test from the list once https://github.com/storybookjs/storybook/issues/19351 is fixed.
skipTasks: ['smoke-test', 'e2e-tests-dev', 'bench'],
},
'lit-vite/default-ts': {
name: 'Lit Latest (Vite | TypeScript)',
script:
'npm create vite --yes {{beforeDir}} -- --template lit-ts && cd {{beforeDir}} && echo "export default {}" > vite.config.js',
expected: {
framework: '@storybook/web-components-vite',
renderer: '@storybook/web-components',
builder: '@storybook/builder-vite',
},
// Remove smoke-test from the list once https://github.com/storybookjs/storybook/issues/19351 is fixed.
skipTasks: ['smoke-test', 'e2e-tests-dev', 'bench'],
},
'vue-cli/default-js': {
name: 'Vue CLI v3 (Webpack | JavaScript)',
script:
'npx -p @vue/cli vue create {{beforeDir}} --default --packageManager=yarn --force --merge && cd {{beforeDir}} && echo "module.exports = {}" > webpack.config.js',
expected: {
framework: '@storybook/vue3-webpack5',
renderer: '@storybook/vue3',
builder: '@storybook/builder-webpack5',
},
// Remove smoke-test from the list once https://github.com/storybookjs/storybook/issues/19351 is fixed.
skipTasks: ['smoke-test', 'e2e-tests-dev', 'bench'],
},
'preact-vite/default-js': {
name: 'Preact Latest (Vite | JavaScript)',
script: 'npm create vite --yes {{beforeDir}} -- --template preact',
expected: {
framework: '@storybook/preact-vite',
renderer: '@storybook/preact',
builder: '@storybook/builder-vite',
},
modifications: {
extraDependencies: ['preact-render-to-string'],
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'preact-vite/default-ts': {
name: 'Preact Latest (Vite | TypeScript)',
script: 'npm create vite --yes {{beforeDir}} -- --template preact-ts',
expected: {
framework: '@storybook/preact-vite',
renderer: '@storybook/preact',
builder: '@storybook/builder-vite',
},
modifications: {
extraDependencies: ['preact-render-to-string'],
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'qwik-vite/default-ts': {
name: 'Qwik CLI Latest (Vite | TypeScript)',
script: 'npm create qwik playground {{beforeDir}}',
// TODO: The community template does not provide standard stories, which is required for e2e tests. Reenable once it does.
inDevelopment: true,
expected: {
framework: 'storybook-framework-qwik',
renderer: 'storybook-framework-qwik',
builder: 'storybook-framework-qwik',
},
// TODO: The community template does not provide standard stories, which is required for e2e tests.
skipTasks: ['e2e-tests', 'e2e-tests-dev', 'bench'],
},
'ember/3-js': {
name: 'Ember v3 (Webpack | JavaScript)',
script: 'npx --package ember-cli@3.28.1 ember new {{beforeDir}}',
inDevelopment: true,
expected: {
framework: '@storybook/ember',
renderer: '@storybook/ember',
builder: '@storybook/builder-webpack5',
},
},
'ember/default-js': {
name: 'Ember v4 (Webpack | JavaScript)',
script:
'npx --package ember-cli@4.12.1 ember new {{beforeDir}} --yarn && cd {{beforeDir}} && yarn add --dev @storybook/ember-cli-storybook && yarn build',
inDevelopment: true,
expected: {
framework: '@storybook/ember',
renderer: '@storybook/ember',
builder: '@storybook/builder-webpack5',
},
},
} satisfies Record<string, BaseTemplates>;
/**
* Internal templates reuse config from other templates and add extra config on top.
* They must contain an id that starts with 'internal/' and contain "isInternal: true".
* They will be hidden by default in the Storybook status page.
*/
const internalTemplates = {
'internal/react18-webpack-babel': {
name: 'React with Babel Latest (Webpack | TypeScript)',
script: 'yarn create webpack5-react {{beforeDir}}',
expected: {
framework: '@storybook/react-webpack5',
renderer: '@storybook/react',
builder: '@storybook/builder-webpack5',
},
modifications: {
extraDependencies: ['@storybook/addon-webpack5-compiler-babel'],
editAddons: (addons) =>
[...addons, '@storybook/addon-webpack5-compiler-babel'].filter(
(a) => a !== '@storybook/addon-webpack5-compiler-swc'
),
},
isInternal: true,
skipTasks: ['e2e-tests-dev', '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',
expected: {
framework: '@storybook/server-webpack5',
renderer: '@storybook/server',
builder: '@storybook/builder-webpack5',
},
isInternal: true,
skipTasks: ['bench'],
},
// 'internal/pnp': {
// ...baseTemplates['cra/default-ts'],
// name: 'PNP (cra/default-ts)',
// script: 'yarn create react-app . --use-pnp',
// isInternal: true,
// inDevelopment: true,
// },
} satisfies Record<`internal/${string}`, Template & { isInternal: true }>;
const benchTemplates = {
'bench/react-vite-default-ts': {
...baseTemplates['react-vite/default-ts'],
name: 'Bench (react-vite/default-ts)',
isInternal: true,
modifications: {
skipTemplateStories: true,
},
skipTasks: ['e2e-tests-dev', 'test-runner', 'test-runner-dev', 'e2e-tests', 'chromatic'],
},
'bench/react-webpack-18-ts': {
...baseTemplates['react-webpack/18-ts'],
name: 'Bench (react-webpack/18-ts)',
isInternal: true,
modifications: {
skipTemplateStories: true,
},
skipTasks: ['e2e-tests-dev', 'test-runner', 'test-runner-dev', 'e2e-tests', 'chromatic'],
},
'bench/react-vite-default-ts-nodocs': {
...baseTemplates['react-vite/default-ts'],
name: 'Bench (react-vite/default-ts, no docs)',
isInternal: true,
modifications: {
skipTemplateStories: true,
disableDocs: true,
},
skipTasks: ['e2e-tests-dev', 'test-runner', 'test-runner-dev', 'e2e-tests', 'chromatic'],
},
'bench/react-vite-default-ts-test-build': {
...baseTemplates['react-vite/default-ts'],
name: 'Bench (react-vite/default-ts, test-build)',
isInternal: true,
modifications: {
skipTemplateStories: true,
testBuild: true,
},
skipTasks: ['e2e-tests-dev', 'test-runner', 'test-runner-dev', 'e2e-tests'],
},
'bench/react-webpack-18-ts-test-build': {
...baseTemplates['react-webpack/18-ts'],
name: 'Bench (react-webpack/18-ts, test-build)',
isInternal: true,
modifications: {
skipTemplateStories: true,
testBuild: true,
},
skipTasks: ['e2e-tests-dev', 'test-runner', 'test-runner-dev', 'e2e-tests'],
},
} satisfies Record<string, Template & { isInternal: true }>;
export const allTemplates: Record<TemplateKey, Template> = {
...baseTemplates,
...internalTemplates,
...benchTemplates,
};
export const normal: TemplateKey[] = [
'cra/default-ts',
'react-vite/default-ts',
'angular-cli/default-ts',
'vue3-vite/default-ts',
'lit-vite/default-ts',
'svelte-vite/default-ts',
'svelte-kit/skeleton-ts',
'nextjs/default-ts',
'bench/react-vite-default-ts',
'bench/react-webpack-18-ts',
'bench/react-vite-default-ts-nodocs',
'bench/react-vite-default-ts-test-build',
'bench/react-webpack-18-ts-test-build',
'ember/default-js',
];
export const merged: TemplateKey[] = [
...normal,
'react-webpack/18-ts',
'react-webpack/17-ts',
'angular-cli/15-ts',
'preact-vite/default-ts',
'html-webpack/default',
'html-vite/default-ts',
];
export const daily: TemplateKey[] = [
...merged,
'angular-cli/prerelease',
'cra/default-js',
'react-vite/default-js',
'react-vite/prerelease-ts',
'react-webpack/prerelease-ts',
'vue3-vite/default-js',
'vue-cli/default-js',
'lit-vite/default-js',
'svelte-kit/skeleton-js',
'svelte-kit/prerelease-ts',
'svelte-vite/default-js',
'nextjs/13-ts',
'nextjs/default-js',
'nextjs/prerelease',
'qwik-vite/default-ts',
'preact-vite/default-js',
'html-vite/default-js',
'internal/react16-webpack',
'internal/react18-webpack-babel',
];
export const templatesByCadence = { normal, merged, daily };