+80
-9
@@ -35,9 +35,6 @@ /*! | ||
| this.use(utils.plugins()); | ||
| this.is('Scaffold'); | ||
| this.is('scaffold'); | ||
| Scaffold.emit('scaffold', this); | ||
| this.on('target', Scaffold.emit.bind(Scaffold, 'target')); | ||
| this.on('files', Scaffold.emit.bind(Scaffold, 'files')); | ||
| this.options = options || {}; | ||
| options = options || {}; | ||
| this.options = options; | ||
| this.targets = {}; | ||
@@ -47,4 +44,7 @@ | ||
| this.options = {}; | ||
| foward(this, options); | ||
| this.addTargets(options); | ||
| return this; | ||
| } else { | ||
| foward(this, options); | ||
| } | ||
@@ -152,9 +152,14 @@ } | ||
| var self = this; | ||
| var Target = this.get('Target'); | ||
| var target = new Target(this.options); | ||
| target.on('files', this.emit.bind(this, 'files')); | ||
| utils.define(target, 'parent', this); | ||
| utils.define(target, 'name', name); | ||
| utils.define(target, 'key', name); | ||
| target.on('files', function(stage, files) { | ||
| utils.define(files, 'parent', target); | ||
| self.emit('files', stage, files); | ||
| }); | ||
| target.options = utils.extend({}, target.options, config.options); | ||
@@ -170,3 +175,11 @@ this.emit('target', target); | ||
| /** | ||
| * Get or set the `Target` constructor to use for creating new targets. | ||
| * Getter/setter for the `Target` constructor to use for creating new targets. | ||
| * | ||
| * ```js | ||
| * var Target = scaffold.get('Target'); | ||
| * var target = new Target(); | ||
| * ``` | ||
| * @name .Target | ||
| * @return {Function} Returns the `Target` constructor to use for creating new targets. | ||
| * @api public | ||
| */ | ||
@@ -185,2 +198,60 @@ | ||
| /** | ||
| * Getter/setter for `scaffold.name`. The `name` property can be set on the options or | ||
| * directly on the instance. | ||
| * | ||
| * ```js | ||
| * var scaffold = new Scaffold({name: 'foo'}); | ||
| * console.log(scaffold.name); | ||
| * //=> 'foo' | ||
| * | ||
| * // or | ||
| * var scaffold = new Scaffold(); | ||
| * scaffold.options.name = 'bar'; | ||
| * console.log(scaffold.name); | ||
| * //=> 'bar' | ||
| * | ||
| * // or | ||
| * var scaffold = new Scaffold(); | ||
| * scaffold.name = 'baz'; | ||
| * console.log(scaffold.name); | ||
| * //=> 'baz' | ||
| * ``` | ||
| * @name .name | ||
| * @return {Function} Returns the `Target` constructor to use for creating new targets. | ||
| * @api public | ||
| */ | ||
| Object.defineProperty(Scaffold.prototype, 'name', { | ||
| configurable: true, | ||
| set: function(val) { | ||
| utils.define(this, '_scaffoldName', val); | ||
| }, | ||
| get: function() { | ||
| return this._scaffoldName || this.options.name; | ||
| } | ||
| }); | ||
| /** | ||
| * Forward events from the scaffold instance to the `Scaffold` constructor | ||
| */ | ||
| function foward(app, options) { | ||
| if (typeof options.name === 'string') { | ||
| app.name = options.name; | ||
| delete options.name; | ||
| } | ||
| Scaffold.emit('scaffold', app); | ||
| emit('target', app, Scaffold); | ||
| emit('files', app, Scaffold); | ||
| } | ||
| /** | ||
| * Forward events from emitter `a` to emitter `b` | ||
| */ | ||
| function emit(name, a, b) { | ||
| a.on(name, b.emit.bind(b, name)); | ||
| } | ||
| /** | ||
| * Expose `Scaffold` | ||
@@ -187,0 +258,0 @@ */ |
+1
-1
| { | ||
| "name": "scaffold", | ||
| "description": "Conventions and API for creating declarative configuration objects for project scaffolds - similar in format to a grunt task, but more portable, generic and can be used by any build system or generator - even gulp.", | ||
| "version": "0.2.10", | ||
| "version": "0.2.11", | ||
| "homepage": "https://github.com/jonschlinkert/scaffold", | ||
@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
9241
20.22%241
37.71%