-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: Stop a use of ES6 modules. And upgrade eslint.
- Loading branch information
1 parent
40554ef
commit 2f26fa5
Showing
53 changed files
with
711 additions
and
364 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"root": true, | ||
"extends": ["mysticatea/es5", "mysticatea/node"], | ||
"rules": { | ||
"no-console": 0, | ||
"no-process-env": 0, | ||
"no-process-exit": 0 | ||
} | ||
} |
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,22 @@ | ||
/** | ||
* @author Toru Nagashima | ||
* @copyright 2016 Toru Nagashima. All rights reserved. | ||
* See LICENSE file in root directory for full license. | ||
*/ | ||
"use strict"; | ||
|
||
var fs = require("fs"); | ||
var path = require("path"); | ||
|
||
try { | ||
fs.symlinkSync( | ||
path.resolve(__dirname, "../test/lib"), | ||
path.resolve(__dirname, "../test-workspace/tasks/lib"), | ||
"junction" | ||
); | ||
} | ||
catch (err) { | ||
if (err.code !== "EEXIST") { | ||
throw err; | ||
} | ||
} |
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,77 @@ | ||
/** | ||
* @author Toru Nagashima | ||
* @copyright 2016 Toru Nagashima. All rights reserved. | ||
* See LICENSE file in root directory for full license. | ||
*/ | ||
"use strict"; | ||
|
||
//------------------------------------------------------------------------------ | ||
// Helpers | ||
//------------------------------------------------------------------------------ | ||
|
||
/** | ||
* Define the function for main process. | ||
* | ||
* @param {string} name - A program name. | ||
* @returns {function} The function for main process. | ||
*/ | ||
function defineMain(name) { | ||
/** | ||
* The main process of `npm-run-all` command. | ||
* | ||
* @param {string[]} args - Arguments to parse. | ||
* @param {stream.Writable} stdout - A writable stream to print logs. | ||
* @param {stream.Writable} stderr - A writable stream to print errors. | ||
* @returns {Promise} A promise which comes to be fulfilled when all | ||
* npm-scripts are completed. | ||
* @private | ||
*/ | ||
return function main(args, stdout = null, stderr = null) { | ||
switch (args[0]) { | ||
case undefined: | ||
case "-h": | ||
case "--help": | ||
return require(`../${name}/help`)(stdout); | ||
|
||
case "-v": | ||
case "--version": | ||
return require("./version")(stdout); | ||
|
||
default: | ||
return require(`../${name}/main`)(args, stdout, stderr); | ||
} | ||
}; | ||
} | ||
|
||
//------------------------------------------------------------------------------ | ||
// Public Interface | ||
//------------------------------------------------------------------------------ | ||
|
||
module.exports = function bootstrap(entryModule, name) { | ||
const main = entryModule.exports = defineMain(name); | ||
|
||
/* eslint-disable no-console, no-process-exit */ | ||
/* istanbul ignore if */ | ||
if (require.main === entryModule) { | ||
// Execute. | ||
const promise = main( | ||
process.argv.slice(2), | ||
process.stdout, | ||
process.stderr | ||
); | ||
|
||
// Error Handling. | ||
promise.then( | ||
() => { | ||
// I'm not sure why, but maybe the process never exits | ||
// on Git Bash (MINGW64) | ||
process.exit(0); | ||
}, | ||
(err) => { | ||
console.error("ERROR:", err.message); | ||
process.exit(1); | ||
} | ||
); | ||
} | ||
}; | ||
|
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
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,63 +1,13 @@ | ||
#!/usr/bin/env node | ||
|
||
/** | ||
* @author Toru Nagashima | ||
* @copyright 2015 Toru Nagashima. All rights reserved. | ||
* See LICENSE file in root directory for full license. | ||
*/ | ||
|
||
//------------------------------------------------------------------------------ | ||
// Helpers | ||
//------------------------------------------------------------------------------ | ||
|
||
/** | ||
* The main process of `npm-run-all` command. | ||
* | ||
* @param {string[]} args - Arguments to parse. | ||
* @param {stream.Writable} stdout - A writable stream to print logs. | ||
* @param {stream.Writable} stderr - A writable stream to print errors. | ||
* @returns {Promise} A promise which comes to be fulfilled when all npm-scripts are completed. | ||
* @private | ||
*/ | ||
export default function main( | ||
args, | ||
stdout = null, | ||
stderr = null | ||
) { | ||
switch (args[0]) { | ||
case undefined: | ||
case "-h": | ||
case "--help": | ||
return require("./help").default(stdout); | ||
|
||
case "-v": | ||
case "--version": | ||
return require("../common/version").default(stdout); | ||
|
||
default: | ||
return require("./main").default(args, stdout, stderr); | ||
} | ||
} | ||
"use strict"; | ||
|
||
//------------------------------------------------------------------------------ | ||
// Main | ||
//------------------------------------------------------------------------------ | ||
|
||
/* eslint-disable no-process-exit */ | ||
/* istanbul ignore if */ | ||
if (require.main === module) { | ||
// Execute. | ||
const promise = main(process.argv.slice(2), process.stdout, process.stderr); | ||
|
||
// Error Handling. | ||
promise.then( | ||
() => { | ||
// I'm not sure why, but maybe the process never exits on Git Bash (MINGW64) | ||
process.exit(0); | ||
}, | ||
(err) => { | ||
console.error("ERROR:", err.message); // eslint-disable-line no-console | ||
process.exit(1); | ||
} | ||
); | ||
} | ||
require("../common/bootstrap")(module, "npm-run-all"); |
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
Oops, something went wrong.