0.5.37 • Published 2 months ago

@avalane/nel v0.5.37

Weekly downloads
-
License
ISC
Repository
github
Last release
2 months ago

Nel

Command line interface for common development tasks.

🏗️ Install

Install Nel globally using npm or your favorite package manager:

npm install --global @avalane/nel

Install Github CLI

Some of the commands in Nel require the Github CLI to be installed. You can install it by following the instructions here: https://cli.github.com/manual/installation

After installation you need to login to Github using the CLI:

gh auth login

Setup jira

For the jira commands to work you need to set up a token for your jira account and add email to a .nelrc file.

  1. Go to: https://id.atlassian.com/manage-profile/security/api-tokens
  2. Create a new token
  3. Run nel jira encrypt <token> to encrypt the token. This is more obfuscation than secure, still it's better than exposing the token in plain text for other processes to read.
  4. Add export JIRA_TOKEN=<your-encrypted-token> to your .bashrc or .zshrc

Configuration

Nel will start in current working directory and search up the directory tree for config file. It supports multiple formats. For example .nelrc.json, .nelrc.yml, .nelrc.js, and .nelrc.cjs. For full list see cosmiconfig.

Jira email should always be specified in the config file. To change development defaults you can add a development section to the config file. See: nel dev for options.

Example config file .nelrc.yml:

jira:
  email: <your-jira-email>
development:
  ardoq: # Must match name specified in the projects package.json file
    environment: local
    subdomain: piedpiper
    open: false
  ardoq-discover:
    environment: engagement
    subdomain: marintech
  ardoq-login:
    environment: appsec
    subdomain: piedpiper
  ardoq-surveys:
    environment: test
    subdomain: martech
  my-awesome-project:
    port: 8080

Open browser

To customize the browser that opens when using the nel dev command, you can set the BROWSER environment variable. For example, to open in Edge:

export BROWSER="Microsoft Edge"

BROWSER is often used for other CLIs, if you want to use a specific browser just for nel, you can set the NEL_BROWSER environment variable.

🚀 Usage

nel --help
Options:
  -v, --version                   Print current version
  -h, --help                      display help for command

Commands:
  interactive|i                   Interactive prompt
  check                           Check setup and config
  open [options] [jira_key...]    Open project or jira ticket
  mergeable
  merge [options]                 Merge pull request
  dev [options]                   Start dev server
  watch                           Watch project
  build                           Build project
  deploy                          Deploy project
  release                         Release project
  vc                              Interactively choose a version control
                                  command.
  branch [name]                   Create a new branch
  checkout-pr|cpr                 Checkout pull request
  delete-branches|d [options]     Delete local branches
  checkout|co [options]           Checkout branch
  jira                            Interactively choose a Jira command.
  link [options] <pathToPackage>  Link package
  unlink                          Unlink package
  test [options]                  Test project
  status                          Display PR status

👤 Aliases

Don't want to type nel every time? Here are some suggested alias you can copy into your shells rc file(s):

alias dev='nel dev'
alias build='nel build'
alias watch='nel watch'
alias deploy='nel deploy'
alias merge='nel merge'
alias test='nel test'
alias cb='nel vc co'
alias cpr='nel vc cpr'

🛠️ Commands

interactive

Interactive prompt

Usage: nel interactive|i [options]

Interactively choose a command to run.

Options:
  -h, --help  display help for command

check

Check setup and config

Usage: nel check [options]

Check that Github CLI is installed and that we can find and read a config file.

Options:
  -h, --help  display help for command

open

Open project or jira ticket

Usage: nel open [options] [jira_key...]

Command for opening various development related tools or services. Currently supports opening jira ticket or current project in a browser

Options:
  -s, --subdomain <org-name>  Subdomain (organisation name) to open in browser
  -e, --environment <env>     Choose environment (choices: "local", "test",
                              "core", "platform", "partners", "insight",
                              "integration", "engagement", "prod")
  -h, --help                  display help for command

mergeable

Usage: nel mergeable [options]

Options:
  -h, --help  display help for command

merge

Merge pull request

Usage: nel merge [options]

Squashes the current branch into main/master. Prompts user for deploy/release of project and closing of related jira after merge.

Options:
  -y, --yes    Deploy and close jira after merge.
  -f, --force  Force merge without checking status.
  -h, --help   display help for command

dev

Start dev server

Usage: nel dev [options]

Starts a dev server in the current project if it finds a valid script in package.json. It opens a browser window after the dev server has started.

Options:
  -n, --no-open               Don't open browser after starting dev server.
  -s, --subdomain <org-name>  Subdomain (organisation name) to open in the
                              browser.
  -p, --port <number>         Port number to open in the browser (default:
                              3000). Should be the port the dev server is
                              using.
  -e, --environment <env>     Choose environment (choices: "local", "test",
                              "core", "platform", "partners", "insight",
                              "integration", "engagement", "prod")
  -h, --help                  display help for command

watch

Watch project

Usage: nel watch [options]

Runs the watch script in a project.

Options:
  -h, --help  display help for command

build

Build project

Usage: nel build [options]

Runs the build script in a project.

Options:
  -h, --help  display help for command

deploy

Deploy project

Usage: nel deploy [options]

Run the deploy or release script in a project after checking that there are no local or remote changes.

Options:
  -h, --help  display help for command

release

Usage: nel release [options]

Release project

Options:
  -h, --help  display help for command

vc

Interactively choose a version control command.

Usage: nel vc [options] [command]

Options:
  -h, --help                   display help for command

Commands:
  branch [name]                Create a new branch
  checkout-pr|cpr              Checkout pull request
  delete-branches|d [options]  Delete local branches
  checkout|co [options]        Checkout branch

branch

Create a new branch

Usage: nel branch [options] [name]

Interactively create a new branch linked to an existing jira issue or lets you create a new issue.

Options:
  -h, --help  display help for command

checkout-pr

Checkout pull request

Usage: nel checkout-pr|cpr [options]

Interactively checkout a open pull request

Options:
  -h, --help  display help for command

delete-branches

Delete local branches

Usage: nel delete-branches|d [options]

Interactively delete branches

Options:
  -y, --yes   Delete without confirmation.
  -h, --help  display help for command

checkout

Checkout branch

Usage: nel checkout|co [options]

Interactively checkout a local or remote branch

Options:
  -r, --remote  List remote branches
  -h, --help    display help for command

jira

Interactively choose a Jira command.

Usage: nel jira [options] [command]

Jira commands

Options:
  -h, --help       display help for command

Commands:
  close <key>      Closes the jira issue
  new [options]    Create a new jira issue through interactive prompts
  encrypt <token>  Returns an encrypted jira token you can expose as an ENV
                   variable

link

Usage: nel link [options] <pathToPackage>

Link package

Options:
  -w, --watch  Watch for changes in linked package
  -h, --help   display help for command

unlink

Usage: nel unlink [options]

Unlink package

Options:
  -h, --help  display help for command

test

Test project

Usage: nel test [options]

Runs the test script in a project.

Options:
  -w, --watch  Watch tests if supported by the project
  -h, --help   display help for command

status

Display PR status

Usage: nel status [options]

Command for display the status of the PR. This lets you see details about the PR without opening it in your browser..

Options:
  -h, --help  display help for command

📓 Logging

You can specify the log level for the nel command by setting the NEL_LOG_LEVEL environment variable. The default is info. Supported levels are debug, info, warn, and error.

Example:

$ NEL_LOG_LEVEL=debug nel