Giter VIP home page Giter VIP logo

copy-production-deps's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar zbigg avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

copy-production-deps's Issues

#assignTargetDirs reached root

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

Doesn't work with local dependencies

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)

RangeError while checking dependencies

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)

Respect `files` section of private package

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 .npmignored files.

Deeply nested dependencies are not copied

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:

  • Arch Linux
  • Node v18.18.0
  • NPM v10.2.1

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 😅

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.