3.1.1 • Published 2 years ago

local-package-cli v3.1.1

Weekly downloads
19
License
MIT
Repository
github
Last release
2 years ago

Local-Package-CLI

This package is used for package related commnad line functions

How to use?

install this package as global package:

Using npm:

npm install -g local-package-cli

Using yarn:

yarn global add local-package-cli

Afterwards you will be able to consume it:

pkg-cli

initializing the package:

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>

init arguments:

  • 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 running pkg-cli copy --compile. this defaults to npm run compile.

  • buildScript - OPTIONAL the script to run before copy when running pkg-cli copy --build. this defaults to npm run build.

  • customScript - OPTIONAL the script to run before copy when running pkg-cli copy --custom. this doesn't have a default script, if you dont set it you wont be able to run pkg-cli copy --custom.

example: pkg-cli init ~/dev --buildScript 'yarn build' --customScript 'npm run lint && npm run compile:dev'

Copy Function

To copy the package to all the repos that require it in package.json, run the command pkg-cli copy.

copy arguments:

  • --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 under folder (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'

Install Function

To install a local package to the current repo (even if not on package.json), run the command pkg-cli install <packageName>.

install arguments:

  • <packageName> - the name of the package to install. the package must be under the dir 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'

package config:

after running init you can update its config running pkg-cli setConfig

to view the current config you can run pkg-cli getConfig

setConfig arguments:

  • 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 running pkg-cli copy --compile. this defaults to npm run compile.

  • buildScript - OPTIONAL the script to run before copy when running pkg-cli copy --build. this defaults to npm run build.

  • customScript - OPTIONAL the script to run before copy when running pkg-cli copy --custom. this doesn't have a default script, if you dont set it you wont be able to run pkg-cli copy --custom.

example: pkg-cli setConfig --dir ~/dev --buildScript 'yarn build'

3.1.1

2 years ago

3.1.0

2 years ago

3.0.0

2 years ago

2.0.15

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.13

3 years ago

2.0.5

3 years ago

2.0.14

3 years ago

2.0.4

3 years ago

2.0.11

3 years ago

2.0.7

3 years ago

2.0.12

3 years ago

2.0.6

3 years ago

2.0.9

3 years ago

2.0.10

3 years ago

2.0.8

3 years ago

2.1.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.6.0

3 years ago

1.5.0

3 years ago

1.4.0

3 years ago

1.3.0

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.10

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago