Coder Social home page Coder Social logo

annoto / nps-utils Goto Github PK

View Code? Open in Web Editor NEW

This project forked from austonpramodh/nps-utils

0.0 1.0 2.0 5.4 MB

Utilities for http://npm.im/nps (npm-package-scripts)

Home Page: https://doclets.io/kentcdodds/nps-utils/master

License: MIT License

JavaScript 9.18% TypeScript 90.82%

nps-utils's Introduction

This repository has been forked from nps-utils

nps-utils

Utilities for nps (npm-package-scripts)

version

The problem

nps is a great package to empower your scripts and there are some common things you wind up doing to keep your package-scripts.js file clean, useful, and maintainable. So you wind up duplicating utility functions across projects.

This solution

This has several utility functions you'll often want when using nps.

Installation

This module is distributed via [npm][npm] which is bundled with [node][node] and should be installed as one of your project's dependencies:

npm install nps-utils

Usage

You'll most likely use this in your package-scripts.js file:

const npsUtils = require('nps-utils')

module.exports = {
  scripts: {
    validate: npsUtils.concurrentNPS('lint', 'build', 'test --coverage'),
    lint: 'eslint .',
    build: 'webpack --env.production',
    test: 'jest'
  }
}

Available methods:

Series Commands

const npsUtils = require('nps-utils')

module.exports = {
  scripts: {
    validate: npsUtils.series('nps build', 'nps lint', 'nps test'),
    lint: 'eslint .',
    build: 'webpack --env.production',
    test: 'jest'
  }
}

Rimraf Commands

const npsUtils = require('nps-utils')

module.exports = {
  scripts: {
    clean: npsUtils.rimraf('build'),
  }
}

Copy Commands

const npsUtils = require('nps-utils')

module.exports = {
  scripts: {
    copy: npsUtils.copy('dist', 'build'),
  }
}

Cross-Env Commands

const npsUtils = require('nps-utils')

module.exports = {
  scripts: {
    copy: npsUtils.crossEnv('NODE_ENV=production nps build'),
    build: 'webpack --env.production'
  }
}

isDocker Commands

const npsUtils = require('nps-utils')

module.exports = {
  scripts: {
    copy: npsUtils.isDocker() ? 'nps watchInsideDocker' : 'nps watch',
    watchInsideDocker: 'webpack --env.production',
    watch: 'webpack --env.production'
  }
}

Concurrently Commands - Experimental

const npsUtils = require('nps-utils')

module.exports = {
  scripts: {
    validate: npsUtils.concurrentNPS('build', 'lint', 'test'),
    lint: 'eslint .',
    build: 'webpack --env.production',
    test: 'jest'
  }
}

LICENSE

MIT

nps-utils's People

Contributors

genadis avatar gowravshekar avatar huy-nguyen avatar wmertens avatar austonpramodh-ces avatar erikras avatar gunnx avatar mikecann avatar

Watchers

James Cloos avatar

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.