-
Notifications
You must be signed in to change notification settings - Fork 663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat Path Options #212
Feat Path Options #212
Conversation
👍 to remove test-write-files.js |
Should I do it now or another PR? It is actually blocking me from implementing template on gitignore. Also I would like to remove
|
I like how this feature evolve. Organizing and documenting options seams necessary now. I still have a remark about the way the paths are stored. Referring to the Another remark. In the |
About the For the problem of where to store paths. There are actually 2 modules that need the paths setting. The first are gulpfiles. The second are future sub-generators. So the reasoning is: For
For storing in
Storing in both place makes duplication, and it's the worst so I wouldn't mention here.
Another solution I have thought about is to make |
I prefer stores un yo-rc.json. As you said yo-rc.json have a higher scope in yeoman generator |
Can you remove test-write-files.js and rebase ? Ans you can delete dotfileFiles. |
Sure I'm working on it. |
8f1a9f2
to
fc9ca26
Compare
One last thing is the exception of |
Ok now it's nice. Now I am refactoring the test one more time for the better. I am making
|
describe('gulp-angular generator utils', function () { | ||
describe('normalizePath', function() { | ||
it('should return simplest form of given relative path to cwd', function () { | ||
utils.normalizePath('/path/to/folder').should.be.equal('path/to/folder'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Windows this test failed.
utils.js is really neccesary ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use path.sep
Used this SO answer but improved with |
Now back to the This way people can easily put the path definition to config.paths to replace See the diff Proposed Basically just wrap Any comment? If you all agree with this I will merge then squash again. |
Seams great to me. But I don't like your last proposal. It create a strange and complex structure on the gulp files. I even prefer putting the configuration in the gulp object if you want. (Something like In fact, I'm still puzzled about using .yo-rc.json as a config file. For other choices, it's also the choices made at the time of generation but nothing say it's maintained (why not installing UI boostrap after?). So finally, why not duplicating this configuration in the gulpfile.js ? |
I still think duplicating is weird, imagine once we have sub-generators, suppose we need to change a path, says, appPath, we have to go to both Well but to be really honest, I also think However, Oh well this is quite a tie. |
So the ultimate aim is to make it clear to user, about what to do if they want to change paths after the app is generated. I think for now let's keep it in Unless there are complaints about this (I hope not :D), then we will change it later, minor changes anyway. So now I will implement |
I think I will search all popular generators & see where they store configurable path. That also affects where people expect to edit paths from. |
According to the list
All of them also store in |
👍 |
Still need more tests on windows. Probably needs to use |
Is it ok to merge? I've got some big refacto going on that I want to merge on this one quickly. |
Now it's good. Do you want me to change the version of slash to ~ ? Do I need to squash again ? |
Changed slash version to |
Don't like either to "squash too much". Thank you! |
Changelog
(diff looks huge but most of them are tests)
Generator Changes
options.json
to define options with Yeoman options. 4 new options:init
->constructor
to make options definition available toyo gulp-angular --help
appName
formatting toformat.js
instead of init.retrieveOptions
inindex.js
to parse options in cases with no--default
& noskipConfig
. This function foroptions
is similar toaskQuestions
forprompts
.mock-options.js
with a defaults value to make it similar toprompts
, for easy use in tests.utils.js
for some path processing functions.props
:props.paths
is a hash, where keys are folder in generator template & values are dest folder for generated app.utils.replacePrefix()
for each dest str inwrite.js
Tempate changes
.yo-rc.json
to get paths data.Test Changes
test-gulp-task-inception.mocha.js
&test-files-generate.mocha.js
to enable different options for each case.--skip-install
,--app-path=...
, prompts are questions.test-gulp-task-inception.mocha.js
with different paths.test-files-generate.mocha.js
with different paths.tests-utils.js
.Mics
README.md
.Further refactor suggestion:
test-options.mocha.js
should just be merged intotest-files-generate.mocha.js
test-write-files
is quite troublesome, there are cases that file is both dotfile & template file, or a double dash __ file is a template file that will break the assertion. Plus the assertion isn't really important as most file assertions are already done intest-files-generate.mocha.js
. So I suggest remove this test.