Comparing version
@@ -6,4 +6,8 @@ 'use strict'; | ||
}); | ||
exports.Routine = undefined; | ||
exports.Routine = exports.Pipeline = undefined; | ||
var _CLI = require('./CLI'); | ||
var _CLI2 = _interopRequireDefault(_CLI); | ||
var _Pipeline = require('./Pipeline'); | ||
@@ -19,9 +23,9 @@ | ||
/** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* @flow | ||
*/ | ||
exports.Pipeline = _Pipeline2.default; | ||
exports.Routine = _Routine2.default; /** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* @flow | ||
*/ | ||
exports.Routine = _Routine2.default; | ||
exports.default = _Pipeline2.default; | ||
exports.default = _CLI2.default; |
@@ -27,6 +27,2 @@ 'use strict'; | ||
var _fs = require('fs'); | ||
var _fs2 = _interopRequireDefault(_fs); | ||
var _Routine2 = require('./Routine'); | ||
@@ -38,37 +34,35 @@ | ||
/** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* @flow | ||
*/ | ||
/*:: import type { RoutineConfig, Result, ResultPromise } from './types';*/ /** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* @flow | ||
*/ | ||
/*:: import type { Result, ResultPromise } from './types';*/ | ||
var Pipeline = function (_Routine) { | ||
(0, _inherits3.default)(Pipeline, _Routine); | ||
function Pipeline() { | ||
function Pipeline(name /*: string*/) { | ||
var config /*: RoutineConfig*/ = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
(0, _classCallCheck3.default)(this, Pipeline); | ||
return (0, _possibleConstructorReturn3.default)(this, (Pipeline.__proto__ || (0, _getPrototypeOf2.default)(Pipeline)).apply(this, arguments)); | ||
// Inherit global config as well | ||
var _this = (0, _possibleConstructorReturn3.default)(this, (Pipeline.__proto__ || (0, _getPrototypeOf2.default)(Pipeline)).call(this, name, config)); | ||
_this.globalConfig = config; | ||
return _this; | ||
} | ||
/** | ||
* Execute the routines in sequential order while passing the result | ||
* from the previous routine to the next routine. The initial value can | ||
* be passed by the consumer. | ||
*/ | ||
(0, _createClass3.default)(Pipeline, [{ | ||
key: 'execute', | ||
/** | ||
* Execute the routines in sequential order while passing the result | ||
* from the previous routine to the next routine. The initial value can | ||
* be passed by the consumer. | ||
*/ | ||
value: function execute() /*: ResultPromise<*>*/ { | ||
var initialValue /*: Result<*>*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; | ||
try { | ||
return this.serializeSubroutines(initialValue); | ||
} catch (e) { | ||
// Catch all errors that happen down the tree | ||
// and do something with them. | ||
throw e; | ||
} | ||
return this.serializeSubroutines(initialValue); | ||
} | ||
@@ -85,18 +79,2 @@ | ||
} | ||
}], [{ | ||
key: 'fromConfig', | ||
/** | ||
* Instantiate a pipeline instance from a configuration file. | ||
*/ | ||
value: function fromConfig(configPath /*: string*/) /*: Pipeline*/ { | ||
var config = JSON.parse(_fs2.default.readFileSync(configPath, 'utf8')); | ||
var pipeline = new Pipeline('boost'); | ||
pipeline.config = config; | ||
pipeline.globalConfig = config; | ||
return pipeline; | ||
} | ||
}]); | ||
@@ -103,0 +81,0 @@ return Pipeline; |
{ | ||
"name": "boost", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Robust pipeline for creating build tools that separate logic into routines and tasks.", | ||
@@ -38,2 +38,3 @@ "keywords": [], | ||
"chalk": "^1.1.3", | ||
"commander": "^2.9.0", | ||
"lodash": "^4.17.2" | ||
@@ -40,0 +41,0 @@ }, |
@@ -11,3 +11,3 @@ # Boost v0.0.0 | ||
```js | ||
Pipeline.fromConfig('./.babelrc') | ||
(new Pipeline('babel', require('./.babelrc'))) | ||
.phase(new LocateRoutine('locate')) // Glob initial files | ||
@@ -14,0 +14,0 @@ .phase(new ResolveRoutine('resolve')) // Resolve dependency lookups |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
18096
18.45%10
11.11%361
18.75%0
-100%4
33.33%+ Added
+ Added