{"action":"created","comment":{"url":"https://api.github.com/repos/sindresorhus/np/pulls/comments/72385685","id":72385685,"diff_hunk":"@@ -60,12 +56,49 @@ const gitTasks = opts => {\n \treturn new Listr(tasks);\n };\n \n+const prerequisiteTasks = newVersion => {\n+\treturn new Listr([\n+\t\t{\n+\t\t\ttitle: 'Check Node.js and npm version',\n+\t\t\tskip: () => semver.lt(process.version, '6.0.0'),\n+\t\t\ttask: () => execa.stdout('npm', ['version', '--json']).then(json => {\n+\t\t\t\tconst versions = JSON.parse(json);\n+\t\t\t\tif (!semver.satisfies(versions.npm, '>=2.15.8 <3.0.0 || >=3.10.1')) {\n+\t\t\t\t\treturn Promise.reject(new Error(`npm@${versions.npm} has known issues publishing when running Node.js 6. Please upgrade npm or downgrade Node and publish again. https://github.com/npm/npm/issues/5082`));\n+\t\t\t\t}\n+\t\t\t})\n+\t\t},\n+\t\t{\n+\t\t\ttitle: 'Fetch remote changes',\n+\t\t\ttask: () => execa('git', ['fetch'])\n+\t\t},\n+\t\t{\n+\t\t\ttitle: 'Check git tag existance',\n+\t\t\ttask: () => execa.stdout('git', ['rev-parse', '--quiet', '--verify', `refs/tags/v${newVersion}`])\n+\t\t\t\t.then(\n+\t\t\t\t\toutput => {\n+\t\t\t\t\t\tif (output) {\n+\t\t\t\t\t\t\tthrow new Error(`Git tag \\`v${newVersion}\\` already exists.`);\n+\t\t\t\t\t\t}\n+\t\t\t\t\t},\n+\t\t\t\t\terr => {\n+\t\t\t\t\t\tif (err.stdout !== '' || err.stderr !== '') {\n+\t\t\t\t\t\t\tthrow err;\n+\t\t\t\t\t\t}","path":"index.js","position":43,"original_position":43,"commit_id":"878bb2d2c576546f9f87c7eb784bd05661b788c1","original_commit_id":"878bb2d2c576546f9f87c7eb784bd05661b788c1","user":{"login":"SamVerschueren","id":1913805,"avatar_url":"https://avatars.githubusercontent.com/u/1913805?v=3","gravatar_id":"","url":"https://api.github.com/users/SamVerschueren","html_url":"https://github.com/SamVerschueren","followers_url":"https://api.github.com/users/SamVerschueren/followers","following_url":"https://api.github.com/users/SamVerschueren/following{/other_user}","gists_url":"https://api.github.com/users/SamVerschueren/gists{/gist_id}","starred_url":"https://api.github.com/users/SamVerschueren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SamVerschueren/subscriptions","organizations_url":"https://api.github.com/users/SamVerschueren/orgs","repos_url":"https://api.github.com/users/SamVerschueren/repos","events_url":"https://api.github.com/users/SamVerschueren/events{/privacy}","received_events_url":"https://api.github.com/users/SamVerschueren/received_events","type":"User","site_admin":false},"body":"That's what I thought as well. It doesn't output errors, but it still exists with status code 1. If you run that command in the terminal, it looks like this.\r\n\r\n> $ git rev-parse -q --verify refs/tags/v0.4.0\r\n> 8cda9fb6af972a74641bd27059de0a5c250f4d0b\r\n> \r\n> $ git rev-parse -q --verify refs/tags/v1.0.0\r\n> <br>\r\n\r\nBut when running it with `execa`, this is what the error object looks like\r\n\r\n```json\r\n{\r\n    \"killed\": false,\r\n    \"code\": 1,\r\n    \"signal\": null,\r\n    \"cmd\": \"git rev-parse --quiet --verify refs/tags/v1.0.0\",\r\n    \"stdout\": \"\",\r\n    \"stderr\": \"\"\r\n}\r\n```\r\n\r\nAnd now without `-q --verify`\r\n\r\n```json\r\n{\r\n    \"killed\": false,\r\n    \"code\": 128,\r\n    \"signal\": null,\r\n    \"cmd\": \"git rev-parse refs/tags/v1.0.0\",\r\n    \"stdout\": \"refs/tags/v1.0.0\\n\",\r\n    \"stderr\": \"fatal: ambiguous argument 'refs/tags/v1.0.0': unknown revision or path not in the working tree.\\nUse '--' to separate paths from revisions, like this:\\n'git <command> [<revision>...] -- [<file>...]'\\n\"\r\n}\r\n```\r\n\r\nThe reason they exit with `1` I guess is to be able to write commands that looks like this\r\n\r\n> $ git rev-parse -q --verify refs/tags/v1.0.0 && echo \"exists\"\r\n\r\nNot sure though, just guessing here.","created_at":"2016-07-27T06:16:30Z","updated_at":"2016-07-27T06:16:30Z","html_url":"https://github.com/sindresorhus/np/pull/73#discussion_r72385685","pull_request_url":"https://api.github.com/repos/sindresorhus/np/pulls/73","_links":{"self":{"href":"https://api.github.com/repos/sindresorhus/np/pulls/comments/72385685"},"html":{"href":"https://github.com/sindresorhus/np/pull/73#discussion_r72385685"},"pull_request":{"href":"https://api.github.com/repos/sindresorhus/np/pulls/73"}}},"pull_request":{"url":"https://api.github.com/repos/sindresorhus/np/pulls/73","id":78903637,"html_url":"https://github.com/sindresorhus/np/pull/73","diff_url":"https://github.com/sindresorhus/np/pull/73.diff","patch_url":"https://github.com/sindresorhus/np/pull/73.patch","issue_url":"https://api.github.com/repos/sindresorhus/np/issues/73","number":73,"state":"open","locked":false,"title":"add git tag check - fixes #70","user":{"login":"SamVerschueren","id":1913805,"avatar_url":"https://avatars.githubusercontent.com/u/1913805?v=3","gravatar_id":"","url":"https://api.github.com/users/SamVerschueren","html_url":"https://github.com/SamVerschueren","followers_url":"https://api.github.com/users/SamVerschueren/followers","following_url":"https://api.github.com/users/SamVerschueren/following{/other_user}","gists_url":"https://api.github.com/users/SamVerschueren/gists{/gist_id}","starred_url":"https://api.github.com/users/SamVerschueren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SamVerschueren/subscriptions","organizations_url":"https://api.github.com/users/SamVerschueren/orgs","repos_url":"https://api.github.com/users/SamVerschueren/repos","events_url":"https://api.github.com/users/SamVerschueren/events{/privacy}","received_events_url":"https://api.github.com/users/SamVerschueren/received_events","type":"User","site_admin":false},"body":"Tried to implement #70.\r\n\r\n### What changed?\r\n\r\nExtracted the prerequisite check into a separate subtask list with the following tasks\r\n\r\n1. Check Node.js and npm version\r\n    - This task will be skipped if Node.js is < 6. Or should we keep the previous logic without `skip` function?\r\n2. Fetch remote changes (necessary to be executed before 3 but doesn't feel right in this place)\r\n3. Check git tag existance\r\n    - I execute the command `git rev-parse --quiet --verify refs/tags/NEW_TAG`. Anything else I should use?\r\n\r\nFeedback is more then welcome because I'm not totally sure about the implementation.\r\n\r\n// @sindresorhus @jamestalmage @ianstormtaylor","created_at":"2016-07-26T18:43:33Z","updated_at":"2016-07-27T06:16:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d2d56a5f14cecd34c2e4db6ded1c805637281cc1","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/sindresorhus/np/pulls/73/commits","review_comments_url":"https://api.github.com/repos/sindresorhus/np/pulls/73/comments","review_comment_url":"https://api.github.com/repos/sindresorhus/np/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sindresorhus/np/issues/73/comments","statuses_url":"https://api.github.com/repos/sindresorhus/np/statuses/878bb2d2c576546f9f87c7eb784bd05661b788c1","head":{"label":"sindresorhus:iss70","ref":"iss70","sha":"878bb2d2c576546f9f87c7eb784bd05661b788c1","user":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"repo":{"id":40806530,"name":"np","full_name":"sindresorhus/np","owner":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sindresorhus/np","description":"A better `npm publish`","fork":false,"url":"https://api.github.com/repos/sindresorhus/np","forks_url":"https://api.github.com/repos/sindresorhus/np/forks","keys_url":"https://api.github.com/repos/sindresorhus/np/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sindresorhus/np/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sindresorhus/np/teams","hooks_url":"https://api.github.com/repos/sindresorhus/np/hooks","issue_events_url":"https://api.github.com/repos/sindresorhus/np/issues/events{/number}","events_url":"https://api.github.com/repos/sindresorhus/np/events","assignees_url":"https://api.github.com/repos/sindresorhus/np/assignees{/user}","branches_url":"https://api.github.com/repos/sindresorhus/np/branches{/branch}","tags_url":"https://api.github.com/repos/sindresorhus/np/tags","blobs_url":"https://api.github.com/repos/sindresorhus/np/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sindresorhus/np/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sindresorhus/np/git/refs{/sha}","trees_url":"https://api.github.com/repos/sindresorhus/np/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sindresorhus/np/statuses/{sha}","languages_url":"https://api.github.com/repos/sindresorhus/np/languages","stargazers_url":"https://api.github.com/repos/sindresorhus/np/stargazers","contributors_url":"https://api.github.com/repos/sindresorhus/np/contributors","subscribers_url":"https://api.github.com/repos/sindresorhus/np/subscribers","subscription_url":"https://api.github.com/repos/sindresorhus/np/subscription","commits_url":"https://api.github.com/repos/sindresorhus/np/commits{/sha}","git_commits_url":"https://api.github.com/repos/sindresorhus/np/git/commits{/sha}","comments_url":"https://api.github.com/repos/sindresorhus/np/comments{/number}","issue_comment_url":"https://api.github.com/repos/sindresorhus/np/issues/comments{/number}","contents_url":"https://api.github.com/repos/sindresorhus/np/contents/{+path}","compare_url":"https://api.github.com/repos/sindresorhus/np/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sindresorhus/np/merges","archive_url":"https://api.github.com/repos/sindresorhus/np/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sindresorhus/np/downloads","issues_url":"https://api.github.com/repos/sindresorhus/np/issues{/number}","pulls_url":"https://api.github.com/repos/sindresorhus/np/pulls{/number}","milestones_url":"https://api.github.com/repos/sindresorhus/np/milestones{/number}","notifications_url":"https://api.github.com/repos/sindresorhus/np/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sindresorhus/np/labels{/name}","releases_url":"https://api.github.com/repos/sindresorhus/np/releases{/id}","deployments_url":"https://api.github.com/repos/sindresorhus/np/deployments","created_at":"2015-08-16T09:06:06Z","updated_at":"2016-07-27T04:30:42Z","pushed_at":"2016-07-26T18:46:31Z","git_url":"git://github.com/sindresorhus/np.git","ssh_url":"git@github.com:sindresorhus/np.git","clone_url":"https://github.com/sindresorhus/np.git","svn_url":"https://github.com/sindresorhus/np","homepage":null,"size":493,"stargazers_count":1316,"watchers_count":1316,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":11,"forks":36,"open_issues":11,"watchers":1316,"default_branch":"master"}},"base":{"label":"sindresorhus:master","ref":"master","sha":"9ae44c7dbd8f2cf52069f8e616cd2deefaf9dcf9","user":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"repo":{"id":40806530,"name":"np","full_name":"sindresorhus/np","owner":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sindresorhus/np","description":"A better `npm publish`","fork":false,"url":"https://api.github.com/repos/sindresorhus/np","forks_url":"https://api.github.com/repos/sindresorhus/np/forks","keys_url":"https://api.github.com/repos/sindresorhus/np/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sindresorhus/np/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sindresorhus/np/teams","hooks_url":"https://api.github.com/repos/sindresorhus/np/hooks","issue_events_url":"https://api.github.com/repos/sindresorhus/np/issues/events{/number}","events_url":"https://api.github.com/repos/sindresorhus/np/events","assignees_url":"https://api.github.com/repos/sindresorhus/np/assignees{/user}","branches_url":"https://api.github.com/repos/sindresorhus/np/branches{/branch}","tags_url":"https://api.github.com/repos/sindresorhus/np/tags","blobs_url":"https://api.github.com/repos/sindresorhus/np/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sindresorhus/np/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sindresorhus/np/git/refs{/sha}","trees_url":"https://api.github.com/repos/sindresorhus/np/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sindresorhus/np/statuses/{sha}","languages_url":"https://api.github.com/repos/sindresorhus/np/languages","stargazers_url":"https://api.github.com/repos/sindresorhus/np/stargazers","contributors_url":"https://api.github.com/repos/sindresorhus/np/contributors","subscribers_url":"https://api.github.com/repos/sindresorhus/np/subscribers","subscription_url":"https://api.github.com/repos/sindresorhus/np/subscription","commits_url":"https://api.github.com/repos/sindresorhus/np/commits{/sha}","git_commits_url":"https://api.github.com/repos/sindresorhus/np/git/commits{/sha}","comments_url":"https://api.github.com/repos/sindresorhus/np/comments{/number}","issue_comment_url":"https://api.github.com/repos/sindresorhus/np/issues/comments{/number}","contents_url":"https://api.github.com/repos/sindresorhus/np/contents/{+path}","compare_url":"https://api.github.com/repos/sindresorhus/np/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sindresorhus/np/merges","archive_url":"https://api.github.com/repos/sindresorhus/np/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sindresorhus/np/downloads","issues_url":"https://api.github.com/repos/sindresorhus/np/issues{/number}","pulls_url":"https://api.github.com/repos/sindresorhus/np/pulls{/number}","milestones_url":"https://api.github.com/repos/sindresorhus/np/milestones{/number}","notifications_url":"https://api.github.com/repos/sindresorhus/np/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sindresorhus/np/labels{/name}","releases_url":"https://api.github.com/repos/sindresorhus/np/releases{/id}","deployments_url":"https://api.github.com/repos/sindresorhus/np/deployments","created_at":"2015-08-16T09:06:06Z","updated_at":"2016-07-27T04:30:42Z","pushed_at":"2016-07-26T18:46:31Z","git_url":"git://github.com/sindresorhus/np.git","ssh_url":"git@github.com:sindresorhus/np.git","clone_url":"https://github.com/sindresorhus/np.git","svn_url":"https://github.com/sindresorhus/np","homepage":null,"size":493,"stargazers_count":1316,"watchers_count":1316,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":11,"forks":36,"open_issues":11,"watchers":1316,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sindresorhus/np/pulls/73"},"html":{"href":"https://github.com/sindresorhus/np/pull/73"},"issue":{"href":"https://api.github.com/repos/sindresorhus/np/issues/73"},"comments":{"href":"https://api.github.com/repos/sindresorhus/np/issues/73/comments"},"review_comments":{"href":"https://api.github.com/repos/sindresorhus/np/pulls/73/comments"},"review_comment":{"href":"https://api.github.com/repos/sindresorhus/np/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sindresorhus/np/pulls/73/commits"},"statuses":{"href":"https://api.github.com/repos/sindresorhus/np/statuses/878bb2d2c576546f9f87c7eb784bd05661b788c1"}}}}
{"actor":{"display_login":"SamVerschueren"}}