Skip to content

Commit 166a6c2

Browse files
committed
Load specific configs.
1 parent 899e8e0 commit 166a6c2

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

lib/actions/fs.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,5 +215,14 @@ fs.templateData = function(path) {
215215
return this.config.getPath(path);
216216
}
217217

218-
return this.config.getAll();
218+
const allConfig = this.config.getAll();
219+
if (this.generatorConfig) {
220+
Object.assign(allConfig, this.generatorConfig.getAll());
221+
}
222+
223+
if (this.instanceConfig) {
224+
Object.assign(allConfig, this.instanceConfig.getAll());
225+
}
226+
227+
return allConfig;
219228
};

lib/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ class Generator extends EventEmitter {
151151
this._arguments = [];
152152
this._composedWith = [];
153153
this._transformStreams = [];
154+
this._namespace = this.options.namespace;
155+
this._namespaceId = this.options.namespaceId;
154156

155157
this.option('help', {
156158
type: Boolean,
@@ -274,6 +276,15 @@ class Generator extends EventEmitter {
274276

275277
this.appname = this.determineAppname();
276278
this.config = this._getStorage();
279+
if (this._namespaceId && this._namespaceId.generator) {
280+
this.generatorConfig = this.config.createStorage(`:${this._namespaceId.generator}`);
281+
if (this._namespaceId.instanceId) {
282+
this.instanceConfig = this.generatorConfig.createStorage(
283+
`#${this._namespaceId.instanceId}`
284+
);
285+
}
286+
}
287+
277288
this._globalConfig = this._getGlobalStorage();
278289

279290
// Ensure source/destination path, can be configured from subclasses

0 commit comments

Comments
 (0)