Configurable Suffixes#247
Open
TrentonAdams wants to merge 2 commits intomeanjs:masterfrom
Open
Conversation
Author
|
Any thoughts on this as of yet? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have made suffixes configurable for the various types of files like .client.view.html, .client.routes.js, etc.
I used the yeoman feature for storing configurations. If you put ".yo-rc.json" in the root of your MEAN.js project, the configurations in it will be automatically pulled in.
I did not provide unit tests for the yeoman storage API, as I presume we should trust that they've provided adequate unit tests for their own project.
http://yeoman.io/authoring/storage.html
A working .yo-rc.json is below...
{
"generator-meanjs": {
"suffixes": {
"client": {
"config": ".config.js",
"routes": ".routes.js",
"controller": ".controller.js",
"services": ".service.js",
"module": ".module.js",
"views": ".view.html",
"controller_tests": ".js",
"routes_tests": ".js"
},
"server": {
"config": ".config.js",
"routes": ".routes.js",
"controller": ".controller.js",
"model": ".model.js",
"policy": ".policy.js",
"model_tests": ".tests.js",
"routes_tests": ".tests.js"
}
}
}
}
I guess I should mention the risks and caveats, and we can think about how we want to mitigate them.
I can think of one risk. If you change all your suffixes to a simple '.js', they will somtimes conflict. i.e. testcruds.config.js and testcrudis.routes.js would both be testcruds.js. We could do a config validation of sorts on startup, and ensure there are no conflicts. It looks like app/index.js would be the appropriate location, yes?