Skip to content

Commit afc7cd7

Browse files
committed
feat: add generatorLookupOptions option
1 parent 4de747f commit afc7cd7

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/environment-base.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export type EnvironmentOptions = ConflicterOptions &
6363
yeomanRepository?: string;
6464
arboristRegistry?: string;
6565
nodePackageManager?: string;
66+
generatorLookupOptions?: Pick<EnvironmentLookupOptions, 'customizeNamespace' | 'lookups'>;
6667
};
6768

6869
const getInstantiateOptions = (firstArg?: any, generatorOptions?: any): InstantiateOptions => {
@@ -200,7 +201,7 @@ export default class EnvironmentBase extends EventEmitter implements BaseEnviron
200201
this.runLoop.setMaxListeners(0);
201202
this.sharedFs.setMaxListeners(0);
202203

203-
this.lookups = defaultLookups;
204+
this.lookups = this.options.generatorLookupOptions?.lookups ?? defaultLookups;
204205

205206
this.sharedOptions = sharedOptions;
206207

@@ -629,7 +630,7 @@ export default class EnvironmentBase extends EventEmitter implements BaseEnviron
629630
async lookup(options?: EnvironmentLookupOptions): Promise<LookupGeneratorMeta[]> {
630631
const {
631632
registerToScope,
632-
customizeNamespace = (ns: string) => ns,
633+
customizeNamespace = this.options.generatorLookupOptions?.customizeNamespace ?? ((ns: string) => ns),
633634
lookups = this.lookups,
634635
...remainingOptions
635636
} = options ?? { localOnly: false };

0 commit comments

Comments
 (0)