Skip to content

Commit

Permalink
Fix release draft not being opened when running $ np <version> (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
TiagoDanin authored and itaisteinherz committed Jun 2, 2019
1 parent 53d20d9 commit 056dc72
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
11 changes: 3 additions & 8 deletions source/cli.js
Expand Up @@ -88,14 +88,9 @@ updateNotifier({pkg: cli.pkg}).notify();

const isAvailable = flags.publish ? await isPackageNameAvailable(pkg) : false;

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

const options = await ui({...flags, exists: !isAvailable, version}, pkg);

if (!options.confirm) {
process.exit(0);
Expand Down
9 changes: 9 additions & 0 deletions source/ui.js
Expand Up @@ -140,6 +140,15 @@ module.exports = async (options, pkg) => {

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

if (options.version) {
return {
...options,
confirm: true,
repoUrl,
releaseNotes
};
}

if (!hasCommits) {
const answers = await inquirer.prompt([{
type: 'confirm',
Expand Down

0 comments on commit 056dc72

Please sign in to comment.