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

feature: Generating README.md #1717

Merged
merged 5 commits into from
Jul 4, 2018

Conversation

arthurdenner
Copy link
Contributor

@arthurdenner arthurdenner commented Jun 30, 2018

Closes #1675.

As suggested in the issue, this PR adds a step to the vue create process to create a README.md based on the project's package.json.

I got some descriptions from the cli-ui package and created generic ones to the others. Please let me know if I missed any script/description.

Regarding the code, I used Array.joins to try to keep the code as clean as possible. I'm not sure if it's the best solution, but using only template strings in this situation is really messy in my opinion.

PS: If tests are necessary to this feature, let me know as well.

function printScripts (pkg, packageManager) {
return Object.keys(pkg.scripts).map(key => {
return [
`\n### ${descriptions[key]}`,
Copy link
Member

Choose a reason for hiding this comment

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

about descriptions, I think it should be decided dynamically according to features selection at vue create.

In that implementation, the description which is not necessary is generated in the README.md.
for example, in the features selection, even if unit test feature is not selected, it will be output to README.md.

Copy link
Contributor Author

@arthurdenner arthurdenner Jun 30, 2018

Choose a reason for hiding this comment

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

But the file is generated based on the keys on the scripts section of package.json. That's what Object.keys(pkg.scripts).map does. If you don't select unit testing, it won't output the description on README.md.

Copy link
Member

Choose a reason for hiding this comment

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

That's true.

In that phase, it's works, due to package.json contents is resolved with Generator.
For #1675, There seems to be no problem with implementation. ✨

As the concern, If third party plugin author want to extend README.md dynamically, I think that it's not that simple implementation, but it need to implement at Generator or cli-service.

Copy link
Contributor

Choose a reason for hiding this comment

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

@kazupon That would be even better

@Akryum Akryum merged commit 278e992 into vuejs:dev Jul 4, 2018
@arthurdenner arthurdenner deleted the feature/generating-readme branch July 12, 2018 20:52
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.

4 participants