Skip to content

Commit 7c08813

Browse files
committed
Last changes
1 parent 6adda04 commit 7c08813

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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",

src/cap-angular-schematic-bootstrap/index.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff 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
])),

src/cap-angular-schematic-bootstrap/schema.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@
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"]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export interface Schema {
22
version: string;
3+
skipWebpackPlugin: boolean;
34
}

0 commit comments

Comments
 (0)