Skip to content
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

Add --welcome option to new and init so that it can be skipped with --no-welcome #6868

Merged
merged 5 commits into from Apr 25, 2017

Conversation

romulomachado
Copy link
Contributor

Closes #6444

Copy link
Member

@Turbo87 Turbo87 left a comment

Choose a reason for hiding this comment

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

Hi @romulomachado and thanks for your PR!

I have two comments about this PR:

  • Instead of adding a skip-welcome option I'd propose a welcome option with default: true. That way --no-welcome will automatically work and in .ember-cli you could write "welcome": false.

  • Instead of removing the code from the blueprint and later trying to add it again via fs calls you should pass the welcome option to the locals() hook of the blueprint and use an if block inside of the application.hbs to insert the welcome page component (see https://github.com/ember-cli/ember-cli/blob/master/blueprints/app/files/.travis.yml#L7 for an example)

Copy link
Member

@Turbo87 Turbo87 left a comment

Choose a reason for hiding this comment

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

awesome! this looks pretty good already :)

could you also add tests for the new behavior to https://github.com/ember-cli/ember-cli/blob/master/tests/acceptance/new-test.js?

@romulomachado
Copy link
Contributor Author

Hey @Turbo87, thanks for the suggestions!

I tried sending the welcome option to locals() before, but it was putting the flag into the file instead of evaluating the if, I was missing the {, the example you provided was very helpful.

Thanks again for helping!

I'm working on fixing the tests now.

@romulomachado
Copy link
Contributor Author

@Turbo87 ✅ Just added the tests! LMK if there's anything else I should do.

@romulomachado
Copy link
Contributor Author

Just realized it's not very friendly to have only the {{outlet}} on the template.hbs if --no-welcome is true so I added the old <h2 id="title">Welcome to Ember</h2> back.

@@ -84,6 +84,8 @@ module.exports = {
let addonName = stringUtil.dasherize(addonRawName);
let addonNamespace = stringUtil.classify(addonRawName);

let { yarn, welcome } = options;
Copy link
Member

Choose a reason for hiding this comment

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

I think destructuring is not yet supported on Node 4

{ name: 'skip-npm', type: Boolean, default: false, aliases: ['sn'] },
{ name: 'skip-bower', type: Boolean, default: false, aliases: ['sb'] },
{ name: 'skip-git', type: Boolean, default: false, aliases: ['sg'] },
{ name: 'welcome', type: Boolean, default: true },
Copy link
Member

Choose a reason for hiding this comment

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

since welcome by itself isn't that descriptive it would probably make sense to add a description here too

.to.match(/"ember-welcome-page"/);

expect(file('app/templates/application.hbs'))
.to.contain(/"{{welcome-page}}"/);
Copy link
Member

Choose a reason for hiding this comment

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

I think the issue is that you wrote /"{{welcome-page}}"/ instead of /{{welcome-page}}/. Could you try this without the quotes? or just use expect(...).to.contain('{{welcome-page}}'); instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Turbo87 That was it! Thank you, just updated it!

@romulomachado
Copy link
Contributor Author

@Turbo87 Just rebased the branch (went from 18 commits to 5).

not bad

@romulomachado romulomachado changed the title Add --skip-welcome option to new and init Add --welcome option to new and init so that it can be skipped with --no-welcome Mar 21, 2017
@Turbo87
Copy link
Member

Turbo87 commented Mar 21, 2017

there seems to be one failing test left, but I'm not sure why that is actually failing... 🤔

any ideas?

@homu
Copy link
Contributor

homu commented Mar 27, 2017

☔ The latest upstream changes (presumably e5f3a33) made this pull request unmergeable. Please resolve the merge conflicts.

@romulomachado
Copy link
Contributor Author

@Turbo87 Had a busy week last week. Hopefully, I'll have some time to fix that failing test this week. I have no idea why it's failing, but I'll investigate.

@romulomachado romulomachado force-pushed the add-skip-welcome-page-option branch 2 times, most recently from 38f04a9 to 08a8aac Compare March 28, 2017 01:28
@homu
Copy link
Contributor

homu commented Apr 22, 2017

☔ The latest upstream changes (presumably ef31f8f) made this pull request unmergeable. Please resolve the merge conflicts.

@kellyselden
Copy link
Member

I'm late to the party, and this idea can be a separate PR, but it seems like if we had a good extendable commands story, the welcome addon could just extend the new command and add it's option, and a hook system would allow it to no-op on that option.

@Turbo87
Copy link
Member

Turbo87 commented Apr 25, 2017

@romulomachado could you rebase the PR on top of the master branch?

@romulomachado
Copy link
Contributor Author

@Turbo87 ✅ Done!

@rwjblue
Copy link
Member

rwjblue commented Apr 25, 2017

@homu r+

@homu
Copy link
Contributor

homu commented Apr 25, 2017

📌 Commit 06931e9 has been approved by rwjblue

@homu
Copy link
Contributor

homu commented Apr 25, 2017

⚡ Test exempted - status

@homu homu merged commit 06931e9 into ember-cli:master Apr 25, 2017
homu added a commit that referenced this pull request Apr 25, 2017
…wjblue

Add --welcome option to `new` and `init` so that it can be skipped with --no-welcome

Closes #6444
@romulomachado romulomachado deleted the add-skip-welcome-page-option branch April 25, 2017 17:55
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.

None yet

5 participants