zbigg / copy-production-deps Goto Github PK
View Code? Open in Web Editor NEWCreate production node_modules from Npm/Yarn workspace
License: MIT License
Create production node_modules from Npm/Yarn workspace
License: MIT License
Trying to run copy-production-deps
(v0.1.6) on this repo: https://github.com/yshrsmz/nuxt-serverless-test yields following error
copy-production-deps: failed: Error: #assignTargetDirs reached root, report this as bug Error: #assignTargetDirs reached root, report this as bug
at resolve (/home/zagorski/zz/copy-production-deps/lib/copy-production-deps.js:246:23)
at getResolved (/home/zagorski/zz/copy-production-deps/lib/copy-production-deps.js:255:17)
at assignTargetDirs (/home/zagorski/zz/copy-production-deps/lib/copy-production-deps.js:278:9)
at Object.copyProductionDeps (/home/zagorski/zz/copy-production-deps/lib/copy-production-deps.js:379:28)
at /home/zagorski/zz/copy-production-deps/lib/cli.js:99:38
at asyncCommand (/home/zagorski/zz/copy-production-deps/lib/cli.js:32:15)
at Object.handler (/home/zagorski/zz/copy-production-deps/lib/cli.js:85:18)
at Object.runCommand (/home/zagorski/zz/copy-production-deps/node_modules/yargs/lib/command.js:240:40)
at Object.parseArgs [as _parseArgs] (/home/zagorski/zz/copy-production-deps/node_modules/yargs/yargs.js:1164:39)
at Object.get [as argv] (/home/zagorski/zz/copy-production-deps/node_modules/yargs/yargs.js:1088:21)
Followup of #4
copy-production-deps
doesn't create proper links/scripts in target node_modules/.bin
.
When I have a dependency from local path, i.e.
"dependencies": {
"api": "file:../api",
...
npx copy-production-deps
fails with following error:
$ npx copy-production-deps . build/dist
npx: installed 31 in 3.648s
copy-production-deps: failed: Error: Cannot overwrite directory '[PATH]\tools\build\dist\node_modules\api/' with non-directory '[PATH]\tools\node_modules\api/'. Error: Cannot overwrite directory '[PATH]\tools\build\dist\node_modules\api/' with non-directory '[PATH]\tools\node_modules\api/'.
at C:\Users\Kaa\AppData\Roaming\npm-cache\_npx\6528\node_modules\copy-production-deps\node_modules\fs-extra\lib\util\stat.js:55:19
at cb (util.js:289:31)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
while testing the package, I ran into the following error
yshrsmz: ~/repos/test% npx copy-production-deps packages/media dist -v
npx: Installed 41 packages in 2.034 seconds.
copy-production-deps: collecting production packages for packages/media
copy-production-deps: failed: RangeError: Maximum call stack size exceeded RangeError: Maximum call stack size exceeded
at internal/fs/utils.js:547:42
at hidden (internal/errors.js:290:14)
at Object.openSync (fs.js:450:10)
at Object.readFileSync (fs.js:360:35)
at loadJsonSync (/Users/a12897/.npm/_npx/73927/lib/node_modules/copy-production-deps/lib/copy-production-deps.js:52:36)
at lookForDependenciesInWorkspace (/Users/yshrsmz/.npm/_npx/73927/lib/node_modules/copy-production-deps/lib/copy-production-deps.js:106:46)
at processPackage (/Users/yshrsmz/.npm/_npx/73927/lib/node_modules/copy-production-deps/lib/copy-production-deps.js:151:5)
at lookForDependenciesInWorkspace (/Users/yshrsmz/.npm/_npx/73927/lib/node_modules/copy-production-deps/lib/copy-production-deps.js:139:9)
at processPackage (/Users/yshrsmz/.npm/_npx/73927/lib/node_modules/copy-production-deps/lib/copy-production-deps.js:151:5)
at lookForDependenciesInWorkspace (/Users/yshrsmz/.npm/_npx/73927/lib/node_modules/copy-production-deps/lib/copy-production-deps.js:139:9)
While we more or less respect .npmignore
of private packages, we should also properly respect files
section "local" packages.
Example in monorepos built withyarn
workspaces:
$ yarn workspaces run build
$ copy-production-deps ./some-backend some-backend/dist
copy-production-deps
should be able to acuire only "publshed" files from all workspaces referenced by "some-backend" package. Now it will will copy all not .npmignore
d files.
To reproduce:
~ $ mkdir tmp
~ $ cd tmp
~/tmp $ npm i --save [email protected]
~/tmp $ npm i --save-dev copy-production-deps
~/tmp $ npm ls @mongodb-js/saslprep
tmp@ /home/mpsijm/tmp
└─┬ [email protected]
└─┬ [email protected]
└── @mongodb-js/[email protected]
~/tmp $ mkdir dist
~/tmp $ npx copy-production-deps
~/tmp $ cd dist
~/tmp/dist $ npm ls @mongodb-js/saslprep
/home/mpsijm/tmp/dist
└── (empty)
In this example, the nested dependency @mongodb-js/saslprep
should be copied to dist/node_modules
(as dependency of mongodb
, but it's not. Note that mongodb
itself is copied, even though its dependencies are not:
~/tmp/dist $ npm ls mongodb
/home/mpsijm/tmp/dist
├── [email protected] extraneous
└─┬ [email protected] extraneous
└── [email protected] deduped
This is probably because mongodb
exists at the top-level node_modules
folder, whereas @mongodb-js/saslprep
does not.
System info:
Note: this is a duplicate of arloliu/copy-node-modules#42. I was looking for alternatives that had more recent releases than 5 years ago, but unfortunately, this package has the same bug 😅
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.