yeoman-environment 5.0.0-beta.1 → 5.0.0-beta.2
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.
- package/dist/environment-base.js +19 -13
- package/package.json +5 -5
package/dist/environment-base.js
CHANGED
|
@@ -328,7 +328,7 @@ export default class EnvironmentBase extends EventEmitter {
|
|
|
328
328
|
// Backward compatibility
|
|
329
329
|
const oldGenerator = generator;
|
|
330
330
|
if (!oldGenerator.options.forwardErrorToEnvironment) {
|
|
331
|
-
oldGenerator.on('error', (error) => this.
|
|
331
|
+
oldGenerator.on('error', (error) => this.adapter.abort(error));
|
|
332
332
|
}
|
|
333
333
|
oldGenerator.promise = oldGenerator.run();
|
|
334
334
|
};
|
|
@@ -549,6 +549,9 @@ export default class EnvironmentBase extends EventEmitter {
|
|
|
549
549
|
*/
|
|
550
550
|
async start(options) {
|
|
551
551
|
return new Promise((resolve, reject) => {
|
|
552
|
+
if (this.adapter.signal?.aborted) {
|
|
553
|
+
return reject(this.adapter.signal.reason);
|
|
554
|
+
}
|
|
552
555
|
Object.assign(this.options, removePropertiesWithNullishValues(pick(options, ['skipInstall', 'nodePackageManager'])));
|
|
553
556
|
this.logCwd = options.logCwd ?? this.logCwd;
|
|
554
557
|
const conflicterOptionsProperties = ['force', 'bail', 'ignoreWhitespace', 'dryRun', 'skipYoResolve'];
|
|
@@ -565,32 +568,26 @@ export default class EnvironmentBase extends EventEmitter {
|
|
|
565
568
|
* would be killed if an error is thrown to environment.
|
|
566
569
|
* Make sure to not rely on that behavior.
|
|
567
570
|
*/
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
this.adapter.close();
|
|
571
|
+
let errorEmitted = false;
|
|
572
|
+
this.on('error', error => {
|
|
573
|
+
errorEmitted = true;
|
|
574
|
+
this.adapter.abort(error);
|
|
573
575
|
});
|
|
574
576
|
this.once('end', async () => {
|
|
575
577
|
await this.adapter.onIdle?.();
|
|
576
578
|
resolve();
|
|
577
|
-
this.adapter.close();
|
|
578
579
|
});
|
|
579
580
|
/*
|
|
580
581
|
* For backward compatibility
|
|
581
582
|
*/
|
|
582
|
-
this.on('generator:reject', error =>
|
|
583
|
-
this.emit('error', error);
|
|
584
|
-
});
|
|
583
|
+
this.on('generator:reject', error => this.adapter.abort(error));
|
|
585
584
|
/*
|
|
586
585
|
* For backward compatibility
|
|
587
586
|
*/
|
|
588
587
|
this.on('generator:resolve', () => {
|
|
589
588
|
this.emit('end');
|
|
590
589
|
});
|
|
591
|
-
this.runLoop.on('error', (error) =>
|
|
592
|
-
this.emit('error', error);
|
|
593
|
-
});
|
|
590
|
+
this.runLoop.on('error', (error) => this.adapter.abort(error));
|
|
594
591
|
this.runLoop.on('paused', () => {
|
|
595
592
|
this.emit('paused');
|
|
596
593
|
});
|
|
@@ -598,6 +595,15 @@ export default class EnvironmentBase extends EventEmitter {
|
|
|
598
595
|
this.runLoop.once('end', () => {
|
|
599
596
|
this.emit('end');
|
|
600
597
|
});
|
|
598
|
+
this.adapter.signal?.addEventListener('abort', async () => {
|
|
599
|
+
const reason = this.adapter.signal.reason;
|
|
600
|
+
if (!errorEmitted) {
|
|
601
|
+
this.emit('error', reason);
|
|
602
|
+
}
|
|
603
|
+
this.runLoop.pause();
|
|
604
|
+
await this.adapter.onIdle?.();
|
|
605
|
+
reject(reason);
|
|
606
|
+
});
|
|
601
607
|
this.emit('run');
|
|
602
608
|
this.runLoop.start();
|
|
603
609
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yeoman-environment",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.2",
|
|
4
4
|
"description": "Handles the lifecyle and bootstrapping of generators in a specific environment",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"development",
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
"doc_path": "./yeoman-environment-doc"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@yeoman/adapter": "^
|
|
60
|
+
"@yeoman/adapter": "^3.1.0",
|
|
61
61
|
"@yeoman/conflicter": "^3.0.0",
|
|
62
62
|
"@yeoman/namespace": "^1.0.1",
|
|
63
63
|
"@yeoman/transform": "^2.1.0",
|
|
64
|
-
"@yeoman/types": "^1.
|
|
64
|
+
"@yeoman/types": "^1.8.0",
|
|
65
65
|
"arrify": "^3.0.0",
|
|
66
66
|
"chalk": "^5.5.0",
|
|
67
67
|
"commander": "^14.0.0",
|
|
@@ -106,10 +106,10 @@
|
|
|
106
106
|
"yeoman-generator-6": "npm:yeoman-generator@^6.0.1",
|
|
107
107
|
"yeoman-generator-7": "npm:yeoman-generator@^7.0.0",
|
|
108
108
|
"yeoman-generator-8": "npm:yeoman-generator@^8.0.0-beta.0",
|
|
109
|
-
"yeoman-test": "^
|
|
109
|
+
"yeoman-test": "^11.0.0-0"
|
|
110
110
|
},
|
|
111
111
|
"peerDependencies": {
|
|
112
|
-
"@yeoman/types": "^1.
|
|
112
|
+
"@yeoman/types": "^1.8.0",
|
|
113
113
|
"mem-fs": "^4.1.2"
|
|
114
114
|
},
|
|
115
115
|
"engines": {
|