yeoman-generator 5.5.2 → 5.6.0

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 +31 -17
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -335,10 +335,27 @@ class Generator extends Base {
335
335
  *
336
336
  * @param {Object[]} priorities - Priorities
337
337
  * @param {String} priorities.priorityName - Priority name
338
- * @param {String} priorities.before - The new priority will be queued before the `before` priority.
338
+ * @param {String} [priorities.before] - The new priority will be queued before the `before` priority. Required for new priorities.
339
339
  * @param {String} [priorities.queueName] - Name to be used at grouped-queue
340
+ * @param {boolean} [priorities.edit] - Edit a priority
341
+ * @param {boolean} [priorities.skip] - Queued manually only
342
+ * @param {Object[]|function} [priorities.args] - Arguments to pass to tasks
340
343
  */
341
344
  registerPriorities(priorities) {
345
+ priorities = priorities.filter((priority) => {
346
+ if (priority.edit) {
347
+ const queue = this._queues[priority.priorityName];
348
+ if (!queue) {
349
+ throw new Error(
350
+ `Error editing priority ${priority.priorityName}, not found`
351
+ );
352
+ }
353
+
354
+ Object.assign(queue, {...priority, edit: undefined});
355
+ }
356
+
357
+ return !priority.edit;
358
+ });
342
359
  const customPriorities = priorities.map((customPriority) => {
343
360
  // Keep backward compatibility with name
344
361
  const newPriority = {
@@ -868,16 +885,6 @@ class Generator extends Base {
868
885
  * @param {TaskOptions} [taskOptions]: options.
869
886
  */
870
887
  extractTasksFromPriority(name, taskOptions = {}) {
871
- const {taskPrefix} = this.features;
872
- const propertyName = taskPrefix ? `${taskPrefix}${name}` : name;
873
- const property = Object.getOwnPropertyDescriptor(
874
- Object.getPrototypeOf(this),
875
- propertyName
876
- );
877
- if (!property) return [];
878
-
879
- const item = property.value ? property.value : property.get.call(this);
880
-
881
888
  const priority = this._queues[name];
882
889
  taskOptions = {
883
890
  ...priority,
@@ -886,19 +893,26 @@ class Generator extends Base {
886
893
  ...taskOptions
887
894
  };
888
895
 
889
- if (!item || (taskOptions.auto && priority && priority.skip)) {
896
+ if (taskOptions.auto && priority && priority.skip) {
890
897
  return [];
891
898
  }
892
899
 
900
+ const {taskPrefix} = this.features;
901
+ const propertyName = taskPrefix ? `${taskPrefix}${name}` : name;
902
+ const property = Object.getOwnPropertyDescriptor(
903
+ taskOptions.taskOrigin || Object.getPrototypeOf(this),
904
+ propertyName
905
+ );
906
+ if (!property) return [];
907
+
908
+ const item = property.value ? property.value : property.get.call(this);
909
+
893
910
  // Name points to a function; single task
894
911
  if (typeof item === 'function') {
895
- taskOptions.taskName = name;
896
- taskOptions.method = item;
897
- return [taskOptions];
912
+ return [{...taskOptions, taskName: name, method: item}];
898
913
  }
899
914
 
900
- // Not a queue hash; stop
901
- if (!priority) {
915
+ if (!item || !priority) {
902
916
  return [];
903
917
  }
904
918
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yeoman-generator",
3
- "version": "5.5.2",
3
+ "version": "5.6.0",
4
4
  "description": "Rails-inspired generator system that provides scaffolding for your apps",
5
5
  "homepage": "http://yeoman.io",
6
6
  "author": "Yeoman",
@@ -71,7 +71,7 @@
71
71
  "read-pkg-up": "^7.0.1",
72
72
  "run-async": "^2.0.0",
73
73
  "semver": "^7.2.1",
74
- "shelljs": "^0.8.4",
74
+ "shelljs": "^0.8.5",
75
75
  "sort-keys": "^4.2.0",
76
76
  "text-table": "^0.2.0"
77
77
  },