Skip to content

Sparkmasterflex/npm_pub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm_pub

Rust script to handle npm publish

This CLI Tool runs:

  1. npm run build - runs your project's build script for production
    • this will need to be in your package.json "scripts"
    • read more here: npm docs
  2. npm version $ver - based on argument passed
    • acceptable versions major, minor, patch, premajor, preminor, prepatch, prerelease
    • read more here Semantic Versioning
  3. git push - pushes to git repo set in remote
    • git rev-parse --abbrev-ref HEAD - to get current branch
    • git push origin $branch
  4. npm publish - publishes to npmjs.com via details in package.json

Installing

or

  • Install rustlang
    • or with homebrew: brew install rustup
  • clone repo
  • cd to local directory and run cargo build --release
  • cp target/release/npm_pub /usr/local/bin/

This is all assuming that /usr/local/bin/ is in your $PATH variable

Usage

Prerequisites

  • Project must
    • be a valid npm project with
      • package.json
      • build script (webpack, etc)
    • be an initiated Git repo
      • with a remote repo (Github, etc)
  • User must be logged in to npm via terminal
    • npm login

Running Tool

In your command line (terminal, iterm, etc) run:

  • $ cd /path/to/project
  • $ npm_pub [major, minor, patch]