release-it 7.5.0 → 7.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -327,9 +327,10 @@ releaseIt(options).then(output => {
327
327
 
328
328
  * [StevenBlack/hosts](https://github.com/StevenBlack/hosts)
329
329
  * [infor-design/enterprise](https://github.com/infor-design/enterprise)
330
- * [nomadreservations/ngx-codemirror](https://github.com/nomadreservations/ngx-codemirror)
331
330
  * [InCuca/vue-standalone-component](https://github.com/InCuca/vue-standalone-component)
332
331
  * [parsable/react-truncate-markup](https://github.com/parsable/react-truncate-markup)
332
+ * [tsqllint/tsqllint](https://github.com/tsqllint/tsqllint)
333
+ * [adr/madr](https://github.com/adr/madr)
333
334
  * GitHub search for [projects with .release-it.json](https://github.com/search?o=desc&q=in%3Apath+.release-it.json&s=indexed&type=Code)
334
335
 
335
336
  ## 📚 Resources
@@ -21,7 +21,7 @@
21
21
  "tagAnnotation": "Release %s",
22
22
  "push": true,
23
23
  "pushArgs": "",
24
- "pushRepo": null,
24
+ "pushRepo": "origin",
25
25
  "beforeStartCommand": false,
26
26
  "afterReleaseCommand": false,
27
27
  "addUntrackedFiles": false
@@ -41,8 +41,9 @@
41
41
  "draft": false,
42
42
  "tokenRef": "GITHUB_TOKEN",
43
43
  "assets": null,
44
- "host": null,
45
- "timeout": 0
44
+ "host": null,
45
+ "timeout": 0,
46
+ "proxy": false
46
47
  },
47
48
  "dist": {
48
49
  "repo": false,
package/lib/git.js CHANGED
@@ -18,7 +18,10 @@ const getBranchName = () => run('git rev-parse --abbrev-ref HEAD', { isReadOnly:
18
18
  const tagExists = tag =>
19
19
  run(`git show-ref --tags --quiet --verify -- "refs/tags/${tag}"`, { isReadOnly: true }).then(() => true, () => false);
20
20
 
21
- const getRemoteUrl = () => run('git config --get remote.origin.url', { isReadOnly: true }).catch(() => null);
21
+ const getRemoteUrl = (remoteUrlOrName = 'origin') =>
22
+ remoteUrlOrName.includes('/')
23
+ ? Promise.resolve(remoteUrlOrName)
24
+ : run(`git config --get remote.${remoteUrlOrName}.url`, { isReadOnly: true }).catch(() => null);
22
25
 
23
26
  const isWorkingDirClean = () =>
24
27
  run('git diff-index --name-only HEAD --exit-code', { isReadOnly: true }).then(() => true, () => false);
@@ -83,10 +86,9 @@ const getLatestTag = () =>
83
86
  () => null
84
87
  );
85
88
 
86
- const push = async ({ pushUrl, hasUpstreamBranch, args = '' } = {}) => {
87
- const repository = pushUrl || '';
89
+ const push = async ({ pushRepo = '', hasUpstreamBranch, args = '' } = {}) => {
88
90
  const setUpstream = hasUpstreamBranch === false ? `--set-upstream origin ${await getBranchName()}` : '';
89
- return run(`git push --follow-tags ${args} ${repository} ${setUpstream}`);
91
+ return run(`git push --follow-tags ${args} ${pushRepo} ${setUpstream}`);
90
92
  };
91
93
 
92
94
  const runChangelogCommand = command =>
@@ -19,16 +19,24 @@ const githubClients = {};
19
19
 
20
20
  const { github } = config.options;
21
21
 
22
- const getGithubClient = ({ host, token }) => {
22
+ const getGithubClient = ({ host, token, proxy }) => {
23
23
  if (!githubClients[host]) {
24
- const client = new GitHubApi({
24
+ const isGitHub = host === 'github.com';
25
+ const baseUrl = `https://${isGitHub ? 'api.github.com' : host}${isGitHub ? '' : '/api/v3'}`;
26
+ const options = {
25
27
  version: '3.0.0',
26
- baseUrl: `https://${host === 'github.com' ? 'api.github.com' : host}${host === 'github.com' ? '' : '/api/v3'}`,
28
+ baseUrl,
27
29
  timeout: github.timeout,
28
30
  headers: {
29
31
  'user-agent': 'webpro/release-it'
30
32
  }
31
- });
33
+ };
34
+
35
+ if (proxy) {
36
+ options.proxy = proxy;
37
+ }
38
+
39
+ const client = new GitHubApi(options);
32
40
 
33
41
  client.authenticate({
34
42
  type: 'oauth',
@@ -61,12 +69,12 @@ const release = ({ version, tagName, repo, changelog = '', github }) => {
61
69
  return noop;
62
70
  }
63
71
 
64
- const { preRelease: prerelease, draft, token } = github;
72
+ const { preRelease: prerelease, draft, token, proxy } = github;
65
73
  const { owner, project } = repo;
66
74
  const host = github.host || repo.host;
67
75
  const tag_name = format(tagName, version);
68
76
  const name = format(github.releaseName, version);
69
- const githubClient = getGithubClient({ host, token });
77
+ const githubClient = getGithubClient({ host, token, proxy });
70
78
 
71
79
  return retry(
72
80
  async bail =>
package/lib/tasks.js CHANGED
@@ -21,13 +21,13 @@ const {
21
21
  } = require('./errors');
22
22
 
23
23
  const validateRepoState = async options => {
24
- const { requireCleanWorkingDir, requireUpstream, github, dist } = options;
24
+ const { requireCleanWorkingDir, requireUpstream, github, src, dist } = options;
25
25
 
26
26
  if (!(await git.isGitRepo())) {
27
27
  throw new GitRepoError();
28
28
  }
29
29
 
30
- const remoteUrl = await git.getRemoteUrl();
30
+ const remoteUrl = await git.getRemoteUrl(src.pushRepo);
31
31
  if (!remoteUrl) {
32
32
  throw new GitRemoteUrlError();
33
33
  }
@@ -150,7 +150,7 @@ module.exports = async options => {
150
150
  const tag = () => git.tag(version, tagName, tagAnnotation);
151
151
  const push = () =>
152
152
  git.push({
153
- pushUrl: src.pushRepo,
153
+ pushRepo: remoteUrl,
154
154
  hasUpstreamBranch: hasUpstream,
155
155
  args: src.pushArgs
156
156
  });
@@ -193,7 +193,7 @@ module.exports = async options => {
193
193
  const remoteUrl = await git.getRemoteUrl();
194
194
  const distRepo = repoPathParse(remoteUrl);
195
195
  const isSameRepo = git.isSameRepo(repo, distRepo);
196
- const shouldTag = (dist.tag && !isSameRepo) || (isSameRepo && tagName !== src.tagName);
196
+ const shouldTag = (dist.tag && !isSameRepo) || (isSameRepo && tagName !== src.tagName) || (dist.tag && !src.tag);
197
197
 
198
198
  _.defaults(github, options.github);
199
199
  _.defaults(npm, options.npm);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-it",
3
- "version": "7.5.0",
3
+ "version": "7.6.2",
4
4
  "description": "CLI release tool for Git repos and npm packages.",
5
5
  "keywords": [
6
6
  "build",
@@ -46,43 +46,43 @@
46
46
  },
47
47
  "license": "MIT",
48
48
  "dependencies": {
49
- "@octokit/rest": "15.9.5",
50
- "async-retry": "1.2.1",
49
+ "@octokit/rest": "15.13.1",
50
+ "async-retry": "1.2.3",
51
51
  "babel-preset-env": "1.7.0",
52
52
  "babel-register": "6.26.0",
53
53
  "bump-file": "1.0.0",
54
54
  "chalk": "2.4.1",
55
- "conventional-changelog": "2.0.1",
56
- "conventional-recommended-bump": "4.0.0",
55
+ "conventional-changelog": "2.0.3",
56
+ "conventional-recommended-bump": "4.0.1",
57
57
  "cpy": "7.0.1",
58
- "debug": "3.1.0",
58
+ "debug": "4.1.0",
59
59
  "globby": "8.0.1",
60
60
  "got": "8.3.2",
61
- "inquirer": "6.0.0",
62
- "is-ci": "1.1.0",
63
- "lodash": "4.17.10",
64
- "mime-types": "2.1.19",
61
+ "inquirer": "6.2.0",
62
+ "is-ci": "1.2.1",
63
+ "lodash": "4.17.11",
64
+ "mime-types": "2.1.20",
65
65
  "ora": "3.0.0",
66
66
  "os-name": "2.0.1",
67
67
  "parse-repo": "1.0.4",
68
- "semver": "5.5.0",
68
+ "semver": "5.6.0",
69
69
  "shelljs": "0.8.2",
70
- "supports-color": "5.4.0",
70
+ "supports-color": "5.5.0",
71
71
  "tmp-promise": "1.0.5",
72
72
  "update-notifier": "2.5.0",
73
73
  "uuid": "3.3.2",
74
74
  "window-size": "1.1.1",
75
- "yargs-parser": "10.1.0"
75
+ "yargs-parser": "11.0.0"
76
76
  },
77
77
  "devDependencies": {
78
- "eslint": "5.3.0",
79
- "eslint-config-prettier": "2.9.0",
80
- "eslint-plugin-prettier": "2.6.2",
78
+ "eslint": "5.7.0",
79
+ "eslint-config-prettier": "3.1.0",
80
+ "eslint-plugin-prettier": "3.0.0",
81
81
  "mock-stdio": "1.0.3",
82
- "nyc": "12.0.2",
83
- "prettier": "1.14.0",
84
- "proxyquire": "2.0.1",
85
- "sinon": "6.1.4",
82
+ "nyc": "13.1.0",
83
+ "prettier": "1.14.3",
84
+ "proxyquire": "2.1.0",
85
+ "sinon": "7.0.0",
86
86
  "tape": "4.9.1"
87
87
  },
88
88
  "engines": {