I think there may be still be a problem with the scoped package support:
var name = pkg.name;
...
var modulePath = path.join(cwd, 'node_modules', name + '.js');
...
// Create the pseudo-module.
fs.writeFileSync(modulePath, moduleText);
If our module name was say "@myscope/mypackage", then fs.writeFileSync is being asked to create a file at the path "[...]/node_modules/@myscope/mypackage.js" which will fail because the "@myscope" directory doesn't exist in "node_modules".
Maybe add some logic to create this directory first (if not exists) before creating the file?
Hi @benmonro thanks for the PR.
I think there may be still be a problem with the scoped package support:
If our module name was say
"@myscope/mypackage"
, thenfs.writeFileSync
is being asked to create a file at the path"[...]/node_modules/@myscope/mypackage.js"
which will fail because the"@myscope"
directory doesn't exist in"node_modules"
.Maybe add some logic to create this directory first (if not exists) before creating the file?