Skip to content

Add prompt for ESDoc/YUIDoc #248

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

Merged
merged 2 commits into from
Oct 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 31 additions & 4 deletions blueprints/ember-cli-addon-docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {
});
},

afterInstall() {
afterInstall(options) {
let configPath = require.resolve(this.project.configPath());
let configContents = fs.readFileSync(configPath, 'utf-8');

Expand Down Expand Up @@ -63,9 +63,36 @@ module.exports = {
}

if (!hasPlugins) {
return this.addAddonsToProject({
packages: ['ember-cli-addon-docs-yuidoc']
});
return this._chooseAddonsToInstall()
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like there's a lint failure because the return below this one is dead code now

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call, I meant to remove that.

.then((addon) => {
return this.addAddonsToProject({
packages: [addon],
blueprintOptions: {
save: options.save
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this option doing? Was something behaving wrong when we didn't have it before?

Copy link
Member Author

Choose a reason for hiding this comment

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

This just allows a passthrough of if you do ember install ember-cli-addon-docs --save it passes the --save to the other deps it adds here.

}
});
});
}
},

_chooseAddonsToInstall() {
// Ask which ember addon to install
return this.ui.prompt({
type: 'list',
name: 'addonToInstall',
message: 'Which documentation style would you like to use?',
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we include a choice not to install anything at all? I could imagine wanting to use another addon-docs plugin that isn't necessarily part of the ember-learn org, or just not needing or wanting generated API docs for an addon at all.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we could certainly add options, as they become necessary. I think for now, this is an improvement on always using yuidoc.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough. I'll probably turn around and add a "no plugin" option anyway because I think it's valuable, but I don't need to push that work on you here 🙂

choices: [
{
name: 'ESDoc',
value: { name: 'ember-cli-addon-docs-esdoc' }
},
{
name: 'YUIDoc',
value: { name: 'ember-cli-addon-docs-yuidoc' }
}
]
}).then((selected) => {
return selected.addonToInstall;
});
}
};