npm-run-all2
Version:
A CLI tool to run multiple npm-scripts in parallel or sequential. (Maintenance fork)
50 lines (45 loc) • 862 B
JavaScript
/**
* Executes functions sequentially.
*
* @param {function[]} arguments - Functions to execute.
* @returns {void}
*/
function flow () {
if (arguments.length === 0) {
return
}
const head = arguments[0]
const rest = [].slice.call(arguments, 1)
head()
setTimeout(() => {
flow.apply(null, rest)
}, 33)
}
const text = String(process.argv[2])
flow(
() => {
process.stdout.write(text)
},
() => {
process.stdout.write(`${text}\n`)
},
() => {
process.stdout.write(`${text}\n${text}`)
},
() => {
process.stdout.write(`${text}\n${text}\n`)
},
() => {
process.stdout.write(`${text}\n${text}\n${text}\n${text}\n`)
},
() => {
process.stdout.write(`\n${text}\n${text}`)
},
() => {
process.stdout.write(`${text}\n\n\n`)
},
() => {
process.stdout.write(`\n${text}`)
}
)