Skip to content

Commit b0f6be1

Browse files
committed
feat(cli): use config directory from package.json
1 parent 06e468f commit b0f6be1

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

packages/generator-feathers/generators/app/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ module.exports = class AppGenerator extends Generator {
160160
)
161161

162162
this.fs.writeJSON(
163-
this.destinationPath('config', 'default.json'),
163+
this.destinationPath(this.configDirectory, 'default.json'),
164164
makeConfig.configDefault(this)
165165
);
166166

167167
this.fs.writeJSON(
168-
this.destinationPath('config', 'production.json'),
168+
this.destinationPath(this.configDirectory, 'production.json'),
169169
makeConfig.configProduction(this)
170170
);
171171
}

packages/generator-feathers/generators/authentication/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ module.exports = class AuthGenerator extends Generator {
135135

136136
this.conflicter.force = true;
137137
this.fs.writeJSON(
138-
this.destinationPath('config', 'default.json'),
138+
this.destinationPath(this.configDirectory, 'default.json'),
139139
config
140140
);
141141
}
@@ -167,7 +167,7 @@ module.exports = class AuthGenerator extends Generator {
167167
dependencies.push(`@feathersjs/authentication-${strategy}`);
168168
}
169169
});
170-
170+
171171
if(!this.fs.exists(this.destinationPath(this.libDirectory, 'services', context.kebabEntity, `${context.kebabEntity}.service.js`))) {
172172
// Create the users service
173173
this.composeWith(require.resolve('../service'), {

packages/generator-feathers/generators/connection/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,9 @@ module.exports = class ConnectionGenerator extends Generator {
136136

137137
if (!config[database]) {
138138
config[database] = configuration;
139-
140139
this.conflicter.force = true;
141140
this.fs.writeJSON(
142-
this.destinationPath('config', 'default.json'),
141+
this.destinationPath(this.configDirectory, 'default.json'),
143142
config
144143
);
145144
}

packages/generator-feathers/lib/generator.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = class BaseGenerator extends Generator {
77
constructor(args, opts) {
88
super(args, opts);
99

10-
const defaultConfig = this.destinationPath('config', 'default.json');
10+
const defaultConfig = this.destinationPath(this.configDirectory, 'default.json');
1111

1212
this.generatorPkg = this.fs.readJSON(path.join(__dirname, '..', 'package.json'));
1313
this.pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
@@ -53,8 +53,11 @@ module.exports = class BaseGenerator extends Generator {
5353
return (this.pkg.directories && this.pkg.directories.test) || 'test';
5454
}
5555

56+
get configDirectory() {
57+
return (this.pkg && this.pkg.directories && this.pkg.directories.config) || 'config';
58+
}
5659
_packagerInstall(deps, options) {
57-
const packager = this.pkg.engines && this.pkg.engines.yarn ?
60+
const packager = this.pkg.engines && this.pkg.engines.yarn ?
5861
'yarn' : 'npm';
5962
const method = `${packager}Install`;
6063
const isDev = options.saveDev;

0 commit comments

Comments
 (0)