File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -10,3 +10,8 @@ npm run create
1010```
1111
1212This 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';
33
44const writers : Writer [ ] = [ new BashWriter ( ) , new ReadmeWriter ( ) ] ;
55
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 ] ;
721 const recipe : Recipe = new ( cls as any ) ( ) ;
822 console . log ( `Recipe ${ recipe . type } ${ recipe . framework } ${ recipe . bundler } ` ) ;
923
You can’t perform that action at this time.
0 commit comments