Closed JulSeb42 closed 1 month ago
It's this:
https://github.com/JulSeb42/julseb-plop-utils/blob/master/index.js#L10
You need to resolve from process.cwd()
, not __dirname
. Dirname resolves from the file's location on disk, in your case node_modules
Nope I'm getting the same error. This is my new line:
configPath: `${process.cwd()}/scripts/plopfile.js`,
I tried to log the cwd
in the return function, I get a path to my local folder
I could find the solution, this is my new index.js
, now the command works as expected:
const __dirname = dirname(fileURLToPath(import.meta.url))
Plop.prepare(
{
cwd: argv.cwd,
configPath: path.join(__dirname, "scripts/plopfile.js"),
preload: argv.preload || [],
completion: argv.completion,
},
env => Plop.execute(env, run)
)
Thanks!
Hello,
I'm building a React app boilerplate generator with an NPX package. The CLI works when I'm inside the package folder, but when I'm inside another folder I get this error:
Any idea why?
This is the command I run for the CLI:
You can find the repo here: https://github.com/JulSeb42/julseb-plop-utils And the npm package here: https://www.npmjs.com/package/julseb-plop-utils
Thanks!