mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
build: enable pnp yarn2 (#2253)
* chore: enable pnp yarn * chore: ignore pnp * fix type issues on run eslint * add missing dependency and fix some errors * fix most of the errors some were just disabled, already fixed in master * add missing jest-config * update jest@26 align with other deps * add missing @babel/register * clean up * use yarn node * use yarn node on release * chore: add husky 6 * chore: add husky 6 * chore: lint-stage * chore: test * chore: add hook git * chore: test * chore: test * update deps * chore: fix commit lint * fix docker run * update git ignore
This commit is contained in:
parent
351ea89df6
commit
69d7df20d8
65 changed files with 28166 additions and 178 deletions
|
@ -9,7 +9,7 @@
|
|||
# you can add exceptions like in .gitignore to maintain a whitelist:
|
||||
# e.g.
|
||||
!babel.config.js
|
||||
!.eslintrc
|
||||
!eslintrc.js
|
||||
!.prettierrc
|
||||
!.eslintignore
|
||||
!.stylelintrc
|
||||
|
@ -18,9 +18,12 @@
|
|||
!.yarnrc.yml
|
||||
!.yarn/releases/yarn-*.cjs
|
||||
!.yarn/plugins/*
|
||||
!.pnp.js
|
||||
|
||||
# do not copy over node_modules we will run `npm install` anyway
|
||||
# just in case, yarn 2 pnp is enabled
|
||||
node_modules
|
||||
.husky/
|
||||
.git/
|
||||
|
||||
# output from test runs and similar things
|
||||
*.log
|
||||
|
|
|
@ -20,3 +20,4 @@ test/unit/partials/
|
|||
types/custom.d.ts
|
||||
docker-examples/
|
||||
LICENSE
|
||||
.pnp.js
|
||||
|
|
|
@ -23,7 +23,7 @@ jobs:
|
|||
# run: yarn install --pure-lockfile
|
||||
# - name: 'Run verdaccio in the background'
|
||||
# run: |
|
||||
# nohup node ./scripts/run-verdaccio.js &
|
||||
# nohup yarn node ./scripts/run-verdaccio.js &
|
||||
# - name: 'Ping to verdaccio'
|
||||
# run: |
|
||||
# npm ping --registry http://localhost:4873
|
||||
|
@ -58,7 +58,7 @@ jobs:
|
|||
run: yarn install
|
||||
- name: 'Run verdaccio in the background'
|
||||
run: |
|
||||
nohup node ./scripts/run-verdaccio.js --config ./scripts/e2e-config.yaml &
|
||||
nohup yarn node ./scripts/run-verdaccio.js --config ./scripts/e2e-config.yaml &
|
||||
- name: 'Ping to verdaccio'
|
||||
run: |
|
||||
npm ping --registry http://localhost:4873
|
||||
|
@ -95,7 +95,7 @@ jobs:
|
|||
run: yarn install
|
||||
- name: 'Run verdaccio in the background'
|
||||
run: |
|
||||
nohup node ./scripts/run-verdaccio.js --config ./scripts/e2e-config.yaml &
|
||||
nohup yarn node ./scripts/run-verdaccio.js --config ./scripts/e2e-config.yaml &
|
||||
- name: 'Ping to verdaccio'
|
||||
run: |
|
||||
npm ping --registry http://localhost:4873
|
||||
|
@ -134,7 +134,7 @@ jobs:
|
|||
# run: yarn install --pure-lockfile
|
||||
# - name: 'Run verdaccio in the background'
|
||||
# run: |
|
||||
# nohup node ./scripts/run-verdaccio.js &
|
||||
# nohup yarn node ./scripts/run-verdaccio.js &
|
||||
# - name: 'Ping to verdaccio'
|
||||
# run: |
|
||||
# pnpm ping --registry http://localhost:4873
|
||||
|
|
|
@ -24,7 +24,7 @@ jobs:
|
|||
run: yarn install
|
||||
- name: 'Run verdaccio in the background'
|
||||
run: |
|
||||
nohup node ./scripts/run-verdaccio.js --config ./scripts/e2e-config.yaml &
|
||||
nohup yarn node ./scripts/run-verdaccio.js --config ./scripts/e2e-config.yaml &
|
||||
- name: 'Ping to verdaccio'
|
||||
run: |
|
||||
npm ping --registry http://localhost:4873
|
||||
|
|
12
.github/workflows/e2e-jest-workflow.yml
vendored
12
.github/workflows/e2e-jest-workflow.yml
vendored
|
@ -22,7 +22,7 @@ jobs:
|
|||
run: yarn install
|
||||
- name: 'Run verdaccio in the background'
|
||||
run: |
|
||||
nohup node ./scripts/run-verdaccio.js --config ./scripts/e2e-config.yaml &
|
||||
nohup yarn node ./scripts/run-verdaccio.js --config ./scripts/e2e-config.yaml &
|
||||
- name: 'Ping to verdaccio'
|
||||
run: |
|
||||
npm ping --registry http://localhost:4873
|
||||
|
@ -53,7 +53,7 @@ jobs:
|
|||
run: yarn install
|
||||
- name: 'Run verdaccio in the background'
|
||||
run: |
|
||||
nohup node ./scripts/run-verdaccio.js --config ./scripts/e2e-config.yaml &
|
||||
nohup yarn node ./scripts/run-verdaccio.js --config ./scripts/e2e-config.yaml &
|
||||
- name: 'Ping to verdaccio'
|
||||
run: |
|
||||
npm ping --registry http://localhost:4873
|
||||
|
@ -89,7 +89,7 @@ jobs:
|
|||
run: yarn install
|
||||
- name: 'Run verdaccio in the background'
|
||||
run: |
|
||||
nohup node ./scripts/run-verdaccio.js --config ./scripts/e2e-config.yaml &
|
||||
nohup yarn node ./scripts/run-verdaccio.js --config ./scripts/e2e-config.yaml &
|
||||
- name: 'Ping to verdaccio'
|
||||
run: |
|
||||
npm ping --registry http://localhost:4873
|
||||
|
@ -122,7 +122,7 @@ jobs:
|
|||
run: yarn install
|
||||
- name: 'Run verdaccio in the background'
|
||||
run: |
|
||||
nohup node ./scripts/run-verdaccio.js --config ./scripts/e2e-config.yaml &
|
||||
nohup yarn node ./scripts/run-verdaccio.js --config ./scripts/e2e-config.yaml &
|
||||
- name: 'Ping to verdaccio'
|
||||
run: |
|
||||
npm ping --registry http://localhost:4873
|
||||
|
@ -156,7 +156,7 @@ jobs:
|
|||
run: yarn install
|
||||
- name: 'Run verdaccio in the background'
|
||||
run: |
|
||||
nohup node ./scripts/run-verdaccio.js &
|
||||
nohup yarn node ./scripts/run-verdaccio.js &
|
||||
- name: 'Ping to verdaccio'
|
||||
run: |
|
||||
pnpm ping --registry http://localhost:4873
|
||||
|
@ -189,7 +189,7 @@ jobs:
|
|||
run: yarn install
|
||||
- name: 'Run verdaccio in the background'
|
||||
run: |
|
||||
nohup node ./scripts/run-verdaccio.js &
|
||||
nohup yarn node ./scripts/run-verdaccio.js &
|
||||
- name: 'Ping to verdaccio'
|
||||
run: |
|
||||
pnpm ping --registry http://localhost:4873
|
||||
|
|
14
.gitignore
vendored
14
.gitignore
vendored
|
@ -1,7 +1,9 @@
|
|||
npm-debug.log
|
||||
|
||||
verdaccio-*.tgz
|
||||
.DS_Store
|
||||
build/
|
||||
# not commited at this point, comment out when enableGlobalCache is false
|
||||
.yarn/cache
|
||||
|
||||
### Test
|
||||
|
||||
|
@ -21,19 +23,13 @@ package-lock.json
|
|||
npm_test-fails-add-tarball*
|
||||
yarn-error.log
|
||||
|
||||
# Istanbul
|
||||
# coverage
|
||||
reports/
|
||||
coverage/
|
||||
.nyc*
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
|
||||
|
||||
# React
|
||||
bundle.js
|
||||
bundle.js.map
|
||||
__tests__
|
||||
|
||||
# Compiled script
|
||||
static/*
|
||||
|
||||
|
|
1
.husky/.gitignore
vendored
Normal file
1
.husky/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
_
|
4
.husky/commit-msg
Executable file
4
.husky/commit-msg
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
yarn commitlint --edit "$1"
|
4
.husky/pre-commit
Executable file
4
.husky/pre-commit
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
yarn lint-staged
|
27999
.pnp.js
generated
Executable file
27999
.pnp.js
generated
Executable file
File diff suppressed because one or more lines are too long
|
@ -30,3 +30,4 @@ docker-examples/
|
|||
.npmignore
|
||||
.gitignore
|
||||
*.ico
|
||||
.pnp.js
|
||||
|
|
|
@ -1,15 +1,9 @@
|
|||
defaultSemverRangePrefix: ""
|
||||
|
||||
enableGlobalCache: true
|
||||
|
||||
enableTelemetry: false
|
||||
|
||||
enableTelemetry: true
|
||||
httpRetry: 10
|
||||
|
||||
httpTimeout: 100000
|
||||
|
||||
nodeLinker: node-modules
|
||||
|
||||
npmRegistryServer: "https://registry.verdaccio.org"
|
||||
|
||||
plugins:
|
||||
|
@ -17,5 +11,6 @@ plugins:
|
|||
spec: "@yarnpkg/plugin-workspace-tools"
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||
spec: "@yarnpkg/plugin-interactive-tools"
|
||||
- ./yarn-plugins/plugin-postinstall.js
|
||||
|
||||
yarnPath: .yarn/releases/yarn-2.4.1.cjs
|
||||
|
|
14
Dockerfile
14
Dockerfile
|
@ -1,7 +1,10 @@
|
|||
FROM --platform=${BUILDPLATFORM:-linux/amd64} node:14.16.1-alpine as builder
|
||||
|
||||
ENV NODE_ENV=production \
|
||||
VERDACCIO_BUILD_REGISTRY=https://registry.verdaccio.org
|
||||
VERDACCIO_BUILD_REGISTRY=https://registry.verdaccio.org \
|
||||
HUSKY_SKIP_INSTALL=1 \
|
||||
CI=true \
|
||||
HUSKY_DEBUG=1
|
||||
|
||||
RUN apk --no-cache add openssl ca-certificates wget && \
|
||||
apk --no-cache add g++ gcc libgcc libstdc++ linux-headers make python && \
|
||||
|
@ -13,15 +16,14 @@ WORKDIR /opt/verdaccio-build
|
|||
COPY . .
|
||||
|
||||
RUN yarn config set npmRegistryServer $VERDACCIO_BUILD_REGISTRY && \
|
||||
yarn config set enableProgressBars false && \
|
||||
yarn config set enableTelemetry false && \
|
||||
yarn config set enableProgressBars true && \
|
||||
yarn config set enableTelemetry true && \
|
||||
yarn config set enableGlobalCache false && \
|
||||
yarn install && \
|
||||
yarn code:docker-build && \
|
||||
yarn cache clean && \
|
||||
yarn workspaces focus --production
|
||||
|
||||
|
||||
|
||||
FROM node:14.16.1-alpine
|
||||
LABEL maintainer="https://github.com/verdaccio/verdaccio"
|
||||
|
||||
|
@ -56,4 +58,4 @@ VOLUME /verdaccio/storage
|
|||
|
||||
ENTRYPOINT ["uid_entrypoint"]
|
||||
|
||||
CMD $VERDACCIO_APPDIR/bin/verdaccio --config /verdaccio/conf/config.yaml --listen $VERDACCIO_PROTOCOL://0.0.0.0:$VERDACCIO_PORT
|
||||
CMD node -r ./.pnp.js $VERDACCIO_APPDIR/bin/verdaccio --config /verdaccio/conf/config.yaml --listen $VERDACCIO_PROTOCOL://0.0.0.0:$VERDACCIO_PORT
|
||||
|
|
29
codecov.yml
29
codecov.yml
|
@ -1,29 +0,0 @@
|
|||
codecov:
|
||||
require_ci_to_pass: yes
|
||||
|
||||
coverage:
|
||||
precision: 2
|
||||
round: down
|
||||
range: "80...85"
|
||||
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
target: auto
|
||||
threshold: 1%
|
||||
base: auto
|
||||
patch: no
|
||||
changes: no
|
||||
|
||||
parsers:
|
||||
gcov:
|
||||
branch_detection:
|
||||
conditional: yes
|
||||
loop: yes
|
||||
method: no
|
||||
macro: no
|
||||
|
||||
comment:
|
||||
layout: "diff,flags,tree"
|
||||
behavior: default
|
||||
require_changes: no
|
|
@ -1,16 +1,14 @@
|
|||
{
|
||||
module.exports = {
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"google",
|
||||
"plugin:react/recommended",
|
||||
"plugin:jest/recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:import/typescript",
|
||||
"plugin:jsx-a11y/recommended",
|
||||
"prettier"
|
||||
],
|
||||
"plugins": ["import", "jest", "jsx-a11y", "react-hooks"],
|
||||
"plugins": ["import", "jest"],
|
||||
"env": {
|
||||
"es6": true,
|
||||
"node": true,
|
||||
|
@ -31,7 +29,7 @@
|
|||
"settings": {
|
||||
"import/resolver": {
|
||||
"node": {
|
||||
"extensions": [".js", ".jsx", ".ts", ".tsx"]
|
||||
"extensions": [".js", ".ts", ".tsx"]
|
||||
}
|
||||
}
|
||||
},
|
47
package.json
47
package.json
|
@ -33,6 +33,7 @@
|
|||
"dayjs": "1.10.4",
|
||||
"debug": "^4.3.1",
|
||||
"envinfo": "7.7.4",
|
||||
"eslint-import-resolver-node": "0.3.4",
|
||||
"express": "4.17.1",
|
||||
"fast-safe-stringify": "^2.0.7",
|
||||
"handlebars": "4.7.7",
|
||||
|
@ -68,8 +69,10 @@
|
|||
"@babel/plugin-proposal-export-namespace-from": "7.12.13",
|
||||
"@babel/plugin-proposal-function-sent": "7.12.13",
|
||||
"@babel/plugin-proposal-json-strings": "7.13.8",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator": "7.14.2",
|
||||
"@babel/plugin-proposal-numeric-separator": "7.12.13",
|
||||
"@babel/plugin-proposal-object-rest-spread": "7.13.8",
|
||||
"@babel/plugin-proposal-optional-chaining": "7.14.2",
|
||||
"@babel/plugin-proposal-throw-expressions": "7.12.13",
|
||||
"@babel/plugin-syntax-dynamic-import": "7.8.3",
|
||||
"@babel/plugin-syntax-import-meta": "7.10.4",
|
||||
|
@ -79,13 +82,12 @@
|
|||
"@babel/polyfill": "^7.12.1",
|
||||
"@babel/preset-env": "7.13.9",
|
||||
"@babel/preset-typescript": "7.13.0",
|
||||
"@babel/register": "7.13.8",
|
||||
"@babel/register": "7.13.16",
|
||||
"@babel/runtime": "7.13.9",
|
||||
"@commitlint/cli": "12.0.1",
|
||||
"@commitlint/config-conventional": "12.0.1",
|
||||
"@octokit/rest": "16.43.2",
|
||||
"@types/async": "3.2.4",
|
||||
"@types/bunyan": "1.8.6",
|
||||
"@types/express": "4.17.6",
|
||||
"@types/http-errors": "1.8.0",
|
||||
"@types/jest": "26.0.14",
|
||||
|
@ -105,7 +107,6 @@
|
|||
"babel-jest": "26.6.3",
|
||||
"babel-loader": "^8.2.2",
|
||||
"babel-plugin-dynamic-import-node": "2.3.3",
|
||||
"codecov": "3.8.1",
|
||||
"cross-env": "7.0.3",
|
||||
"detect-secrets": "1.0.6",
|
||||
"eslint": "7.19.0",
|
||||
|
@ -114,22 +115,21 @@
|
|||
"eslint-plugin-babel": "5.3.1",
|
||||
"eslint-plugin-import": "2.22.1",
|
||||
"eslint-plugin-jest": "24.1.3",
|
||||
"eslint-plugin-jsx-a11y": "6.4.1",
|
||||
"eslint-plugin-react": "7.22.0",
|
||||
"eslint-plugin-react-hooks": "4.2.0",
|
||||
"eslint-plugin-simple-import-sort": "7.0.0",
|
||||
"eslint-plugin-verdaccio": "9.6.1",
|
||||
"fs-extra": "9.1.0",
|
||||
"get-stdin": "8.0.0",
|
||||
"husky": "2.7.0",
|
||||
"husky": "6.0.0",
|
||||
"in-publish": "2.0.1",
|
||||
"jest": "25.5.4",
|
||||
"jest-environment-node": "25.5.0",
|
||||
"jest": "26.6.3",
|
||||
"jest-config": "26.6.3",
|
||||
"jest-environment-node": "26.6.2",
|
||||
"jest-junit": "9.0.0",
|
||||
"lint-staged": "8.2.1",
|
||||
"lint-staged": "11.0.0",
|
||||
"lockfile-lint": "4.3.7",
|
||||
"nock": "12.0.3",
|
||||
"node-mocks-http": "^1.10.1",
|
||||
"pinst": "2.0.0",
|
||||
"prettier": "2.2.1",
|
||||
"puppeteer": "5.5.0",
|
||||
"rimraf": "3.0.2",
|
||||
|
@ -167,15 +167,14 @@
|
|||
"test:e2e": "yarn jest --config ./test/jest.config.e2e.js",
|
||||
"test:all": "yarn run test && yarn run test:functional && yarn run test:e2e & yarn run test:e2e:pkg",
|
||||
"pre:ci": "yarn run lint",
|
||||
"coverage:publish": "codecov",
|
||||
"lint": "yarn run type-check && yarn run lint:ts",
|
||||
"lint:ts": "eslint \"**/*.{js,jsx,ts,tsx}\"",
|
||||
"lint:ts": "eslint \"**/*.{js,jsx,ts,tsx}\" -c ./eslintrc.js",
|
||||
"lint:lockfile": "lockfile-lint --path yarn.lock --type yarn --validate-https --allowed-hosts verdaccio npm yarn",
|
||||
"start": "yarn babel-node --extensions \".ts,.tsx\" src/lib/cli",
|
||||
"start:debug": "yarn node debug/bootstrap.js",
|
||||
"code:build": "yarn babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps inline",
|
||||
"code:docker-build": "yarn babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\"",
|
||||
"docker": "docker build -t verdaccio/verdaccio:pr-2122 . --no-cache",
|
||||
"docker": "docker build -t verdaccio/verdaccio:local . --no-cache",
|
||||
"docker:run": "docker run -it --rm -p 4873:4873 verdaccio/verdaccio:local"
|
||||
},
|
||||
"engines": {
|
||||
|
@ -183,30 +182,16 @@
|
|||
"npm": ">=6"
|
||||
},
|
||||
"preferGlobal": true,
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged",
|
||||
"commit-msg": "commitlint -e $GIT_PARAMS"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"relative": true,
|
||||
"linters": {
|
||||
"*": [
|
||||
"eslint .",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"ignore": [
|
||||
"*.json"
|
||||
]
|
||||
},
|
||||
"license": "MIT",
|
||||
"commitlint": {
|
||||
"extends": [
|
||||
"@commitlint/config-conventional"
|
||||
]
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,jsx,ts,tsx,json,yml,yaml,md}": "prettier --write",
|
||||
"*.{js,ts,tsx}": "eslint --fix -c ./eslintrc.js"
|
||||
},
|
||||
"collective": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/verdaccio",
|
||||
|
|
|
@ -7,4 +7,4 @@ changelog=$(git show $GITHUB_SHA --unified=0 CHANGELOG.md | tail +12 | sed -e 's
|
|||
|
||||
echo "$changelog"
|
||||
|
||||
echo "$changelog" | node scripts/trigger-release.js $lastTag
|
||||
echo "$changelog" | yarn node scripts/trigger-release.js $lastTag
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
/**
|
||||
* @prettier
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const [, , /* node */ /* file */ tag] = process.argv;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
module.exports = function() {
|
||||
const message = "this is a basic project";
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(message);
|
||||
|
||||
return message;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
module.exports = function() {
|
||||
const message = "this is a scoped basic project";
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(message);
|
||||
|
||||
return message;
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
/* eslint-disable no-console */
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import os from 'os';
|
||||
import { green } from 'kleur';
|
||||
import { spawn } from 'child_process';
|
||||
import { green } from 'kleur';
|
||||
import { npm } from '../utils/process';
|
||||
import * as __global from '../utils/global.js';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const fs = require('fs');
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import NodeEnvironment from 'jest-environment-node';
|
||||
const fs = require('fs');
|
||||
const __global = require('../utils/global');
|
||||
// import { npm } from '../utils/process';
|
||||
|
||||
|
@ -16,6 +16,7 @@ class E2ECliTestEnvironment extends NodeEnvironment {
|
|||
);
|
||||
__global.addItem('dir-root', tempRoot);
|
||||
this.global.__namespace = __global;
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`current directory: ${process.cwd()}`);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable no-console */
|
||||
|
||||
const namespace = Object.create(null);
|
||||
|
||||
exports.addItem = function(name, value) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable no-console */
|
||||
|
||||
import * as child_process from 'child_process';
|
||||
import { SpawnOptions } from 'child_process';
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ describe('/ (Verdaccio Page)', () => {
|
|||
beforeAll(async () => {
|
||||
page = await global.__BROWSER__.newPage();
|
||||
await page.goto('http://0.0.0.0:55558');
|
||||
// eslint-disable-next-line no-console
|
||||
page.on('console', msg => console.log('PAGE LOG:', msg.text()));
|
||||
});
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
/* eslint new-cap: 0 */
|
||||
/* eslint-disable no-console */
|
||||
|
||||
const { yellow } = require('kleur');
|
||||
const NodeEnvironment = require('jest-environment-node');
|
||||
const puppeteer = require('puppeteer');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const { yellow } = require('kleur');
|
||||
const NodeEnvironment = require('jest-environment-node');
|
||||
const puppeteer = require('puppeteer');
|
||||
const {VerdaccioConfig} = require("../lib/verdaccio-server");
|
||||
const VerdaccioProcess = require("../lib/server_process");
|
||||
const Server = require("../lib/server");
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
const { green } = require('kleur');
|
||||
const puppeteer = require('puppeteer');
|
||||
const fs = require('fs');
|
||||
const mkdirp = require('mkdirp');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const { green } = require('kleur');
|
||||
const puppeteer = require('puppeteer');
|
||||
const mkdirp = require('mkdirp');
|
||||
|
||||
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
|
||||
|
||||
module.exports = async function() {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(green('Setup Puppeteer'));
|
||||
const browser = await puppeteer.launch({ headless: true, /* slowMo: 300 */ args: ['--no-sandbox'] });
|
||||
global.__BROWSER__ = browser;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
const { green } = require('kleur');
|
||||
const rimraf = require('rimraf');
|
||||
/* eslint-disable no-console */
|
||||
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const { green } = require('kleur');
|
||||
const rimraf = require('rimraf');
|
||||
|
||||
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ import {
|
|||
PORT_SERVER_2,
|
||||
TARBALL
|
||||
} from '../config.functional';
|
||||
import fixturePkg from '../fixtures/package';
|
||||
import whoIam from './whoIam';
|
||||
import ping from './ping';
|
||||
import fixturePkg from '../fixtures/package';
|
||||
|
||||
function readfile(folderPath) {
|
||||
return fs.readFileSync(path.join(__dirname, '/', folderPath));
|
||||
|
|
|
@ -69,6 +69,7 @@ describe('functional test verdaccio', function () {
|
|||
});
|
||||
|
||||
process.on('unhandledRejection', function (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('unhandledRejection', err);
|
||||
process.nextTick(function () {
|
||||
throw err;
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
import { yellow, green, blue, magenta } from 'kleur';
|
||||
/* eslint-disable no-console */
|
||||
|
||||
import path from 'path';
|
||||
import { yellow, green, blue, magenta } from 'kleur';
|
||||
import NodeEnvironment from 'jest-environment-node';
|
||||
import { VerdaccioConfig } from '../../lib/verdaccio-server';
|
||||
import VerdaccioProcess from '../../lib/server_process';
|
||||
import Server from '../../lib/server';
|
||||
import ExpressServer from './simple_server';
|
||||
import { IServerBridge } from '../../types';
|
||||
import { DOMAIN_SERVERS, PORT_SERVER_1, PORT_SERVER_2, PORT_SERVER_3 } from '../config.functional';
|
||||
import ExpressServer from './simple_server';
|
||||
|
||||
const EXPRESS_PORT = 55550;
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import _ from 'lodash';
|
||||
|
||||
import { RemoteUser } from '@verdaccio/types';
|
||||
import { HEADERS } from '../../../src/lib/constants';
|
||||
import { notify } from '../../../src/lib/notify';
|
||||
import { DOMAIN_SERVERS, PORT_SERVER_APP } from '../config.functional';
|
||||
import { RemoteUser } from '@verdaccio/types';
|
||||
|
||||
export default function (express) {
|
||||
const config = {
|
||||
|
@ -114,7 +114,6 @@ export default function (express) {
|
|||
// @ts-ignore
|
||||
notify(metadata, multipleNotificationsEndpoint, publisherInfo).then(
|
||||
function (body) {
|
||||
console.log('--->body', body);
|
||||
body.forEach(function (notification) {
|
||||
const jsonBody = parseBody(notification);
|
||||
expect(
|
||||
|
|
|
@ -17,7 +17,6 @@ const PKG_GH1312 = 'pkg-gh1312';
|
|||
|
||||
function isCached(pkgName, tarballName) {
|
||||
const pathCached = path.join(__dirname, STORAGE, pkgName, tarballName);
|
||||
console.log('isCached =>', pathCached);
|
||||
|
||||
return fs.existsSync(pathCached);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import _ from 'lodash';
|
||||
import assert from 'assert';
|
||||
import _ from 'lodash';
|
||||
import request from 'request';
|
||||
import { IRequestPromise } from '../types';
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import _ from 'lodash';
|
||||
import assert from 'assert';
|
||||
import smartRequest from './request';
|
||||
import _ from 'lodash';
|
||||
import { IServerBridge } from '../types';
|
||||
import { API_MESSAGE, HEADERS, HTTP_STATUS, TOKEN_BASIC } from '../../src/lib/constants';
|
||||
import { buildToken } from '../../src/lib/utils';
|
||||
import { CREDENTIALS } from '../functional/config.functional';
|
||||
import getPackage from '../functional/fixtures/package';
|
||||
import smartRequest from './request';
|
||||
|
||||
const buildAuthHeader = (user, pass): string => {
|
||||
return buildToken(TOKEN_BASIC, Buffer.from(`${user}:${pass}`).toString('base64'));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import _ from 'lodash';
|
||||
import rimRaf from 'rimraf';
|
||||
import path from 'path';
|
||||
import { fork } from 'child_process';
|
||||
import _ from 'lodash';
|
||||
import rimRaf from 'rimraf';
|
||||
import { CREDENTIALS } from '../functional/config.functional';
|
||||
import { HTTP_STATUS } from '../../src/lib/constants';
|
||||
import { IVerdaccioConfig, IServerBridge, IServerProcess } from '../types';
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
// this file is not aim to be tested, just to check flow definitions
|
||||
|
||||
import Config from '../../../../src/lib/config';
|
||||
import { logger } from '../../../../src/lib/logger';
|
||||
import { Callback } from '@verdaccio/types';
|
||||
|
||||
import {
|
||||
Config as AppConfig,
|
||||
PackageAccess,
|
||||
|
@ -12,6 +9,9 @@ import {
|
|||
Logger,
|
||||
PluginOptions
|
||||
} from '@verdaccio/types';
|
||||
import Config from '../../../../src/lib/config';
|
||||
import { logger } from '../../../../src/lib/logger';
|
||||
|
||||
|
||||
class ExampleAuthPlugin implements IPluginAuth<{}> {
|
||||
config: AppConfig;
|
||||
|
|
0
test/types-test/plugins/middleware/.eslintrc
Normal file
0
test/types-test/plugins/middleware/.eslintrc
Normal file
|
@ -1,15 +1,7 @@
|
|||
// this file is not aim to be tested, just to check typescript definitions
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/* eslint-disable no-unused-vars */
|
||||
|
||||
import Config from '../../../../src/lib/config';
|
||||
import { generatePackageTemplate } from '../../../../src/lib/storage-utils';
|
||||
import { readFile } from '../../../functional/lib/test.utils';
|
||||
import { Package } from '@verdaccio/types';
|
||||
|
||||
const readMetadata = (fileName: string): Package =>
|
||||
JSON.parse(readFile(`../../unit/partials/${fileName}`).toString()) as Package;
|
||||
|
||||
import { IUploadTarball, IReadTarball } from '@verdaccio/streams';
|
||||
import {
|
||||
Config as AppConfig,
|
||||
IPluginMiddleware,
|
||||
|
@ -17,9 +9,16 @@ import {
|
|||
RemoteUser,
|
||||
IBasicAuth
|
||||
} from '@verdaccio/types';
|
||||
import { IUploadTarball, IReadTarball } from '@verdaccio/streams';
|
||||
import { generateVersion } from '../../../unit/__helper/utils';
|
||||
import { Package } from '@verdaccio/types';
|
||||
|
||||
import Config from '../../../../src/lib/config';
|
||||
import { generatePackageTemplate } from '../../../../src/lib/storage-utils';
|
||||
import { readFile } from '../../../functional/lib/test.utils';
|
||||
|
||||
const readMetadata = (fileName: string): Package =>
|
||||
JSON.parse(readFile(`../../unit/partials/${fileName}`).toString()) as Package;
|
||||
|
||||
import { generateVersion } from '../../../unit/__helper/utils';
|
||||
export default class ExampleMiddlewarePlugin implements IPluginMiddleware<{}> {
|
||||
register_middlewares(app: any, auth: IBasicAuth<{}>, storage: IStorageManager<{}>): void {
|
||||
const remoteUser: RemoteUser = {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import _ from 'lodash';
|
||||
import request from 'supertest';
|
||||
|
||||
import { Package } from '@verdaccio/types';
|
||||
import { HEADER_TYPE, HEADERS, HTTP_STATUS, TOKEN_BEARER } from '../../../src/lib/constants';
|
||||
import { buildToken, encodeScopedUri } from '../../../src/lib/utils';
|
||||
import { Package } from '@verdaccio/types';
|
||||
import { getTaggedVersionFromPackage } from './expects';
|
||||
import { generateRandomHexString } from '../../../src/lib/crypto-utils';
|
||||
import { getTaggedVersionFromPackage } from './expects';
|
||||
|
||||
// API Helpers
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable max-len */
|
||||
|
||||
import { Package } from '@verdaccio/types';
|
||||
|
||||
export function generateAttachment() {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import _ from 'lodash';
|
||||
import { VerdaccioError } from '@verdaccio/commons-api';
|
||||
import smartRequest, { PromiseAssert } from '../../lib/request';
|
||||
import { mockServer } from '../__helper/mock';
|
||||
import { HTTP_STATUS } from '../../../src/lib/constants';
|
||||
import { IRequestPromise } from '../../types';
|
||||
import { VerdaccioError } from '@verdaccio/commons-api';
|
||||
|
||||
describe('Request Functional', () => {
|
||||
jest.setTimeout(20000);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import request from 'supertest';
|
||||
import path from 'path';
|
||||
import request from 'supertest';
|
||||
import rimraf from 'rimraf';
|
||||
|
||||
import { setup } from '../../../../src/lib/logger';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import path from 'path';
|
||||
import { Readable } from 'stream';
|
||||
import request from 'supertest';
|
||||
import _ from 'lodash';
|
||||
import path from 'path';
|
||||
import rimraf from 'rimraf';
|
||||
import nock from 'nock';
|
||||
import { Readable } from 'stream';
|
||||
|
||||
import configDefault from '../../partials/config';
|
||||
import publishMetadata from '../../partials/publish-api';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import request from 'supertest';
|
||||
import path from 'path';
|
||||
import request from 'supertest';
|
||||
import rimraf from 'rimraf';
|
||||
import _ from 'lodash';
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import _ from 'lodash';
|
||||
import { Config, Security, RemoteUser } from '@verdaccio/types';
|
||||
import Auth from '../../../../src/lib/auth';
|
||||
import { CHARACTER_ENCODING, TOKEN_BEARER } from '../../../../src/lib/constants';
|
||||
// $FlowFixMe
|
||||
|
@ -18,7 +19,6 @@ import { aesDecrypt, verifyPayload } from '../../../../src/lib/crypto-utils';
|
|||
import { parseConfigurationFile } from '../../__helper';
|
||||
|
||||
import { IAuth } from '../../../../types';
|
||||
import { Config, Security, RemoteUser } from '@verdaccio/types';
|
||||
|
||||
setup([]);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import request from 'supertest';
|
||||
import path from 'path';
|
||||
import request from 'supertest';
|
||||
import rimraf from 'rimraf';
|
||||
|
||||
import endPointAPI from '../../../../src/api';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import path from 'path';
|
||||
import request from 'supertest';
|
||||
import _ from 'lodash';
|
||||
import path from 'path';
|
||||
import rimraf from 'rimraf';
|
||||
|
||||
import endPointAPI from '../../../../src/api';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import endPointAPI from '../../../src/api/index';
|
||||
import { API_ERROR } from '../../../src/lib/constants';
|
||||
|
||||
import express from 'express';
|
||||
import request from 'request';
|
||||
import rimraf from 'rimraf';
|
||||
import { API_ERROR } from '../../../src/lib/constants';
|
||||
import endPointAPI from '../../../src/api/index';
|
||||
import config from '../partials/config/index';
|
||||
|
||||
import { setup } from '../../../src/lib/logger';
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import path from 'path';
|
||||
import _ from 'lodash';
|
||||
import selfsigned from 'selfsigned';
|
||||
import os from 'os';
|
||||
import fs from 'fs';
|
||||
import _ from 'lodash';
|
||||
import selfsigned from 'selfsigned';
|
||||
|
||||
import startServer from '../../../../src';
|
||||
import config from '../../partials/config';
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import _ from 'lodash';
|
||||
import { Config } from '@verdaccio/types';
|
||||
import { getInternalError } from '@verdaccio/commons-api';
|
||||
import Auth from '../../../../src/lib/auth';
|
||||
import { authProfileConf, authPluginFailureConf, authPluginPassThrougConf } from './helper/plugin';
|
||||
import AppConfig from '../../../../src/lib/config';
|
||||
import { setup } from '../../../../src/lib/logger';
|
||||
|
||||
import { IAuth } from '../../../../types';
|
||||
import { Config } from '@verdaccio/types';
|
||||
import { ROLES } from '../../../../src/lib/constants';
|
||||
import { getInternalError } from '@verdaccio/commons-api';
|
||||
import { authProfileConf, authPluginFailureConf, authPluginPassThrougConf } from './helper/plugin';
|
||||
|
||||
setup([]);
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable max-len */
|
||||
// this is how a Babel.js transpiled plugin looks like
|
||||
|
||||
"use strict";
|
||||
|
@ -6,11 +7,11 @@ Object.defineProperty(exports, "__esModule", {
|
|||
value: true
|
||||
});
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) {descriptor.writable = true;} Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) {defineProperties(Constructor.prototype, protoProps);} if (staticProps) {defineProperties(Constructor, staticProps);} return Constructor; }; }();
|
||||
let _createClass = function () { function defineProperties(target, props) { for (let i = 0; i < props.length; i++) { let descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) {descriptor.writable = true;} Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) {defineProperties(Constructor.prototype, protoProps);} if (staticProps) {defineProperties(Constructor, staticProps);} return Constructor; }; }();
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Dummy = function () {
|
||||
let Dummy = function () {
|
||||
function Dummy(config, logger) {
|
||||
_classCallCheck(this, Dummy);
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|||
});
|
||||
exports.Dummy = undefined;
|
||||
|
||||
var _dummy = require('./dummy');
|
||||
let _dummy = require('./dummy');
|
||||
|
||||
var _dummy2 = _interopRequireDefault(_dummy);
|
||||
let _dummy2 = _interopRequireDefault(_dummy);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import rimRaf from 'rimraf';
|
||||
import path from 'path';
|
||||
import rimRaf from 'rimraf';
|
||||
|
||||
import { Config, MergeTags, Package } from '@verdaccio/types';
|
||||
import { VerdaccioError } from '@verdaccio/commons-api';
|
||||
import LocalStorage from '../../../../src/lib/local-storage';
|
||||
import AppConfig from '../../../../src/lib/config';
|
||||
// @ts-ignore
|
||||
|
@ -13,10 +15,8 @@ import { generateNewVersion } from '../../../lib/utils-test';
|
|||
const readMetadata = (fileName = 'metadata') =>
|
||||
readFile(`../../unit/partials/${fileName}`).toString();
|
||||
|
||||
import { Config, MergeTags, Package } from '@verdaccio/types';
|
||||
import { IStorage } from '../../../../types';
|
||||
import { API_ERROR, HTTP_STATUS, DIST_TAGS } from '../../../../src/lib/constants';
|
||||
import { VerdaccioError } from '@verdaccio/commons-api';
|
||||
|
||||
setup([]);
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import assert from 'assert';
|
||||
let semverSort = require('../../../../src/lib/utils').semverSort;
|
||||
import { mergeVersions } from '../../../../src/lib/metadata-utils';
|
||||
|
||||
let semverSort = require('../../../../src/lib/utils').semverSort;
|
||||
|
||||
require('../../../../src/lib/logger').setup([]);
|
||||
|
||||
describe('Storage._merge_versions versions', () => {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Package } from '@verdaccio/types';
|
||||
import { normalizePackage, mergeUplinkTimeIntoLocal } from '../../../../src/lib/storage-utils';
|
||||
import { STORAGE, DIST_TAGS } from '../../../../src/lib/constants';
|
||||
import { readFile } from '../../../functional/lib/test.utils';
|
||||
|
||||
import { Package } from '@verdaccio/types';
|
||||
|
||||
const readMetadata = (fileName = 'metadata') => readFile(`../../unit/partials/${fileName}`);
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import rimraf from 'rimraf';
|
||||
import { Writable } from 'stream';
|
||||
import rimraf from 'rimraf';
|
||||
import { Config } from '@verdaccio/types';
|
||||
import configExample from '../../partials/config';
|
||||
import AppConfig from '../../../../src/lib/config';
|
||||
import Storage from '../../../../src/lib/storage';
|
||||
import { setup } from '../../../../src/lib/logger';
|
||||
|
||||
import { Config } from '@verdaccio/types';
|
||||
import { IStorageHandler } from '../../../../types';
|
||||
import { API_ERROR, HTTP_STATUS } from '../../../../src/lib/constants';
|
||||
import { mockServer } from '../../__helper/mock';
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import _ from 'lodash';
|
||||
import { Config, UpLinkConf } from '@verdaccio/types';
|
||||
import { VerdaccioError } from '@verdaccio/commons-api';
|
||||
import ProxyStorage from '../../../../src/lib/up-storage';
|
||||
import AppConfig from '../../../../src/lib/config';
|
||||
import configExample from '../../partials/config';
|
||||
import { setup } from '../../../../src/lib/logger';
|
||||
|
||||
import { Config, UpLinkConf } from '@verdaccio/types';
|
||||
import { IProxy } from '../../../../types';
|
||||
import { API_ERROR, HTTP_STATUS } from '../../../../src/lib/constants';
|
||||
import { mockServer } from '../../__helper/mock';
|
||||
import { DOMAIN_SERVERS } from '../../../functional/config.functional';
|
||||
import { VerdaccioError } from '@verdaccio/commons-api';
|
||||
|
||||
setup([]);
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* If you have any questions, ask at the http://chat.verdaccio.org #questions channel.
|
||||
*
|
||||
*/
|
||||
import path from 'path';
|
||||
import request from 'supertest';
|
||||
import _ from 'lodash';
|
||||
import path from 'path';
|
||||
import rimraf from 'rimraf';
|
||||
|
||||
import endPointAPI from '../../../../src/api/index';
|
||||
|
|
|
@ -6,6 +6,7 @@ describe('Parse interval', () => {
|
|||
test('parse ' + str, () => {
|
||||
if (res === null) {
|
||||
assert.throws(function () {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(parseInterval(str));
|
||||
});
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import request from 'supertest';
|
||||
import path from 'path';
|
||||
import request from 'supertest';
|
||||
import rimraf from 'rimraf';
|
||||
|
||||
import configDefault from '../../partials/config';
|
||||
|
|
|
@ -9,12 +9,7 @@
|
|||
"resolveJsonModule": true,
|
||||
"outDir": "lib",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"typeRoots": [
|
||||
"./node_modules/@verdaccio/types/lib/verdaccio",
|
||||
"./node_modules/@types",
|
||||
"./types/custom.d.ts"
|
||||
]
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
|
|
2
types/custom.d.ts
vendored
2
types/custom.d.ts
vendored
|
@ -1,3 +1,5 @@
|
|||
/// <reference types="@verdaccio/types" />
|
||||
|
||||
import { Logger, RemoteUser } from "@verdaccio/types";
|
||||
|
||||
declare global {
|
||||
|
|
16
yarn-plugins/plugin-postinstall.js
Normal file
16
yarn-plugins/plugin-postinstall.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Not used at this moment, but I'll leave it here for future usage.
|
||||
* Ref https://github.com/verdaccio/verdaccio/pull/2253#discussion_r632052482
|
||||
*/
|
||||
module.exports = {
|
||||
name: `plugin-postinstall`,
|
||||
factory: () => ({
|
||||
hooks: {
|
||||
beforeWorkspacePacking(_workspace, data) {
|
||||
if ('scripts' in data && 'postinstall' in data.scripts) {
|
||||
delete data.scripts.postinstall;
|
||||
}
|
||||
},
|
||||
},
|
||||
}),
|
||||
};
|
BIN
yarn.lock
BIN
yarn.lock
Binary file not shown.
Loading…
Reference in a new issue