release-it 18.0.0-next.0 → 18.0.0-next.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/lib/config.js +1 -1
- package/lib/plugin/github/util.js +4 -2
- package/package.json +12 -12
- package/test/config.js +1 -1
- package/test/github.js +23 -0
package/lib/config.js
CHANGED
|
@@ -2,7 +2,7 @@ import util from 'node:util';
|
|
|
2
2
|
import { cosmiconfigSync } from 'cosmiconfig';
|
|
3
3
|
import parseToml from '@iarna/toml/parse-string.js';
|
|
4
4
|
import _ from 'lodash';
|
|
5
|
-
import isCI from '
|
|
5
|
+
import { isCI } from 'ci-info';
|
|
6
6
|
import { readJSON, getSystemInfo } from './util.js';
|
|
7
7
|
|
|
8
8
|
const debug = util.debug('release-it:config');
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// Totally much borrowed from https://github.com/semantic-release/github/blob/master/lib/success.js
|
|
2
2
|
import issueParser from 'issue-parser';
|
|
3
3
|
|
|
4
|
-
const getSearchQueries = (base, commits, separator = '+') => {
|
|
4
|
+
export const getSearchQueries = (base, commits, separator = '+') => {
|
|
5
|
+
const encodedSeparator = encodeURIComponent(separator);
|
|
6
|
+
|
|
5
7
|
return commits.reduce((searches, commit) => {
|
|
6
8
|
const lastSearch = searches[searches.length - 1];
|
|
7
|
-
if (lastSearch && lastSearch.length + commit.length <= 256 -
|
|
9
|
+
if (lastSearch && encodeURIComponent(lastSearch).length + commit.length <= 256 - encodedSeparator.length) {
|
|
8
10
|
searches[searches.length - 1] = `${lastSearch}${separator}${commit}`;
|
|
9
11
|
} else {
|
|
10
12
|
searches.push(`${base}${separator}${commit}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-it",
|
|
3
|
-
"version": "18.0.0-next.
|
|
3
|
+
"version": "18.0.0-next.2",
|
|
4
4
|
"description": "Generic CLI tool to automate versioning and package publishing-related tasks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"build",
|
|
@@ -82,23 +82,23 @@
|
|
|
82
82
|
"@octokit/rest": "21.0.2",
|
|
83
83
|
"async-retry": "1.3.3",
|
|
84
84
|
"chalk": "5.3.0",
|
|
85
|
+
"ci-info": "^4.0.0",
|
|
85
86
|
"cosmiconfig": "9.0.0",
|
|
86
87
|
"execa": "9.3.1",
|
|
87
88
|
"git-url-parse": "15.0.0",
|
|
88
89
|
"globby": "14.0.2",
|
|
89
|
-
"inquirer": "10.
|
|
90
|
-
"is-ci": "3.0.1",
|
|
90
|
+
"inquirer": "10.2.2",
|
|
91
91
|
"issue-parser": "7.0.1",
|
|
92
92
|
"lodash": "4.17.21",
|
|
93
93
|
"mime-types": "2.1.35",
|
|
94
94
|
"new-github-release-url": "2.0.0",
|
|
95
95
|
"open": "10.1.0",
|
|
96
|
-
"ora": "8.0
|
|
96
|
+
"ora": "8.1.0",
|
|
97
97
|
"os-name": "6.0.0",
|
|
98
98
|
"proxy-agent": "6.4.0",
|
|
99
99
|
"semver": "7.6.3",
|
|
100
100
|
"shelljs": "0.8.5",
|
|
101
|
-
"update-notifier": "7.
|
|
101
|
+
"update-notifier": "7.3.1",
|
|
102
102
|
"url-join": "5.0.0",
|
|
103
103
|
"wildcard-match": "5.1.3",
|
|
104
104
|
"yargs-parser": "21.1.1"
|
|
@@ -106,28 +106,28 @@
|
|
|
106
106
|
"devDependencies": {
|
|
107
107
|
"@eslint/compat": "1.1.1",
|
|
108
108
|
"@eslint/eslintrc": "3.1.0",
|
|
109
|
-
"@eslint/js": "9.
|
|
109
|
+
"@eslint/js": "9.10.0",
|
|
110
110
|
"@octokit/request-error": "6.1.4",
|
|
111
|
-
"@types/node": "
|
|
111
|
+
"@types/node": "22.5.4",
|
|
112
112
|
"ava": "6.1.3",
|
|
113
|
-
"eslint": "9.
|
|
113
|
+
"eslint": "9.10.0",
|
|
114
114
|
"eslint-config-prettier": "9.1.0",
|
|
115
115
|
"eslint-plugin-ava": "15.0.1",
|
|
116
|
-
"eslint-plugin-import-x": "
|
|
116
|
+
"eslint-plugin-import-x": "4.2.1",
|
|
117
117
|
"eslint-plugin-prettier": "5.2.1",
|
|
118
118
|
"fs-monkey": "1.0.6",
|
|
119
119
|
"globals": "15.9.0",
|
|
120
120
|
"installed-check": "9.3.0",
|
|
121
|
-
"knip": "5.
|
|
121
|
+
"knip": "5.30.1",
|
|
122
122
|
"memfs": "4.11.1",
|
|
123
123
|
"mock-stdio": "1.0.3",
|
|
124
124
|
"nock": "14.0.0-beta.8",
|
|
125
125
|
"prettier": "3.3.3",
|
|
126
126
|
"remark-cli": "12.0.1",
|
|
127
127
|
"remark-preset-webpro": "1.1.0",
|
|
128
|
-
"sinon": "
|
|
128
|
+
"sinon": "19.0.0",
|
|
129
129
|
"strip-ansi": "7.1.0",
|
|
130
|
-
"typescript": "5.
|
|
130
|
+
"typescript": "5.6.2"
|
|
131
131
|
},
|
|
132
132
|
"overrides": {
|
|
133
133
|
"pac-resolver": "7.0.1",
|
package/test/config.js
CHANGED
package/test/github.js
CHANGED
|
@@ -2,6 +2,7 @@ import test from 'ava';
|
|
|
2
2
|
import sinon from 'sinon';
|
|
3
3
|
import { RequestError } from '@octokit/request-error';
|
|
4
4
|
import GitHub from '../lib/plugin/github/GitHub.js';
|
|
5
|
+
import { getSearchQueries } from '../lib/plugin/github/util.js';
|
|
5
6
|
import { factory, runTasks } from './util/index.js';
|
|
6
7
|
import {
|
|
7
8
|
interceptAuthentication,
|
|
@@ -485,3 +486,25 @@ test.skip('should truncate long body', async t => {
|
|
|
485
486
|
t.is(releaseUrl, 'https://github.com/user/repo/releases/tag/2.0.2');
|
|
486
487
|
exec.restore();
|
|
487
488
|
});
|
|
489
|
+
|
|
490
|
+
test('should generate search queries correctly', t => {
|
|
491
|
+
const generateCommit = () => Math.random().toString(36).substring(2, 9);
|
|
492
|
+
const base = 'repo:owner/repo+type:pr+is:merged';
|
|
493
|
+
const commits = Array.from({ length: 5 }, generateCommit);
|
|
494
|
+
const separator = '+';
|
|
495
|
+
|
|
496
|
+
const result = getSearchQueries(base, commits, separator);
|
|
497
|
+
|
|
498
|
+
// Test case 1: Check if all commits are included in the search queries
|
|
499
|
+
const allCommitsIncluded = commits.every(commit => result.some(query => query.includes(commit)));
|
|
500
|
+
t.true(allCommitsIncluded, 'All commits should be included in the search queries');
|
|
501
|
+
|
|
502
|
+
// Test case 2: Check if the function respects the 256 character limit
|
|
503
|
+
const manyCommits = Array.from({ length: 100 }, generateCommit);
|
|
504
|
+
const longResult = getSearchQueries(base, manyCommits, separator);
|
|
505
|
+
t.true(longResult.length > 1, 'Many commits should be split into multiple queries');
|
|
506
|
+
t.true(
|
|
507
|
+
longResult.every(query => encodeURIComponent(query).length <= 256),
|
|
508
|
+
'Each query should not exceed 256 characters after encoding'
|
|
509
|
+
);
|
|
510
|
+
});
|