https://github.com/zbigg/copy-production-deps
Create production node_modules from Npm/Yarn workspace
https://github.com/zbigg/copy-production-deps
dependencies nodejs yarn-workspaces
Last synced: over 1 year ago
JSON representation
Create production node_modules from Npm/Yarn workspace
- Host: GitHub
- URL: https://github.com/zbigg/copy-production-deps
- Owner: zbigg
- License: mit
- Created: 2020-03-25T16:03:46.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-01-24T04:09:18.000Z (over 1 year ago)
- Last Synced: 2025-03-08T06:48:08.097Z (over 1 year ago)
- Topics: dependencies, nodejs, yarn-workspaces
- Language: TypeScript
- Homepage:
- Size: 207 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Copy node production deps
[](http://www.npmjs.com/package/copy-production-deps)
[](https://travis-ci.org/zbigg/copy-production-deps)
[](https://codecov.io/gh/zbigg/copy-production-deps)
Find and copy production deps of `package` living in `yarn workspace` to `dist` folder.
**NOTE: This is very experimental package.**, nevertheless it's used in one internal project
to build minimal `node_modules` for services running in docker.
## Usage
```shell
# copy deps of current folder to ./dist
$ npx copy-production-deps
# copy deps specific package to specific folder
$ npx copy-production-deps packages/foo-backend dist/foo-backend
# Only dist selected packages that are not bundled with esbuild
$ esbuild server.js --outfile dist/server.js --external:mongoose --external:hiredis
$ npx copy-production-deps . dist --only-packages mongoose,hiredis
```
## Doc
Full synopsis:
```
copy-production-deps [packageDir] [distDir]
copy production deps from Npm/Yarn workspace to dist folder
Positionals:
packageDir source package folder (must contain package.json) [default: "."]
distDir distribution directory (packages will be copied to
${distDir}/node_modules) [default: "./dist"]
Options:
--version Show version number [boolean]
--dryRun, -n Dry run - only show what would be copied.
[boolean] [default: false]
--verbose, -v Run with verbose logging [boolean] [default: false]
--exclude-from Read ecluded file patterns from file one pattern a line.
[array] [default: []]
--exclude Exclude file pattern (minimatch glob) [array] [default: []]
--only-packages Include only those packages [array] [default: []
--help Show help [boolean]
```
## Why
Born from frustration that both `yarn` and `npm` have several bugs related to `--production` install and i almost wrote everywhere before i found [copy-node-modules](https://github.com/arloliu/copy-node-modules#readme) which apparently didn't support yarn workspaces.
## Contribute
PRs accepted.
## License
MIT © Zbigniew Zagórski