@@ -17,7 +17,12 @@ const featureFlags = [
17
17
'playwright' ,
18
18
'nightwatch'
19
19
]
20
- const featureFlagsDenylist = [ [ 'cypress' , 'playwright' , 'nightwatch' ] ]
20
+ const featureFlagsDenylist = [
21
+ [ 'cypress' , 'playwright' ] ,
22
+ [ 'playwright' , 'nightwatch' ] ,
23
+ [ 'cypress' , 'nightwatch' ] ,
24
+ [ 'cypress' , 'playwright' , 'nightwatch' ]
25
+ ]
21
26
22
27
// The following code & comments are generated by GitHub CoPilot.
23
28
function fullCombination ( arr ) {
@@ -51,12 +56,6 @@ function fullCombination(arr) {
51
56
let flagCombinations = fullCombination ( featureFlags )
52
57
flagCombinations . push ( [ 'default' ] )
53
58
54
- // Filter out combinations that are not allowed
55
- flagCombinations = flagCombinations . filter (
56
- ( combination ) =>
57
- ! featureFlagsDenylist . some ( ( denylist ) => denylist . every ( ( flag ) => combination . includes ( flag ) ) )
58
- )
59
-
60
59
// `--with-tests` are equivalent of `--vitest --cypress`
61
60
// Previously it means `--cypress` without `--vitest`.
62
61
// Here we generate the snapshots only for the sake of easier comparison with older templates.
@@ -70,14 +69,26 @@ withTestsFlags.push(['with-tests'])
70
69
flagCombinations . push ( ...withTestsFlags )
71
70
72
71
const playgroundDir = path . resolve ( __dirname , '../playground/' )
73
- const bin = path . posix . relative ( '../playground/' , '../outfile.cjs' )
74
-
75
72
cd ( playgroundDir )
73
+
74
+ // remove all previous combinations
76
75
for ( const flags of flagCombinations ) {
77
76
const projectName = flags . join ( '-' )
78
77
79
78
console . log ( `Removing previously generated project ${ projectName } ` )
80
79
fs . rmSync ( projectName , { recursive : true , force : true } )
80
+ }
81
+
82
+ // Filter out combinations that are not allowed
83
+ flagCombinations = flagCombinations . filter (
84
+ ( combination ) =>
85
+ ! featureFlagsDenylist . some ( ( denylist ) => denylist . every ( ( flag ) => combination . includes ( flag ) ) )
86
+ )
87
+
88
+ const bin = path . posix . relative ( '../playground/' , '../outfile.cjs' )
89
+
90
+ for ( const flags of flagCombinations ) {
91
+ const projectName = flags . join ( '-' )
81
92
82
93
console . log ( `Creating project ${ projectName } ` )
83
94
await $ `node ${ [ bin , projectName , ...flags . map ( ( flag ) => `--${ flag } ` ) , '--force' ] } `
0 commit comments