UNPKG

963 BJavaScriptView Raw
1const runCLICommand = require("./runCLICommand");
2const chalk = require("chalk");
3
4const runSequence = async (tasks, FcScripts) => {
5 for (let t in tasks) {
6 let taskName = tasks[t];
7 let taskIndex = FcScripts.allTasks.findIndex(t => t.name === taskName);
8 if (taskIndex === -1) {
9 console.log(
10 `${chalk.red.underline(
11 "Skipping task " + taskName + ", as it cannot be found in .md file"
12 )}`
13 );
14 } else {
15 let script = FcScripts.allTasks[taskIndex].script;
16 let params = script.split(" ");
17 let type = params.shift();
18 await runCLICommand({
19 task: { name: taskName },
20 script: {
21 type: type,
22 rest: params
23 }
24 });
25 }
26 }
27};
28
29module.exports = runSequence;
30// (async () => {
31// await startScripts();
32// })();