feat: new node binary date format (#827)

This commit is contained in:
elrrrrrrr
2025-09-04 21:55:14 -07:00
committed by GitHub
parent 3aa4c688b5
commit 13b2da0411
23 changed files with 142 additions and 29 deletions

View File

@@ -82,7 +82,7 @@ export class BucketBinary extends AbstractBinary {
let date = '-';
// root dir children, should set date to '2022-04-19T01:00:00Z', sync per hour
if (dir === '/') {
date = new Date().toISOString().split(':', 1)[0] + ':00:00Z';
date = `${new Date().toISOString().split(':', 1)[0]}:00:00Z`;
}
items.push({
name,

View File

@@ -1,6 +1,7 @@
import { basename } from 'node:path';
import { SingletonProto } from '@eggjs/tegg';
import binaries, { type BinaryName } from '../../../../config/binaries.js';
import dayjs from 'dayjs';
import { BinaryType } from '../../enum/Binary.js';
import {
AbstractBinary,
@@ -24,6 +25,7 @@ export class NodeBinary extends AbstractBinary {
const binaryConfig = binaries[binaryName];
const url = `${binaryConfig.distUrl}${dir}`;
const html = await this.requestXml(url);
// <a href="v9.8.0/">v9.8.0/</a> 08-Mar-2018 01:55 -
// <a href="v9.9.0/">v9.9.0/</a> 21-Mar-2018 15:47 -
// <a href="index.json">index.json</a> 17-Dec-2021 23:16 219862
@@ -38,8 +40,43 @@ export class NodeBinary extends AbstractBinary {
// <a href="/dist/v18.15.0/SHASUMS256.txt.asc">SHASUMS256.txt.asc</a> 04-Nov-2024 17:29 3.7 KB
// <a href="/dist/v18.15.0/SHASUMS256.txt.sig">SHASUMS256.txt.sig</a> 04-Nov-2024 17:29 310 B
// <a href="/dist/v18.15.0/SHASUMS256.txt">SHASUMS256.txt</a> 04-Nov-2024 17:29 3.2 KB
// <a href="/dist/latest-v20.x/SHASUMS256.txt.asc">SHASUMS256.txt.asc</a> 03 Sept 2025, 18:20 4.7 KB
// <a href="/dist/latest-v20.x/SHASUMS256.txt.sig">SHASUMS256.txt.sig</a> 03 Sept 2025, 18:20 566 B
// <a href="/dist/latest-v20.x/SHASUMS256.txt">SHASUMS256.txt</a> 03 Sept 2025, 18:19 3.8 KB
// <a href="/dist/latest-v20.x/node-v20.19.5-aix-ppc64.tar.gz">node-v20.19.5-aix-ppc64.tar.gz</a> 03 Sept 2025, 18:19 60 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-arm64.msi">node-v20.19.5-arm64.msi</a> 03 Sept 2025, 18:19 24 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-darwin-arm64.tar.gz">node-v20.19.5-darwin-arm64.tar.gz</a> 03 Sept 2025, 18:19 41 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-darwin-arm64.tar.xz">node-v20.19.5-darwin-arm64.tar.xz</a> 03 Sept 2025, 18:19 21 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-darwin-x64.tar.gz">node-v20.19.5-darwin-x64.tar.gz</a> 03 Sept 2025, 18:19 43 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-darwin-x64.tar.xz">node-v20.19.5-darwin-x64.tar.xz</a> 03 Sept 2025, 18:19 23 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-headers.tar.gz">node-v20.19.5-headers.tar.gz</a> 03 Sept 2025, 18:19 8.7 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-headers.tar.xz">node-v20.19.5-headers.tar.xz</a> 03 Sept 2025, 18:19 524 KB
// <a href="/dist/latest-v20.x/node-v20.19.5-linux-arm64.tar.gz">node-v20.19.5-linux-arm64.tar.gz</a> 03 Sept 2025, 18:19 47 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-linux-arm64.tar.xz">node-v20.19.5-linux-arm64.tar.xz</a> 03 Sept 2025, 18:19 25 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-linux-armv7l.tar.gz">node-v20.19.5-linux-armv7l.tar.gz</a> 03 Sept 2025, 18:19 43 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-linux-armv7l.tar.xz">node-v20.19.5-linux-armv7l.tar.xz</a> 03 Sept 2025, 18:19 22 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-linux-ppc64le.tar.gz">node-v20.19.5-linux-ppc64le.tar.gz</a> 03 Sept 2025, 18:19 49 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-linux-ppc64le.tar.xz">node-v20.19.5-linux-ppc64le.tar.xz</a> 03 Sept 2025, 18:19 26 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-linux-s390x.tar.gz">node-v20.19.5-linux-s390x.tar.gz</a> 03 Sept 2025, 18:19 47 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-linux-s390x.tar.xz">node-v20.19.5-linux-s390x.tar.xz</a> 03 Sept 2025, 18:19 25 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-linux-x64.tar.gz">node-v20.19.5-linux-x64.tar.gz</a> 03 Sept 2025, 18:19 47 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-linux-x64.tar.xz">node-v20.19.5-linux-x64.tar.xz</a> 03 Sept 2025, 18:19 26 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-win-arm64.7z">node-v20.19.5-win-arm64.7z</a> 03 Sept 2025, 18:19 17 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-win-arm64.zip">node-v20.19.5-win-arm64.zip</a> 03 Sept 2025, 18:19 26 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-win-x64.7z">node-v20.19.5-win-x64.7z</a> 03 Sept 2025, 18:19 19 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-win-x64.zip">node-v20.19.5-win-x64.zip</a> 03 Sept 2025, 18:19 30 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-win-x86.7z">node-v20.19.5-win-x86.7z</a> 03 Sept 2025, 18:19 18 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-win-x86.zip">node-v20.19.5-win-x86.zip</a> 03 Sept 2025, 18:19 28 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-x64.msi">node-v20.19.5-x64.msi</a> 03 Sept 2025, 18:19 27 MB
// <a href="/dist/latest-v20.x/node-v20.19.5-x86.msi">node-v20.19.5-x86.msi</a> 03 Sept 2025, 18:19 25 MB
// <a href="/dist/latest-v20.x/node-v20.19.5.pkg">node-v20.19.5.pkg</a> 03 Sept 2025, 18:19 72 MB
// <a href="/dist/latest-v20.x/node-v20.19.5.tar.gz">node-v20.19.5.tar.gz</a> 03 Sept 2025, 18:19 89 MB
// <a href="/dist/latest-v20.x/node-v20.19.5.tar.xz">node-v20.19.5.tar.xz</a> 03 Sept 2025, 18:19 43 MB
// date format: 19-Jan-2020 06:07 or 03 Sept 2025, 18:19
const re =
/<a href="([^"]+?)"[^>]*?>[^<]+?<\/a>\s+?((?:[\w-]+? \w{2}:\d{2})|-)\s+?([\d.\-\s\w]+)/gi;
/<a href="([^"]+?)"[^>]*?>[^<]+?<\/a>\s+?((?:[\w-]+? \w{2}:\d{2})|(?:\d{2} [A-Za-z]{3,9} \d{4}, \d{2}:\d{2})|-)\s+?([\d.\-\s\w]+)/gi;
const matchs = html.matchAll(re);
const items: BinaryItem[] = [];
for (const m of matchs) {
@@ -50,7 +87,7 @@ export class NodeBinary extends AbstractBinary {
name = basename(name);
}
const fileUrl = isDir ? '' : `${url}${name}`;
const date = m[2];
const date = m[2] === '-' ? '-' : dayjs(m[2]).format('DD-MMM-YYYY HH:mm');
const size = m[3].trim();
if (size === '0') continue;
if (binaryConfig.ignoreFiles?.includes(`${dir}${name}`)) continue;

View File

@@ -429,6 +429,7 @@ export class PlaywrightBinary extends AbstractBinary {
// },
// ]
browsers.push(...data.browsers);
return data;
})
.catch(err => {
/* c8 ignore next 2 */

View File

@@ -56,9 +56,9 @@ export class PuppeteerBinary extends AbstractBinary {
this.dirItems[`/${platform}/`] = [];
let i = 0;
do {
let requestUrl = s3Url + '?prefix=' + platform + '&max-keys=100';
let requestUrl = `${s3Url}?prefix=${platform}&max-keys=100`;
if (marker) {
requestUrl += '&marker=' + marker;
requestUrl += `&marker=${marker}`;
}
const xml = await this.requestXml(requestUrl);
const parser = new XMLParser();

View File

@@ -70,7 +70,7 @@ export class CnpmjsorgChangesStream extends AbstractChangeStream {
if (data.results?.length > 0) {
for (const change of data.results) {
const seq = new Date(change.gmt_modified).getTime() + '';
const seq = `${new Date(change.gmt_modified).getTime()}`;
const fullname = change.id;
if (seq && fullname && seq !== since) {
const change = {

View File

@@ -92,7 +92,7 @@ export class CreateHookTriggerService extends AbstractService {
`[${isoNow()}][Hooks] create trigger succeed \n`
);
} catch (e) {
e.message = 'create trigger failed: ' + e.message;
e.message = `create trigger failed: ${e.message}`;
await this.taskService.finishTask(
task,
TaskState.Fail,

View File

@@ -66,7 +66,7 @@ export class HookTriggerService {
`[${isoNow()}][TriggerHooks] trigger hook succeed ${status} \n`
);
} catch (e) {
e.message = 'trigger hook failed: ' + e.message;
e.message = `trigger hook failed: ${e.message}`;
task.error = e.message;
await this.taskService.finishTask(
task,

View File

@@ -278,7 +278,7 @@ export class PackageVersionFileService extends AbstractService {
onentry: (entry: unknown) => {
const filename = this.#formatTarEntryFilename(entry);
if (!filename) return;
paths.push('/' + filename);
paths.push(`/${filename}`);
if (this.#matchReadmeFilename(filename)) {
readmeFilenames.push(filename);
}

View File

@@ -240,7 +240,7 @@ export class TaskService extends AbstractService {
try {
const nextPosition = await this.nfsAdapter.appendBytes(
task.logPath,
Buffer.from(appendLog + '\n'),
Buffer.from(`${appendLog}\n`),
task.logStorePosition,
{
'Content-Type': 'text/plain; charset=utf-8',
@@ -259,7 +259,7 @@ export class TaskService extends AbstractService {
// override exists log file
await this.nfsAdapter.uploadBytes(
task.logPath,
Buffer.from(appendLog + '\n')
Buffer.from(`${appendLog}\n`)
);
return;
}

View File

@@ -43,7 +43,7 @@ export class DownloadController extends AbstractController {
const versions: Record<string, { day: string; downloads: number }[]> = {};
for (const entity of entities) {
const yearMonth = String(entity.yearMonth);
const prefix = yearMonth.slice(0, 4) + '-' + yearMonth.slice(4, 6);
const prefix = `${yearMonth.slice(0, 4)}-${yearMonth.slice(4, 6)}`;
for (let i = 1; i <= 31; i++) {
const day = String(i).padStart(2, '0');
const field = `d${day}` as keyof typeof entity;
@@ -87,7 +87,7 @@ export class DownloadController extends AbstractController {
const days: Record<string, number> = {};
for (const entity of entities) {
const yearMonth = String(entity.yearMonth);
const prefix = yearMonth.slice(0, 4) + '-' + yearMonth.slice(4, 6);
const prefix = `${yearMonth.slice(0, 4)}-${yearMonth.slice(4, 6)}`;
for (let i = 1; i <= 31; i++) {
const day = String(i).padStart(2, '0');
const field = `d${day}` as keyof typeof entity;

View File

@@ -39,8 +39,7 @@ export class ProxyCacheRepository extends AbstractRepository {
this.ProxyCache
);
} catch (e) {
e.message =
'[ProxyCacheRepository] insert ProxyCache failed: ' + e.message;
e.message = `[ProxyCacheRepository] insert ProxyCache failed: ${e.message}`;
throw e;
}
}

View File

@@ -33,7 +33,7 @@ export class TaskRepository extends AbstractRepository {
try {
await ModelConvertor.convertEntityToModel(task, this.Task);
} catch (e) {
e.message = '[TaskRepository] insert Task failed: ' + e.message;
e.message = `[TaskRepository] insert Task failed: ${e.message}`;
if (isDuplicateKeyError(e)) {
this.logger.warn(e);
const taskModel = await this.Task.findOne({ bizId: task.bizId });

View File

@@ -10,7 +10,7 @@ describe('test/common/UserUtil.test.ts', () => {
assert.match(token, /cnpm_\w{31,33}_\w{4,6}/);
assert.ok(checkToken(token, 'cnpm'));
assert.ok(!checkToken(token, 'npm'));
assert.ok(!checkToken(token + 'a', 'cnpm'));
assert.ok(!checkToken(`${token}a`, 'cnpm'));
}
});
});

View File

@@ -81,6 +81,42 @@ describe('test/common/adapter/binary/NodeBinary.test.ts', () => {
assert.ok(matchFile);
});
it('should fetch subdir: /v20.19.5/ work', async () => {
app.mockHttpclient('https://nodejs.org/dist/v20.19.5/', 'GET', {
data: await TestUtil.readFixturesFile(
'nodejs.org/site/v20.19.5/index.html'
),
});
const result = await binary.fetch('/v20.19.5/', 'node');
assert.ok(result);
assert.ok(result.items.length > 0);
let matchDir = false;
let matchFile = false;
for (const item of result.items) {
if (item.name === 'docs/') {
assert.ok(item.date === '-');
assert.ok(item.isDir === true);
assert.ok(item.size === '-');
matchDir = true;
}
if (item.name === 'SHASUMS256.txt') {
assert.ok(item.date === '03-Sep-2025 18:19');
assert.ok(item.isDir === false);
assert.ok(item.size === '3.8 KB');
assert.ok(
item.url === 'https://nodejs.org/dist/v20.19.5/SHASUMS256.txt'
);
matchFile = true;
}
if (!item.isDir) {
assert.ok(typeof item.size === 'string');
assert.ok(item.size.length > 2);
}
}
assert.ok(matchDir);
assert.ok(matchFile);
});
it('should fetch subdir: /v18.15.0/ work', async () => {
app.mockHttpclient('https://nodejs.org/dist/v18.15.0/', 'GET', {
data: await TestUtil.readFixturesFile(

View File

@@ -2166,7 +2166,7 @@ describe('test/core/service/PackageSyncerService/executeTask.test.ts', () => {
mock(app.config.cnpmcore, 'taskQueueHighWaterSize', 1);
const name = 'cnpmcore-test-sync-deprecated';
await packageSyncerService.createTask(name);
await packageSyncerService.createTask(name + '-foo');
await packageSyncerService.createTask(`${name}-foo`);
const task = await packageSyncerService.findExecuteTask();
assert.ok(task);
assert.equal(task.targetName, name);

View File

@@ -0,0 +1,40 @@
<!DOCTYPE html><html><head><title>Index of /dist/latest-v20.x/</title><style>@media (prefers-color-scheme:dark){body{color:#fff;background-color:#1c1b22}a{color:#3391ff}a:visited{color:#c63b65}}</style></head><body><h1>Index of /dist/latest-v20.x/</h1><hr><pre>
<a href="../">../</a>
<a href="docs/">docs/</a> - -
<a href="win-arm64/">win-arm64/</a> - -
<a href="win-x64/">win-x64/</a> - -
<a href="win-x86/">win-x86/</a> - -
<a href="/dist/latest-v20.x/SHASUMS256.txt.asc">SHASUMS256.txt.asc</a> 03 Sept 2025, 18:20 4.7 KB
<a href="/dist/latest-v20.x/SHASUMS256.txt.sig">SHASUMS256.txt.sig</a> 03 Sept 2025, 18:20 566 B
<a href="/dist/latest-v20.x/SHASUMS256.txt">SHASUMS256.txt</a> 03 Sept 2025, 18:19 3.8 KB
<a href="/dist/latest-v20.x/node-v20.19.5-aix-ppc64.tar.gz">node-v20.19.5-aix-ppc64.tar.gz</a> 03 Sept 2025, 18:19 60 MB
<a href="/dist/latest-v20.x/node-v20.19.5-arm64.msi">node-v20.19.5-arm64.msi</a> 03 Sept 2025, 18:19 24 MB
<a href="/dist/latest-v20.x/node-v20.19.5-darwin-arm64.tar.gz">node-v20.19.5-darwin-arm64.tar.gz</a> 03 Sept 2025, 18:19 41 MB
<a href="/dist/latest-v20.x/node-v20.19.5-darwin-arm64.tar.xz">node-v20.19.5-darwin-arm64.tar.xz</a> 03 Sept 2025, 18:19 21 MB
<a href="/dist/latest-v20.x/node-v20.19.5-darwin-x64.tar.gz">node-v20.19.5-darwin-x64.tar.gz</a> 03 Sept 2025, 18:19 43 MB
<a href="/dist/latest-v20.x/node-v20.19.5-darwin-x64.tar.xz">node-v20.19.5-darwin-x64.tar.xz</a> 03 Sept 2025, 18:19 23 MB
<a href="/dist/latest-v20.x/node-v20.19.5-headers.tar.gz">node-v20.19.5-headers.tar.gz</a> 03 Sept 2025, 18:19 8.7 MB
<a href="/dist/latest-v20.x/node-v20.19.5-headers.tar.xz">node-v20.19.5-headers.tar.xz</a> 03 Sept 2025, 18:19 524 KB
<a href="/dist/latest-v20.x/node-v20.19.5-linux-arm64.tar.gz">node-v20.19.5-linux-arm64.tar.gz</a> 03 Sept 2025, 18:19 47 MB
<a href="/dist/latest-v20.x/node-v20.19.5-linux-arm64.tar.xz">node-v20.19.5-linux-arm64.tar.xz</a> 03 Sept 2025, 18:19 25 MB
<a href="/dist/latest-v20.x/node-v20.19.5-linux-armv7l.tar.gz">node-v20.19.5-linux-armv7l.tar.gz</a> 03 Sept 2025, 18:19 43 MB
<a href="/dist/latest-v20.x/node-v20.19.5-linux-armv7l.tar.xz">node-v20.19.5-linux-armv7l.tar.xz</a> 03 Sept 2025, 18:19 22 MB
<a href="/dist/latest-v20.x/node-v20.19.5-linux-ppc64le.tar.gz">node-v20.19.5-linux-ppc64le.tar.gz</a> 03 Sept 2025, 18:19 49 MB
<a href="/dist/latest-v20.x/node-v20.19.5-linux-ppc64le.tar.xz">node-v20.19.5-linux-ppc64le.tar.xz</a> 03 Sept 2025, 18:19 26 MB
<a href="/dist/latest-v20.x/node-v20.19.5-linux-s390x.tar.gz">node-v20.19.5-linux-s390x.tar.gz</a> 03 Sept 2025, 18:19 47 MB
<a href="/dist/latest-v20.x/node-v20.19.5-linux-s390x.tar.xz">node-v20.19.5-linux-s390x.tar.xz</a> 03 Sept 2025, 18:19 25 MB
<a href="/dist/latest-v20.x/node-v20.19.5-linux-x64.tar.gz">node-v20.19.5-linux-x64.tar.gz</a> 03 Sept 2025, 18:19 47 MB
<a href="/dist/latest-v20.x/node-v20.19.5-linux-x64.tar.xz">node-v20.19.5-linux-x64.tar.xz</a> 03 Sept 2025, 18:19 26 MB
<a href="/dist/latest-v20.x/node-v20.19.5-win-arm64.7z">node-v20.19.5-win-arm64.7z</a> 03 Sept 2025, 18:19 17 MB
<a href="/dist/latest-v20.x/node-v20.19.5-win-arm64.zip">node-v20.19.5-win-arm64.zip</a> 03 Sept 2025, 18:19 26 MB
<a href="/dist/latest-v20.x/node-v20.19.5-win-x64.7z">node-v20.19.5-win-x64.7z</a> 03 Sept 2025, 18:19 19 MB
<a href="/dist/latest-v20.x/node-v20.19.5-win-x64.zip">node-v20.19.5-win-x64.zip</a> 03 Sept 2025, 18:19 30 MB
<a href="/dist/latest-v20.x/node-v20.19.5-win-x86.7z">node-v20.19.5-win-x86.7z</a> 03 Sept 2025, 18:19 18 MB
<a href="/dist/latest-v20.x/node-v20.19.5-win-x86.zip">node-v20.19.5-win-x86.zip</a> 03 Sept 2025, 18:19 28 MB
<a href="/dist/latest-v20.x/node-v20.19.5-x64.msi">node-v20.19.5-x64.msi</a> 03 Sept 2025, 18:19 27 MB
<a href="/dist/latest-v20.x/node-v20.19.5-x86.msi">node-v20.19.5-x86.msi</a> 03 Sept 2025, 18:19 25 MB
<a href="/dist/latest-v20.x/node-v20.19.5.pkg">node-v20.19.5.pkg</a> 03 Sept 2025, 18:19 72 MB
<a href="/dist/latest-v20.x/node-v20.19.5.tar.gz">node-v20.19.5.tar.gz</a> 03 Sept 2025, 18:19 89 MB
<a href="/dist/latest-v20.x/node-v20.19.5.tar.xz">node-v20.19.5.tar.xz</a> 03 Sept 2025, 18:19 43 MB
</pre><hr></body></html>

View File

@@ -221,7 +221,7 @@ describe('test/port/controller/TokenController/createToken.test.ts', () => {
res = await app
.httpRequest()
.get('/-/npm/v1/tokens')
.set('authorization', 'Bearer ' + res.body.token);
.set('authorization', `Bearer ${res.body.token}`);
assert.ok(res.body.objects.length > 0);
assert.ok(

View File

@@ -35,7 +35,7 @@ describe('test/port/controller/UserController/logout.test.ts', () => {
let res = await app
.httpRequest()
.delete('/-/user/token/invalid-token-value')
.set('authorization', user.authorization + 'foo')
.set('authorization', `${user.authorization}foo`)
.expect(200);
assert.equal(res.body.ok, false);
res = await app

View File

@@ -10,7 +10,7 @@ describe('test/port/controller/UserController/showProfile.test.ts', () => {
let res = await app
.httpRequest()
.get('/-/npm/v1/user')
.set('authorization', authorization + 'wrong');
.set('authorization', `${authorization}wrong`);
assert.ok(res.status === 401);
assert.ok(res.body.error === '[UNAUTHORIZED] Invalid token');

View File

@@ -368,7 +368,7 @@ describe('test/port/controller/package/DownloadPackageVersionTarController.test.
const res = await app
.httpRequest()
.get('/lodash/-/lodash-1.404.404.tgz')
.set('user-agent', publisher.ua + ' node/16.0.0')
.set('user-agent', `${publisher.ua} node/16.0.0`)
.set('Accept', 'application/vnd.npm.install-v1+json');
assert.ok(res.status === 404);
app.notExpectLog(
@@ -383,7 +383,7 @@ describe('test/port/controller/package/DownloadPackageVersionTarController.test.
const res = await app
.httpRequest()
.get('/lodash/-/lodash-1.404.404.tgz')
.set('user-agent', publisher.ua + ' node/16.0.0')
.set('user-agent', `${publisher.ua} node/16.0.0`)
.set('Accept', 'application/vnd.npm.install-v1+json');
assert.ok(res.status === 404);
app.expectLog(
@@ -407,7 +407,7 @@ describe('test/port/controller/package/DownloadPackageVersionTarController.test.
const res = await app
.httpRequest()
.get('/foobar/-/foobar-1.0.0.tgz')
.set('user-agent', publisher.ua + ' node/16.0.0')
.set('user-agent', `${publisher.ua} node/16.0.0`)
.set('Accept', 'application/vnd.npm.install-v1+json');
assert.ok(res.status === 200);
// run in background

View File

@@ -991,7 +991,7 @@ describe('test/port/controller/package/ShowPackageController.test.ts', () => {
const res = await app
.httpRequest()
.get('/lodash')
.set('user-agent', publisher.ua + ' node/16.0.0')
.set('user-agent', `${publisher.ua} node/16.0.0`)
.set('Accept', 'application/vnd.npm.install-v1+json');
assert.ok(res.status === 404);
// app.expectLog('[middleware:ErrorHandler][syncPackage] create sync package');
@@ -1004,7 +1004,7 @@ describe('test/port/controller/package/ShowPackageController.test.ts', () => {
const res = await app
.httpRequest()
.get('/egg')
.set('user-agent', publisher.ua + ' node/16.0.0')
.set('user-agent', `${publisher.ua} node/16.0.0`)
.set('Accept', 'application/vnd.npm.install-v1+json');
assert.ok(res.status === 302);
assert.ok(res.headers.location === 'https://registry.npmjs.org/egg');
@@ -1023,7 +1023,7 @@ describe('test/port/controller/package/ShowPackageController.test.ts', () => {
const res = await app
.httpRequest()
.get('/foobar')
.set('user-agent', publisher.ua + ' node/16.0.0')
.set('user-agent', `${publisher.ua} node/16.0.0`)
.set('Accept', 'application/vnd.npm.install-v1+json');
assert.ok(res.status === 200);
assert.ok(res.body.description === 'cnpmcore mock json');

View File

@@ -433,7 +433,7 @@ describe('test/port/controller/package/ShowPackageVersionController.test.ts', ()
const res = await app
.httpRequest()
.get('/foobar/1.0.0')
.set('user-agent', publisher.ua + ' node/16.0.0')
.set('user-agent', `${publisher.ua} node/16.0.0`)
.set('Accept', 'application/vnd.npm.install-v1+json');
assert.ok(res.status === 200);
assert.ok(res.body.dist.tarball.includes(app.config.cnpmcore.registry));

View File

@@ -23,7 +23,7 @@ describe('test/repository/ChangeRepository.test.ts', () => {
change.type = 'add';
change.targetName = 'test';
change.data = {};
change.changeId = 'change_id_' + i;
change.changeId = `change_id_${i}`;
await change.save();
}
});