install this package as global package:
npm install -g local-package-cli
yarn global add local-package-cli
pkg-cli
before you can use the copy functions you will need to initialize the package, to do so run in command line
pkg-cli init <dir>
-
dir
- the directory where you keep all your repositories, (i.e: ~/dev | C:\dev). the copy function will only search the package in repositories under this directory. -
compileScript
- [OPTIONAL] the script to run before copy when runningpkg-cli copy --compile
. this defaults tonpm run compile
. -
buildScript
- [OPTIONAL] the script to run before copy when runningpkg-cli copy --build
. this defaults tonpm run build
. -
customScript
- [OPTIONAL] the script to run before copy when runningpkg-cli copy --custom
. this doesn't have a default script, if you dont set it you wont be able to runpkg-cli copy --custom
.
example: pkg-cli init ~/dev --buildScript 'yarn build' --customScript 'npm run lint && npm run compile:dev'
To copy the package to all the repos that require it in package.json, run the command pkg-cli copy
.
--compile [script]
- runs the [script] if [script] is not passed, then set durring init phase then runs the copy command--build [script]
- runs the [script] if [script] is not passed, then set durring init phase then runs the copy command--custom [script]
- runs the [script] if [script] is not passed, then set durring init phase then runs the copy command--watch [folder]
- watches files underfolder
(if not passed it will watch./
), on change the package will copy again (including compile/build/custom scripts).
examples:
pkg-cli copy --compile
pkg-cli copy --watch
pkg-cli copy --compile --watch src
pkg-cli copy --build --custom 'npm run lint'
To install a local package to the current repo (even if not on package.json), run the command pkg-cli install <packageName>
.
<packageName>
- the name of the package to install. the package must be under thedir
in the config file--compile [script]
- runs the [script] if [script] is not passed, then set durring init phase on the package then it installs it--build [script]
- runs the [script] if [script] is not passed, then set durring init phase on the package then it installs it--custom [script]
- runs the [script] if [script] is not passed, then set durring init phase on the package then it installs it
examples:
pkg-cli install local-package-cli --compile
pkg-cli install local-package-cli --build --custom 'npm run lint'
after running init you can update its config running pkg-cli setConfig
to view the current config you can run pkg-cli getConfig
-
dir
- [OPTIONAL] the directory where you keep all your repositories, (i.e: ~/dev | C:\dev). the copy function will only search the package in repositories under this directory. -
compileScript
- [OPTIONAL] the script to run before copy when runningpkg-cli copy --compile
. this defaults tonpm run compile
. -
buildScript
- [OPTIONAL] the script to run before copy when runningpkg-cli copy --build
. this defaults tonpm run build
. -
customScript
- [OPTIONAL] the script to run before copy when runningpkg-cli copy --custom
. this doesn't have a default script, if you dont set it you wont be able to runpkg-cli copy --custom
.
example: pkg-cli setConfig --dir ~/dev --buildScript 'yarn build'