yeoman-environment 1.6.1 → 1.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/environment.js +17 -9
- package/lib/resolver.js +4 -1
- package/package.json +1 -1
- package/readme.md +1 -1
package/lib/environment.js
CHANGED
|
@@ -230,20 +230,22 @@ Environment.prototype.getGeneratorNames = function getGeneratorNames() {
|
|
|
230
230
|
* get `angular:common:all` then we get `angular:common` as a fallback (unless
|
|
231
231
|
* an `angular:common:all` generator is registered).
|
|
232
232
|
*
|
|
233
|
-
* @param {String}
|
|
233
|
+
* @param {String} namespaceOrPath
|
|
234
234
|
* @return {Generator|null} - the generator registered under the namespace
|
|
235
235
|
*/
|
|
236
236
|
|
|
237
|
-
Environment.prototype.get = function get(
|
|
237
|
+
Environment.prototype.get = function get(namespaceOrPath) {
|
|
238
238
|
// Stop the recursive search if nothing is left
|
|
239
|
-
if (!
|
|
239
|
+
if (!namespaceOrPath) {
|
|
240
240
|
return;
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
+
var namespace = namespaceOrPath;
|
|
244
|
+
|
|
243
245
|
// Legacy yeoman-generator `#hookFor()` function is passing the generator path as part
|
|
244
246
|
// of the namespace. If we find a path delimiter in the namespace, then ignore the
|
|
245
247
|
// last part of the namespace.
|
|
246
|
-
var parts =
|
|
248
|
+
var parts = namespaceOrPath.split(':');
|
|
247
249
|
var maybePath = _.last(parts);
|
|
248
250
|
if (parts.length > 1 && /[\/\\]/.test(maybePath)) {
|
|
249
251
|
parts.pop();
|
|
@@ -258,7 +260,9 @@ Environment.prototype.get = function get(namespace) {
|
|
|
258
260
|
|
|
259
261
|
return this.store.get(namespace) ||
|
|
260
262
|
this.store.get(this.alias(namespace)) ||
|
|
261
|
-
|
|
263
|
+
// namespace is empty if namespaceOrPath contains a win32 absolute path of the form 'C:\path\to\generator'.
|
|
264
|
+
// for this reason we pass namespaceOrPath to the getByPath function.
|
|
265
|
+
this.getByPath(namespaceOrPath);
|
|
262
266
|
};
|
|
263
267
|
|
|
264
268
|
/**
|
|
@@ -294,10 +298,14 @@ Environment.prototype.create = function create(namespace, options) {
|
|
|
294
298
|
if (!_.isFunction(Generator)) {
|
|
295
299
|
return this.error(
|
|
296
300
|
new Error(
|
|
297
|
-
'You don
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
'
|
|
301
|
+
chalk.red('You don\’t seem to have a generator with the name “' + namespace + '” installed.') + '\n' +
|
|
302
|
+
'But help is on the way:\n\n' +
|
|
303
|
+
'You can see available generators via ' +
|
|
304
|
+
chalk.yellow('npm search yeoman-generator') + ' or via ' + chalk.yellow('http://yeoman.io/generators/') + '. \n' +
|
|
305
|
+
'Install them with ' + chalk.yellow('npm install generator-' + namespace) + '.\n\n' +
|
|
306
|
+
'To see all your installed generators run ' + chalk.yellow('yo') + ' without any arguments. ' +
|
|
307
|
+
'Adding the ' + chalk.yellow('--help') + ' option will also show subgenerators. \n\n' +
|
|
308
|
+
'If ' + chalk.yellow('yo') + ' cannot find the generator, run ' + chalk.yellow('yo doctor') + ' to troubleshoot your system.'
|
|
301
309
|
)
|
|
302
310
|
);
|
|
303
311
|
}
|
package/lib/resolver.js
CHANGED
|
@@ -127,13 +127,16 @@ resolver.getNpmPaths = function () {
|
|
|
127
127
|
paths.push(path.join(__dirname, '../..'));
|
|
128
128
|
|
|
129
129
|
// adds support for generator resolving when yeoman-generator has been linked
|
|
130
|
-
|
|
130
|
+
if (process.argv[1]) {
|
|
131
|
+
paths.push(path.join(path.dirname(process.argv[1]), '../..'));
|
|
132
|
+
}
|
|
131
133
|
|
|
132
134
|
// Default paths for each system
|
|
133
135
|
if (win32) {
|
|
134
136
|
paths.push(path.join(process.env.APPDATA, 'npm/node_modules'));
|
|
135
137
|
} else {
|
|
136
138
|
paths.push('/usr/lib/node_modules');
|
|
139
|
+
paths.push('/usr/local/lib/node_modules');
|
|
137
140
|
}
|
|
138
141
|
|
|
139
142
|
// Walk up the CWD and add `node_modules/` folder lookup on each level
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Yeoman Environment
|
|
2
2
|
|
|
3
|
-
[](http://badge.fury.io/js/yeoman-environment) [](https://travis-ci.org/yeoman/environment) [](http://badge.fury.io/js/yeoman-environment) [](https://travis-ci.org/yeoman/environment) [](https://coveralls.io/github/yeoman/environment?branch=master) [](https://gitter.im/yeoman/yeoman)
|
|
4
4
|
|
|
5
5
|
> Handles the lifecycle and bootstrapping of generators in a specific environment
|
|
6
6
|
|