Skip to content

Commit 3f33d41

Browse files
ruffiemmgechev
authored andcommitted
(feat) reduced complexity when adding n additional packages (mgechev#1593)
* (feat) reduced complexity when adding n additional packages * (feat) changed class instance property to local variable * (bug) fixed ExtendPackages interface implementation * (feat) commenting additional packages example * (bug) commenting ExtendPackages unused import
1 parent b5da527 commit 3f33d41

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

tools/config/project.config.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { join } from 'path';
22

33
import { SeedConfig } from './seed.config';
4+
// import { ExtendPackages } from './seed.config.interfaces';
45

56
/**
67
* This class extends the basic seed configuration, allowing for project specific overrides. A few examples can be found
@@ -31,6 +32,31 @@ export class ProjectConfig extends SeedConfig {
3132
// {src: `${this.CSS_SRC}/path-to-lib/test-lib.css`, inject: true, vendor: false},
3233
];
3334

35+
// Add packages (e.g. lodash)
36+
// let additionalPackages: ExtendPackages[] = [{
37+
// name: 'lodash',
38+
// path: `${this.APP_BASE}node_modules/lodash/lodash.js`,
39+
// packageMeta: {
40+
// main: 'index.js',
41+
// defaultExtension: 'js'
42+
// }
43+
// }];
44+
//
45+
// or
46+
//
47+
// let additionalPackages: ExtendPackages[] = [];
48+
//
49+
// additionalPackages.push({
50+
// name: 'lodash',
51+
// path: `${this.APP_BASE}node_modules/lodash/lodash.js`,
52+
// packageMeta: {
53+
// main: 'index.js',
54+
// defaultExtension: 'js'
55+
// }
56+
// });
57+
//
58+
// this.addPackagesBundles(additionalPackages);
59+
3460
/* Add to or override NPM module configurations: */
3561
// this.mergeObject(this.PLUGIN_CONFIGS['browser-sync'], { ghostMode: false });
3662
}

tools/config/seed.config.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,14 @@ export class SeedConfig {
573573
}
574574
}
575575

576+
addPackagesBundles(packs: ExtendPackages[]) {
577+
578+
packs.forEach((pack: ExtendPackages) => {
579+
this.addPackageBundles(pack);
580+
});
581+
582+
}
583+
576584
}
577585

578586
/**
@@ -626,4 +634,3 @@ function getBuildType() {
626634
return BUILD_TYPES.DEVELOPMENT;
627635
}
628636
}
629-

0 commit comments

Comments
 (0)