first commit
This commit is contained in:
20
build/node_modules/exec-series/LICENSE
generated
vendored
Normal file
20
build/node_modules/exec-series/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 - 2016 Shinnosuke Watanabe
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
102
build/node_modules/exec-series/README.md
generated
vendored
Normal file
102
build/node_modules/exec-series/README.md
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
# exec-series
|
||||
|
||||
[](https://www.npmjs.com/package/exec-series)
|
||||
[](https://travis-ci.org/shinnn/exec-series)
|
||||
[](https://ci.appveyor.com/project/ShinnosukeWatanabe/exec-series)
|
||||
[](https://coveralls.io/r/shinnn/exec-series)
|
||||
[](https://david-dm.org/shinnn/exec-series)
|
||||
[](https://david-dm.org/shinnn/exec-series#info=devDependencies)
|
||||
|
||||
A [Node](https://nodejs.org/) module to run commands in order
|
||||
|
||||
```javascript
|
||||
const execSeries = require('exec-series');
|
||||
|
||||
execSeries(['echo "foo"', 'echo "bar"'], (err, stdouts, stderrs) => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
console.log(stdouts); // yields: ['foo\n', 'bar\n']
|
||||
console.log(stderrs); // yields: ['', '']
|
||||
});
|
||||
```
|
||||
|
||||
On Linux, you can do almost the same thing with [`&&`](http://tldp.org/LDP/abs/html/list-cons.html#LISTCONSREF) operator like below:
|
||||
|
||||
```javascript
|
||||
const {exec} = require('child_process');
|
||||
|
||||
exec('echo "foo" && echo "bar"', (err, stdout, stderr) => {
|
||||
//...
|
||||
});
|
||||
```
|
||||
|
||||
However, some environments, such as [Windows PowerShell](https://connect.microsoft.com/PowerShell/feedback/details/778798/implement-the-and-operators-that-bash-has), don't support `&&` operator. This module helps you to [create a cross-platform Node program](https://gist.github.com/domenic/2790533).
|
||||
|
||||
## Installation
|
||||
|
||||
[Use npm.](https://docs.npmjs.com/cli/install)
|
||||
|
||||
```
|
||||
npm install exec-series
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```javascript
|
||||
const execSeries = require('exec-series');
|
||||
```
|
||||
|
||||
### execSeries(*commands* [, *options*, *callback*])
|
||||
|
||||
*commands*: `Array` of `String` (the commands to run)
|
||||
*options*: `Object` ([child_process.exec][exec] options with `maxBuffer` defaulting to 10 MB)
|
||||
*callback*: `Function`
|
||||
|
||||
It sequentially runs the commands using [child_process.exec][exec]. If the first command has finished successfully, the second command will run, and so on.
|
||||
|
||||
After the last command has finished, it runs the callback function.
|
||||
|
||||
When one of the commands fails, it immediately calls the callback function and the rest of the commands won't be run.
|
||||
|
||||
#### callback(*error*, *stdoutArray*, *stderrArray*)
|
||||
|
||||
*error*: `Error` if one of the commands fails, otherwise `undefined`
|
||||
*stdoutArray*: `Array` of `String` (stdout of the commands)
|
||||
*stderrArray*: `Array` of `String` (stderr of the commands)
|
||||
|
||||
```javascript
|
||||
execSeries([
|
||||
'mkdir foo',
|
||||
'echo bar',
|
||||
'exit 200',
|
||||
'mkdir baz'
|
||||
], (err, stdouts, stderrs) => {
|
||||
err.code; //=> 200
|
||||
stdouts; //=> ['', 'bar\n', '']
|
||||
stderrs; //=> ['', '', '']
|
||||
|
||||
fs.statSync('foo').isDirectory; //=> true
|
||||
fs.statSync('baz'); // throw an error
|
||||
});
|
||||
```
|
||||
|
||||
Callback function is optional.
|
||||
|
||||
```javascript
|
||||
execSeries(['mkdir foo', 'mkdir bar']);
|
||||
|
||||
setTimeout(() => {
|
||||
fs.statSync('foo').isDirectory(); //=> true
|
||||
fs.statSync('bar').isDirectory(); //=> true
|
||||
}, 1000);
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2014 - 2016 [Shinnosuke Watanabe](https://github.com/shinnn)
|
||||
|
||||
Licensed under [the MIT License](./LICENSE).
|
||||
|
||||
[exec]: https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback
|
||||
49
build/node_modules/exec-series/index.js
generated
vendored
Normal file
49
build/node_modules/exec-series/index.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/*!
|
||||
* exec-series | MIT (c) Shinnosuke Watanabe
|
||||
* https://github.com/shinnn/exec-series
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
var eachSeries = require('async-each-series');
|
||||
var objectAssign = require('object-assign');
|
||||
|
||||
var TEN_MEBIBYTE = 1024 * 1024 * 10;
|
||||
|
||||
module.exports = function execSeries(commands, options, cb) {
|
||||
if (!Array.isArray(commands)) {
|
||||
throw new TypeError(
|
||||
commands +
|
||||
' is not an array. First argument must be an array of strings.'
|
||||
);
|
||||
}
|
||||
|
||||
if (cb === undefined) {
|
||||
if (typeof options === 'function') {
|
||||
cb = options;
|
||||
options = {};
|
||||
}
|
||||
} else if (typeof cb !== 'function') {
|
||||
throw new TypeError(
|
||||
cb +
|
||||
' is not a function. Last argument must be a function.'
|
||||
);
|
||||
}
|
||||
|
||||
var stdouts = [];
|
||||
var stderrs = [];
|
||||
|
||||
eachSeries(commands, function(command, next) {
|
||||
exec(command, objectAssign({maxBuffer: TEN_MEBIBYTE}, options), function(err, stdout, stderr) {
|
||||
stdouts.push(stdout);
|
||||
stderrs.push(stderr);
|
||||
next(err);
|
||||
});
|
||||
}, function(err) {
|
||||
if (cb) {
|
||||
cb(err || null, stdouts, stderrs);
|
||||
}
|
||||
});
|
||||
};
|
||||
79
build/node_modules/exec-series/package.json
generated
vendored
Normal file
79
build/node_modules/exec-series/package.json
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"exec-series@1.0.3",
|
||||
"/Users/asciidisco/Desktop/asciidisco.com/build"
|
||||
]
|
||||
],
|
||||
"_from": "exec-series@1.0.3",
|
||||
"_id": "exec-series@1.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-bSV6m+rEgqhyx3g7yGFYOfx3FDo=",
|
||||
"_location": "/exec-series",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "exec-series@1.0.3",
|
||||
"name": "exec-series",
|
||||
"escapedName": "exec-series",
|
||||
"rawSpec": "1.0.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/bin-build"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/exec-series/-/exec-series-1.0.3.tgz",
|
||||
"_spec": "1.0.3",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build",
|
||||
"author": {
|
||||
"name": "Shinnosuke Watanabe",
|
||||
"url": "https://github.com/shinnn"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/shinnn/exec-series/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"async-each-series": "^1.1.0",
|
||||
"object-assign": "^4.1.0"
|
||||
},
|
||||
"description": "Run commands in order",
|
||||
"devDependencies": {
|
||||
"@shinnn/eslint-config-node-legacy": "^2.0.0",
|
||||
"eslint": "^3.0.1",
|
||||
"istanbul": "^0.4.4",
|
||||
"rimraf": "^2.5.3",
|
||||
"tap-spec": "^4.1.1",
|
||||
"tape": "^4.6.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/shinnn/exec-series#readme",
|
||||
"keywords": [
|
||||
"child_process",
|
||||
"exec",
|
||||
"series",
|
||||
"serial",
|
||||
"serially",
|
||||
"command",
|
||||
"sequence",
|
||||
"sequential",
|
||||
"sequentially",
|
||||
"order"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "exec-series",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/shinnn/exec-series.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "node --strong_mode node_modules/.bin/istanbul cover test.js",
|
||||
"coveralls": "${npm_package_scripts_coverage} && istanbul-coveralls",
|
||||
"pretest": "eslint --fix --config @shinnn/node-legacy index.js test.js",
|
||||
"test": "node --strong_mode test.js | tap-spec"
|
||||
},
|
||||
"version": "1.0.3"
|
||||
}
|
||||
Reference in New Issue
Block a user