How to use the run-series function in run-series

To help you get started, we’ve selected a few run-series 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 insin / nwb / src / commands / build-react-component.js View on Github external
// Strip propTypes and prop-type imports from UMD production build
    config.babelProd = {
      removePropTypes: {
        removeImport: true,
      }
    }
  }

  let tasks = [(cb) => moduleBuild(args, config, cb)]
  // Disable demo build with --no-demo or --no-demo-build
  if (args.demo !== false &&
      args['demo-build'] !== false &&
      directoryExists('demo')) {
    tasks.push((cb) => buildDemo(args, cb))
  }
  runSeries(tasks, cb)
}
github insin / nwb / src / utils.js View on Github external
checkDirectories(dirs, (err, dirs) => {
    if (err != null) return cb(err)
    if (dirs == null || dirs.length === 0) return cb()
    let spinner = ora(`Cleaning ${desc}`).start()
    runSeries(
      dirs.map(dir => cb => fs.remove(dir, cb)),
      (err) => {
        if (err) {
          spinner.fail()
          return cb(err)
        }
        spinner.succeed()
        cb()
      }
    )
  })
}
github insin / nwb / src / createProject.js View on Github external
tasks.unshift((cb) => {
        inquirer.prompt(questions).then(
          (answers) => {
            dependencies = projectConfig.getProjectDependencies(answers)
            cb(null)
          },
          (err) => cb(err)
        )
      })
    }
  }
  else {
    dependencies = projectConfig.getProjectDependencies()
  }

  runSeries(tasks, cb)
}
github kktjs / kkt / src / utils.js View on Github external
checkDirectories(dirs, (err, dirs) => {
    if (err != null) return cb(err)
    if (dirs == null || dirs.length === 0) return cb()
    let spinner = loading(`Cleaning ${desc}`).start()
    runSeries(
      dirs.map(dir => cb => fs.remove(dir, cb)),
      (err) => {
        if (err) {
          spinner.fail()
          return cb(err)
        }
        spinner.succeed()
        cb()
      }
    )
  })
}
github kktjs / kkt / src / utils.js View on Github external
function checkDirectories(
  dirs: string[],
  cb: (?Error, existingDirs?: string[]) => void,
) {
  runSeries(
    dirs.map(dir => cb => fs.stat(dir, (err, stats) => {
      if (err) return cb(err.code === 'ENOENT' ? null : err)
      cb(null, stats.isDirectory() ? dir : null)
    })),
    (err, dirs) => {
      if (err) return cb(err)
      cb(null, dirs.filter(dir => dir != null))
    }
  )
}
github insin / nwb / src / commands / build-demo.js View on Github external
export default function buildDemo(args, cb) {
  runSeries([
    (cb) => cleanDemo(args, cb),
    (cb) => webpackBuild('demo', args, getCommandConfig, cb),
  ], cb)
}
github insin / nwb / src / quickCommands.js View on Github external
export function build(args: Object, appConfig: QuickAppConfig, cb: ErrBack) {
  if (args._.length === 1) {
    return cb(new UserError('An entry module must be specified.'))
  }

  let dist = args._[2] || 'dist'

  runSeries([
    (cb) => install(appConfig.getQuickDependencies(), {args, check: true}, cb),
    (cb) => cleanApp({_: ['clean-app', dist]}, cb),
    (cb) => webpackBuild(
      `${appConfig.getName()} app`,
      args,
      () => createBuildConfig(args, appConfig.getQuickBuildConfig()),
      cb
    ),
  ], cb)
}
github insin / nwb / src / quickCommands.js View on Github external
export function serve(args: Object, appConfig: QuickAppConfig, cb: ErrBack) {
  if (args._.length === 1) {
    return cb(new UserError('An entry module must be specified.'))
  }

  runSeries([
    (cb) => install(appConfig.getQuickDependencies(), {args, check: true}, cb),
    (cb) => webpackServer(args, createServeConfig(args, appConfig.getQuickServeConfig()), cb),
  ], cb)
}
github insin / nwb / src / appCommands.js View on Github external
let tasks = [
    (cb) => cleanApp({_: ['clean-app', dist]}, cb),
    (cb) => webpackBuild(
      `${appConfig.getName()} app`,
      args,
      () => createBuildConfig(args, appConfig.getBuildConfig()),
      cb
    ),
  ]

  let buildDependencies = appConfig.getBuildDependencies()
  if (buildDependencies.length > 0) {
    tasks.unshift((cb) => install(buildDependencies, {check: true}, cb))
  }

  runSeries(tasks, cb)
}

run-series

Run an array of functions in series

MIT
Latest version published 4 years ago

Package Health Score

65 / 100
Full package analysis

Popular run-series functions