yeoman-environment 5.0.0 → 5.1.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.
@@ -19,13 +19,14 @@ export type EnvironmentLookupOptions = LookupOptions & {
19
19
  /** Customize the namespace to be registered */
20
20
  customizeNamespace?: (ns?: string) => string | undefined;
21
21
  };
22
- export type EnvironmentOptions = BaseEnvironmentOptions & Omit<TerminalAdapterOptions, 'promptModule'> & {
22
+ export type EnvironmentOptions = ConflicterOptions & BaseEnvironmentOptions & Omit<TerminalAdapterOptions, 'promptModule'> & {
23
23
  adapter?: InputOutputAdapter;
24
24
  logCwd?: string;
25
25
  command?: YeomanCommand;
26
26
  yeomanRepository?: string;
27
27
  arboristRegistry?: string;
28
28
  nodePackageManager?: string;
29
+ generatorLookupOptions?: Pick<EnvironmentLookupOptions, 'customizeNamespace' | 'lookups'>;
29
30
  };
30
31
  /**
31
32
  * Copy and remove null and undefined values
@@ -39,7 +40,8 @@ export default class EnvironmentBase extends EventEmitter implements BaseEnviron
39
40
  adapter: QueuedAdapter;
40
41
  sharedFs: MemFs<MemFsEditorFile>;
41
42
  conflicterOptions?: ConflicterOptions;
42
- protected readonly options: EnvironmentOptions;
43
+ readonly sharedOptions: Record<string, any>;
44
+ readonly options: EnvironmentOptions;
43
45
  protected readonly aliases: Array<{
44
46
  match: RegExp;
45
47
  value: string;
@@ -49,7 +51,6 @@ export default class EnvironmentBase extends EventEmitter implements BaseEnviron
49
51
  protected runLoop: GroupedQueue;
50
52
  protected composedStore: ComposedStore;
51
53
  protected lookups: string[];
52
- protected sharedOptions: Record<string, any>;
53
54
  protected repository: FlyRepository;
54
55
  protected experimental: boolean;
55
56
  protected _rootGenerator?: BaseGenerator;
@@ -91,6 +91,7 @@ export default class EnvironmentBase extends EventEmitter {
91
91
  adapter;
92
92
  sharedFs;
93
93
  conflicterOptions;
94
+ sharedOptions;
94
95
  options;
95
96
  aliases = [];
96
97
  store;
@@ -98,7 +99,6 @@ export default class EnvironmentBase extends EventEmitter {
98
99
  runLoop;
99
100
  composedStore;
100
101
  lookups;
101
- sharedOptions;
102
102
  repository;
103
103
  experimental;
104
104
  _rootGenerator;
@@ -121,7 +121,7 @@ export default class EnvironmentBase extends EventEmitter {
121
121
  // Node won't complain about event listeners leaks.
122
122
  this.runLoop.setMaxListeners(0);
123
123
  this.sharedFs.setMaxListeners(0);
124
- this.lookups = defaultLookups;
124
+ this.lookups = this.options.generatorLookupOptions?.lookups ?? defaultLookups;
125
125
  this.sharedOptions = sharedOptions;
126
126
  // Create a default sharedData.
127
127
  this.sharedOptions.sharedData = this.sharedOptions.sharedData ?? {};
@@ -416,7 +416,7 @@ export default class EnvironmentBase extends EventEmitter {
416
416
  * registered as `dummy:yo` generator.
417
417
  */
418
418
  async lookup(options) {
419
- const { registerToScope, customizeNamespace = (ns) => ns, lookups = this.lookups, ...remainingOptions } = options ?? { localOnly: false };
419
+ const { registerToScope, customizeNamespace = this.options.generatorLookupOptions?.customizeNamespace ?? ((ns) => ns), lookups = this.lookups, ...remainingOptions } = options ?? { localOnly: false };
420
420
  options = {
421
421
  ...remainingOptions,
422
422
  lookups,
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { type EnvironmentOptions } from './environment-base.ts';
2
2
  import Environment from './environment-full.ts';
3
3
  export { default } from './environment-full.ts';
4
- export { default as EnvironmentBase } from './environment-base.ts';
4
+ export { default as EnvironmentBase, type EnvironmentOptions } from './environment-base.ts';
5
5
  export declare const createEnv: (options?: EnvironmentOptions) => Environment;
6
6
  export declare const enforceUpdate: () => void;
7
7
  export * from './commands.ts';
@@ -210,6 +210,9 @@ function getGlobalNpmPaths(filterPaths = true) {
210
210
  if (yarnBase) {
211
211
  paths.push(resolve(yarnBase, 'node_modules'), resolve(yarnBase, '../link/'));
212
212
  }
213
+ if (process.env.PNPM_HOME) {
214
+ paths.push(resolve(process.env.PNPM_HOME, 'global/*/node_modules'));
215
+ }
213
216
  // Get npm global prefix and infer the module paths from there
214
217
  const globalInstall = execaOutput('npm', ['root', '-g']);
215
218
  if (globalInstall) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yeoman-environment",
3
- "version": "5.0.0",
3
+ "version": "5.1.1",
4
4
  "description": "Handles the lifecyle and bootstrapping of generators in a specific environment",
5
5
  "keywords": [
6
6
  "development",
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@yeoman/adapter": "^3.1.0",
61
- "@yeoman/conflicter": "^3.0.0",
61
+ "@yeoman/conflicter": "^4.0.0",
62
62
  "@yeoman/namespace": "^1.0.1",
63
63
  "@yeoman/transform": "^2.1.0",
64
64
  "@yeoman/types": "^1.8.0",
@@ -68,7 +68,7 @@
68
68
  "debug": "^4.4.1",
69
69
  "execa": "^9.6.0",
70
70
  "fly-import": "^1.0.0",
71
- "globby": "^14.1.0",
71
+ "globby": "^16.0.0",
72
72
  "grouped-queue": "^2.1.0",
73
73
  "locate-path": "^8.0.0",
74
74
  "lodash-es": "^4.17.21",