Closed ntucker closed 9 months ago
cli.mjs
:
import { prepareCommand } from 'yeoman-environment`;
import generator from '../generators/app/index.js';
await prepareCommand(generator).parseAsync();
cli.cjs
(executable should be commonjs`):
#!/usr/bin/env node
(async function () {
await import('../cli.mjs');
})();
I'm getting some conflicting indicators in the prepareCommand types:
/**
* Prepare a commander instance for cli support.
*
* @param generatorPaht - Generator to create Command
* @return Return a Command instance
*/
export declare const prepareCommand: (options: CommandPreparation) => Promise<YeomanCommand>;
JSDOCS do not match types.
When I try the import code you had above, I get
A generator with namespace or a generator path is required
https://github.com/yeoman/environment/blob/main/src/commands.ts#L27C1-L33C4
Indicates that prepareCommand(generator)
is not a valid call
This definitely doesn't do the same thing as calling yo as env isn't setup the same
This issue is stale because it has been open with no activity. Remove stale label or comment or this will be closed
How to use yeoman 4? I just want to run a generator that i have the filepath for
https://github.com/yeoman/environment/blob/6bacec60de3cc2bbd8b3f4bd5c890a50f26da013/test/command.js#L139 doesn't work I get
Environment.prepareEnvironment is not a function
Related to https://github.com/yeoman/yo/pull/793#issuecomment-1792792833