-
-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc749bc
commit a549297
Showing
8 changed files
with
120 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,11 @@ | ||
import {join} from "path"; | ||
|
||
export default function readTasks() { | ||
try { | ||
const packageJsonPath = join(process.cwd(), "package.json"); | ||
const packageJson = require(packageJsonPath); | ||
const scripts = packageJson && packageJson.scripts; | ||
if (typeof scripts === "object" && !Array.isArray(scripts)) { | ||
return Object.keys(scripts); | ||
} | ||
const packageJsonPath = join(process.cwd(), "package.json"); | ||
const packageJson = require(packageJsonPath); | ||
const scripts = packageJson && packageJson.scripts; | ||
if (typeof scripts === "object" && !Array.isArray(scripts)) { | ||
return Object.keys(scripts); | ||
} | ||
catch (err) { | ||
// do nothing. | ||
} | ||
|
||
return []; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,10 @@ | ||
import runTask from "./run-task"; | ||
|
||
export default function runTasksInSequencial(tasks, stdin, stdout, stderr) { | ||
let currentPromise = null; | ||
let aborted = false; | ||
|
||
const resultPromise = (async () => { | ||
for (const task of tasks) { | ||
currentPromise = runTask(task, stdin, stdout, stderr); | ||
const result = await currentPromise; | ||
currentPromise = null; | ||
|
||
if (aborted) { | ||
break; | ||
} | ||
if (result.code) { | ||
throw new Error(`${result.task}: None-Zero Exit(${result.code});`); | ||
} | ||
export default async function runTasksInSequencial(tasks, stdin, stdout, stderr) { | ||
for (const task of tasks) { | ||
const result = await runTask(task, stdin, stdout, stderr); | ||
if (result.code) { | ||
throw new Error(`${result.task}: None-Zero Exit(${result.code});`); | ||
} | ||
})(); | ||
|
||
// Define abort method. | ||
resultPromise.abort = function abort() { | ||
aborted = true; | ||
if (currentPromise != null) { | ||
currentPromise.abort(); | ||
} | ||
}; | ||
|
||
return resultPromise; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
to add to git. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "npm-run-all-test", | ||
"version": "0.0.0", | ||
"private": true, | ||
"description": "", | ||
"config": { | ||
"test": "OK" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/mysticatea/npm-run-all.git" | ||
}, | ||
"author": "Toru Nagashima", | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters