yeoman-generator 7.5.0 → 7.5.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.
|
@@ -83,7 +83,7 @@ export declare abstract class TasksMixin {
|
|
|
83
83
|
* @param args: Task arguments.
|
|
84
84
|
* @param taskStatus.
|
|
85
85
|
*/
|
|
86
|
-
executeTask(this: BaseGeneratorImpl, task: Task, args?: any[] | ((generator: Generator) => any[]), taskStatus?: TaskStatus | undefined): Promise<void>;
|
|
86
|
+
executeTask(this: BaseGeneratorImpl, task: Task, args?: any[] | ((generator: Generator) => any[]) | undefined, taskStatus?: TaskStatus | undefined): Promise<void>;
|
|
87
87
|
/**
|
|
88
88
|
* Ignore cancellable tasks.
|
|
89
89
|
*/
|
|
@@ -22,15 +22,15 @@ export class TasksMixin {
|
|
|
22
22
|
* Register priorities for this generator
|
|
23
23
|
*/
|
|
24
24
|
registerPriorities(priorities) {
|
|
25
|
-
priorities = priorities.filter(priority => {
|
|
26
|
-
if (
|
|
27
|
-
const queue = this._queues[
|
|
25
|
+
priorities = priorities.filter(({ priorityName, edit, ...priority }) => {
|
|
26
|
+
if (edit) {
|
|
27
|
+
const queue = this._queues[priorityName];
|
|
28
28
|
if (!queue) {
|
|
29
|
-
throw new Error(`Error editing priority ${
|
|
29
|
+
throw new Error(`Error editing priority ${priorityName}, not found`);
|
|
30
30
|
}
|
|
31
31
|
Object.assign(queue, { ...priority, edit: undefined });
|
|
32
32
|
}
|
|
33
|
-
return !
|
|
33
|
+
return !edit;
|
|
34
34
|
});
|
|
35
35
|
const customPriorities = priorities.map(customPriority => ({ ...customPriority }));
|
|
36
36
|
// Sort customPriorities, a referenced custom queue must be added before the one that reference it.
|
|
@@ -241,17 +241,17 @@ export class TasksMixin {
|
|
|
241
241
|
* @param args: Task arguments.
|
|
242
242
|
* @param taskStatus.
|
|
243
243
|
*/
|
|
244
|
-
async executeTask(task, args = task.args
|
|
244
|
+
async executeTask(task, args = task.args, taskStatus = this._taskStatus) {
|
|
245
245
|
const { reject, queueName = 'default', taskName: methodName, method } = task;
|
|
246
246
|
const { _namespace: namespace } = this;
|
|
247
|
-
const priority = Object.entries(this._queues).find(([_, options]) => options.queueName === queueName);
|
|
248
|
-
const priorityName = priority ? priority[0] : undefined;
|
|
249
247
|
debug(`Running ${namespace}#${methodName}`);
|
|
250
248
|
this.emit(`method:${methodName}`);
|
|
251
249
|
const taskCancelled = task.cancellable && taskStatus?.cancelled;
|
|
252
250
|
if (taskCancelled) {
|
|
253
251
|
return;
|
|
254
252
|
}
|
|
253
|
+
const [priorityName, priority] = Object.entries(this._queues).find(([_, queue]) => queue.queueName === queueName) ?? [];
|
|
254
|
+
args ??= priority?.args ?? this.args;
|
|
255
255
|
args = typeof args === 'function' ? args(this) : args;
|
|
256
256
|
this.runningState = { namespace, queueName, methodName };
|
|
257
257
|
try {
|