Skip to content

Commit

Permalink
fix: replace require.resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Nov 14, 2023
1 parent 63c8b2b commit 00ff1cc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
*/
import fs from 'node:fs';
import os from 'node:os';
import { createRequire } from 'node:module';
import yeoman from 'yeoman-environment';
import { FlagAnswers } from './types.js';

export function generate(type: string, generatorOptions: Record<string, unknown> = {}): Promise<void> {
const env = yeoman.createEnv();
env.register(require.resolve(`./generators/${type}`), `sf:${type}`);
env.register(createRequire(import.meta.url).resolve(`./generators/${type}`), `sf:${type}`);
return env.run(`sf:${type}`, generatorOptions);
}

Expand Down

0 comments on commit 00ff1cc

Please sign in to comment.