File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -10,3 +10,8 @@ npm run create
10
10
```
11
11
12
12
This will overwrite all existing recipes. If you are happy with the changes, ` git commit ` them.
13
+
14
+ To recreate one or more named recipes rather than all of them use:
15
+ ``` bash
16
+ npm run create -- VanillaWebpack VanillaRspack
17
+ ```
Original file line number Diff line number Diff line change @@ -3,7 +3,21 @@ import * as allRecipes from './recipes/typescript';
3
3
4
4
const writers : Writer [ ] = [ new BashWriter ( ) , new ReadmeWriter ( ) ] ;
5
5
6
- for ( const cls of Object . values ( allRecipes ) ) {
6
+ let recipeNames = Object . keys ( allRecipes ) ;
7
+ if ( process . argv . length > 2 ) {
8
+ recipeNames = process . argv . slice ( 2 ) . map ( ( arg ) => arg + 'Recipe' ) ;
9
+
10
+ const unknownNames = recipeNames . filter ( name => ! ( name in allRecipes ) ) ;
11
+ if ( unknownNames . length > 0 ) {
12
+ console . error ( "Unknown recipe name(s):" , unknownNames . join ( ', ' ) ) ;
13
+ process . exit ( 1 )
14
+ }
15
+ }
16
+
17
+ console . log ( "Creating recipes for" , recipeNames ) ;
18
+
19
+ for ( const recipeName of recipeNames ) {
20
+ const cls = allRecipes [ recipeName ] ;
7
21
const recipe : Recipe = new ( cls as any ) ( ) ;
8
22
console . log ( `Recipe ${ recipe . type } ${ recipe . framework } ${ recipe . bundler } ` ) ;
9
23
You can’t perform that action at this time.
0 commit comments