aideslucas / local-package-cli

The perfect package to work with packages locally

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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'

About

The perfect package to work with packages locally

License:MIT License


Languages

Language:TypeScript 98.8%Language:JavaScript 1.2%