@@ -16,8 +16,7 @@ import { createConfig } from '../../utils/create-config';
16
16
import { prodConfig } from './prod-config' ;
17
17
import { MfSchematicSchema } from './schema' ;
18
18
19
- import { addPackageJsonDependency , NodeDependencyType } from '@schematics/angular/utility/dependencies' ;
20
- import { hostname } from 'os' ;
19
+ import { addPackageJsonDependency , getPackageJsonDependency , NodeDependencyType } from '@schematics/angular/utility/dependencies' ;
21
20
22
21
// export async function npmInstall(packageName: string) {
23
22
// await new Promise<boolean>((resolve) => {
@@ -192,7 +191,7 @@ export default function config (options: MfSchematicSchema): Rule {
192
191
193
192
const configPath = path . join ( projectRoot , 'webpack.config.js' ) . replace ( / \\ / g, '/' ) ;
194
193
const configProdPath = path . join ( projectRoot , 'webpack.prod.config.js' ) . replace ( / \\ / g, '/' ) ;
195
- const port = options . port ;
194
+ const port = parseInt ( options . port ) ;
196
195
const main = projectConfig . architect . build . options . main ;
197
196
198
197
const relWorkspaceRoot = path . relative ( projectRoot , '' ) ;
@@ -285,14 +284,19 @@ export default function config (options: MfSchematicSchema): Rule {
285
284
286
285
updatePackageJson ( tree ) ;
287
286
288
- addPackageJsonDependency ( tree , {
289
- name : 'ngx-build-plus' ,
290
- type : NodeDependencyType . Dev ,
291
- version : '^13.0.1' ,
292
- overwrite : true
293
- } ) ;
294
287
295
- context . addTask ( new NodePackageInstallTask ( ) ) ;
288
+ const dep = getPackageJsonDependency ( tree , "ngx-build-plus" ) ;
289
+
290
+ if ( ! dep ) {
291
+ addPackageJsonDependency ( tree , {
292
+ name : 'ngx-build-plus' ,
293
+ type : NodeDependencyType . Dev ,
294
+ version : '^13.0.1' ,
295
+ overwrite : true
296
+ } ) ;
297
+
298
+ context . addTask ( new NodePackageInstallTask ( ) ) ;
299
+ }
296
300
297
301
return chain ( [
298
302
makeMainAsync ( main ) ,
0 commit comments