Skip to content

Commit

Permalink
Move grouped-queue require (#1190)
Browse files Browse the repository at this point in the history
* Move grouped-queue require just before it will be used.

* Update lib/index.js

Co-Authored-By: Jacob Tomaw <jacob.tomaw@gmail.com>

Co-authored-by: Jacob Tomaw <jacob.tomaw@gmail.com>
  • Loading branch information
mshima and flatiron32 committed Mar 11, 2020
1 parent 8092de4 commit 7579d7b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/index.js
Expand Up @@ -14,7 +14,6 @@ const runAsync = require('run-async');
const through = require('through2');
const FileEditor = require('mem-fs-editor');
const createDebug = require('debug');
const SubQueue = require('grouped-queue/lib/subqueue');
const Environment = require('yeoman-environment');

const Conflicter = require('./util/conflicter');
Expand Down Expand Up @@ -280,6 +279,15 @@ class Generator extends EventEmitter {

// Backwards compatibilitiy with grouped-queue < 1.0.0
if (!this.env.runLoop.addSubQueue) {
let SubQueue;
try {
SubQueue = require('grouped-queue/lib/subqueue');
} catch {
throw new Error(
"The running environment doesn't have the necessary features to run this generator. Update it and run again."
);
}

this.env.runLoop.addSubQueue = function(name, before) {
if (this.__queues__[name]) {
// Sub-queue already exists
Expand Down

0 comments on commit 7579d7b

Please sign in to comment.