Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'run-series' 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.
// 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)
}
}, function t(cluster, assert) {
var tasks = Object.keys(cluster.remoteRepos).map(makePublishThunk);
function makePublishThunk(remoteKey) {
return function publishThunk(callback) {
var cwd = path.join(cluster.remotesDir, remoteKey);
cluster.thriftStorePublish(cwd, callback);
};
}
series([
series.bind(null, tasks),
cluster.inspectUpstream.bind(cluster)
], onResults);
function onResults(err, results) {
if (err) {
assert.ifError(err);
}
var upstream = results[1];
Object.keys(cluster.remoteRepos).forEach(testPublish);
function testPublish(key) {
var filepath = 'thrift/github.com/org/' + key.toLowerCase() +
'/service.thrift';
assert.equal(
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()
}
)
})
}
tasks.unshift((cb) => {
inquirer.prompt(questions).then(
(answers) => {
dependencies = projectConfig.getProjectDependencies(answers)
cb(null)
},
(err) => cb(err)
)
})
}
}
else {
dependencies = projectConfig.getProjectDependencies()
}
runSeries(tasks, cb)
}
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()
}
)
})
}
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))
}
)
}
export default function buildDemo(args, cb) {
runSeries([
(cb) => cleanDemo(args, cb),
(cb) => webpackBuild('demo', args, getCommandConfig, cb),
], cb)
}
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)
}
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)
}
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)
}