Skip to content

Configurable Suffixes#247

Open
TrentonAdams wants to merge 2 commits intomeanjs:masterfrom
TrentonAdams:master
Open

Configurable Suffixes#247
TrentonAdams wants to merge 2 commits intomeanjs:masterfrom
TrentonAdams:master

Conversation

@TrentonAdams
Copy link
Copy Markdown

@TrentonAdams TrentonAdams commented Sep 3, 2016

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?

@TrentonAdams
Copy link
Copy Markdown
Author

Any thoughts on this as of yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant