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

Fix release draft not being opened when running $ np <version> #425

Merged
merged 1 commit into from Jun 2, 2019

Conversation

TiagoDanin
Copy link
Contributor

Closes #404

@itaisteinherz
Copy link
Collaborator

itaisteinherz commented Jun 1, 2019

Can you elaborate on why this fixes #404?

@TiagoDanin
Copy link
Contributor Author

To create Release Draft is necessary repoUrl and releaseNotes options.

const isOnGitHub = options.repoUrl && hostedGitInfo.fromUrl(options.repoUrl).type === 'github';

body: options.releaseNotes(tag),

These options are created in np/source/ui.js:

const repoUrl = pkg.repository && githubUrlFromGit(pkg.repository.url, {extraBaseUrls});

np/source/ui.js

Line 141 in 22929bd

const {hasCommits, releaseNotes} = await printCommitLog(repoUrl);

np/source/ui.js

Lines 38 to 40 in 22929bd

const releaseNotes = nextTag => commits.map(commit =>
`- ${commit.message} ${commit.id}`
).join('\n') + `\n\n${repoUrl}/compare/${latest}...${nextTag}`;

Now the ui({...}, pkg) is called with npm <version> or Inquirer Prompt. Previously only with Inquirer Prompt.

np/source/cli.js

Lines 91 to 93 in 22929bd

const version = cli.input.length > 0 ? cli.input[0] : false;
const options = await ui({...flags, exists: !isAvailable, version}, pkg);

@itaisteinherz itaisteinherz changed the title Show and create release draft when run "np <version>" Open release draft when running "np <version>" Jun 2, 2019
Copy link
Collaborator

@itaisteinherz itaisteinherz left a comment

Choose a reason for hiding this comment

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

Thanks!

@itaisteinherz itaisteinherz changed the title Open release draft when running "np <version>" Fix release draft not being opened when running "np <version>" Jun 2, 2019
@itaisteinherz itaisteinherz changed the title Fix release draft not being opened when running "np <version>" Fix release draft not being opened when running $ np <version> Jun 2, 2019
@itaisteinherz itaisteinherz merged commit 056dc72 into sindresorhus:master Jun 2, 2019
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.

Release draft not opened after executing np
2 participants