yeoman-environment 5.0.0-beta.1 → 5.0.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.
@@ -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.emit('error', error));
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
- this.on('error', async (error) => {
569
- this.runLoop.pause();
570
- await this.adapter.onIdle?.();
571
- reject(error);
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.1",
3
+ "version": "5.0.0",
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": "^2.1.1",
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.7.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",
@@ -70,13 +70,13 @@
70
70
  "fly-import": "^1.0.0",
71
71
  "globby": "^14.1.0",
72
72
  "grouped-queue": "^2.1.0",
73
- "locate-path": "^7.2.0",
73
+ "locate-path": "^8.0.0",
74
74
  "lodash-es": "^4.17.21",
75
75
  "mem-fs": "^4.1.2",
76
76
  "mem-fs-editor": "^11.1.4",
77
77
  "semver": "^7.7.2",
78
78
  "slash": "^5.1.0",
79
- "untildify": "^5.0.0",
79
+ "untildify": "^6.0.0",
80
80
  "which-package-manager": "^1.0.1"
81
81
  },
82
82
  "devDependencies": {
@@ -106,12 +106,16 @@
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": "^10.1.1"
109
+ "yeoman-test": "^11.0.0-0"
110
110
  },
111
111
  "peerDependencies": {
112
- "@yeoman/types": "^1.7.1",
112
+ "@yeoman/adapter": "^3.0.0",
113
+ "@yeoman/types": "^1.8.0",
113
114
  "mem-fs": "^4.1.2"
114
115
  },
116
+ "acceptDependencies": {
117
+ "@yeoman/adapter": ">=3.0.0"
118
+ },
115
119
  "engines": {
116
120
  "node": "^20.17.0 || >=22.9.0"
117
121
  },