Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "nps-utils in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'nps-utils' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

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',
      },
'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')
// 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,
  },
}
// 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,
  },
}
}

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,
}

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,
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)]
})
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'
    },
'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',
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')
    }
  }
};

Is your System Free of Underlying Vulnerabilities?
Find Out Now