Skip to content
This repository was archived by the owner on Mar 26, 2018. It is now read-only.

feat(app): read module name form bower.json #975

Merged
merged 2 commits into from
Feb 5, 2015

Conversation

marcin-wosinek
Copy link
Contributor

app-suffix option is not saved for later uses and needs to be readded to each
future subgenerator. This change reads module name from new bower.json field
so module author have full flexibility about naming it.

@marcin-wosinek
Copy link
Contributor Author

pushes further job done with #572 - with it --app-suffix will be saved for future submodules runs.

@@ -20,5 +20,6 @@
"angular-mocks": "^<%= ngVer %>",
"angular-scenario": "^<%= ngVer %>"
}<% if (appPath) { %>,
"appPath": "<%= appPath %>"<% } %>
"appPath": "<%= appPath %>"<% } %>,
"moduleName": "<%= scriptAppName %>"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eddiemonge these should be in .yo-rc.json.

@@ -14,7 +14,12 @@ var Generator = module.exports = function Generator() {
this.appname = path.basename(process.cwd());
}
this.appname = this._.slugify(this._.humanize(this.appname));
this.scriptAppName = this._.camelize(this.appname) + angularUtils.appName(this);

try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this try catch to make the bower.json variables available as a top level variable so it can be used on line 27(32) as well without having two try catch blocks for essentially the same thing.

eventually (soon) these are going int he .yo-rc.json file.

try {
this.env.options.appPath = require(path.join(process.cwd(), 'bower.json')).appPath;
} catch (e) {}
this.env.options.appPath = bowerJson.appPath;
}
this.env.options.appPath = this.env.options.appPath || 'app';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove 33-35 and change 36 to:

this.env.options.appPath = this.env.options.appPath || bowerJson.appPath || 'app';

app-suffix option is not saved for later uses and needs to be readded to each
future subgenerator. This change reads module name from new bower.json field
so module author have full flexibility about naming it.
eddiemonge added a commit that referenced this pull request Feb 5, 2015
feat(app): read module name form bower.json
@eddiemonge eddiemonge merged commit 6e67975 into yeoman:master Feb 5, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants