@npranto/tools
A command line tool to setup useful packages and configurations w/in a project, i.e, husky, prettier, eslint and so on
Installation
- Install
tools
CLI globally on your machine
npm install @npranto/tools -g
- Start using the CLI
tools --help
Usage
Usage: tools [options] [command]
Options:
-h, --help display help for command
Commands:
husky [options]
WHAT IT DOES:
- Installs prettier package as a devDependency
- Initializes `git init`
- Setups up all the git hooks w/ husky
-R, --remove (removes all husky setup from current project)
BEFORE YOU RUN:
- only run this command from the root of your project, otherwise husky may not setup properly
prettier [options]
WHAT IT DOES:
- Installs prettier package as a devDependency
- adds `.prettierrc` file w/ default configurations
- adds `.prettierignore` with default ignore files
- adds `format` npm script inside package.json file to auto formats all the files w/in your project
-C, --custom (to setup your own prettier configurations w/ a set of questionnaires)
-R, --remove (removes all prettier setup from current project)
BEFORE YOU RUN:
- only run this command from the root of your project, otherwise prettier may not setup properly
eslint [options]
WHAT IT DOES:
- Installs eslint package as a devDependency
- adds `.eslintrc.js` file for ESLint configuration
- adds `.eslintignore` with default ignore files
- adds `format` npm script inside package.json file to auto formats all the files w/in your project
-R, --remove (removes all ESLint setup from current project)
BEFORE YOU RUN:
- only run this command from the root of your project, otherwise eslint may not setup properly
editorconfig [options]
WHAT IT DOES:
- adds `.editorconfig` file in the root level (w/ default configurations)
-R, --remove (removes editorconfig from current project)
BEFORE YOU RUN:
- only run this command from the root of your project, otherwise editorconfig may not setup properly
gh-actions [options]
WHAT IT DOES:
A list of GitHub Actions workflows
-BV, --bump-version (automatically bumps patch version on merge to `master`)
BEFORE YOU RUN:
- only run this command from the root of your project, otherwise Github Actions workflow may not setup properly
help [command] display help for command
For Contributors Only
Development Setup
Clone repository
git clone https://github.com/
npranto/tools.git
Install dependencies
npm install
Note: run the above command inside the tools
project directory
Globally install
tools
CLI in your machine
npm install -g .
Note: run the above command inside the tools
project directory
Development Process
- to work on a feature or a bugfix issue, checkout the
master
branch first (locally) - create a new branch off of
master
-git checkout -b tools-[ISSUE_NUMBER]
- once feature/bugfix is added, commit the changes and push it up to origin to create a new pull request
- once pull request changes have been reviewed, merge the changes to
master
- verify that a new tag is created w/ a patch version bump
Release Process
To release new changes to production (NPM), we usually create draft and publish a new Release by targeting a specific tag created in history. Once the drafted release notes has been carefully reviewed and published, the NPM Publish Github action will kick off automatically to publish the new version to NPM
Step(s):
- go over to Release history
- click on "Draft a new release", to create a new release note to publish
- choose the tag you want to release from "Choose a tag" dropdown
- add "Release title", generally the tag name, i.e, "v1.0.5"
- for "Previous tag" dropdown, choose the currently deployed version from NPM
- click on "Generate release notes" to automatically fill in details for release notes
- click on "Publish release"
- verify that the new release version is created in Release history
- verify that a new build for NPM Publish Github action is kicked off
- once the build succeeds, verify that @npranto/tools's latest version is pointing to the released version (in NPM)
Note: if the "NPM Publish" action build fails, look into the build logs, debug potential issue, fix the issue and repeat the same process from Step 1