yeoman-generator 5.6.0 → 5.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +7 -5
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -191,13 +191,15 @@ class Generator extends Base {
191
191
 
192
192
  this.env = this.options.env;
193
193
 
194
- this.resolved = this.options.resolved || __dirname;
194
+ this.resolved = this.options.resolved || __filename;
195
195
  this.description = this.description || '';
196
196
 
197
197
  if (this.env) {
198
198
  // Determine the app root
199
199
  this.contextRoot = this.env.cwd;
200
200
  this.destinationRoot(this.options.destinationRoot || this.env.cwd);
201
+ // Clear destionationRoot, _destinationRoot will take priority when composing, but not override passed options.
202
+ delete this.options.destinationRoot;
201
203
 
202
204
  // Ensure source/destination path, can be configured from subclasses
203
205
  this.sourceRoot(path.join(path.dirname(this.resolved), 'templates'));
@@ -897,7 +899,7 @@ class Generator extends Base {
897
899
  return [];
898
900
  }
899
901
 
900
- const {taskPrefix} = this.features;
902
+ const {taskPrefix = this.features.taskPrefix || ''} = taskOptions;
901
903
  const propertyName = taskPrefix ? `${taskPrefix}${name}` : name;
902
904
  const property = Object.getOwnPropertyDescriptor(
903
905
  taskOptions.taskOrigin || Object.getPrototypeOf(this),
@@ -1072,7 +1074,6 @@ class Generator extends Base {
1072
1074
  method
1073
1075
  } = task;
1074
1076
  const {namespace = ''} = this.options || {};
1075
- args = typeof args === 'function' ? args(this) : args;
1076
1077
 
1077
1078
  const priority = Object.entries(this._queues).find(
1078
1079
  ([_, options]) => options.queueName === queueName
@@ -1090,6 +1091,7 @@ class Generator extends Base {
1090
1091
  const generator = this;
1091
1092
 
1092
1093
  runAsync(function () {
1094
+ args = typeof args === 'function' ? args(generator) : args;
1093
1095
  generator.async = () => this.async();
1094
1096
  generator.runningState = {namespace, queueName, methodName};
1095
1097
  return method.apply(generator, args);
@@ -1290,12 +1292,12 @@ class Generator extends Base {
1290
1292
 
1291
1293
  // Pass down the default options so they're correctly mirrored down the chain.
1292
1294
  options = {
1295
+ destinationRoot: this._destinationRoot,
1293
1296
  ...options,
1294
1297
  skipInstall: this.options.skipInstall,
1295
1298
  skipCache: this.options.skipCache,
1296
1299
  forceInstall: this.options.forceInstall,
1297
- skipLocalCache: this.options.skipLocalCache,
1298
- destinationRoot: this._destinationRoot
1300
+ skipLocalCache: this.options.skipLocalCache
1299
1301
  };
1300
1302
 
1301
1303
  const instantiate = (Generator, path) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yeoman-generator",
3
- "version": "5.6.0",
3
+ "version": "5.6.1",
4
4
  "description": "Rails-inspired generator system that provides scaffolding for your apps",
5
5
  "homepage": "http://yeoman.io",
6
6
  "author": "Yeoman",