release-it 15.4.0 → 15.4.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.
@@ -286,7 +286,7 @@ class GitHub extends Release {
286
286
 
287
287
  this.log.exec('octokit repos.uploadReleaseAssets', patterns, { isDryRun });
288
288
 
289
- if (!assets || !isReleased || isDryRun) {
289
+ if (!assets || !isReleased) {
290
290
  return true;
291
291
  }
292
292
 
@@ -294,6 +294,9 @@ class GitHub extends Release {
294
294
  if (!files.length) {
295
295
  this.log.warn(`octokit repos.uploadReleaseAssets: did not find "${assets}" relative to ${process.cwd()}`);
296
296
  }
297
+
298
+ if (isDryRun) return Promise.resolve();
299
+
297
300
  return Promise.all(files.map(filePath => this.uploadAsset(filePath)));
298
301
  });
299
302
  }
@@ -257,7 +257,7 @@ class GitLab extends Release {
257
257
 
258
258
  this.log.exec('gitlab releases#uploadAssets', patterns, { isDryRun });
259
259
 
260
- if (!assets || isDryRun) {
260
+ if (!assets) {
261
261
  return noop;
262
262
  }
263
263
 
@@ -265,6 +265,9 @@ class GitLab extends Release {
265
265
  if (!files.length) {
266
266
  this.log.warn(`gitlab releases#uploadAssets: could not find "${assets}" relative to ${process.cwd()}`);
267
267
  }
268
+
269
+ if (isDryRun) return Promise.resolve();
270
+
268
271
  return Promise.all(files.map(filePath => this.uploadAsset(filePath)));
269
272
  });
270
273
  }
package/lib/util.js CHANGED
@@ -48,7 +48,10 @@ const rejectAfter = (ms, error) =>
48
48
 
49
49
  const parseGitUrl = remoteUrl => {
50
50
  if (!remoteUrl) return { host: null, owner: null, project: null, protocol: null, remote: null, repository: null };
51
- const normalizedUrl = (remoteUrl || '').replace(/^[A-Z]:/, '').replace(/\\/g, '/'); // Hacky workaround for file protocol in Windows
51
+ const normalizedUrl = (remoteUrl || '')
52
+ .replace(/^[A-Z]:\\\\/, 'file://') // Assume file protocol for Windows drive letters
53
+ .replace(/^\//, 'file://') // Assume file protocol if only /path is given
54
+ .replace(/\\+/g, '/'); // Replace forward with backslashes
52
55
  const parsedUrl = gitUrlParse(normalizedUrl);
53
56
  const { resource: host, name: project, protocol, href: remote } = parsedUrl;
54
57
  const owner = protocol === 'file' ? _.last(parsedUrl.owner.split('/')) : parsedUrl.owner; // Fix owner for file protocol
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-it",
3
- "version": "15.4.0",
3
+ "version": "15.4.2",
4
4
  "description": "Generic CLI tool to automate versioning and package publishing related tasks.",
5
5
  "keywords": [
6
6
  "build",
@@ -60,16 +60,16 @@
60
60
  "license": "MIT",
61
61
  "dependencies": {
62
62
  "@iarna/toml": "2.2.5",
63
- "@octokit/rest": "19.0.3",
63
+ "@octokit/rest": "19.0.4",
64
64
  "async-retry": "1.3.3",
65
65
  "chalk": "5.0.1",
66
66
  "cosmiconfig": "7.0.1",
67
67
  "execa": "6.1.0",
68
68
  "form-data": "4.0.0",
69
- "git-url-parse": "12.0.0",
69
+ "git-url-parse": "13.0.0",
70
70
  "globby": "13.1.2",
71
- "got": "12.3.1",
72
- "inquirer": "9.1.0",
71
+ "got": "12.4.1",
72
+ "inquirer": "9.1.1",
73
73
  "is-ci": "3.0.1",
74
74
  "lodash": "4.17.21",
75
75
  "mime-types": "2.1.35",
@@ -88,9 +88,9 @@
88
88
  "yargs-parser": "21.1.1"
89
89
  },
90
90
  "devDependencies": {
91
- "@octokit/request-error": "3.0.0",
92
- "ava": "4.3.1",
93
- "eslint": "8.21.0",
91
+ "@octokit/request-error": "3.0.1",
92
+ "ava": "4.3.3",
93
+ "eslint": "8.23.1",
94
94
  "eslint-config-prettier": "8.5.0",
95
95
  "eslint-plugin-ava": "13.2.0",
96
96
  "eslint-plugin-import": "2.26.0",
package/test/git.js CHANGED
@@ -274,7 +274,7 @@ test.serial('should reset files', async t => {
274
274
 
275
275
  test.serial('should roll back when cancelled', async t => {
276
276
  sh.exec('git init');
277
- sh.exec(`git remote add origin foo`);
277
+ sh.exec(`git remote add origin file://foo`);
278
278
  const version = '1.2.3';
279
279
  gitAdd(`{"version":"${version}"}`, 'package.json', 'Add package.json');
280
280
  const options = { git: { requireCleanWorkingDir: true, commit: true, tag: true, tagName: 'v${version}' } };
package/test/utils.js CHANGED
@@ -47,12 +47,39 @@ test('parseGitUrl', t => {
47
47
  repository: 'org/sub-group/repo-in-sub-group'
48
48
  });
49
49
 
50
+ t.deepEqual(parseGitUrl('git@github.com:org/example.com.git'), {
51
+ host: 'github.com',
52
+ owner: 'org',
53
+ project: 'example.com',
54
+ protocol: 'ssh',
55
+ remote: 'git@github.com:org/example.com.git',
56
+ repository: 'org/example.com'
57
+ });
58
+
59
+ t.deepEqual(parseGitUrl('file://Users/john/doe/owner/project'), {
60
+ host: 'users',
61
+ owner: 'owner',
62
+ project: 'project',
63
+ protocol: 'file',
64
+ remote: 'file://users/john/doe/owner/project',
65
+ repository: 'owner/project'
66
+ });
67
+
50
68
  t.deepEqual(parseGitUrl('/Users/john/doe/owner/project'), {
51
- host: '',
69
+ host: 'users',
70
+ owner: 'owner',
71
+ project: 'project',
72
+ protocol: 'file',
73
+ remote: 'file://users/john/doe/owner/project',
74
+ repository: 'owner/project'
75
+ });
76
+
77
+ t.deepEqual(parseGitUrl('C:\\\\Users\\john\\doe\\owner\\project'), {
78
+ host: 'users',
52
79
  owner: 'owner',
53
80
  project: 'project',
54
81
  protocol: 'file',
55
- remote: '/Users/john/doe/owner/project',
82
+ remote: 'file://users/john/doe/owner/project',
56
83
  repository: 'owner/project'
57
84
  });
58
85
  });