platformjs-cli
Installs a command pjs
that includes convenience functions for working with git repositories, npm packages, and other common development scenarios.
Overview
Setup
$ pjs init # Initialize a "root" development directory
$ source pjs-bash # Let pjs interact with the bash environment
Common commands
$ pjs status # Recursively run git status for each git
# repo under the current directory and cd
# to the first with any uncomitted diffs
$ pjs publish # Tag, commit, push, and publish to NPM the
# repository in the current directory
$ pjs cd <name> # Change directory to the git repo under the
# root that most closely matches "name"
Install & Setup
Installation
The pjs
command is intended to be installed globally:
$ npm install -g platformjs-cli
Setup
To define a root directory as a development "home", the pjs init
command can be used. This will define a .pjsconfig
for that subtree and create a pjs-bash
file to allow psj
to interact with the bash
environment. This only need to be run once in the directory.
$ pjs init
To allow pjs to interact with the bash
environment (e.g. change the current working directoy) during a session, pjs-bash
needs to be "source'd". This command needs to be run every session
(or included in your bash profile):
$ source pjs-bash
Commands
git batch commands
pjs home
Changes directory to your development "home" directory.
# Needs to be run once to allow pjs to interact with the
# the bash environment
$ source pjs-bash
# Now becomes a shortcut to change directory to pjs "home"
# directory
$ psj home
pjs status
Recursively runs and reports the results of git status
for the current directory and/or any sub-directories containing a .git
folder.
pjs pushall
Recursively runs and reports the results of git pushall
for the current directory and/or any sub-directories containing a .git
folder.
miscellaneous
pjs publish
In the current working directory:
- Bumps the minor version number in
package.json
- Commits the updated package.json to git
- Add a new tag of the form
v#.#.#
to git - Pushes commit and tag to the default git remote
- Runs
npm publish
on the updated package
The command does some basic checks such as setting the version to 0.0.0
if the version has not yet been set, warning if there is no description field, aborting the publish is there are uncommitted changes in the working repo, etc.