mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
feat!: drop node 8 and node 10 (#2142)
There is no breaking changes on features aside of Node version
This commit is contained in:
parent
4f3afa33a2
commit
43f70437af
8 changed files with 42 additions and 98 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -9,7 +9,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
node_version: [10, 12, 14, 15]
|
node_version: [12, 14, 15]
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
|
20
.github/workflows/e2e-jest-workflow.yml
vendored
20
.github/workflows/e2e-jest-workflow.yml
vendored
|
@ -14,10 +14,10 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.3.3
|
- uses: actions/checkout@v2.3.3
|
||||||
|
|
||||||
- name: 'Use Node.js 10.x'
|
- name: 'Use Node.js 12.x'
|
||||||
uses: actions/setup-node@v2.1.5
|
uses: actions/setup-node@v2.1.5
|
||||||
with:
|
with:
|
||||||
node-version: 10.x
|
node-version: 12.x
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: yarn install
|
run: yarn install
|
||||||
- name: 'Run verdaccio in the background'
|
- name: 'Run verdaccio in the background'
|
||||||
|
@ -45,10 +45,10 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.3.3
|
- uses: actions/checkout@v2.3.3
|
||||||
|
|
||||||
- name: 'Use Node.js 10.x'
|
- name: 'Use Node.js 12.x'
|
||||||
uses: actions/setup-node@v2.1.5
|
uses: actions/setup-node@v2.1.5
|
||||||
with:
|
with:
|
||||||
node-version: 10.x
|
node-version: 12.x
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: yarn install
|
run: yarn install
|
||||||
- name: 'Run verdaccio in the background'
|
- name: 'Run verdaccio in the background'
|
||||||
|
@ -79,10 +79,10 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.3.3
|
- uses: actions/checkout@v2.3.3
|
||||||
|
|
||||||
- name: 'Use Node.js 10.x'
|
- name: 'Use Node.js 12.x'
|
||||||
uses: actions/setup-node@v2.1.5
|
uses: actions/setup-node@v2.1.5
|
||||||
with:
|
with:
|
||||||
node-version: 10.x
|
node-version: 12.x
|
||||||
- name: 'install latest npm'
|
- name: 'install latest npm'
|
||||||
run: npm i -g npm@latest-6
|
run: npm i -g npm@latest-6
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
|
@ -112,10 +112,10 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.3.3
|
- uses: actions/checkout@v2.3.3
|
||||||
|
|
||||||
- name: 'Use Node.js 10.x'
|
- name: 'Use Node.js 12.x'
|
||||||
uses: actions/setup-node@v2.1.5
|
uses: actions/setup-node@v2.1.5
|
||||||
with:
|
with:
|
||||||
node-version: 10.x
|
node-version: 12.x
|
||||||
- name: 'install latest npm'
|
- name: 'install latest npm'
|
||||||
run: npm i -g npm
|
run: npm i -g npm
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
|
@ -146,10 +146,10 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.3.3
|
- uses: actions/checkout@v2.3.3
|
||||||
|
|
||||||
- name: 'Use Node.js 10.x'
|
- name: 'Use Node.js 12.x'
|
||||||
uses: actions/setup-node@v2.1.5
|
uses: actions/setup-node@v2.1.5
|
||||||
with:
|
with:
|
||||||
node-version: 10.x
|
node-version: 12.x
|
||||||
- name: 'install latest pnpm'
|
- name: 'install latest pnpm'
|
||||||
run: npm i -g pnpm
|
run: npm i -g pnpm
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
||||||
'@babel/env',
|
'@babel/env',
|
||||||
{
|
{
|
||||||
targets: {
|
targets: {
|
||||||
node: '8'
|
node: '12',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
10
package.json
10
package.json
|
@ -36,7 +36,7 @@
|
||||||
"express": "4.17.1",
|
"express": "4.17.1",
|
||||||
"handlebars": "4.7.7",
|
"handlebars": "4.7.7",
|
||||||
"http-errors": "1.8.0",
|
"http-errors": "1.8.0",
|
||||||
"js-yaml": "3.14.1",
|
"js-yaml": "4.0.0",
|
||||||
"jsonwebtoken": "8.5.1",
|
"jsonwebtoken": "8.5.1",
|
||||||
"kleur": "4.1.4",
|
"kleur": "4.1.4",
|
||||||
"lodash": "4.17.21",
|
"lodash": "4.17.21",
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
"marked": "2.0.1",
|
"marked": "2.0.1",
|
||||||
"mime": "2.5.2",
|
"mime": "2.5.2",
|
||||||
"minimatch": "3.0.4",
|
"minimatch": "3.0.4",
|
||||||
"mkdirp": "0.5.5",
|
"mkdirp": "1.0.4",
|
||||||
"mv": "2.1.1",
|
"mv": "2.1.1",
|
||||||
"pkginfo": "0.4.1",
|
"pkginfo": "0.4.1",
|
||||||
"request": "2.88.0",
|
"request": "2.88.0",
|
||||||
|
@ -74,8 +74,8 @@
|
||||||
"@babel/preset-typescript": "7.13.0",
|
"@babel/preset-typescript": "7.13.0",
|
||||||
"@babel/register": "7.13.8",
|
"@babel/register": "7.13.8",
|
||||||
"@babel/runtime": "7.13.9",
|
"@babel/runtime": "7.13.9",
|
||||||
"@commitlint/cli": "8.3.5",
|
"@commitlint/cli": "12.0.1",
|
||||||
"@commitlint/config-conventional": "8.3.4",
|
"@commitlint/config-conventional": "12.0.1",
|
||||||
"@octokit/rest": "16.43.2",
|
"@octokit/rest": "16.43.2",
|
||||||
"@types/async": "3.2.4",
|
"@types/async": "3.2.4",
|
||||||
"@types/bunyan": "1.8.6",
|
"@types/bunyan": "1.8.6",
|
||||||
|
@ -113,7 +113,7 @@
|
||||||
"eslint-plugin-simple-import-sort": "7.0.0",
|
"eslint-plugin-simple-import-sort": "7.0.0",
|
||||||
"eslint-plugin-verdaccio": "9.6.1",
|
"eslint-plugin-verdaccio": "9.6.1",
|
||||||
"fs-extra": "9.1.0",
|
"fs-extra": "9.1.0",
|
||||||
"get-stdin": "7.0.0",
|
"get-stdin": "8.0.0",
|
||||||
"husky": "2.7.0",
|
"husky": "2.7.0",
|
||||||
"in-publish": "2.0.1",
|
"in-publish": "2.0.1",
|
||||||
"jest": "25.5.4",
|
"jest": "25.5.4",
|
||||||
|
|
|
@ -13,21 +13,13 @@ import { parseConfigFile } from './utils';
|
||||||
require('pkginfo')(module);
|
require('pkginfo')(module);
|
||||||
|
|
||||||
if (process.getuid && process.getuid() === 0) {
|
if (process.getuid && process.getuid() === 0) {
|
||||||
global.console.warn(
|
global.console.warn(bgYellow().red("*** WARNING: Verdaccio doesn't need superuser privileges. Don't run it under root! ***"));
|
||||||
bgYellow().red(
|
|
||||||
"*** WARNING: Verdaccio doesn't need superuser privileges. Don't run it under root! ***"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const MIN_NODE_VERSION = '6.9.0';
|
const MIN_NODE_VERSION = '12.0.0';
|
||||||
|
|
||||||
if (semver.satisfies(process.version, `>=${MIN_NODE_VERSION}`) === false) {
|
if (semver.satisfies(process.version, `>=${MIN_NODE_VERSION}`) === false) {
|
||||||
global.console.error(
|
global.console.error(bgRed(`Verdaccio requires at least Node.js ${MIN_NODE_VERSION} or higher, please upgrade your Node.js distribution`));
|
||||||
bgRed(
|
|
||||||
`Verdaccio requires at least Node.js ${MIN_NODE_VERSION} or higher, please upgrade your Node.js distribution`
|
|
||||||
)
|
|
||||||
);
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,19 +60,9 @@ function init() {
|
||||||
|
|
||||||
logger.logger.warn({ file: configPathLocation }, 'config file - @{file}');
|
logger.logger.warn({ file: configPathLocation }, 'config file - @{file}');
|
||||||
|
|
||||||
startVerdaccio(
|
startVerdaccio(verdaccioConfiguration, cliListener, configPathLocation, pkgVersion, pkgName, listenDefaultCallback);
|
||||||
verdaccioConfiguration,
|
|
||||||
cliListener,
|
|
||||||
configPathLocation,
|
|
||||||
pkgVersion,
|
|
||||||
pkgName,
|
|
||||||
listenDefaultCallback
|
|
||||||
);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.logger.fatal(
|
logger.logger.fatal({ file: configPathLocation, err: err }, 'cannot open config file @{file}: @{!err.message}');
|
||||||
{ file: configPathLocation, err: err },
|
|
||||||
'cannot open config file @{file}: @{!err.message}'
|
|
||||||
);
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,7 +76,7 @@ if (commander.info) {
|
||||||
Binaries: ['Node', 'Yarn', 'npm'],
|
Binaries: ['Node', 'Yarn', 'npm'],
|
||||||
Virtualization: ['Docker'],
|
Virtualization: ['Docker'],
|
||||||
Browsers: ['Chrome', 'Edge', 'Firefox', 'Safari'],
|
Browsers: ['Chrome', 'Edge', 'Firefox', 'Safari'],
|
||||||
npmGlobalPackages: ['verdaccio']
|
npmGlobalPackages: ['verdaccio'],
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
@ -113,7 +95,7 @@ if (commander.info) {
|
||||||
process.on('uncaughtException', function (err) {
|
process.on('uncaughtException', function (err) {
|
||||||
logger.logger.fatal(
|
logger.logger.fatal(
|
||||||
{
|
{
|
||||||
err: err
|
err: err,
|
||||||
},
|
},
|
||||||
'uncaught exception, please report this\n@{err.stack}'
|
'uncaught exception, please report this\n@{err.stack}'
|
||||||
);
|
);
|
||||||
|
|
|
@ -12,29 +12,10 @@ import sanitizyReadme from '@verdaccio/readme';
|
||||||
|
|
||||||
import { Package, Version, Author } from '@verdaccio/types';
|
import { Package, Version, Author } from '@verdaccio/types';
|
||||||
import { Request } from 'express';
|
import { Request } from 'express';
|
||||||
import {
|
import { getConflict, getBadData, getBadRequest, getInternalError, getUnauthorized, getForbidden, getServiceUnavailable, getNotFound, getCode } from '@verdaccio/commons-api';
|
||||||
getConflict,
|
|
||||||
getBadData,
|
|
||||||
getBadRequest,
|
|
||||||
getInternalError,
|
|
||||||
getUnauthorized,
|
|
||||||
getForbidden,
|
|
||||||
getServiceUnavailable,
|
|
||||||
getNotFound,
|
|
||||||
getCode
|
|
||||||
} from '@verdaccio/commons-api';
|
|
||||||
import { generateGravatarUrl, GENERIC_AVATAR } from '../utils/user';
|
import { generateGravatarUrl, GENERIC_AVATAR } from '../utils/user';
|
||||||
import { StringValue, AuthorAvatar } from '../../types';
|
import { StringValue, AuthorAvatar } from '../../types';
|
||||||
import {
|
import { APP_ERROR, DEFAULT_PORT, DEFAULT_DOMAIN, DEFAULT_PROTOCOL, CHARACTER_ENCODING, HEADERS, DIST_TAGS, DEFAULT_USER } from './constants';
|
||||||
APP_ERROR,
|
|
||||||
DEFAULT_PORT,
|
|
||||||
DEFAULT_DOMAIN,
|
|
||||||
DEFAULT_PROTOCOL,
|
|
||||||
CHARACTER_ENCODING,
|
|
||||||
HEADERS,
|
|
||||||
DIST_TAGS,
|
|
||||||
DEFAULT_USER
|
|
||||||
} from './constants';
|
|
||||||
|
|
||||||
import { normalizeContributors } from './storage-utils';
|
import { normalizeContributors } from './storage-utils';
|
||||||
|
|
||||||
|
@ -139,11 +120,7 @@ export function validateMetadata(object: Package, name: string): Package {
|
||||||
* Create base url for registry.
|
* Create base url for registry.
|
||||||
* @return {String} base registry url
|
* @return {String} base registry url
|
||||||
*/
|
*/
|
||||||
export function combineBaseUrl(
|
export function combineBaseUrl(protocol: string, host: string | void, prefix?: string | void): string {
|
||||||
protocol: string,
|
|
||||||
host: string | void,
|
|
||||||
prefix?: string | void
|
|
||||||
): string {
|
|
||||||
const result = `${protocol}://${host}`;
|
const result = `${protocol}://${host}`;
|
||||||
|
|
||||||
const prefixOnlySlash = prefix === '/';
|
const prefixOnlySlash = prefix === '/';
|
||||||
|
@ -174,11 +151,7 @@ export function extractTarballFromUrl(url: string): string {
|
||||||
* @param {*} config
|
* @param {*} config
|
||||||
* @return {String} a filtered package
|
* @return {String} a filtered package
|
||||||
*/
|
*/
|
||||||
export function convertDistRemoteToLocalTarballUrls(
|
export function convertDistRemoteToLocalTarballUrls(pkg: Package, req: Request, urlPrefix: string | void): Package {
|
||||||
pkg: Package,
|
|
||||||
req: Request,
|
|
||||||
urlPrefix: string | void
|
|
||||||
): Package {
|
|
||||||
for (const ver in pkg.versions) {
|
for (const ver in pkg.versions) {
|
||||||
if (Object.prototype.hasOwnProperty.call(pkg.versions, ver)) {
|
if (Object.prototype.hasOwnProperty.call(pkg.versions, ver)) {
|
||||||
const distName = pkg.versions[ver].dist;
|
const distName = pkg.versions[ver].dist;
|
||||||
|
@ -196,12 +169,7 @@ export function convertDistRemoteToLocalTarballUrls(
|
||||||
* @param {*} uri
|
* @param {*} uri
|
||||||
* @return {String} a parsed url
|
* @return {String} a parsed url
|
||||||
*/
|
*/
|
||||||
export function getLocalRegistryTarballUri(
|
export function getLocalRegistryTarballUri(uri: string, pkgName: string, req: Request, urlPrefix: string | void): string {
|
||||||
uri: string,
|
|
||||||
pkgName: string,
|
|
||||||
req: Request,
|
|
||||||
urlPrefix: string | void
|
|
||||||
): string {
|
|
||||||
const currentHost = req.headers.host;
|
const currentHost = req.headers.host;
|
||||||
|
|
||||||
if (!currentHost) {
|
if (!currentHost) {
|
||||||
|
@ -279,7 +247,7 @@ export function parseAddress(urlAddress: any): any {
|
||||||
return {
|
return {
|
||||||
proto: urlPattern[2] || DEFAULT_PROTOCOL,
|
proto: urlPattern[2] || DEFAULT_PROTOCOL,
|
||||||
host: urlPattern[6] || urlPattern[7] || DEFAULT_DOMAIN,
|
host: urlPattern[6] || urlPattern[7] || DEFAULT_DOMAIN,
|
||||||
port: urlPattern[8] || DEFAULT_PORT
|
port: urlPattern[8] || DEFAULT_PORT,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +256,7 @@ export function parseAddress(urlAddress: any): any {
|
||||||
if (urlPattern) {
|
if (urlPattern) {
|
||||||
return {
|
return {
|
||||||
proto: urlPattern[2] || DEFAULT_PROTOCOL,
|
proto: urlPattern[2] || DEFAULT_PROTOCOL,
|
||||||
path: urlPattern[4]
|
path: urlPattern[4],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,7 +330,7 @@ const parseIntervalTable = {
|
||||||
d: 86400000,
|
d: 86400000,
|
||||||
w: 7 * 86400000,
|
w: 7 * 86400000,
|
||||||
M: 30 * 86400000,
|
M: 30 * 86400000,
|
||||||
y: 365 * 86400000
|
y: 365 * 86400000,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -381,11 +349,7 @@ export function parseInterval(interval: any): number {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const m = x.match(/^((0|[1-9][0-9]*)(\.[0-9]+)?)(ms|s|m|h|d|w|M|y|)$/);
|
const m = x.match(/^((0|[1-9][0-9]*)(\.[0-9]+)?)(ms|s|m|h|d|w|M|y|)$/);
|
||||||
if (
|
if (!m || parseIntervalTable[m[4]] >= last_suffix || (m[4] === '' && last_suffix !== Infinity)) {
|
||||||
!m ||
|
|
||||||
parseIntervalTable[m[4]] >= last_suffix ||
|
|
||||||
(m[4] === '' && last_suffix !== Infinity)
|
|
||||||
) {
|
|
||||||
throw Error('invalid interval: ' + interval);
|
throw Error('invalid interval: ' + interval);
|
||||||
}
|
}
|
||||||
last_suffix = parseIntervalTable[m[4]];
|
last_suffix = parseIntervalTable[m[4]];
|
||||||
|
@ -419,13 +383,13 @@ export const ErrorCode = {
|
||||||
getForbidden,
|
getForbidden,
|
||||||
getServiceUnavailable,
|
getServiceUnavailable,
|
||||||
getNotFound,
|
getNotFound,
|
||||||
getCode
|
getCode,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function parseConfigFile(configPath: string): any {
|
export function parseConfigFile(configPath: string): any {
|
||||||
try {
|
try {
|
||||||
if (/\.ya?ml$/i.test(configPath)) {
|
if (/\.ya?ml$/i.test(configPath)) {
|
||||||
return YAML.safeLoad(fs.readFileSync(configPath, CHARACTER_ENCODING.UTF8));
|
return YAML.load(fs.readFileSync(configPath, CHARACTER_ENCODING.UTF8));
|
||||||
}
|
}
|
||||||
return require(configPath);
|
return require(configPath);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -488,9 +452,7 @@ export function deleteProperties(propertiesToDelete: string[], objectItem: any):
|
||||||
export function addGravatarSupport(pkgInfo: Package, online = true): AuthorAvatar {
|
export function addGravatarSupport(pkgInfo: Package, online = true): AuthorAvatar {
|
||||||
const pkgInfoCopy = { ...pkgInfo } as any;
|
const pkgInfoCopy = { ...pkgInfo } as any;
|
||||||
const author: any = _.get(pkgInfo, 'latest.author', null) as any;
|
const author: any = _.get(pkgInfo, 'latest.author', null) as any;
|
||||||
const contributors: AuthorAvatar[] = normalizeContributors(
|
const contributors: AuthorAvatar[] = normalizeContributors(_.get(pkgInfo, 'latest.contributors', []));
|
||||||
_.get(pkgInfo, 'latest.contributors', [])
|
|
||||||
);
|
|
||||||
const maintainers = _.get(pkgInfo, 'latest.maintainers', []);
|
const maintainers = _.get(pkgInfo, 'latest.maintainers', []);
|
||||||
|
|
||||||
// for author.
|
// for author.
|
||||||
|
@ -503,7 +465,7 @@ export function addGravatarSupport(pkgInfo: Package, online = true): AuthorAvata
|
||||||
pkgInfoCopy.latest.author = {
|
pkgInfoCopy.latest.author = {
|
||||||
avatar: GENERIC_AVATAR,
|
avatar: GENERIC_AVATAR,
|
||||||
email: '',
|
email: '',
|
||||||
author
|
author,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,7 +479,7 @@ export function addGravatarSupport(pkgInfo: Package, online = true): AuthorAvata
|
||||||
contributor = {
|
contributor = {
|
||||||
avatar: GENERIC_AVATAR,
|
avatar: GENERIC_AVATAR,
|
||||||
email: contributor,
|
email: contributor,
|
||||||
name: contributor
|
name: contributor,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,7 +542,7 @@ export function formatAuthor(author: AuthorFormat): any {
|
||||||
let authorDetails = {
|
let authorDetails = {
|
||||||
name: DEFAULT_USER,
|
name: DEFAULT_USER,
|
||||||
email: '',
|
email: '',
|
||||||
url: ''
|
url: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_.isNil(author)) {
|
if (_.isNil(author)) {
|
||||||
|
@ -590,14 +552,14 @@ export function formatAuthor(author: AuthorFormat): any {
|
||||||
if (_.isString(author)) {
|
if (_.isString(author)) {
|
||||||
authorDetails = {
|
authorDetails = {
|
||||||
...authorDetails,
|
...authorDetails,
|
||||||
name: author as string
|
name: author as string,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_.isObject(author)) {
|
if (_.isObject(author)) {
|
||||||
authorDetails = {
|
authorDetails = {
|
||||||
...authorDetails,
|
...authorDetails,
|
||||||
...(author as Author)
|
...(author as Author),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,4 +17,4 @@ packages:
|
||||||
unpublish: xxx
|
unpublish: xxx
|
||||||
proxy: npmjs
|
proxy: npmjs
|
||||||
logs:
|
logs:
|
||||||
- { type: stdout, format: pretty, level: warn }
|
- { type: stdout, format: pretty, level: trace }
|
||||||
|
|
BIN
yarn.lock
BIN
yarn.lock
Binary file not shown.
Loading…
Reference in a new issue