File tree Expand file tree Collapse file tree 4 files changed +21
-10
lines changed
src/cap-angular-schematic-bootstrap Expand file tree Collapse file tree 4 files changed +21
-10
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " cap-angular-schematic-bootstrap" ,
3- "version" : " 0.0.5 " ,
3+ "version" : " 0.0.6 " ,
44 "description" : " Bootstrap integration schematic" ,
55 "scripts" : {
66 "build" : " tsc -p tsconfig.json" ,
Original file line number Diff line number Diff line change @@ -51,22 +51,22 @@ function addJqueryPluginToWebpackConfig(): Rule {
5151
5252 const filePath = '/webpack.server.config.js' ;
5353 const buffer = tree . read ( filePath ) ;
54- if ( buffer === null ) {
55- console . log ( 'webpack.server.config.js not exist.' ) ;
56- }
54+ if ( buffer !== null ) {
5755
58- // Add to configuration and api routes on server.js
59- const toAdd =
56+ // Add to configuration and api routes on server.js
57+ const toAdd =
6058`
6159 new webpack.ProvidePlugin({
6260 "window.$": "jquery",
6361 "window.jQuery": "jquery"
6462 }),
6563` ;
6664
67- const appComponent = getFileContent ( tree , filePath ) ;
68- tree . overwrite ( filePath , appComponent . replace ( `plugins: [` , `plugins: [` + toAdd ) ) ;
69-
65+ const appComponent = getFileContent ( tree , filePath ) ;
66+ tree . overwrite ( filePath , appComponent . replace ( `plugins: [` , `plugins: [` + toAdd ) ) ;
67+ } else {
68+ console . log ( 'webpack.server.config.js not exist.' ) ;
69+ }
7070 }
7171}
7272
@@ -76,7 +76,7 @@ export function schematicsBootstrap(options: BootstrapSchema): Rule {
7676 return chain ( [
7777 branchAndMerge ( chain ( [
7878 addBootstrapToPackageJson ( options ) ,
79- addJqueryPluginToWebpackConfig ( ) ,
79+ ( ! options . skipWebpackPlugin ) ? addJqueryPluginToWebpackConfig ( ) : noop ( ) ,
8080 addBootstrapCSS ( ) ,
8181 installNodeDeps ( ) ,
8282 ] ) ) ,
Original file line number Diff line number Diff line change 1313 "$source" : " argv" ,
1414 "index" : 0
1515 }
16+ },
17+ "skipWebpackPlugin" : {
18+ "type" : " boolean" ,
19+ "description" : " Skip Jquery plugins implementation on webpack.server.config.js" ,
20+ "x-prompt" : " Do you want to skip Jquery plugins implementation on webpack.server.config.js?" ,
21+ "default" : true ,
22+ "$default" : {
23+ "$source" : " argv" ,
24+ "index" : 1
25+ }
1626 }
1727 },
1828 "required" : [" version" ]
Original file line number Diff line number Diff line change 11export interface Schema {
22 version : string ;
3+ skipWebpackPlugin : boolean ;
34}
You can’t perform that action at this time.
0 commit comments