How to use nps-utils - 10 common examples

To help you get started, we’ve selected a few nps-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aurelia / cli / lib / resources / content / package-scripts.template.js View on Github external
const {series, crossEnv, concurrent, rimraf} = require('nps-utils')
// @if model.integrationTestRunner.id='protractor'
const {config: {port : E2E_PORT}} = require('./test/protractor.conf')
// @endif

module.exports = {
  scripts: {
    default: 'nps webpack',
    test: {
      // @if testRunners.jest
      default: 'nps test.jest',
      // @endif
      // @if testRunners.jest
      // @if model.transpiler.id='babel'
      jest: {
        default: series(
          rimraf('test/coverage-jest'),
          crossEnv('BABEL_TARGET=node jest')
        ),
        accept: crossEnv('BABEL_TARGET=node jest -u'),
        watch: crossEnv('BABEL_TARGET=node jest --watch'),
      },
      // @endif
      // @if model.transpiler.id='typescript'
      jest: {
        default: series(
          rimraf('test/coverage-jest'),
          'jest'
        ),
        accept: 'jest -u',
        watch: 'jest --watch',
      },
github aurelia / cli / lib / resources / content / package-scripts.template.js View on Github external
'nps e2e.protractor'
      ),
    },
    // @endif
    build: 'nps webpack.build',
    webpack: {
      default: 'nps webpack.server',
      build: {
        before: rimraf('dist'),
        default: 'nps webpack.build.production',
        development: {
          default: series(
            'nps webpack.build.before',
            'webpack --progress -d'
          ),
          extractCss: series(
            'nps webpack.build.before',
            'webpack --progress -d --env.extractCss'
          ),
          serve: series.nps(
            'webpack.build.development',
            'serve'
          ),
        },
        production: {
          inlineCss: series(
            'nps webpack.build.before',
            crossEnv('NODE_ENV=production webpack --progress -p --env.production')
          ),
          default: series(
            'nps webpack.build.before',
            crossEnv('NODE_ENV=production webpack --progress -p --env.production --env.extractCss')
github oclif / command / package-scripts.js View on Github external
// add mocha junit reporter
    mocha = crossEnv(`MOCHA_FILE=reports/mocha.xml ${mocha} --reporter mocha-junit-reporter`)
    // add eslint reporter
    linters.eslint.script = `${linters.eslint.script} --format junit --output-file reports/eslint.xml`
    // add tslint reporter
    linters.tslint.script = `${linters.tslint.script} --format junit > reports/tslint.xml`
  }
  // add code coverage reporting with nyc
  const nyc = 'nyc --nycrc-path node_modules/@dxcli/nyc-config/.nycrc'
  const nycReport = `${nyc} report --reporter text-lcov > coverage.lcov`
  mocha = series(`${nyc} ${mocha}`, nycReport)
}

let test = concurrent({
  ...linters,
  test: series('nps build', mocha),
})

if (process.env.CI) test = series(mkdirp('reports'), test)

module.exports = {
  scripts: {
    ...linters,
    build: series('rm -rf lib', 'tsc'),
    lint: concurrent(linters),
    test,
    mocha,
  },
}
github oclif / example-single-ts / package-scripts.js View on Github external
// add mocha junit reporter
    mocha = crossEnv(`MOCHA_FILE=reports/mocha.xml ${mocha} --reporter mocha-junit-reporter`)
    // add eslint reporter
    linters.eslint.script = `${linters.eslint.script} --format junit --output-file reports/eslint.xml`
    // add tslint reporter
    linters.tslint.script = `${linters.tslint.script} --format junit > reports/tslint.xml`
  }
  // add code coverage reporting with nyc
  const nyc = 'nyc --nycrc-path node_modules/@anycli/nyc-config/.nycrc'
  const nycReport = `${nyc} report --reporter text-lcov > coverage.lcov`
  mocha = series(`${nyc} ${mocha}`, nycReport)
}

let test = concurrent({
  ...linters,
  test: series('nps build', mocha),
})

if (process.env.CI) test = series(mkdirp('reports'), test)

module.exports = {
  scripts: {
    ...linters,
    build: series('rm -rf lib', 'tsc'),
    lint: concurrent(linters),
    test,
    mocha,
  },
}
github oclif / command / package-scripts.js View on Github external
}

let mocha = 'mocha --forbid-only "test/**/*.test.ts"'
if (process.env.CI) {
  if (process.env.CIRCLECI) {
    // add mocha junit reporter
    mocha = crossEnv(`MOCHA_FILE=reports/mocha.xml ${mocha} --reporter mocha-junit-reporter`)
    // add eslint reporter
    linters.eslint.script = `${linters.eslint.script} --format junit --output-file reports/eslint.xml`
    // add tslint reporter
    linters.tslint.script = `${linters.tslint.script} --format junit > reports/tslint.xml`
  }
  // add code coverage reporting with nyc
  const nyc = 'nyc --nycrc-path node_modules/@dxcli/nyc-config/.nycrc'
  const nycReport = `${nyc} report --reporter text-lcov > coverage.lcov`
  mocha = series(`${nyc} ${mocha}`, nycReport)
}

let test = concurrent({
  ...linters,
  test: series('nps build', mocha),
})

if (process.env.CI) test = series(mkdirp('reports'), test)

module.exports = {
  scripts: {
    ...linters,
    build: series('rm -rf lib', 'tsc'),
    lint: concurrent(linters),
    test,
    mocha,
github oclif / example-single-ts / package-scripts.js View on Github external
}

let mocha = 'mocha --forbid-only "test/**/*.test.ts"'
if (process.env.CI) {
  if (process.env.CIRCLECI) {
    // add mocha junit reporter
    mocha = crossEnv(`MOCHA_FILE=reports/mocha.xml ${mocha} --reporter mocha-junit-reporter`)
    // add eslint reporter
    linters.eslint.script = `${linters.eslint.script} --format junit --output-file reports/eslint.xml`
    // add tslint reporter
    linters.tslint.script = `${linters.tslint.script} --format junit > reports/tslint.xml`
  }
  // add code coverage reporting with nyc
  const nyc = 'nyc --nycrc-path node_modules/@anycli/nyc-config/.nycrc'
  const nycReport = `${nyc} report --reporter text-lcov > coverage.lcov`
  mocha = series(`${nyc} ${mocha}`, nycReport)
}

let test = concurrent({
  ...linters,
  test: series('nps build', mocha),
})

if (process.env.CI) test = series(mkdirp('reports'), test)

module.exports = {
  scripts: {
    ...linters,
    build: series('rm -rf lib', 'tsc'),
    lint: concurrent(linters),
    test,
    mocha,
github oclif / oclif / package-scripts.js View on Github external
sh.config.silent = true
  const mocha = 'mocha --forbid-only'
  const base = path.join('test/commands', cmd)
  sh.pushd(base)
  let tests = _(sh.ls())
  .map(t => [t.split('.')[0], path.join(base, t)])
  .map(([t, s]) => [t, process.env.CIRCLECI ? `MOCHA_FILE=reports/mocha-${t}.xml ${mocha} --reporter mocha-junit-reporter ${s}` : `${mocha} ${s}`])
  sh.popd()
  tests = process.env.TEST_SERIES === '1' ?
    series(...tests.map(t => t[1]).value()) :
    concurrent(tests.fromPairs().value())
  if (process.env.CIRCLECI) {
    tests = series(mkdirp('reports'), tests)
  }
  sh.config.silent = silent
  return [cmd, series('nps build', tests)]
})
github segmentstream / digital-data-manager / package-scripts.js View on Github external
const createDist = mkdirp(distDir);
const createBuild = mkdirp(buildDir);
const cleanDist = rimraf(`${distDir}/*`);
const cleanBuild = rimraf(`${buildDir}/*`);

const browserifyDebug = 'browserify src/index.js -t babelify --debug | exorcist --base=./build build/segmentstream.js.map > build/segmentstream.js';
const browserifyProd = 'browserify src/index.js -t babelify > dist/segmentstream.js && grunt wrap && uglifyjs dist/segmentstream.js -c -m --output dist/segmentstream.min.js';
const browserifyTest = 'browserify test/index.test.js -t babelify --debug | exorcist --base=./build build/segmentstream-test.js.map > build/segmentstream-test.js';
module.exports = {
  scripts: {
    build: {
      default:
      {
        description: 'This uses for debug purpose. Creates dd.manager.js and its map.',
        script: series(cleanBuild, createBuild, browserifyDebug),
      },
      prod:
      {
        description: 'Prepare for deploy. JS + minimize',
        script: series(cleanDist, createDist, browserifyProd),
      },
    },
    standard: 'standard',
    buildTest: series(cleanBuild, createBuild, browserifyTest),
    mocha: 'mocha build/segmentstream-test.js',
    test: {
      default: series.nps('standard', 'buildTest', 'karma')
    },
    karma: {
      default: 'karma start'
    },
github sezna / nps / package-scripts.js View on Github external
'This uses commitizen to help us generate beautifully formatted commit messages',
      script: 'git-cz',
    },
    test: {
      default: 'jest --config=test/jest.src.config.js --coverage',
      watch: 'jest --config=test/jest.src.config.js --watch',
      cli: {
        default: 'jest --config=test/jest.cli.config.js',
        watch: 'jest --config=test/jest.cli.config.js --watch',
      },
    },
    build: {
      default: {
        description:
          'deletes the `dist` directory and transpiles all relevant `src` to the `dist`',
        script: series(cleanDist, transpile),
      },
      watch: {
        script: series(cleanDist, `${transpile} --watch`),
      },
      andValidate: {
        description: 'Runs the normal build first, then validates the CLI',
        script: series.nps('build', 'test.cli'),
      },
    },
    lint: {
      description: 'lint the code with eslint',
      script: 'eslint .',
    },
    validate: {
      description:
        'This runs several scripts to make sure things look good before committing or on clean install',
github aurelia-contrib / aurelia-plugin-skeleton-ts-webpack / package-scripts.js View on Github external
dry: release('minor', true)
      },
      major: {
        default: release('major'),
        dry: release('major', true)
      }
    },
    /**
     * Make sure to run 'npm run ghpages-setup' before 'npm run ghpages' the very first time,
     * or manually create the gh-pages branch and set the remote.
     *
     * There is no dry run variant for this because it's not really that harmful if the demo page goes bad
     * and it doesn't affect the master branch.
     */
    ghpages: {
      default: series(
        'git checkout gh-pages',
        'git merge master --no-edit',
        'rimraf *.bundle.js',
        'rimraf *.bundle.map',
        'nps build.demo.production',
        'git add index.html *.bundle.js *.bundle.map',
        'git commit -m "doc(demo): build demo"',
        'git push',
        'git checkout master'
      ),
      setup: series('git checkout -b gh-pages', 'git push -u origin gh-pages', 'git checkout master')
    }
  }
};

nps-utils

Utilities for nps (npm-package-scripts)

MIT
Latest version published 6 years ago

Package Health Score

47 / 100
Full package analysis

Popular nps-utils functions

Similar packages