yeoman-environment 3.15.0 → 3.15.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.
@@ -33,6 +33,7 @@ const {
33
33
  createYoRcTransform,
34
34
  createYoResolveTransform
35
35
  } = require('./util/transform');
36
+ const {requireOrImport} = require('./util/esm');
36
37
 
37
38
  const {isFilePending} = FileEditor.State;
38
39
 
@@ -564,13 +565,15 @@ class Environment extends Base {
564
565
  return;
565
566
  }
566
567
 
567
- // eslint-disable-next-line node/no-unsupported-features/es-syntax
568
- const importModule = async () => import(meta.resolved);
569
- const instantiate = async (args, options) => this.instantiate(await this._findGeneratorClass(await meta.importGenerator()), args, options);
568
+ const {importGenerator, resolved} = meta;
569
+ const importModule = async () => requireOrImport(resolved);
570
+ const importGeneratorClass = async () => this._findGeneratorClass(await importGenerator(), meta);
571
+ const instantiate = async (args, options) => this.instantiate(await importGeneratorClass(), args, options);
570
572
  const instantiateHelp = async () => instantiate([], {help: true});
571
573
  const newMeta = {
572
574
  ...meta,
573
575
  importModule,
576
+ importGeneratorClass,
574
577
  instantiate,
575
578
  instantiateHelp
576
579
  };
@@ -1282,14 +1285,7 @@ class Environment extends Base {
1282
1285
 
1283
1286
  const conflicterStatus = {};
1284
1287
  if (this.enableConflicterIgnore) {
1285
- conflicterStatus.fileActions = [{
1286
- key: 'i',
1287
- name: 'ignore, do not overwrite and remember (experimental)',
1288
- value: ({relativeFilePath}) => {
1289
- this.fs.append(`${this.cwd}/.yo-resolve`, `${relativeFilePath} skip`, {create: true});
1290
- return 'skip';
1291
- }
1292
- }];
1288
+ conflicterStatus.fs = this.fs;
1293
1289
  }
1294
1290
 
1295
1291
  this.fs.commit([
@@ -315,8 +315,20 @@ class Conflicter {
315
315
  value: 'edit'
316
316
  }
317
317
  );
318
- if (conflicterStatus && conflicterStatus.fileActions) {
319
- prompt.choices.push(...conflicterStatus.fileActions);
318
+ if (conflicterStatus) {
319
+ if (conflicterStatus.fileActions) {
320
+ prompt.choices.push(...conflicterStatus.fileActions);
321
+ }
322
+ if (conflicterStatus.fs) {
323
+ prompt.choices.push({
324
+ key: 'i',
325
+ name: 'ignore, do not overwrite and remember (experimental)',
326
+ value: ({relativeFilePath}) => {
327
+ conflicterStatus.fs.append(`${this.cwd}/.yo-resolve`, `${relativeFilePath} skip`, {create: true});
328
+ return 'skip';
329
+ }
330
+ });
331
+ }
320
332
  }
321
333
  }
322
334
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yeoman-environment",
3
- "version": "3.15.0",
3
+ "version": "3.15.1",
4
4
  "description": "Handles the lifecyle and bootstrapping of generators in a specific environment",
5
5
  "homepage": "http://yeoman.io",
6
6
  "author": "Yeoman",