Coder Social home page Coder Social logo

npsh's Introduction

npsh

NPM Coverage License Downloads

Node.js package scripts helper.

Includes commonly used scripts for CI, so they can be added from one npm package instead of being copied among different repos.

Installation

npm install npsh

Usage

Semantic version check

To check semantic version of your project create a "svc" script at the package.json file.

Here is an example with placeholders:

"svc": "npsh svc github_user_name project_name branch_name"

And a real example which will be checking PR/branch version against master branch:

"svc": "npsh svc andr-ii nuti master"

Commit hooks

For adding pre-commit and commit-msg hooks to your project create a "hooks" script at the package.json file.

"hooks": "npsh hooks"

Then simply run following command to add commit hooks:

npm run hooks

By default pre-commit hook includes:

  • npm i --package-lock-only
  • npm run format
  • npm run lint
  • npm run types
  • npm run spell
  • npm run svc
  • git add .

So make sure these scripts are present at the package.json.

bin builder

b If your project has an executable ./bin/index.js file and you would like to avoid to have it in the development (TypeScript for example) project - npsh bin can be used. It generates ./bin/index.js executable file which requires your lib module by default.

Create a "build:bin" script at the package.json file.

"build:bin": "npsh bin"

After execution this script will create a default ./bin/index.js file at your project directory:

#!/urs/bin/env node

require('../lib');

If your lib module exports a function - it can be executed after require('../lib'). Change "build:bin" script as following:

"build:bin": "npsh bin 'myFunc()'"

After execution ./bin/index.js will have following content:

#!/urs/bin/env node

require('../lib').myFunc();

npsh's People

Contributors

dependabot[bot] avatar andr-ll avatar

Stargazers

 avatar

Watchers

 avatar

npsh's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.