1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-20 17:05:52 +01:00

refactor: devDependencies strictly defined in each package (#1884)

* refactor: new babel preset

* chore: using pnpm

let's see how it goes, all seems works fine by far, pretty solid.
This commit is contained in:
Juan Picado 2020-08-11 07:21:51 +02:00
parent eb0dae5fa7
commit 9f2a29a275
112 changed files with 11211 additions and 346 deletions

22
.babelrc Normal file

@ -0,0 +1,22 @@
{
"presets": [ [
"@babel/env",
{
"targets": {
"node": 10
}
}
],
"@babel/typescript"
],
"plugins": [
"babel-plugin-dynamic-import-node",
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator"
],
"ignore": [
"**/*.d.ts"
]
}

@ -1,143 +0,0 @@
version: 2.1
executors:
node_latest_browser:
docker:
- image: circleci/node:latest-browsers
node_latest:
docker:
- image: circleci/node:13
node_lts_12:
docker:
- image: circleci/node:12
default_executor: node_latest
aliases:
- &repo_path
~/verdaccio
- &defaults
working_directory: *repo_path
- &yarn_cache_key
yarn-sha-{{ checksum "yarn.lock" }}
- &coverage_key
coverage-{{ .Branch }}-{{ .Revision }}
- &ignore_non_dev_branches
filters:
tags:
only: /.*/
branches:
ignore:
- gh-pages
- /release\/.*/
commands:
restore_repo:
description: Restore repository from workspace
steps:
- attach_workspace:
at: *repo_path
run_test:
description: Run test and functional test
steps:
- run:
name: Test
command: yarn run test
- store_test_results:
path: reports/
jobs:
prepare:
<<: *defaults
executor: default_executor
steps:
- checkout
- restore_cache:
key: *yarn_cache_key
- run:
name: Install dependencies
command: yarn
- run:
name: Install dependencies
command: yarn bootstrap
- run:
name: Prepare CI
command: yarn lint
- run:
name: Clean project
command: yarn clean
- run:
name: Build project
command: yarn build
- save_cache:
key: *yarn_cache_key
paths:
- ~/.yarn
- ~/.cache/yarn
- node_modules
- persist_to_workspace:
root: *repo_path
paths:
- ./*
test_node_latest:
<<: *defaults
executor: node_latest
steps:
- restore_repo
- run_test
- save_cache:
key: *coverage_key
paths:
- coverage
test_node_lts_12:
<<: *defaults
executor: node_lts_12
steps:
- restore_repo
- run_test
# test_e2e_cli:
# <<: *defaults
# executor: node_latest
# steps:
# - restore_repo
# - run:
# name: Test End-to-End ClI
# command: yarn run test:e2e:cli
coverage:
<<: *defaults
executor: default_executor
steps:
- restore_repo
- restore_cache:
key: *coverage_key
- run:
name: Publish coverage
command: yarn run coverage:publish
- store_artifacts:
path: coverage
workflows:
version: 2
workflow:
jobs:
- prepare:
<<: *ignore_non_dev_branches
- test_node_latest:
requires:
- prepare
<<: *ignore_non_dev_branches
- test_node_lts_12:
requires:
- prepare
<<: *ignore_non_dev_branches
# - test_e2e_cli:
# requires:
# - prepare
# - test_node_latest
# - test_node_lts_12
# <<: *ignore_non_dev_branches
# - coverage:
# requires:
# - test_e2e_cli
# <<: *ignore_non_dev_branches

116
.eslintrc

@ -1,21 +1,123 @@
{
"extends": [
"@verdaccio"
"eslint:recommended",
"google",
"plugin:react/recommended",
"plugin:jest/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"plugin:prettier/recommended",
"plugin:jsx-a11y/recommended",
"prettier/@typescript-eslint"
],
"plugins": [
"import",
"jest",
"prettier",
"jsx-a11y",
"react-hooks"
],
"env": {
"es6": true,
"browser": true,
"node": true,
"jest": true
},
"globals": {
"__APP_VERSION__": true
},
"parserOptions": {
"allowImportExportEverywhere": true,
"sourceType": "module",
"ecmaVersion": 2019,
"ecmaFeatures": {
"impliedStrict": true,
"jsx": true
}
},
"settings": {
"react": {
"version": "detect"
},
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
},
"parser": "@typescript-eslint/parser",
"rules": {
"@typescript-eslint/no-var-requires": 0,
"curly": [
"error", "all"
],
"prettier/prettier": [
"error",
{
"endOfLine": "auto",
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"bracketSpacing": true
}
],
"keyword-spacing": "off",
"no-tabs": "off",
"no-useless-escape": "off",
"padded-blocks": "off",
"require-jsdoc": "off",
"valid-jsdoc": "off",
"import/order": ["warn"],
"react/prop-types": 0,
"jest/no-export": 0,
"jest/no-test-callback": 0,
"jest/no-try-expect": 1,
"jest/no-identical-title": 1,
"eol-last": "warn",
"no-irregular-whitespace": "warn",
"no-mixed-spaces-and-tabs": ["warn", "smart-tabs"],
"no-trailing-spaces": "warn",
"camelcase": "off",
"guard-for-in": "error",
"new-cap": "error",
"max-len": ["warn", 180],
"no-console": ["error", { "allow": ["warn"] }],
"no-constant-condition": "error",
"no-debugger": "error",
"no-empty": "error",
"no-fallthrough": "error",
"no-invalid-this": "error",
"no-new-require": "error",
"no-undef": "error",
"no-unreachable": "error",
"no-unused-vars": ["warn", { "vars": "all", "args": "none" }],
"no-var": "error",
"one-var": "error",
"prefer-rest-params": "warn",
"prefer-spread": "warn",
"semi": 0,
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/ban-ts-ignore": 0,
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/no-inferrable-types": 0,
"@typescript-eslint/interface-name-prefix": 0,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/no-this-alias": ["warn"],
"@typescript-eslint/no-this-alias": 0,
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/array-type": ["warn"],
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/indent": 0,
"@typescript-eslint/interface-name-prefix": 0,
"import/order": 0,
"handle-callback-err": 1,
"prefer-const": 1,
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/ban-types": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/explicit-member-accessibility": ["warn"],
"@typescript-eslint/prefer-optional-chain": ["warn"],
"handle-callback-err": 0,
"prefer-const": 0,
"prefer-promise-reject-errors": 1
}
}

@ -10,7 +10,7 @@ on:
- 'packages/**'
- 'jest/**'
- 'package.json'
- 'lerna.json'
- 'pnpm-workspace.yaml'
jobs:
ci:
@ -19,25 +19,27 @@ jobs:
strategy:
fail-fast: false
matrix:
node_version: [10, 12, 13, 14]
node_version: [10, 12, 14]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.1
- name: Use Node ${{ matrix.node_version }}
uses: actions/setup-node@v2.1.1
uses: actions/setup-node@v1
with:
node_version: ${{ matrix.node_version }}
- name: Install pnpm
run: npm i -g pnpm
- name: Install
run: yarn --frozen-lockfile
- name: Bootstrap Lerna
run: yarn bootstrap
run: pnpm recursive install
- name: Install packages
run: pnpm install -r
- name: Lint
run: yarn lint
run: pnpm lint
- name: Clean
run: yarn clean
run: pnpm clean
- name: Build
run: yarn build
run: pnpm build
- name: Test
run: yarn test
run: pnpm test

@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/checkout@v2.3.1
- name: Build
run: yarn docker
run: npm run docker
env:
VERDACCIO_BUILD_REGISTRY: https://registry.verdaccio.org

2
.npmrc

@ -1,2 +1,2 @@
always-auth = true
fetch-retries="10"
recursive-install = true

@ -1,6 +1,6 @@
FROM node:12.18.3-alpine as builder
ENV NODE_ENV=production \
ENV NODE_ENV=development \
VERDACCIO_BUILD_REGISTRY=https://registry.verdaccio.org
RUN apk --no-cache add openssl ca-certificates wget && \
@ -12,12 +12,12 @@ RUN apk --no-cache add openssl ca-certificates wget && \
WORKDIR /opt/verdaccio-build
COPY . .
RUN yarn config set registry $VERDACCIO_BUILD_REGISTRY && \
yarn install --production=false && \
yarn build && \
yarn lint && \
yarn cache clean && \
yarn install --production=true
RUN npm -g i pnpm@latest && \
pnpm config set registry $VERDACCIO_BUILD_REGISTRY && \
pnpm recursive install --frozen-lockfile && \
pnpm run build && \
pnpm run lint && \
pnpm install --prod
FROM node:12.18.3-alpine
LABEL maintainer="https://github.com/verdaccio/verdaccio"

@ -4,6 +4,6 @@
"version": "1.0.0",
"dependencies": {
"@verdaccio/babel-preset": "9.4.0",
"@verdaccio/eslint-config": "9.3.2"
"@verdaccio/cli": "5.0.0-alpha.0"
}
}

@ -1,14 +0,0 @@
{
"version": "5.0.0-alpha.0",
"packages": [
"packages/*"
],
"npmClient": "yarn",
"useWorkspaces": true,
"stream": true,
"command": {
"publish": {
"message": "chore: publish release %s"
}
}
}

@ -9,15 +9,35 @@
},
"homepage": "https://verdaccio.org",
"private": true,
"workspaces": [
"packages/*",
"website"
],
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/verdaccio"
},
"devDependencies": {
"@babel/cli": "7.10.5",
"@babel/core": "7.10.5",
"@babel/node": "7.10.5",
"@babel/plugin-proposal-class-properties": "7.10.4",
"@babel/plugin-proposal-decorators": "7.10.5",
"@babel/plugin-proposal-export-namespace-from": "7.10.4",
"@babel/plugin-proposal-function-sent": "7.10.4",
"@babel/plugin-proposal-json-strings": "7.10.4",
"@babel/plugin-proposal-nullish-coalescing-operator": "7.10.4",
"@babel/plugin-proposal-numeric-separator": "7.10.4",
"@babel/plugin-proposal-object-rest-spread": "7.10.4",
"@babel/plugin-proposal-optional-chaining": "7.10.4",
"@babel/plugin-proposal-throw-expressions": "7.10.4",
"@babel/plugin-syntax-dynamic-import": "7.8.3",
"@babel/plugin-syntax-import-meta": "7.10.4",
"@babel/plugin-transform-async-to-generator": "7.10.4",
"@babel/plugin-transform-classes": "7.10.4",
"@babel/plugin-transform-runtime": "7.10.5",
"@babel/polyfill": "7.10.4",
"@babel/preset-env": "7.10.4",
"@babel/preset-react": "7.10.4",
"@babel/preset-typescript": "7.10.4",
"@babel/register": "7.10.5",
"@babel/runtime": "7.10.5",
"@commitlint/cli": "8.3.5",
"@commitlint/config-conventional": "8.2.0",
"@octokit/rest": "17.0.0",
@ -32,13 +52,29 @@
"@types/request": "2.48.3",
"@types/semver": "7.2.0",
"@types/supertest": "2.0.9",
"@verdaccio/babel-preset": "9.6.1",
"@verdaccio/eslint-config": "9.3.2",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^3.8.0",
"@verdaccio/types": "9.5.0",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.1.0",
"babel-jest": "26.1.0",
"babel-plugin-dynamic-import-node": "2.3.3",
"babel-plugin-emotion": "10.0.33",
"codecov": "3.6.1",
"cross-env": "7.0.2",
"detect-secrets": "1.0.6",
"eslint": "7.0.0",
"eslint": "7.5.0",
"eslint-config-google": "0.14.0",
"eslint-config-prettier": "6.10.0",
"eslint-plugin-babel": "5.3.0",
"eslint-plugin-import": "2.22.0",
"eslint-plugin-jest": "23.8.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "3.1.2",
"eslint-plugin-react": "^7.20.5",
"eslint-plugin-react-hooks": "^4.0.8",
"eslint-plugin-simple-import-sort": "5.0.2",
"eslint-plugin-verdaccio": "8.4.2",
"fs-extra": "8.1.0",
"get-stdin": "7.0.0",
"husky": "2.7.0",
@ -47,7 +83,6 @@
"jest-environment-node": "26.1.0",
"jest-junit": "11.0.1",
"kleur": "3.0.3",
"lerna": "3.22.1",
"lint-staged": "8.2.1",
"nock": "12.0.3",
"prettier": "1.19.1",
@ -61,21 +96,13 @@
"verdaccio-memory": "9.7.0"
},
"scripts": {
"bootstrap": "lerna bootstrap",
"debug": "node debug/bootstrap.js",
"dev": "cross-env BABEL_ENV=registry babel-node --extensions \".ts,.tsx\" packages/cli/src",
"clean": "lerna run clean",
"build": "lerna run build",
"clean": "pnpm recursive run clean",
"build": "pnpm recursive run build",
"docker": "docker build -t verdaccio/verdaccio:local . --no-cache",
"release": "lerna version --conventional-commits",
"version:canary": "lerna version --conventional-commits --conventional-prerelease --no-commit-hooks --exact --no-changelog --yes --preid alpha",
"publish:canary": "lerna publish from-package --canary --yes --no-git-reset --no-git-tag-version --no-push --force-publish --concurrency 1",
"release:from-prerelease": "lerna version --conventional-commits --conventional-graduate",
"release:prerelease": "lerna version --conventional-commits --conventional-prerelease --preid next --registry http://localhost:4873",
"release:publish": "lerna publish from-git",
"release:publish-prerelease": "lerna publish from-git --pre-dist-tag next",
"lint": "eslint \"packages/**/@(src|tests|test)/**\"",
"test": "lerna run test --concurrency 1",
"test": "pnpm recursive test",
"test:e2e:cli": "cross-env NODE_ENV=test jest --config ./test/e2e-cli/jest.config.e2e.cli.js --passWithNoTests",
"website:lint": "cd website && yarn lint",
"website:develop": "cd website && yarn develop",

@ -1,3 +1,3 @@
{
"presets": [["@verdaccio"]]
"extends": "../../.babelrc"
}

@ -19,7 +19,7 @@
"type-check": "tsc --noEmit",
"build:types": "tsc --emitDeclarationOnly --declaration true",
"build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
"build": "npm run build:js && npm run build:types"
"build": "pnpm run build:js && pnpm run build:types"
},
"license": "MIT",
"dependencies": {
@ -37,6 +37,8 @@
"mime": "2.4.4"
},
"devDependencies": {
"@verdaccio/config": "5.0.0-alpha.0",
"@verdaccio/server": "5.0.0-alpha.0",
"@verdaccio/dev-types": "5.0.0-alpha.0",
"@verdaccio/types": "9.5.0",
"body-parser": "1.19.0",

@ -1,5 +1,5 @@
import _ from 'lodash';
import Path from 'path';
import _ from 'lodash';
import mime from 'mime';
import { Router } from 'express';

@ -5,12 +5,12 @@ function compileTextSearch(textSearch: string): ((pkg: Package) => boolean) {
const personMatch = (person, search) => {
if(typeof person === 'string')
{return person.includes(search);}
if(typeof person === 'object')
{for(const field of Object.values(person))
{if(typeof field === 'string' && field.includes(search))
{return true;}}}
return false;
}
const matcher = function(q) {
@ -35,13 +35,13 @@ function compileTextSearch(textSearch: string): ((pkg: Package) => boolean) {
export default function(route, auth, storage): void {
route.get('/-/v1/search', (req, res)=>{
// TODO: implement proper result scoring weighted by quality, popularity and maintenance query parameters
let [text, size, from /* , quality, popularity, maintenance */] =
let [text, size, from /* , quality, popularity, maintenance */] =
['text', 'size', 'from' /* , 'quality', 'popularity', 'maintenance' */]
.map(k => req.query[k])
size = parseInt(size) || 20;
from = parseInt(from) || 0;
const isInteresting = compileTextSearch(text);
const resultStream = storage.search(0, {req: {query: {local: true}}});
@ -95,4 +95,4 @@ export default function(route, auth, storage): void {
{sendResponse()}
})
})
}
}

@ -5,8 +5,8 @@ import { getApiToken } from '@verdaccio/auth';
import { logger } from '@verdaccio/logger';
import { Response, Router } from 'express';
import {$NextFunctionVer, $RequestExtend, IAuth, IStorageHandler} from '../../../types';
import { Config, RemoteUser, Token } from '@verdaccio/types';
import {$NextFunctionVer, $RequestExtend, IAuth, IStorageHandler} from '../../../types';
export type NormalizeToken = Token & {
created: string;

@ -8,10 +8,10 @@ import { Config } from '@verdaccio/config';
import { Storage } from '@verdaccio/store';
import { final, handleError, errorReportingMiddleware } from '@verdaccio/middleware';
import { Auth } from '@verdaccio/auth';
import apiEndpoints from '../../src';
import {IAuth} from "@verdaccio/dev-types";
import {HEADER_TYPE, HTTP_STATUS, generatePackageMetadata} from "@verdaccio/dev-commons";
import {HEADERS} from "@verdaccio/commons-api";
import apiEndpoints from '../../src';
const getConf = (conf) => {
const configPath = path.join(__dirname, 'config', conf);

@ -1,9 +1,9 @@
import supertest from 'supertest';
import {initializeServer, publishTaggedVersion, publishVersion} from './_helper';
import { HTTP_STATUS } from '@verdaccio/commons-api';
import {HEADER_TYPE, HEADERS} from '@verdaccio/dev-commons';
import {$RequestExtend, $ResponseExtend} from "@verdaccio/dev-types";
import {initializeServer, publishTaggedVersion, publishVersion} from './_helper';
const mockApiJWTmiddleware = jest.fn(() =>
(req: $RequestExtend, res: $ResponseExtend, _next): void => {

@ -1,8 +1,8 @@
import supertest from 'supertest';
import {initializeServer } from './_helper';
import { HTTP_STATUS } from '@verdaccio/commons-api';
import {HEADER_TYPE, HEADERS} from '@verdaccio/dev-commons';
import {initializeServer } from './_helper';
describe('ping', () => {
test('should return the reply the ping', async () => {

@ -1,8 +1,8 @@
import {initializeServer, publishVersion} from './_helper';
import { HTTP_STATUS } from '@verdaccio/commons-api';
import {API_ERROR, API_MESSAGE, generatePackageMetadata, HEADER_TYPE, HEADERS} from '@verdaccio/dev-commons';
import {$RequestExtend, $ResponseExtend} from '@verdaccio/dev-types';
import supertest from "supertest";
import {initializeServer, publishVersion} from './_helper';
const mockApiJWTmiddleware = jest.fn(() =>
(req: $RequestExtend, res: $ResponseExtend, _next): void => {

@ -1,11 +1,11 @@
import supertest from 'supertest';
import { initializeServer } from './_helper';
import { HTTP_STATUS, API_ERROR } from '@verdaccio/commons-api';
import {HEADERS, HEADER_TYPE, API_MESSAGE} from '@verdaccio/dev-commons';
import {$RequestExtend, $ResponseExtend} from "@verdaccio/dev-types";
import {getBadRequest, getConflict, getUnauthorized} from "@verdaccio/commons-api/lib";
import _ from "lodash";
import { initializeServer } from './_helper';
const mockApiJWTmiddleware = jest.fn(() =>
(req: $RequestExtend, res: $ResponseExtend, _next): void => {

@ -1,9 +1,9 @@
import supertest from 'supertest';
import {initializeServer } from './_helper';
import { HTTP_STATUS } from '@verdaccio/commons-api';
import { HEADERS} from '@verdaccio/dev-commons';
import {$RequestExtend, $ResponseExtend} from "@verdaccio/dev-types";
import {initializeServer } from './_helper';
const mockApiJWTmiddleware = jest.fn(() =>
(req: $RequestExtend, res: $ResponseExtend, _next): void => {

@ -1,5 +1,5 @@
import { addVersion, uploadPackageTarball, removeTarball, unPublishPackage, publishPackage } from '../../src/publish';
import { HTTP_STATUS, API_ERROR } from '@verdaccio/dev-commons';
import { addVersion, uploadPackageTarball, removeTarball, unPublishPackage, publishPackage } from '../../src/publish';
const REVISION_MOCK = '15-e53a77096b0ee33e';

@ -1,3 +1,3 @@
{
"presets": [["@verdaccio"]]
"extends": "../../.babelrc"
}

@ -19,7 +19,7 @@
"type-check": "tsc --noEmit",
"build:types": "tsc --emitDeclarationOnly --declaration true",
"build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
"build": "npm run build:js && npm run build:types"
"build": "pnpm run build:js && pnpm run build:types"
},
"license": "MIT",
"dependencies": {
@ -32,7 +32,10 @@
"lodash": "4.17.15"
},
"devDependencies": {
"@verdaccio/dev-types": "5.0.0-alpha.0"
"@verdaccio/config": "workspace:5.0.0-alpha.0",
"@verdaccio/mock": "workspace:5.0.0-alpha.0",
"@verdaccio/dev-types": "workspace:5.0.0-alpha.0",
"@verdaccio/types": "9.5.0"
},
"gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982"
}

@ -75,7 +75,7 @@ export async function getApiToken(auth: IAuthWebUI, config: Config, remoteUser:
// i am wiling to use here _.isNil but flow does not like it yet.
const { jwt } = security.api;
if (jwt && jwt.sign) {
if (jwt?.sign) {
return await auth.jwtEncrypt(remoteUser, jwt.sign);
}
return await new Promise((resolve): void => {

@ -1,5 +1,6 @@
import path from "path";
import _ from 'lodash';
import { Auth } from '@verdaccio/auth';
import { Auth } from '../src';
import {CHARACTER_ENCODING, TOKEN_BEARER} from '@verdaccio/dev-commons';
import { configExample } from '@verdaccio/mock';
@ -19,16 +20,15 @@ import {
signPayload
} from '@verdaccio/utils';
import { IAuth } from '@verdaccio/dev-types';
import {Config, Security, RemoteUser} from '@verdaccio/types';
import {
getMiddlewareCredentials,
getApiToken,
verifyJWTPayload,
getSecurity } from '../src'
import { IAuth } from '@verdaccio/dev-types';
import {Config, Security, RemoteUser} from '@verdaccio/types';
import path from "path";
setup([]);
const parseConfigurationFile = (conf) => {
@ -48,6 +48,7 @@ describe('Auth utilities', () => {
function getConfig(configFileName: string, secret: string) {
const conf = parseConfigFile(parseConfigurationSecurityFile(configFileName));
// @ts-ignore
const secConf= _.merge(configExample(), conf);
secConf.secret = secret;
const config: Config = new AppConfig(secConf);

@ -1,12 +1,13 @@
import _ from 'lodash';
import { Auth } from '@verdaccio/auth';
import {Config as AppConfig } from '@verdaccio/config';
import {setup} from '@verdaccio/logger';
import {IAuth} from '@verdaccio/dev-types';
import {Config} from '@verdaccio/types';
import { Config as AppConfig } from '@verdaccio/config';
import { setup } from '@verdaccio/logger';
import { IAuth } from '@verdaccio/dev-types';
import { Config } from '@verdaccio/types';
import { ROLES } from '@verdaccio/dev-commons';
import { getInternalError } from '@verdaccio/commons-api';
import { Auth } from '../src';
import { authProfileConf, authPluginFailureConf, authPluginPassThrougConf } from './helper/plugin';
setup([]);

@ -0,0 +1,11 @@
import { getInternalError } from '@verdaccio/commons-api';
module.exports = function ( ) {
return {
authenticate( user, pass, callback ) {
// we return an 500 error, the second argument must be false.
// https://verdaccio.org/docs/en/dev-plugins#onerror
callback(getInternalError(), false);
}
};
};

@ -0,0 +1,10 @@
module.exports = function ( ) {
return {
authenticate( user, pass, callback ) {
/* user and pass are used here to forward errors
and success types respectively for testing purposes */
callback(user, pass);
}
};
};

@ -0,0 +1,10 @@
module.exports = function ( ) {
return {
authenticate( user, pass, callback ) {
// https://verdaccio.org/docs/en/dev-plugins#onsuccess
// this is a successful login and return a simple group
callback(null, ['test']);
}
};
};

@ -1,3 +1,3 @@
{
"presets": [["@verdaccio"]]
"extends": "../../.babelrc"
}

@ -24,11 +24,12 @@
"type-check": "tsc --noEmit",
"build:types": "tsc --emitDeclarationOnly --declaration true",
"build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
"build": "npm run build:js && npm run build:types",
"build": "pnpm run build:js && pnpm run build:types",
"bundle": "cross-env BABEL_ENV=registry webpack --config scripts/bundle.js --profile --json > compilation-stats.json"
},
"dependencies": {
"@verdaccio/config": "5.0.0-alpha.0",
"@verdaccio/logger": "5.0.0-alpha.0",
"@verdaccio/node-api": "5.0.0-alpha.0",
"@verdaccio/utils": "5.0.0-alpha.0",
"commander": "5.1.0",

@ -19,7 +19,7 @@ export default function initProgram(commander, pkgVersion, pkgName) {
verdaccioConfiguration = parseConfigFile(configPathLocation);
const { web, https, self_path } = verdaccioConfiguration;
process.title = web && web.title || DEFAULT_PROCESS_NAME;
process.title = web?.title || DEFAULT_PROCESS_NAME;
// note: self_path is only being used by @verdaccio/storage , not really useful and migth be removed soon
if (!self_path) {

@ -1,3 +1,3 @@
{
"presets": [["@verdaccio"]]
"extends": "../../.babelrc"
}

@ -19,7 +19,7 @@
"type-check": "tsc --noEmit",
"build:types": "tsc --emitDeclarationOnly --declaration true",
"build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
"build": "npm run build:js && npm run build:types"
"build": "pnpm run build:js && pnpm run build:types"
},
"gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982"
}

@ -1,3 +1,3 @@
{
"presets": [["@verdaccio"]]
"extends": "../../.babelrc"
}

@ -20,11 +20,16 @@
"type-check": "tsc --noEmit",
"build:types": "tsc --emitDeclarationOnly --declaration true",
"build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
"build": "npm run build:js && npm run build:types"
"build": "pnpm run build:js && pnpm run build:types"
},
"devDependencies": {
"@verdaccio/dev-types": "workspace:5.0.0-alpha.0"
},
"dependencies": {
"@verdaccio/logger": "5.0.0-alpha.0",
"@verdaccio/utils": "5.0.0-alpha.0"
"@verdaccio/dev-commons": "workspace:5.0.0-alpha.0",
"@verdaccio/logger": "workspace:5.0.0-alpha.0",
"@verdaccio/utils": "workspace:5.0.0-alpha.0",
"mkdirp": "0.5.5"
},
"gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982"
}

@ -1,7 +1,7 @@
import fs from 'fs';
import path from 'path';
import _ from 'lodash';
import Path from 'path';
import _ from 'lodash';
import { logger } from '@verdaccio/logger';
import mkdirp from 'mkdirp';

@ -1,5 +1,5 @@
import _ from 'lodash';
import assert from 'assert';
import _ from 'lodash';
import {
getMatchedPackagesSpec,

@ -1,7 +1,7 @@
import path from 'path';
import _ from 'lodash';
import { Config, readDefaultConfig } from '@verdaccio/config';
import { Config, readDefaultConfig } from '../src';
import { setup } from '@verdaccio/logger';
import {DEFAULT_REGISTRY, DEFAULT_UPLINK, ROLES, WEB_TITLE} from '@verdaccio/dev-commons';

@ -1,3 +1,3 @@
{
"presets": [["@verdaccio"]]
"extends": "../../.babelrc"
}

@ -21,7 +21,11 @@
"request": "2.87.0"
},
"devDependencies": {
"@verdaccio/auth": "5.0.0-alpha.0",
"@verdaccio/config": "5.0.0-alpha.0",
"@verdaccio/utils": "5.0.0-alpha.0",
"@verdaccio/dev-commons": "5.0.0-alpha.0",
"@verdaccio/dev-types": "5.0.0-alpha.0",
"@verdaccio/types": "9.5.0"
},
"scripts": {
@ -30,7 +34,7 @@
"type-check": "tsc --noEmit",
"build:types": "tsc --emitDeclarationOnly --declaration true",
"build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
"build": "npm run build:js && npm run build:types"
"build": "pnpm run build:js && pnpm run build:types"
},
"gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982"
}

@ -1,3 +1,3 @@
{
"presets": [["@verdaccio"]]
"extends": "../../.babelrc"
}

@ -13,11 +13,15 @@
"url": "git://github.com/verdaccio/verdaccio"
},
"dependencies": {
"@verdaccio/dev-commons": "5.0.0-alpha.0",
"@verdaccio/logger": "5.0.0-alpha.0",
"@verdaccio/dev-commons": "workspace:5.0.0-alpha.0",
"@verdaccio/logger": "workspace:5.0.0-alpha.0",
"lodash": "4.17.15"
},
"devDependencies": {
"@verdaccio/mock": "workspace:5.0.0-alpha.0",
"@verdaccio/dev-types": "workspace:5.0.0-alpha.0",
"@verdaccio/config": "workspace:5.0.0-alpha.0",
"@verdaccio/commons-api": "^9.7.1",
"@verdaccio/types": "9.5.0"
},
"homepage": "https://verdaccio.org",
@ -28,7 +32,7 @@
"type-check": "tsc --noEmit",
"build:types": "tsc --emitDeclarationOnly --declaration true",
"build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
"build": "npm run build:js && npm run build:types"
"build": "pnpm run build:js && pnpm run build:types"
},
"gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982"
}

@ -1,3 +1,3 @@
{
"presets": [["@verdaccio"]]
"extends": "../../.babelrc"
}

@ -1,7 +1,4 @@
{
"extends": [
"@verdaccio"
],
"rules": {
"guard-for-in": 0
}

@ -17,11 +17,9 @@
"scripts": {
"clean": "rimraf ./build",
"test": "cross-env NODE_ENV=test BABEL_ENV=test jest",
"type-check": "tsc --noEmit",
"lint": "yarn type-check && eslint \"@(src|tests)/**\"",
"build:types": "tsc --emitDeclarationOnly --declaration true",
"build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
"build": "npm run build:js && npm run build:types"
"build": "pnpm run build:js && pnpm run build:types"
},
"dependencies": {
"@verdaccio/commons-api": "9.6.1",

@ -1,3 +1,3 @@
{
"presets": [["@verdaccio"]]
"extends": "../../.babelrc"
}

@ -19,8 +19,7 @@
"test": "cross-env NODE_ENV=test BABEL_ENV=test jest --runTestsByPath",
"type-check": "tsc --noEmit",
"build:types": "tsc --emitDeclarationOnly --declaration true",
"build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
"build": "npm run build:js && npm run build:types"
"build": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps"
},
"dependencies": {
"@verdaccio/logger-prettify": "5.0.0-alpha.0",
@ -28,7 +27,7 @@
"pino": "5.17.0"
},
"devDependencies": {
"@types/pino": "6.0.1",
"@types/pino": "5.20.0",
"@verdaccio/types": "9.5.0"
},
"gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982"

@ -1,3 +1,3 @@
{
"presets": [["@verdaccio"]]
"extends": "../../.babelrc"
}

@ -19,7 +19,7 @@
"type-check": "tsc --noEmit",
"build:types": "tsc --emitDeclarationOnly --declaration true",
"build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
"build": "npm run build:js && npm run build:types"
"build": "pnpm run build:js && pnpm run build:types"
},
"dependencies": {
"@verdaccio/commons-api": "9.6.1",

@ -1,3 +1,3 @@
{
"presets": [["@verdaccio"]]
"extends": "../../.babelrc"
}

@ -20,9 +20,10 @@
"type-check": "tsc --noEmit",
"build:types": "tsc --emitDeclarationOnly --declaration true",
"build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
"build": "npm run build:js && npm run build:types"
"build": "pnpm run build:js && pnpm run build:types"
},
"dependencies": {
"@verdaccio/dev-commons": "5.0.0-alpha.0",
"@verdaccio/utils": "5.0.0-alpha.0",
"fs-extra": "^8.1.0",
"lodash": "^4.17.15",

@ -1,6 +1,6 @@
import _ from 'lodash';
import path from 'path';
import _ from 'lodash';
import {parseConfigFile} from '@verdaccio/utils';

@ -1,7 +1,7 @@
import path from 'path';
import fs from 'fs';
import * as fsExtra from 'fs-extra';
import os from 'os';
import * as fsExtra from 'fs-extra';
import {DOMAIN_SERVERS} from './constants';
import VerdaccioProcess from './server_process';
import {VerdaccioConfig} from './verdaccio-server';

@ -1,5 +1,5 @@
import _ from 'lodash';
import assert from 'assert';
import _ from 'lodash';
import request from 'request';
import { IRequestPromise } from './types';
@ -47,7 +47,7 @@ export class PromiseAssert extends Promise<any> implements IRequestPromise {
public body_error(expected: any) {
const selfData = this[requestData];
return injectResponse(this, this.then(function(body) {
@ -88,7 +88,7 @@ export class PromiseAssert extends Promise<any> implements IRequestPromise {
}
function injectResponse(smartObject: any, promise: Promise<any>): Promise<any> {
promise[requestData] = smartObject[requestData];
return promise;
}

@ -1,10 +1,10 @@
import _ from 'lodash';
import assert from 'assert';
import _ from 'lodash';
import {API_MESSAGE, HEADERS, HTTP_STATUS, TOKEN_BASIC} from '@verdaccio/dev-commons';
import {buildToken} from "@verdaccio/utils";
import smartRequest from './request';
import {IServerBridge} from './types';
import {API_MESSAGE, HEADERS, HTTP_STATUS, TOKEN_BASIC} from '@verdaccio/dev-commons';
import {buildToken} from "@verdaccio/utils";
import {CREDENTIALS} from "./constants"
import getPackage from './fixtures/package';

@ -1,8 +1,8 @@
import { Version } from "@verdaccio/types";
import fs from "fs";
import path from "path";
import os from "os";
import { pseudoRandomBytes } from 'crypto';
import { Version } from "@verdaccio/types";
export function generateRamdonStorage() {
const tempStorage = pseudoRandomBytes(5).toString('hex');

@ -1,3 +1,3 @@
{
"presets": [["@verdaccio"]]
"extends": "../../.babelrc"
}

@ -18,7 +18,7 @@
"type-check": "tsc --noEmit",
"build:types": "tsc --emitDeclarationOnly --declaration true",
"build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
"build": "npm run build:js && npm run build:types",
"build": "pnpm run build:js && pnpm run build:types",
"test": "cross-env NODE_ENV=test BABEL_ENV=test jest"
},
"license": "MIT",
@ -26,9 +26,11 @@
"@verdaccio/dev-commons": "5.0.0-alpha.0",
"@verdaccio/logger": "5.0.0-alpha.0",
"@verdaccio/server": "5.0.0-alpha.0",
"@verdaccio/utils": "5.0.0-alpha.0"
"@verdaccio/utils": "5.0.0-alpha.0",
"selfsigned": "1.10.7"
},
"devDependencies": {
"@verdaccio/mock": "5.0.0-alpha.0",
"@verdaccio/types": "9.7.0"
},
"publishConfig": {

@ -1,10 +1,10 @@
import { assign, isObject, isFunction } from 'lodash';
import URL from 'url';
import fs from 'fs';
import http from 'http';
import https from 'https';
import { Application } from 'express';
import constants from 'constants';
import { Application } from 'express';
import { assign, isObject, isFunction } from 'lodash';
import { Callback, ConfigWithHttps, HttpsConfKeyCert, HttpsConfPfx } from '@verdaccio/types';
import { API_ERROR, certPem, csrPem, keyPem } from '@verdaccio/dev-commons';

@ -1,7 +1,7 @@
import path from 'path';
import selfsigned from 'selfsigned';
import os from 'os';
import fs from 'fs';
import selfsigned from 'selfsigned';
import { configExample } from '@verdaccio/mock';
import {DEFAULT_DOMAIN, DEFAULT_PROTOCOL} from '@verdaccio/dev-commons';

@ -1,6 +1,6 @@
import {getListListenAddresses} from "../src/cli-utils";
import _ from "lodash";
import {DEFAULT_DOMAIN, DEFAULT_PORT, DEFAULT_PROTOCOL} from "@verdaccio/dev-commons";
import {getListListenAddresses} from "../src/cli-utils";
jest.mock('@verdaccio/logger', () => ({
setup: jest.fn(),

@ -1,3 +1,3 @@
{
"presets": [["@verdaccio"]]
"extends": "../../.babelrc"
}

@ -20,7 +20,7 @@
"type-check": "tsc --noEmit",
"build:types": "tsc --emitDeclarationOnly --declaration true",
"build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
"build": "npm run build:js && npm run build:types"
"build": "pnpm run build:js && pnpm run build:types"
},
"dependencies": {
"@verdaccio/dev-commons": "5.0.0-alpha.0",

@ -1,9 +1,9 @@
import zlib from 'zlib';
import Stream from 'stream';
import URL, {UrlWithStringQuery} from 'url';
import JSONStream from 'JSONStream';
import _ from 'lodash';
import request from 'request';
import Stream, { Readable } from 'stream';
import URL, {UrlWithStringQuery} from 'url';
import { parseInterval, isObject, ErrorCode, buildToken } from '@verdaccio/utils';
import { ReadTarball } from '@verdaccio/streams';
import { ERROR_CODE, TOKEN_BASIC, TOKEN_BEARER, HEADERS, HTTP_STATUS, API_ERROR, HEADER_TYPE, CHARACTER_ENCODING } from '@verdaccio/dev-commons';
@ -574,7 +574,7 @@ class ProxyStorage implements IProxy {
}
// always attach Via header to avoid loops, even if we're not proxying
headers['Via'] = req && req.headers['via'] ? req.headers['via'] + ', ' : '';
headers['Via'] = req?.headers['via'] ? req.headers['via'] + ', ' : '';
headers['Via'] += '1.1 ' + this.server_id + ' (Verdaccio)';
}

@ -1,3 +1,3 @@
{
"presets": [["@verdaccio"]]
"extends": "../../.babelrc"
}

@ -31,6 +31,8 @@
"lodash": "4.17.15"
},
"devDependencies": {
"@verdaccio/proxy": "5.0.0-alpha.0",
"@verdaccio/commons-api": "9.7.1",
"@verdaccio/dev-types": "5.0.0-alpha.0",
"@verdaccio/mock": "5.0.0-alpha.0",
"http-errors": "1.7.3",
@ -43,7 +45,7 @@
"type-check": "tsc --noEmit",
"build:types": "tsc --emitDeclarationOnly --declaration true",
"build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
"build": "npm run build:js && npm run build:types"
"build": "pnpm run build:js && pnpm run build:types"
},
"gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982"
}

@ -1,8 +1,7 @@
import path from 'path';
import request from 'supertest';
import _ from 'lodash';
import path from 'path';
import endPointAPI from '@verdaccio/server';
import {
HEADERS,
HTTP_STATUS,
@ -33,6 +32,8 @@ import {
generateStarMedatada, generateVersion
} from './helpers/utils';
import endPointAPI from '../../src';
setup([]);
const credentials = { name: 'jota', password: 'secretPass' };

@ -1,6 +1,6 @@
import path from "path";
import express from 'express';
import request from 'request';
import path from "path";
import {API_ERROR} from '@verdaccio/dev-commons';
import {parseConfigFile} from "@verdaccio/utils";

@ -1,7 +1,6 @@
import request from 'supertest';
import path from 'path';
import request from 'supertest';
import endPointAPI from '@verdaccio/server';
import {HEADERS, HTTP_STATUS, HEADER_TYPE, TOKEN_BEARER, TOKEN_BASIC, API_ERROR} from '@verdaccio/dev-commons';
import {mockServer, generateRamdonStorage} from '@verdaccio/mock';
import {buildUserBuffer, buildToken} from '@verdaccio/utils';
@ -9,6 +8,8 @@ import {configExample, DOMAIN_SERVERS, addUser, getPackage, loginUserToken} from
import {setup, logger} from '@verdaccio/logger';
import endPointAPI from '../../src';
setup([]);
const credentials = { name: 'JotaJWT', password: 'secretPass' };

@ -1,12 +1,12 @@
import request from 'supertest';
import path from 'path';
import request from 'supertest';
import {setup, logger} from '@verdaccio/logger'
setup([]);
import { HEADERS, HTTP_STATUS } from '@verdaccio/dev-commons';
import endPointAPI from '@verdaccio/server';
import endPointAPI from '../../src';
import {generateRamdonStorage, mockServer, configExample, DOMAIN_SERVERS} from '@verdaccio/mock';

@ -1,13 +1,14 @@
import request from 'supertest';
import path from 'path';
import request from 'supertest';
import endPointAPI from '@verdaccio/server';
import {mockServer} from '@verdaccio/mock';
import {API_ERROR, HTTP_STATUS, SUPPORT_ERRORS} from '@verdaccio/dev-commons';
import {setup, logger} from '@verdaccio/logger';
import {generateRamdonStorage, getNewToken, getProfile, postProfile, configExample, DOMAIN_SERVERS} from '@verdaccio/mock';
import endPointAPI from '../../src';
setup([]);

@ -1,5 +1,5 @@
import _ from 'lodash';
import path from "path";
import _ from 'lodash';
import { Config as AppConfig } from '@verdaccio/config';
import {Config, UpLinkConf} from '@verdaccio/types';

@ -1,8 +1,7 @@
import request from 'supertest';
import path from 'path';
import request from 'supertest';
import _ from 'lodash';
import endPointAPI from '@verdaccio/server';
import {
HEADERS,
HTTP_STATUS,
@ -14,6 +13,8 @@ import {generateRamdonStorage, DOMAIN_SERVERS, mockServer, getNewToken, configEx
import {setup, logger} from '@verdaccio/logger';
import endPointAPI from '../../src';
setup([]);
const credentials = { name: 'jota_token', password: 'secretPass' };

@ -1,15 +1,15 @@
import request from 'supertest';
import path from 'path';
import request from 'supertest';
import publishMetadata from './partials/publish-api';
import forbiddenPlace from './partials/forbidden-place';
import endPointAPI from '../../src';
import { HEADERS, API_ERROR, HTTP_STATUS, HEADER_TYPE, DIST_TAGS} from '@verdaccio/dev-commons';
import {addUser, mockServer, DOMAIN_SERVERS, configExample, generateRamdonStorage} from '@verdaccio/mock';
import {setup, logger} from '@verdaccio/logger';
import endPointAPI from '../../src';
import forbiddenPlace from './partials/forbidden-place';
import publishMetadata from './partials/publish-api';
setup([]);

@ -1,3 +1,3 @@
{
"presets": [["@verdaccio"]]
"extends": "../../.babelrc"
}

@ -20,7 +20,7 @@
"type-check": "tsc --noEmit",
"build:types": "tsc --emitDeclarationOnly --declaration true",
"build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
"build": "npm run build:js && npm run build:types"
"build": "pnpm run build:js && pnpm run build:types"
},
"dependencies": {
"@verdaccio/commons-api": "9.6.1",
@ -32,10 +32,14 @@
"@verdaccio/streams": "9.6.1",
"@verdaccio/utils": "5.0.0-alpha.0",
"async": "3.1.1",
"lunr-mutable-indexes": "^2.3.2",
"lodash": "4.17.15",
"semver": "7.1.2"
},
"devDependencies": {
"@verdaccio/config": "5.0.0-alpha.0",
"@verdaccio/mock": "5.0.0-alpha.0",
"@verdaccio/dev-types": "5.0.0-alpha.0",
"@verdaccio/types": "9.5.0"
},
"gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982"

@ -873,7 +873,7 @@ class LocalStorage implements IStorage {
return this.storagePlugin.deleteToken(user, tokenKey);
}
public readTokens(filter: TokenFilter): Promise<Array<Token>> {
public readTokens(filter: TokenFilter): Promise<Token[]> {
if (_.isFunction(this.storagePlugin.readTokens) === false) {
return Promise.reject(ErrorCode.getCode(HTTP_STATUS.SERVICE_UNAVAILABLE, SUPPORT_ERRORS.PLUGIN_MISSING_INTERFACE));
}

@ -1,11 +1,11 @@
import _ from 'lodash';
import { SearchInstance } from './search';
import { ErrorCode, isObject, normalizeDistTags, semverSort, generateRandomHexString } from '@verdaccio/utils';
import { Package, Version, Author } from '@verdaccio/types';
import { IStorage } from '@verdaccio/dev-types';
import { API_ERROR, HTTP_STATUS, DIST_TAGS, USERS, STORAGE } from '@verdaccio/dev-commons';
import { SearchInstance } from './search';
export function generatePackageTemplate(name: string): Package {
return {

@ -1,9 +1,8 @@
import _ from 'lodash';
import assert from 'assert';
import async, { AsyncResultArrayCallback } from 'async';
import Stream from 'stream';
import async, { AsyncResultArrayCallback } from 'async';
import _ from 'lodash';
import { ProxyStorage } from '@verdaccio/proxy';
import { SearchInstance }from './search';
import { API_ERROR, HTTP_STATUS, DIST_TAGS } from '@verdaccio/dev-commons';
import { ReadTarball } from '@verdaccio/streams';
import {
@ -19,6 +18,7 @@ import { IStorage, IProxy, IStorageHandler, ProxyList, StringValue, IGetPackageO
import { GenericBody, TokenFilter, Token } from '@verdaccio/types';
import { logger } from '@verdaccio/logger';
import { VerdaccioError } from '@verdaccio/commons-api';
import { SearchInstance }from './search';
import { LocalStorage } from './local-storage';
import { mergeVersions } from './metadata-utils';
@ -75,7 +75,7 @@ class Storage implements IStorageHandler {
return typeof this.config.publish !== 'undefined' && _.isBoolean(this.config.publish.allow_offline) && this.config.publish.allow_offline;
}
public readTokens(filter: TokenFilter): Promise<Array<Token>> {
public readTokens(filter: TokenFilter): Promise<Token[]> {
return this.localStorage.readTokens(filter);
}

@ -1,20 +1,20 @@
import rimRaf from 'rimraf';
import path from 'path';
import rimRaf from 'rimraf';
import { LocalStorage } from '@verdaccio/store/src/local-storage';
import {Config as AppConfig } from '@verdaccio/config';
// @ts-ignore
import { logger, setup} from '@verdaccio/logger';
import { configExample, generateNewVersion } from '@verdaccio/mock';
import {IStorage} from '@verdaccio/dev-types';
import { LocalStorage } from '../src/local-storage';
import {generatePackageTemplate} from '../src/storage-utils';
import {readFile} from './fixtures/test.utils';
const readMetadata = (fileName = 'metadata') => readFile(`../fixtures/${fileName}`).toString();
import {Config, MergeTags, Package} from '@verdaccio/types';
import { API_ERROR, HTTP_STATUS, DIST_TAGS} from '@verdaccio/dev-commons';
import { VerdaccioError } from '@verdaccio/commons-api';
import {generatePackageTemplate} from '../src/storage-utils';
import {readFile} from './fixtures/test.utils';
setup([]);

@ -1,8 +1,8 @@
import { Config } from '@verdaccio/config';
import { Storage } from '@verdaccio/store';
import { configExample } from '@verdaccio/mock';
import { setup } from '@verdaccio/logger';
import { Storage } from '../src';
import { SearchInstance } from '../src/search';
setup([]);

@ -1,6 +1,6 @@
import {normalizePackage, mergeUplinkTimeIntoLocal} from '../src/storage-utils';
import {Package} from '@verdaccio/types';
import { STORAGE, DIST_TAGS } from '@verdaccio/dev-commons';
import {normalizePackage, mergeUplinkTimeIntoLocal} from '../src/storage-utils';
import {readFile} from "./fixtures/test.utils";

@ -1,3 +1,3 @@
{
"presets": [["@verdaccio"]]
"extends": "../../.babelrc"
}

@ -12,6 +12,9 @@
"type": "git",
"url": "git://github.com/verdaccio/verdaccio"
},
"dependencies": {
"lunr-mutable-indexes": "^2.3.2"
},
"homepage": "https://verdaccio.org",
"license": "MIT",
"scripts": {

@ -1,3 +1,3 @@
{
"presets": [["@verdaccio"]]
"extends": "../../.babelrc"
}

@ -15,7 +15,8 @@
"license": "MIT",
"homepage": "https://verdaccio.org",
"dependencies": {
"@verdaccio/dev-commons": "5.0.0-alpha.0",
"@verdaccio/commons-api": "^9.7.1",
"@verdaccio/dev-commons": "workspace:5.0.0-alpha.0",
"@verdaccio/readme": "9.6.1",
"js-yaml": "3.13.1",
"jsonwebtoken": "8.5.1",
@ -23,8 +24,10 @@
"semver": "7.3.2"
},
"devDependencies": {
"lodash": "^4.17.19",
"@types/minimatch": "3.0.3",
"@verdaccio/dev-types": "5.0.0-alpha.0"
"@verdaccio/logger": "workspace:5.0.0-alpha.0",
"@verdaccio/dev-types": "workspace:5.0.0-alpha.0"
},
"scripts": {
"clean": "rimraf ./build",
@ -32,7 +35,7 @@
"type-check": "tsc --noEmit",
"build:types": "tsc --emitDeclarationOnly --declaration true",
"build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
"build": "npm run build:js && npm run build:types"
"build": "pnpm run build:js && pnpm run build:types"
},
"gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982"
}

@ -1,11 +1,11 @@
import _ from 'lodash';
import assert from 'assert';
import _ from 'lodash';
import minimatch from 'minimatch';
import { ErrorCode } from './utils';
import { PackageList, UpLinksConfList } from '@verdaccio/types';
import { MatchedPackage, LegacyPackageList } from '@verdaccio/dev-types';
import { ErrorCode } from './utils';
const BLACKLIST = {
all: true,

@ -1,6 +1,7 @@
import fs from 'fs';
import assert from 'assert';
import URL from 'url';
import { IncomingHttpHeaders } from 'http';
import _ from 'lodash';
import semver from 'semver';
import YAML from 'js-yaml';
@ -33,7 +34,6 @@ import {
getCode,
} from '@verdaccio/commons-api';
import { IncomingHttpHeaders } from 'http';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-var-requires
@ -314,7 +314,7 @@ export function normalizeDistTags(pkg: Package): void {
if (!pkg[DIST_TAGS].latest) {
// overwrite latest with highest known version based on semver sort
sorted = semverSort(Object.keys(pkg.versions));
if (sorted && sorted.length) {
if (sorted?.length) {
pkg[DIST_TAGS].latest = sorted.pop();
}
}

@ -1,3 +1,5 @@
import { API_ERROR, ROLES } from "@verdaccio/dev-commons";
import { VerdaccioError, getForbidden } from "@verdaccio/commons-api";
import {
allow_action,
createAnonymousRemoteUser,
@ -9,9 +11,6 @@ import {
createSessionToken,
getAuthenticatedMessage,
} from "../src";
import { API_ERROR, ROLES } from "@verdaccio/dev-commons";
import { VerdaccioError, getForbidden } from "@verdaccio/commons-api";
import { Config, IPluginAuth } from '@verdaccio/types';
jest.mock('@verdaccio/logger', () => ({
logger: { trace: jest.fn() }
}));

@ -1,7 +1,7 @@
import path from 'path';
import _ from 'lodash';
import {PACKAGE_ACCESS, ROLES} from '@verdaccio/dev-commons';
import {PACKAGE_ACCESS} from '@verdaccio/dev-commons';
import {spliceURL} from '../src/string';
import {parseConfigFile} from '../src/utils';

Some files were not shown because too many files have changed in this diff Show More