-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[ENHANCEMENT] Change blueprint command options to type String to avoid nopt transformations #3820
[ENHANCEMENT] Change blueprint command options to type String to avoid nopt transformations #3820
Conversation
it seems like people being required to provide a relative or absolutely path, should be sufficient we dont need to resolve non-path like things. I believe https://github.com/ember-cli/ember-cli/blob/master/tests/acceptance/new-test.js#L130 should fail in its current form, but work with |
Sure, that sounds very reasonable. How would we technical detect it though? Check for the presence of '/' in the blueprint name and assume it's a path? |
ya, relative or absolute. |
87d5d79
to
ac13a3a
Compare
@stefanpenner I updated the PR and added an extra test for absolute paths. Let me know if there's anything I should change before merging. |
ac13a3a
to
d1cd079
Compare
looking now |
@@ -72,6 +72,10 @@ module.exports = Command.extend({ | |||
return Promise.reject(new SilentError('We currently do not support a name of `' + packageName + '`.')); | |||
} | |||
|
|||
if (blueprintOpts.blueprint[0] === '.') { | |||
blueprintOpts.blueprint = path.resolve(process.cwd(), blueprintOpts.blueprint); |
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.
at first, I thought this was a mistake. But I believe it to be correct, as you want:
cd app/ && ember --blueprint=../blueprints/foo
to be relative the cwd, not the project root.
👍
1 last comment, and then i feel good to merge this. |
…rmations This is alright, as the check for `gitUrl` happens in the install-blueprint task anyway.
d1cd079
to
413e311
Compare
@stefanpenner Tada! |
[ENHANCEMENT] Change blueprint command options to type String to avoid nopt transformations
Before this PR, the
--blueprint
option in thenew
andinit
commands got validated as agitUrl
or apath
.When used as a
path
, it would get resolved to an absolute path, making it point to a specific blueprint on the filesystem depending on the current working directory.This PR changes it to a String, so it won't be modified before getting lookup'ed up by
Blueprint.lookup
This doesn't break it being used as a
gitUrl
, because that check happens again in the InstallBlueprint task.It does break it from being used as a path to a blueprint on the filesystem. Instead now it's used as a blueprint in one of the regular lookup paths.
I don't believe this will affect many people, if any. I imagine people always rely on the default
app
blueprint when usingnew
orinit
.I considered keeping it backward compatible, but the new behaviour might be what we actually want moving forward.
The only test this breaks is this one, which I'm for removing/modifying, but wanted someone else's opinion.
\cc @stefanpenner