Compare commits
116 Commits
@verdaccio
...
@verdaccio
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6bbc8ecc6 | ||
|
|
3763b9f285 | ||
|
|
f96b147ea1 | ||
|
|
1117dd347b | ||
|
|
78486b87e8 | ||
|
|
b121e3662f | ||
|
|
2e51c931dd | ||
|
|
4b0eaff5f7 | ||
|
|
15d5e969c4 | ||
|
|
9805298893 | ||
|
|
e0e39540c5 | ||
|
|
7c75776c84 | ||
|
|
586f1b0684 | ||
|
|
d036190aff | ||
|
|
988ff72081 | ||
|
|
b6495d5b6c | ||
|
|
2f033888e4 | ||
|
|
8a8f2b6774 | ||
|
|
3fe8cb0406 | ||
|
|
13710ba371 | ||
|
|
e39fbfee5f | ||
|
|
14671d8a10 | ||
|
|
be2626fcd5 | ||
|
|
717175567c | ||
|
|
65e077a926 | ||
|
|
b704689309 | ||
|
|
f625c114bb | ||
|
|
42d08eb423 | ||
|
|
668bbd0955 | ||
|
|
2ce7c7dfad | ||
|
|
a2877ab03c | ||
|
|
12d4b1ffc2 | ||
|
|
0fb5d31596 | ||
|
|
b315d4e113 | ||
|
|
6ab1faa25e | ||
|
|
2808cc268f | ||
|
|
d1d820f8b2 | ||
|
|
25a4601594 | ||
|
|
28ce2a99da | ||
|
|
7521a59f19 | ||
|
|
1ca89d923e | ||
|
|
386e47c34b | ||
|
|
fc185335a3 | ||
|
|
a6b0d63afb | ||
|
|
b8c7b771ad | ||
|
|
2645ae2e48 | ||
|
|
66c6df4ae9 | ||
|
|
feb385c8fd | ||
|
|
bd9b170090 | ||
|
|
30c5c19d5f | ||
|
|
9e419a99fc | ||
|
|
9faf6cb209 | ||
|
|
90b8bc242c | ||
|
|
c45711ade5 | ||
|
|
625f529fe9 | ||
|
|
0165ac1cd1 | ||
|
|
d753f02f91 | ||
|
|
456c78b4a7 | ||
|
|
cf9d2d50aa | ||
|
|
843328f73c | ||
|
|
65d7392b3a | ||
|
|
e7ef249b1d | ||
|
|
669f0a63e8 | ||
|
|
35677db1f1 | ||
|
|
d278f1b259 | ||
|
|
0f0cbf2b2f | ||
|
|
f74a6a39e8 | ||
|
|
cd3b702aa6 | ||
|
|
960ebc67a5 | ||
|
|
dd442f192f | ||
|
|
b549a0de59 | ||
|
|
f9c90dd3f5 | ||
|
|
135d21c9db | ||
|
|
a8b7fb0e8d | ||
|
|
05ed10811f | ||
|
|
4c40fa6664 | ||
|
|
3d45cecf04 | ||
|
|
aad7707268 | ||
|
|
73e6863426 | ||
|
|
54b17f4442 | ||
|
|
7aff3dcb9c | ||
|
|
a9144021d4 | ||
|
|
77e2e50943 | ||
|
|
09a7cf3456 | ||
|
|
8ca5fe6d26 | ||
|
|
73d34bf9c4 | ||
|
|
67406082ed | ||
|
|
d6e44a4c18 | ||
|
|
2197d08e42 | ||
|
|
15c694156a | ||
|
|
59ac312c21 | ||
|
|
8f16dcfdee | ||
|
|
95ed3db43c | ||
|
|
cb8991f3d5 | ||
|
|
3d1d5071ed | ||
|
|
8682af5628 | ||
|
|
1d8910a8cd | ||
|
|
1ef60915e6 | ||
|
|
55ee3fdd97 | ||
|
|
4ebf18816a | ||
|
|
276a0a63a7 | ||
|
|
f3f00052d8 | ||
|
|
d2c65da9c7 | ||
|
|
2924ffa235 | ||
|
|
6b1a28deb8 | ||
|
|
a54c18c02a | ||
|
|
52b47868e3 | ||
|
|
8582548559 | ||
|
|
32f66cc2c7 | ||
|
|
6a01bdbcc9 | ||
|
|
5ddfa5264c | ||
|
|
1cc00cf2ab | ||
|
|
086c4a7c3c | ||
|
|
babe5c3f6c | ||
|
|
0da7031e77 | ||
|
|
393125baa1 |
@@ -1,245 +0,0 @@
|
||||
{
|
||||
"projectName": "verdaccio",
|
||||
"projectOwner": "verdaccio",
|
||||
"repoType": "github",
|
||||
"repoHost": "https://github.com",
|
||||
"commitConvention": "none",
|
||||
"files": [
|
||||
"CONTRIBUTORS.md"
|
||||
],
|
||||
"contributors": [
|
||||
{
|
||||
"login": "juanpicado",
|
||||
"name": "Juan Picado",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/558752?v=4",
|
||||
"profile": "https://www.linkedin.com/in/jotadeveloper/",
|
||||
"contributions": [
|
||||
"doc",
|
||||
"code",
|
||||
"infra",
|
||||
"eventOrganizing",
|
||||
"blog",
|
||||
"maintenance"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "sergiohgz",
|
||||
"name": "Sergio Herrera",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/14012309?v=4",
|
||||
"profile": "https://github.com/sergiohgz",
|
||||
"contributions": [
|
||||
"infra",
|
||||
"maintenance"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "DanielRuf",
|
||||
"name": "Daniel Ruf",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/827205?v=4",
|
||||
"profile": "https://daniel-ruf.de/",
|
||||
"contributions": [
|
||||
"security",
|
||||
"infra",
|
||||
"maintenance"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "priscilawebdev",
|
||||
"name": "Priscila Oliveira",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/29228205?v=4",
|
||||
"profile": "https://priscilawebdev.github.io/priscilaoliveira/",
|
||||
"contributions": [
|
||||
"design",
|
||||
"code",
|
||||
"maintenance"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "ayusharma",
|
||||
"name": "Ayush Sharma",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/6918450?v=4",
|
||||
"profile": "http://ayusharma.github.io/",
|
||||
"contributions": [
|
||||
"infra",
|
||||
"code",
|
||||
"design"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "trentearl",
|
||||
"name": "Trent Earl",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/802857?v=4",
|
||||
"profile": "https://github.com/trentearl",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "jmwilkinson",
|
||||
"name": "jmwilkinson",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/17836030?v=4",
|
||||
"profile": "https://github.com/jmwilkinson",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "bufferoverflow",
|
||||
"name": "Roger Meier",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/378909?v=4",
|
||||
"profile": "https://github.com/bufferoverflow",
|
||||
"contributions": [
|
||||
"plugin"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "jamesgeorge007",
|
||||
"name": "James George",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/25279263?v=4",
|
||||
"profile": "https://ghuser.io/jamesgeorge007",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "AvailCat",
|
||||
"name": "AvailCat",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/19658647?v=4",
|
||||
"profile": "https://github.com/AvailCat",
|
||||
"contributions": [
|
||||
"code",
|
||||
"infra",
|
||||
"maintenance"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "lgaitan",
|
||||
"name": "Lucius Gaitán",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/5970350?v=4",
|
||||
"profile": "https://www.luciusgaitan.com/",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "ramonornela",
|
||||
"name": "Ramon Henrique Ornelas",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/187946?v=4",
|
||||
"profile": "https://github.com/ramonornela",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "UnitedMarsupials-zz",
|
||||
"name": "UnitedMarsupials-zz",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/1486340?v=4",
|
||||
"profile": "https://people.freebsd.org/~mi/resume/",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "ryan-codingintrigue",
|
||||
"name": "Ryan Graham",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/9048902?v=4",
|
||||
"profile": "http://www.codingintrigue.co.uk/",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "coolsp",
|
||||
"name": "coolsp",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/1246647?v=4",
|
||||
"profile": "https://github.com/coolsp",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "ashishsurana",
|
||||
"name": "Ashish Surana",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/5610944?v=4",
|
||||
"profile": "http://ashishsurana.in/",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "buffaybu",
|
||||
"name": "Wang Yifei",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/2025661?v=4",
|
||||
"profile": "https://github.com/buffaybu",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "lirantal",
|
||||
"name": "Liran Tal",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/316371?v=4",
|
||||
"profile": "https://twitter.com/liran_tal",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "brenordr",
|
||||
"name": "Breno Rodrigues",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/19731692?v=4",
|
||||
"profile": "https://github.com/brenordr",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "jachstet-sea",
|
||||
"name": "jachstet-sea",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/7993508?v=4",
|
||||
"profile": "https://github.com/jachstet-sea",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "Vrtak-CZ",
|
||||
"name": "Patrik Votoček",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/112567?v=4",
|
||||
"profile": "https://patrik.votocek.cz/",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "monkeywithacupcake",
|
||||
"name": "jess",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/7316730?v=4",
|
||||
"profile": "https://github.com/monkeywithacupcake",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "toolsofraj",
|
||||
"name": "toolsofraj",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/2507152?v=4",
|
||||
"profile": "https://github.com/toolsofraj",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "ddhp",
|
||||
"name": "Jian-Chen Chen (jesse)",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/1715380?v=4",
|
||||
"profile": "https://github.com/ddhp",
|
||||
"contributions": [
|
||||
"translation",
|
||||
"code"
|
||||
]
|
||||
}
|
||||
],
|
||||
"skipCi": true,
|
||||
"contributorsPerLine": 7
|
||||
}
|
||||
15
.changeset/afraid-mice-obey.md
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
'@verdaccio/types': minor
|
||||
'@verdaccio/ui-theme': minor
|
||||
'@verdaccio/web': minor
|
||||
---
|
||||
|
||||
allow disable login on ui and endpoints
|
||||
|
||||
To be able disable the login, set `login: false`, anything else would enable login. This flag will disable access via UI and web endpoints.
|
||||
|
||||
```yml
|
||||
web:
|
||||
title: verdaccio
|
||||
login: false
|
||||
```
|
||||
5
.changeset/calm-pants-impress.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'verdaccio-aws-s3-storage': patch
|
||||
---
|
||||
|
||||
Fix the prefix used to delete from s3 when unpublishing packages
|
||||
5
.changeset/few-mangos-grow.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@verdaccio/ui-theme': minor
|
||||
---
|
||||
|
||||
upgrade to react@17 and other dependencies
|
||||
5
.changeset/gold-vans-tease.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@verdaccio/utils': patch
|
||||
---
|
||||
|
||||
Fixed the validation of the name when searching for a tarball that have scoped package name
|
||||
6
.changeset/heavy-ravens-lay.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@verdaccio/cli': minor
|
||||
'@verdaccio/fastify-migration': minor
|
||||
---
|
||||
|
||||
[Fastify] Add ping endpoint
|
||||
5
.changeset/little-stingrays-rule.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'verdaccio-audit': patch
|
||||
---
|
||||
|
||||
fix: several issues which caused the audit to fail (#2335)
|
||||
@@ -33,26 +33,34 @@
|
||||
"verdaccio-aws-s3-storage": "11.0.0-alpha.0",
|
||||
"verdaccio-google-cloud": "11.0.0-alpha.0",
|
||||
"verdaccio-memory": "11.0.0-alpha.0",
|
||||
"@verdaccio/website": "0.0.1",
|
||||
"@verdaccio/ui-theme": "6.0.0-alpha.1",
|
||||
"@verdaccio/e2e-cli": "1.0.0",
|
||||
"@verdaccio/e2e-ui": "1.0.0",
|
||||
"@verdaccio/cli-standalone": "6.0.0-alpha.3",
|
||||
"@verdaccio/tarball": "11.0.0-alpha.3",
|
||||
"@verdaccio/url": "11.0.0-alpha.3",
|
||||
"@verdaccio/fastify-migration": "6.0.0-6-next.9"
|
||||
"@verdaccio/fastify-migration": "6.0.0-6-next.9",
|
||||
"@verdaccio/eslint-config": "1.0.0",
|
||||
"@verdaccio/benchmark": "1.0.0",
|
||||
"@verdaccio/website": "5.1.3"
|
||||
},
|
||||
"changesets": [
|
||||
"afraid-mice-obey",
|
||||
"big-lobsters-sin",
|
||||
"calm-pants-impress",
|
||||
"few-cooks-destroy",
|
||||
"few-mangos-grow",
|
||||
"fifty-jars-rest",
|
||||
"gentle-parrots-lay",
|
||||
"gentle-trains-switch",
|
||||
"gold-vans-tease",
|
||||
"healthy-bikes-behave",
|
||||
"healthy-poets-compare",
|
||||
"heavy-ravens-lay",
|
||||
"hip-hounds-destroy",
|
||||
"late-adults-love",
|
||||
"late-parents-act",
|
||||
"little-stingrays-rule",
|
||||
"many-vans-care",
|
||||
"modern-spies-tell",
|
||||
"neat-toes-report",
|
||||
@@ -61,6 +69,7 @@
|
||||
"plenty-spiders-melt",
|
||||
"plenty-tables-refuse",
|
||||
"pretty-hounds-tap",
|
||||
"red-chefs-float",
|
||||
"shiny-chefs-heal",
|
||||
"smart-apricots-kneel",
|
||||
"spicy-frogs-press",
|
||||
|
||||
11
.changeset/red-chefs-float.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
'@verdaccio/store': patch
|
||||
'@verdaccio/web': patch
|
||||
---
|
||||
|
||||
Fix the search by exact name of the package
|
||||
|
||||
Full package name queries was not finding anithing. It was happening
|
||||
becouse of stemmer of [lunr.js](https://lunrjs.com/).
|
||||
|
||||
To fix this, the stemmer of [lunr.js](https://lunrjs.com/) was removed from search pipeline.
|
||||
@@ -4,7 +4,6 @@
|
||||
**/types/custom.d.ts
|
||||
build/
|
||||
coverage/
|
||||
flow-typed/
|
||||
node_modules/
|
||||
static/
|
||||
website/
|
||||
|
||||
102
.eslintrc
@@ -1,102 +0,0 @@
|
||||
{
|
||||
"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"],
|
||||
"env": {
|
||||
"es6": true,
|
||||
"node": true,
|
||||
"jest": true
|
||||
},
|
||||
"globals": {
|
||||
"__APP_VERSION__": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"allowImportExportEverywhere": true,
|
||||
"sourceType": "module",
|
||||
"ecmaVersion": 11,
|
||||
"ecmaFeatures": {
|
||||
"impliedStrict": true,
|
||||
"jsx": true
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"import/resolver": {
|
||||
"node": {
|
||||
"extensions": [".js", ".jsx", ".ts", ".tsx"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"rules": {
|
||||
"curly": ["error", "all"],
|
||||
"react/prop-types": 0,
|
||||
"jest/no-export": 0,
|
||||
"jest/no-test-callback": 0,
|
||||
"jest/expect-expect": 0,
|
||||
"jest/no-try-expect": 0,
|
||||
"jest/no-done-callback": "off",
|
||||
"jest/no-conditional-expect": "off",
|
||||
"keyword-spacing": "off",
|
||||
"no-tabs": "off",
|
||||
"no-useless-escape": "off",
|
||||
"padded-blocks": "off",
|
||||
"require-jsdoc": "off",
|
||||
"valid-jsdoc": "off",
|
||||
"import/order": ["error"],
|
||||
"eol-last": "error",
|
||||
"no-irregular-whitespace": "error",
|
||||
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
|
||||
"no-trailing-spaces": "error",
|
||||
"camelcase": "off",
|
||||
"guard-for-in": "error",
|
||||
"new-cap": "error",
|
||||
"max-len": ["error", 100],
|
||||
"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-var": "error",
|
||||
"one-var": "error",
|
||||
"prefer-rest-params": "error",
|
||||
"prefer-spread": "error",
|
||||
"handle-callback-err": 0,
|
||||
"prefer-const": 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/no-empty-function": 0,
|
||||
"@typescript-eslint/no-this-alias": 0,
|
||||
"@typescript-eslint/no-use-before-define": 0,
|
||||
"@typescript-eslint/array-type": ["error"],
|
||||
"@typescript-eslint/no-explicit-any": 0,
|
||||
"@typescript-eslint/indent": 0,
|
||||
"@typescript-eslint/ban-ts-comment": 0,
|
||||
"@typescript-eslint/ban-types": 0,
|
||||
"@typescript-eslint/explicit-module-boundary-types": 0,
|
||||
|
||||
// rules to fix
|
||||
"no-unused-vars": ["warn", { "vars": "all", "args": "none" }],
|
||||
"jest/no-identical-title": ["warn"],
|
||||
"prefer-promise-reject-errors": ["warn"],
|
||||
"jest/no-disabled-tests": ["warn"],
|
||||
"jest/no-commented-out-tests": ["warn"],
|
||||
"@typescript-eslint/prefer-optional-chain": ["warn"],
|
||||
"@typescript-eslint/explicit-member-accessibility": ["warn"],
|
||||
"@typescript-eslint/no-unused-vars": ["warn"]
|
||||
}
|
||||
}
|
||||
3
.eslintrc.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
extends: ['@verdaccio/eslint-config'],
|
||||
};
|
||||
27
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -6,6 +6,25 @@ title: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
<!-- PLEASE READ THIS:
|
||||
- If you are not sure is a bug, OPEN a DISCUSSION, if is a legitimate bug, is easy to create a bug from a discussion.
|
||||
- Empty reports won't be considered and eventually be closed by a bot.
|
||||
- Include debugging notes will help to fix it faster, HOW TO: https://github.com/verdaccio/verdaccio/wiki/Debugging-Verdaccio
|
||||
- If you remove this template, ticket will be closed immediately.
|
||||
- No English perfect is required, use public translators if is need it, we will do our best to help you.
|
||||
- Extra bonus: The most complete this report is delivered, the faster you will get a response.
|
||||
- Extra bonus: include screenshots, logs (remove sensitive data).
|
||||
- If you are willing to fix it, there is a checkbox at the bottom.
|
||||
-->
|
||||
|
||||
**Your Environment**
|
||||
<!-- bug below the version 5.x will be closed, see SECURITY.md for more details -->
|
||||
* **verdaccio version**: 5.x.x
|
||||
* **node version** [12.x.x, 14.x.x]:
|
||||
* **package manager**: [npm@7, pnpm@6, yarn@2]
|
||||
* **os**: [mac, windows@10, linux]
|
||||
* **platform**: [npm, docker, helm, other]
|
||||
|
||||
**Describe the bug**
|
||||
|
||||
<!-- A clear and concise description of what the bug is. -->
|
||||
@@ -23,7 +42,7 @@ Be aware, the lack of reproducible steps the issue might cause your ticket to be
|
||||
|
||||
<!-- A clear and concise description of what you expected to happen. -->
|
||||
|
||||
**Screenshots**
|
||||
**Screenshots, server logs, package manager log**
|
||||
|
||||
<!-- If applicable, add screenshots to help explain your problem. -->
|
||||
|
||||
@@ -38,10 +57,14 @@ Be aware, the lack of reproducible steps the issue might cause your ticket to be
|
||||
**Debugging output**
|
||||
|
||||
- `$ NODE_DEBUG=request verdaccio` display request calls (verdaccio <--> uplinks)
|
||||
- `$ DEBUG=express:* verdaccio` enable extreme verdaccio debug mode (verdaccio api)
|
||||
- `$ DEBUG=verdaccio* verdaccio` enable extreme verdaccio debug mode (verdaccio api)
|
||||
- `$ npm -ddd` prints:
|
||||
- `$ npm config get registry` prints:
|
||||
|
||||
**Contribute to Verdaccio**
|
||||
|
||||
- [ ] I'm willing to fix this bug 🥇
|
||||
|
||||
<!--
|
||||
|
||||
IMPORTANT: please do not attach external files, all content should be visible from any device.
|
||||
|
||||
10
.github/ISSUE_TEMPLATE/feature.md
vendored
@@ -7,14 +7,18 @@ assignees: ''
|
||||
---
|
||||
|
||||
<!--
|
||||
IMPORTANT: If you don't have an action plan, please consider create a DISCUSSION (idea) instead for an open a feature request issue.
|
||||
|
||||
https://github.com/verdaccio/verdaccio/discussions/new
|
||||
|
||||
Verdaccio is a project addressed for voluntaries, if you appreciate this project consider to donate.
|
||||
1$/5$ or custom amount single contribution
|
||||
|
||||
or monthly
|
||||
1$/month - minimal contribution
|
||||
5$/month - nice contribution
|
||||
500$ - help to promote this project, marketing, stickers.
|
||||
2000$/year - sponsor status, your company logo will be in our readme, meetups talks and your request will have high priority
|
||||
|
||||
https://opencollective.com/verdaccio
|
||||
https://github.com/sponsors/verdaccio
|
||||
|
||||
As reminder, the Open Source must be sustainable.
|
||||
-->
|
||||
|
||||
6
.github/stale.yml
vendored
@@ -1,7 +1,7 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 15
|
||||
daysUntilStale: 365
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 10
|
||||
daysUntilClose: 500
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- dev: high priority
|
||||
@@ -17,7 +17,7 @@ markComment: >
|
||||
|
||||
This issue has gone quiet 😶.
|
||||
|
||||
We get a lot of issues, so we currently close issues after 25 days of inactivity. It’s been at least 15 days since the last update here.
|
||||
We get a lot of issues, so we currently close issues after 180 days of inactivity. It’s been at least 90c days since the last update here.
|
||||
If we missed this issue or if you want to keep it open, please reply here. You can also add/suggest the label "discuss" to keep this issue open!
|
||||
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out [https://github.com/verdaccio/contributing](https://github.com/verdaccio/contributing) for more information about opening PRs, triaging issues, and contributing!
|
||||
|
||||
|
||||
168
.github/workflows/benckmark.yml
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
---
|
||||
name: ci - benchmark
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# 3 times day
|
||||
# collecting enough data to draw some graphics
|
||||
- cron: '0 1 * * *'
|
||||
# push:
|
||||
# branches:
|
||||
# - master
|
||||
jobs:
|
||||
prepare:
|
||||
name: Prepare build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14.x
|
||||
- name: install pnpm
|
||||
run: sudo npm i pnpm@6.6.1 -g
|
||||
- name: set store
|
||||
run: |
|
||||
mkdir ~/.pnpm-store
|
||||
pnpm config set store-dir ~/.pnpm-store
|
||||
- name: setup pnpm config registry
|
||||
run: pnpm config set registry https://registry.verdaccio.org
|
||||
- name: install dependencies
|
||||
run: pnpm install
|
||||
- name: Cache .pnpm-store
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
pnpm-
|
||||
- name: build
|
||||
run: pnpm build
|
||||
- name: tar packages
|
||||
run: |
|
||||
tar -czvf ${{ github.workspace }}/pkg.tar.gz -C ${{ github.workspace }}/packages .
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: verdaccio-artifact
|
||||
path: pkg.tar.gz
|
||||
benchmark-autocannon:
|
||||
needs: prepare
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
benchmark:
|
||||
- info
|
||||
- tarball
|
||||
verdaccioVersion:
|
||||
# - local
|
||||
- 3.13.1
|
||||
- 4.12.2
|
||||
- 5.1.2
|
||||
name: Benchmark autocannon
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14.x
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: verdaccio-artifact
|
||||
- name: untar packages
|
||||
run: tar -xzvf pkg.tar.gz -C ${{ github.workspace }}/packages
|
||||
- name: install pnpm
|
||||
# require fixed version
|
||||
run: sudo npm i pnpm@6.6.1 -g
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
- name: install dependencies
|
||||
run: pnpm install
|
||||
- name: start registry
|
||||
run: ./scripts/benchmark-prepare.sh ${{matrix.verdaccioVersion}}
|
||||
- name: benchmark
|
||||
run: pnpm benchmark:api -- -v ${{matrix.verdaccioVersion}} -f ${{matrix.benchmark}}
|
||||
shell: bash
|
||||
env:
|
||||
DEBUG: metrics*
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: verdaccio-metrics-api
|
||||
path: ./api-results-${{matrix.verdaccioVersion}}-${{matrix.benchmark}}.json
|
||||
if-no-files-found: error
|
||||
retention-days: 10
|
||||
- name: submit metrics
|
||||
run: pnpm benchmark:submit
|
||||
env:
|
||||
DEBUG: metrics
|
||||
METRICS_SOURCE: autocannon
|
||||
METRICS_URL: ${{ secrets.METRICS_URL }}
|
||||
METRICS_TOKEN: ${{ secrets.METRICS_TOKEN }}
|
||||
METRICS_BENCHMARK: ${{matrix.benchmark}}
|
||||
METRICS_VERSION: ${{matrix.verdaccioVersion}}
|
||||
METRICS_COMMIT_HASH: ${{ github.sha }}
|
||||
METRICS_FILE_NAME: 'api-results'
|
||||
benchmark:
|
||||
needs: prepare
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
benchmark:
|
||||
- info
|
||||
- tarball
|
||||
verdaccioVersion:
|
||||
# future 6.x (wip)
|
||||
# - local (master branch)
|
||||
# old versions to compare same test along previous releases
|
||||
- 3.13.1
|
||||
- 4.12.2
|
||||
- 5.1.2
|
||||
name: Benchmark hyperfine
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14.x
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: verdaccio-artifact
|
||||
- name: untar packages
|
||||
run: tar -xzvf pkg.tar.gz -C ${{ github.workspace }}/packages
|
||||
- name: install pnpm
|
||||
# require fixed version
|
||||
run: sudo npm i pnpm@6.6.1 -g
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
- name: install dependencies
|
||||
run: pnpm install
|
||||
- name: install hyperfine
|
||||
run: |
|
||||
wget https://github.com/sharkdp/hyperfine/releases/download/v1.11.0/hyperfine_1.11.0_amd64.deb
|
||||
sudo dpkg -i hyperfine_1.11.0_amd64.deb
|
||||
- name: start registry
|
||||
run: ./scripts/benchmark-prepare.sh ${{matrix.verdaccioVersion}}
|
||||
- name: benchmark
|
||||
run: ./scripts/benchmark-run.sh ${{matrix.benchmark}}
|
||||
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell
|
||||
shell: bash
|
||||
- name: rename
|
||||
run: mv ./hyper-results.json ./hyper-results-${{matrix.verdaccioVersion}}-${{matrix.benchmark}}.json
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: verdaccio-metrics
|
||||
path: ./hyper-results-${{matrix.verdaccioVersion}}-${{matrix.benchmark}}.json
|
||||
if-no-files-found: error
|
||||
retention-days: 10
|
||||
- name: submit metrics
|
||||
run: pnpm benchmark:submit
|
||||
env:
|
||||
DEBUG: metrics
|
||||
METRICS_SOURCE: hyperfine
|
||||
METRICS_URL: ${{ secrets.METRICS_URL }}
|
||||
METRICS_TOKEN: ${{ secrets.METRICS_TOKEN }}
|
||||
METRICS_BENCHMARK: ${{matrix.benchmark}}
|
||||
METRICS_VERSION: ${{matrix.verdaccioVersion}}
|
||||
METRICS_COMMIT_HASH: ${{ github.sha }}
|
||||
2
.github/workflows/changesets.yml
vendored
@@ -33,7 +33,7 @@ jobs:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.VERDACCIO_TOKEN }}
|
||||
|
||||
- name: install pnpm
|
||||
run: npm i pnpm@latest -g
|
||||
run: npm i pnpm@6.10.3 -g
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.VERDACCIO_TOKEN }}
|
||||
|
||||
|
||||
41
.github/workflows/ci.yml
vendored
@@ -29,7 +29,7 @@ jobs:
|
||||
with:
|
||||
node-version: 14
|
||||
- name: Install pnpm
|
||||
run: npm i pnpm@latest -g
|
||||
run: npm i pnpm@6.10.3 -g
|
||||
- name: set store
|
||||
run: |
|
||||
mkdir ~/.pnpm-store
|
||||
@@ -54,7 +54,7 @@ jobs:
|
||||
with:
|
||||
node-version: 16
|
||||
- name: Install pnpm
|
||||
run: npm i pnpm@latest -g
|
||||
run: npm i pnpm@6.10.3 -g
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
@@ -74,7 +74,7 @@ jobs:
|
||||
with:
|
||||
node-version: 16
|
||||
- name: Install pnpm
|
||||
run: npm i pnpm@latest -g
|
||||
run: npm i pnpm@6.10.3 -g
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
@@ -94,14 +94,12 @@ jobs:
|
||||
with:
|
||||
node-version: 16
|
||||
- name: Install pnpm
|
||||
run: npm i pnpm@latest -g
|
||||
run: npm i pnpm@6.10.3 -g
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
- name: Install
|
||||
## we run scripts due gatsby needs it
|
||||
## when website is excluded we can add --ignore-scripts
|
||||
run: pnpm recursive install --frozen-lockfile --ignore-scripts
|
||||
- name: build
|
||||
run: pnpm build
|
||||
@@ -118,7 +116,7 @@ jobs:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
node_version: [12, 14]
|
||||
node_version: [14]
|
||||
name: ${{ matrix.os }} / Node ${{ matrix.node_version }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
@@ -133,7 +131,7 @@ jobs:
|
||||
- name: untar packages
|
||||
run: tar -xzvf pkg.tar.gz -C ${{ github.workspace }}/packages
|
||||
- name: Install pnpm
|
||||
run: npm i pnpm@latest -g
|
||||
run: npm i pnpm@6.10.3 -g
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
@@ -157,7 +155,7 @@ jobs:
|
||||
- name: untar packages
|
||||
run: tar -xzvf pkg.tar.gz -C ${{ github.workspace }}/packages
|
||||
- name: Install pnpm
|
||||
run: npm i pnpm@latest -g
|
||||
run: npm i pnpm@6.10.3 -g
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
@@ -184,7 +182,7 @@ jobs:
|
||||
- name: untar packages
|
||||
run: tar -xzvf pkg.tar.gz -C ${{ github.workspace }}/packages
|
||||
- name: Install pnpm
|
||||
run: npm i pnpm@latest -g
|
||||
run: npm i pnpm@6.10.3 -g
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
@@ -194,27 +192,6 @@ jobs:
|
||||
run: pnpm recursive install --frozen-lockfile
|
||||
- name: Test CLI
|
||||
run: pnpm test:e2e:cli
|
||||
website:
|
||||
needs: [format, lint]
|
||||
runs-on: ubuntu-latest
|
||||
name: website build node 14
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.1
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 14
|
||||
- name: Install pnpm
|
||||
run: npm i pnpm@latest -g
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
- name: Install
|
||||
run: pnpm recursive install --frozen-lockfile
|
||||
- name: Build website
|
||||
run: |
|
||||
cd website
|
||||
pnpm build:website
|
||||
test-windows:
|
||||
needs: [format, lint]
|
||||
runs-on: windows-latest
|
||||
@@ -226,7 +203,7 @@ jobs:
|
||||
with:
|
||||
node-version: 14
|
||||
- name: Install pnpm
|
||||
run: npm i pnpm@latest -g
|
||||
run: npm i pnpm@6.10.3 -g
|
||||
# pnpm cache is not working for windows (we need a solution)
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
|
||||
148
.github/workflows/website.yml
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
name: Verdaccio Website CI
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
paths:
|
||||
- 'website/**'
|
||||
- 'package.json'
|
||||
- './.github/workflows/website.yml'
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
paths:
|
||||
- 'website/**'
|
||||
- 'package.json'
|
||||
- './.github/workflows/website.yml'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
NODE_OPTIONS: --max_old_space_size=4096
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.1
|
||||
|
||||
- name: Use Node 14
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14
|
||||
|
||||
- name: Cache pnpm modules
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-pnpm-modules
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
|
||||
|
||||
- uses: pnpm/action-setup@v2.0.1
|
||||
with:
|
||||
version: 6.10.2
|
||||
run_install: |
|
||||
- recursive: true
|
||||
args: [--frozen-lockfile]
|
||||
|
||||
- name: Lint And Pretty
|
||||
run: |
|
||||
pnpm eslint:check --filter ...@verdaccio/website
|
||||
pnpm prettier:check --filter ...@verdaccio/website
|
||||
|
||||
- name: Cache Docusaurus Build
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: website/node_modules/.cache/webpack
|
||||
key: cache/webpack-${{github.ref}}-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: cache/webpack-${{github.ref}}
|
||||
|
||||
# Will deploy to production on:
|
||||
# 1st: When a push occurs on master branch
|
||||
# 2nd: When we force the worflow dispatch through the UI
|
||||
- name: Build Production
|
||||
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'workflow_dispatch'
|
||||
env:
|
||||
CROWDIN_VERDACCIO_PROJECT_ID: ${{ secrets.CROWDIN_VERDACCIO_PROJECT_ID }}
|
||||
CROWDIN_VERDACCIO_API_KEY: ${{ secrets.CROWDIN_VERDACCIO_API_KEY }}
|
||||
CONTEXT: production
|
||||
run: pnpm netlify:build:production --filter ...@verdaccio/website
|
||||
|
||||
- name: 🔥 Deploy Production Netlify
|
||||
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'workflow_dispatch'
|
||||
uses: semoal/action-netlify-deploy@master
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
build-dir: './website/build'
|
||||
|
||||
# Will deploy to Preview URL, only when a pull request is open with changes on the website
|
||||
- name: Build Deployment Preview
|
||||
if: github.event_name == 'pull_request' && github.ref != 'refs/heads/master'
|
||||
env:
|
||||
CONTEXT: deploy-preview
|
||||
run: pnpm netlify:build:deployPreview --filter ...@verdaccio/website
|
||||
|
||||
- name: 🤖 Deploy Preview Netlify
|
||||
if: github.event_name == 'pull_request' && github.ref != 'refs/heads/master'
|
||||
uses: semoal/action-netlify-deploy@master
|
||||
id: netlify_preview
|
||||
with:
|
||||
draft: true
|
||||
comment-on-pull-request: true
|
||||
github-deployment-is-production: false
|
||||
github-deployment-is-transient: true
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
build-dir: './website/build'
|
||||
|
||||
- name: Audit preview URL with Lighthouse
|
||||
if: github.event_name == 'pull_request' && github.ref != 'refs/heads/master'
|
||||
id: lighthouse_audit
|
||||
uses: treosh/lighthouse-ci-action@v3
|
||||
with:
|
||||
urls: |
|
||||
${{ steps.netlify_preview.outputs.preview-url }}
|
||||
uploadArtifacts: true
|
||||
temporaryPublicStorage: true
|
||||
|
||||
- name: Format lighthouse score
|
||||
if: github.event_name == 'pull_request' && github.ref != 'refs/heads/master'
|
||||
id: format_lighthouse_score
|
||||
uses: actions/github-script@v3
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
const result = ${{ steps.lighthouse_audit.outputs.manifest }}[0].summary
|
||||
const links = ${{ steps.lighthouse_audit.outputs.links }}
|
||||
const formatResult = (res) => Math.round((res * 100))
|
||||
Object.keys(result).forEach(key => result[key] = formatResult(result[key]))
|
||||
const score = res => res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴'
|
||||
const comment = [
|
||||
`⚡️ [Lighthouse report](${Object.values(links)[0]}) for the changes in this PR:`,
|
||||
'| Category | Score |',
|
||||
'| --- | --- |',
|
||||
`| ${score(result.performance)} Performance | ${result.performance} |`,
|
||||
`| ${score(result.accessibility)} Accessibility | ${result.accessibility} |`,
|
||||
`| ${score(result['best-practices'])} Best practices | ${result['best-practices']} |`,
|
||||
`| ${score(result.seo)} SEO | ${result.seo} |`,
|
||||
' ',
|
||||
`*Lighthouse ran on [${Object.keys(links)[0]}](${Object.keys(links)[0]})*`
|
||||
].join('\n')
|
||||
core.setOutput("comment", comment);
|
||||
|
||||
- name: Add comment to PR
|
||||
if: github.event_name == 'pull_request' && github.ref != 'refs/heads/master'
|
||||
id: comment_to_pr
|
||||
uses: marocchino/sticky-pull-request-comment@v1
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
number: ${{ github.event.issue.number }}
|
||||
header: lighthouse
|
||||
message: |
|
||||
${{ steps.format_lighthouse_score.outputs.comment }}
|
||||
24
.gitignore
vendored
@@ -2,22 +2,17 @@
|
||||
verdaccio-*.tgz
|
||||
.DS_Store
|
||||
build/
|
||||
dist/
|
||||
.eslintcache
|
||||
./dist
|
||||
|
||||
### Test
|
||||
node_modules
|
||||
|
||||
### database
|
||||
.verdaccio-db.json
|
||||
.sinopia-db.json
|
||||
|
||||
###
|
||||
### test
|
||||
test-storage*
|
||||
.verdaccio_test_env
|
||||
node_modules
|
||||
package-lock.json
|
||||
yarn-error.log
|
||||
yarn.lock
|
||||
|
||||
|
||||
# docker examples
|
||||
docker-examples/v5/reverse_proxy/nginx/relative_path/storage/*
|
||||
@@ -36,12 +31,15 @@ tsconfig.tsbuildinfo
|
||||
|
||||
## bundle files
|
||||
packages/standalone/dist/
|
||||
|
||||
## ui
|
||||
packages/plugins/ui-theme/static
|
||||
|
||||
# website
|
||||
website/public
|
||||
website/.cache
|
||||
|
||||
# CI Pnpm cache
|
||||
.pnpm-store/
|
||||
|
||||
# benchmark
|
||||
api-results.json
|
||||
hyper-results.json
|
||||
hyper-results*.json
|
||||
api-results*.json
|
||||
|
||||
10
.netlify/netlify-plugin-pnpm/index.js
Normal file
@@ -0,0 +1,10 @@
|
||||
module.exports = {
|
||||
onPreBuild: async ({ utils: { build, run } }) => {
|
||||
try {
|
||||
await run.command("npm install -g pnpm")
|
||||
await run.command("pnpm install --ignore-scripts --frozen-lockfile")
|
||||
} catch (error) {
|
||||
return build.failBuild(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
2
.netlify/netlify-plugin-pnpm/manifest.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
name: netlify-plugin-pnpm
|
||||
inputs: []
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
## npm
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
@@ -23,7 +22,6 @@ docs/
|
||||
wiki/
|
||||
|
||||
## flow
|
||||
flow-typed/
|
||||
types/
|
||||
|
||||
# jest
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
**/pnpm-lock.yaml
|
||||
**/verdaccio-corrupted.db.json
|
||||
**/wrong.package.json
|
||||
/website/.cache/
|
||||
/website/crowdin/
|
||||
/website/public/
|
||||
/website/src/dictionaries/
|
||||
crowdin.yaml
|
||||
/docs/website
|
||||
/website/*
|
||||
/website/translated_docs/
|
||||
CHANGELOG.md
|
||||
CONTRIBUTORS.md
|
||||
node_modules/
|
||||
@@ -22,4 +22,5 @@ docker-examples/v5/reverse_proxy/nginx/relative_path/storage/*
|
||||
docker-examples/
|
||||
build/
|
||||
.vscode/
|
||||
.github/
|
||||
.github/
|
||||
.netlify/
|
||||
|
||||
22
.project
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>verdaccio-dev</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
</natures>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>1630305579538</id>
|
||||
<name></name>
|
||||
<type>26</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-true-false-node_modules</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
</projectDescription>
|
||||
186
CONTRIBUTING.md
@@ -2,8 +2,8 @@
|
||||
|
||||
> Any change matters, whatever the size, just do it.
|
||||
|
||||
We are happy that you are willing to contribute. For that reason, we
|
||||
have prepared these guidelines for you:
|
||||
We're happy that you're considering contributing! To help, we've prepared these
|
||||
guidelines for you:
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
@@ -32,34 +32,47 @@ have prepared these guidelines for you:
|
||||
|
||||
## How Do I Contribute?
|
||||
|
||||
There are different ways to contribute, each comes with a different levels
|
||||
of tasks, such as:
|
||||
There are many ways to contribute:
|
||||
|
||||
- Report a bug.
|
||||
- Request a feature you think would be great for verdaccio.
|
||||
- Fix bugs.
|
||||
- Test and triage reported bugs by others.
|
||||
- Work on requested/approved features.
|
||||
- Improve the codebase (lint, naming, comments, test descriptions, etc...)
|
||||
- Report a bug
|
||||
- Request a feature you think would be great for Verdaccio
|
||||
- Fix bugs
|
||||
- Test and triage bugs reported by others
|
||||
- Work on requested/approved features
|
||||
- Improve the codebase (linting, naming, comments, test descriptions, etc...)
|
||||
|
||||
Verdaccio has several areas of involvement, which might fit you better, eg:
|
||||
The Verdaccio project is split into several areas:
|
||||
|
||||
- **Core**: The [core](https://github.com/verdaccio/verdaccio) is the main repository, built with **Node.js**.
|
||||
- **Website**: we uses **Gatsby.js** for the **website** and if you are familiar with this technology, you might become the official webmaster.
|
||||
- **Website**: we use [**Docusaurus**](https://docusaurus.io/) for the **website** and if you are familiar with this technology, you might become the official webmaster.
|
||||
- **User Interface**: The [user Interface](https://github.com/verdaccio/ui) is based in **react** and **material-ui** and looking for front-end contributors.
|
||||
- **Kubernetes and Helm**: Ts the official repository for the [**Helm chart**](https://github.com/verdaccio/charts).
|
||||
|
||||
> There are other areas to contribute, like documentation, translation which are not hosted on this repo but check the last section of this notes for further information.
|
||||
> There are other areas to contribute, like documentation, translation which are
|
||||
> not hosted on this repo but check the last section of this notes for further
|
||||
> information.
|
||||
|
||||
## Development Setup
|
||||
|
||||
Verdaccio uses [_pnpm_](https://pnpm.js.org/) as package manager for development in this repository. Please install the latest one:
|
||||
Verdaccio uses [pnpm](https://pnpm.io) as the package manager for development in this repository.
|
||||
|
||||
If you are using pnpm for the first time the [pnpm configuration documentation](https://pnpm.io/configuring) may be useful to avoid any potential problems with the following steps.
|
||||
|
||||
**Note**: pnpm uses npm's configuration formats so check that your global `.npmrc` file does not inadvertently disable package locks. In other words, your `.npmrc` file **should not** contain
|
||||
|
||||
```
|
||||
package-lock=false
|
||||
```
|
||||
|
||||
This setting would cause the `pnpm install` command to install incorrect versions of package dependencies and the subsequent `pnpm build` step would likely fail.
|
||||
|
||||
To begin your development setup, please install the latest version of pnpm globally:
|
||||
|
||||
```
|
||||
npm i -g pnpm
|
||||
```
|
||||
|
||||
First step is installing all dependencies:
|
||||
With pnpm installed, the first step is installing all dependencies:
|
||||
|
||||
```
|
||||
pnpm install
|
||||
@@ -79,62 +92,69 @@ pnpm build
|
||||
pnpm test
|
||||
```
|
||||
|
||||
Verdaccio is a mono repository, for running an specific test or package go the specific package eg:
|
||||
Verdaccio is a mono repository. To run the tests for for a specific package:
|
||||
|
||||
```
|
||||
cd packages/store
|
||||
pnpm test
|
||||
```
|
||||
|
||||
or an specific test in that package
|
||||
or an specific test in that package:
|
||||
|
||||
```
|
||||
pnpm test test/merge.dist.tags.spec.ts
|
||||
```
|
||||
|
||||
or a single test unit
|
||||
or a single test unit:
|
||||
|
||||
```
|
||||
pnpm test test/merge.dist.tags.spec.ts -- -t 'simple'
|
||||
```
|
||||
|
||||
The coverage is enabled by default, to speed up test running
|
||||
Coverage reporting is enabled by default, but you can turn it off to speed up
|
||||
test runs:
|
||||
|
||||
```
|
||||
pnpm test test/merge.dist.tags.spec.ts -- -t 'simple' --coverage=false
|
||||
```
|
||||
|
||||
To increase debug output, we use `debug`, to enable it in your test just add
|
||||
You can enable increased [`debug`](https://www.npmjs.com/package/debug) output:
|
||||
|
||||
```
|
||||
DEBUG=verdaccio* pnpm test
|
||||
DEBUG=verdaccio:* pnpm test
|
||||
```
|
||||
|
||||
More details in the debug section
|
||||
|
||||
### Running and debugging
|
||||
|
||||
We uses [`debug`](https://www.npmjs.com/package/debug) for debug outcome. Each package has it owns namespace.
|
||||
We use [`debug`](https://www.npmjs.com/package/debug) to add helpful debugging
|
||||
output to the code. Each package has it owns namespace.
|
||||
|
||||
### Debugging compiled code
|
||||
#### Debugging compiled code
|
||||
|
||||
Currently you can only run in debug mode pre-compiled packages, to enable debug while running add the `verdaccio` namespace using the `DEBUG` environment variable, like this:
|
||||
Currently you can only run pre-compiled packages in debug mode. To enable debug
|
||||
while running add the `verdaccio` namespace using the `DEBUG` environment
|
||||
variable, like this:
|
||||
|
||||
```
|
||||
DEBUG=verdaccio:* node packages/verdaccio/debug/bootstrap.js
|
||||
```
|
||||
|
||||
On this way can be reviewed every package, but if you need to filter out and display more specific output, increase the name space filter.
|
||||
You can filter this output to just the packages you're interested in using
|
||||
namespaces:
|
||||
|
||||
```
|
||||
DEBUG=verdaccio:plugin:* node packages/verdaccio/debug/bootstrap.js
|
||||
```
|
||||
|
||||
The debug code is intended to analyze what is happening under the hood and none of the output is gathered with the logger module.
|
||||
The debug code is intended to analyze what is happening under the hood and none
|
||||
of the output is sent to the logger module.
|
||||
|
||||
## Reporting Bugs
|
||||
|
||||
**Bugs are considered features that are not working as described in documentation.**
|
||||
**Bugs are considered features that are not working as described in
|
||||
documentation.**
|
||||
|
||||
If you've found a bug in Verdaccio **that isn't a security risk**, please file
|
||||
a report in our [issue tracker](https://github.com/verdaccio/verdaccio/issues).
|
||||
@@ -142,28 +162,31 @@ a report in our [issue tracker](https://github.com/verdaccio/verdaccio/issues).
|
||||
> **NOTE: Verdaccio still does not support all npm commands. Some were not
|
||||
> considered important and others have not been requested yet.**
|
||||
|
||||
### Read the documentation
|
||||
|
||||
Check whether you are using the software in the way is documented [documentation](http://www.verdaccio.org/docs/en/installation.html).
|
||||
|
||||
### What's is not considered a bug?
|
||||
|
||||
- _Third party integrations_: proxies integrations, external plugins.
|
||||
- _Package managers_: If a package manager does not support a specific command or cannot be reproduced with another package manager.
|
||||
- _Features clearly flagged as not supported_.
|
||||
- _Node.js issues installation in any platform_: If you cannot install the global package ( this is considered external issue)
|
||||
- Any ticket which has the flagged as [external issue](https://github.com/verdaccio/verdaccio/labels/external-issue).
|
||||
- _Third party integrations_: proxies integrations, external plugins
|
||||
- _Package managers_: If a package manager does not support a specific command
|
||||
or cannot be reproduced with another package manager
|
||||
- _Features clearly flagged as not supported_
|
||||
- _Node.js issues installation in any platform_: If you cannot install the
|
||||
global package (this is considered external issue)
|
||||
- Any ticket which has beed flagged as an [external issue
|
||||
](https://github.com/verdaccio/verdaccio/labels/external-issue)
|
||||
|
||||
If you intent to report a **security** issue, please follow our [Security policy guidelines](https://github.com/verdaccio/verdaccio/security/policy).
|
||||
If you intend to report a **security** issue, please follow our [Security policy
|
||||
guidelines](https://github.com/verdaccio/verdaccio/security/policy).
|
||||
|
||||
### Issue Search
|
||||
|
||||
Before consider report a bug, please follow this steps before:
|
||||
Before reporting a bug please:
|
||||
|
||||
- Search if has already been reported via the issue search.
|
||||
- Look for the **question** label: we have labelled questions for easy follow-up as [questions](https://github.com/verdaccio/verdaccio/labels/question).
|
||||
- Search for existing issues to see if it has already been reported
|
||||
- Look for the **question** label: we have labelled questions for easy follow-up
|
||||
as [questions](https://github.com/verdaccio/verdaccio/labels/question)
|
||||
|
||||
In case any of those match with your search, up-vote it (using GitHub reactions) or add additional helpful details to the existing issue to show that it's affecting multiple people.
|
||||
In case any of those match with your search, up-vote it (using GitHub reactions)
|
||||
or add additional helpful details to the existing issue to show that it's
|
||||
affecting multiple people.
|
||||
|
||||
### Chat
|
||||
|
||||
@@ -174,20 +197,24 @@ Questions can be asked via [Discord](http://chat.verdaccio.org/)
|
||||
## Request Features
|
||||
|
||||
New feature requests are welcome. Analyse whether the idea fits within scope of
|
||||
the project. Then, detail your request, ensuring context and use case is provided.
|
||||
the project. Adding in context and the use-case will really help!
|
||||
|
||||
**Please provide:**
|
||||
|
||||
- A detailed description the advantages of your request
|
||||
- Whether or not it's compatible with `npm`, `pnpm` and [_yarn classic_](https://github.com/yarnpkg/yarn) or [_yarn berry_](https://github.com/yarnpkg/berry).
|
||||
- Whether or not it's compatible with `npm`, `pnpm` and [_yarn classic_
|
||||
](https://github.com/yarnpkg/yarn) or [_yarn berry_
|
||||
](https://github.com/yarnpkg/berry).
|
||||
- A potential implementation or design
|
||||
- Whatever else you have in your mind 🤓
|
||||
- Whatever else is on your mind! 🤓
|
||||
|
||||
## Contributing Guidelines
|
||||
|
||||
This is the most exciting part, when you became a Verdaccio contributor 🙌🏼, to ensure a fast code review and merge, please follow the next guidelines:
|
||||
It's very exciting to become a Verdaccio contributor 🙌🏼. To ensure a fast code
|
||||
review and merge, please follow the next guidelines:
|
||||
|
||||
> Any contribution gives you the right to be part of this organization as _collaborator_.
|
||||
> Any contribution gives you the right to be part of this organization as
|
||||
> _collaborator_.
|
||||
|
||||
### Submitting a Pull Request
|
||||
|
||||
@@ -213,14 +240,14 @@ information on [rebasing](https://git-scm.com/book/en/v2/Git-Branching-Rebasing)
|
||||
|
||||
#### Caveats
|
||||
|
||||
Feel free to commit as much times you want in your branch, but keep on mind on this repository we `git squash` on merge by default, any other way is forbidden since we intent to have a clean git history.
|
||||
Feel free to commit as much times you want in your branch, but keep on mind on
|
||||
this repository we `git squash` on merge by default, as we like to maintain a
|
||||
clean git history.
|
||||
|
||||
#### Before Commit
|
||||
|
||||
Before committing, **you must ensure there are no linting errors and
|
||||
all tests pass.**
|
||||
|
||||
To do this, run these commands before create the PR:
|
||||
all tests pass.** To do this, run these commands before create the PR:
|
||||
|
||||
```bash
|
||||
pnpm lint
|
||||
@@ -229,9 +256,10 @@ pnpm build
|
||||
pnpm test
|
||||
```
|
||||
|
||||
> note: eslint and formatting are running separately, keep code formatting before push.
|
||||
> note: eslint and formatting are run separately, keep code formatting
|
||||
> before push.
|
||||
|
||||
All good? perfect, then you should create the pull request.
|
||||
All good? Perfect! You should create the pull request.
|
||||
|
||||
#### Commit Guidelines
|
||||
|
||||
@@ -240,8 +268,8 @@ For example:
|
||||
- `feat: A new feature`
|
||||
- `fix: A bug fix`
|
||||
|
||||
A commit of the type feat introduces a new feature to the codebase
|
||||
(this correlates with MINOR in semantic versioning).
|
||||
A commit of the type feat introduces a new feature to the codebase (this
|
||||
correlates with MINOR in semantic versioning).
|
||||
|
||||
e.g.:
|
||||
|
||||
@@ -249,7 +277,8 @@ e.g.:
|
||||
feat: xxxxxxxxxx
|
||||
```
|
||||
|
||||
A commit of the type fix patches a bug in your codebase (this correlates with PATCH in semantic versioning).
|
||||
A commit of the type fix patches a bug in your codebase (this correlates with
|
||||
PATCH in semantic versioning).
|
||||
|
||||
e.g.:
|
||||
|
||||
@@ -257,24 +286,31 @@ e.g.:
|
||||
fix: xxxxxxxxxxx
|
||||
```
|
||||
|
||||
Commits types such as as `docs:`,`style:`,`refactor:`,`perf:`,`test:`
|
||||
and `chore:` are valid but have no effect on versioning. **It would be great if you use them.**
|
||||
Commits types such as as `docs:`,`style:`,`refactor:`,`perf:`,`test:` and
|
||||
`chore:` are valid but have no effect on versioning: **please use them!**
|
||||
|
||||
All commits message are going to be validated when they are created using husky hooks.
|
||||
All commits message are going to be validated when they are created using
|
||||
_husky_ hooks.
|
||||
|
||||
> Please, try to provide one single commit to help a clean and easy merge process.
|
||||
> Please try to provide one single commit to help a clean and easy merge process
|
||||
|
||||
### Adding a changeset
|
||||
|
||||
We use [changesets](https://github.com/atlassian/changesets) in order to generate a detailed Changelog as possible.
|
||||
We use [changesets](https://github.com/atlassian/changesets) in order to
|
||||
generate a detailed Changelog as possible.
|
||||
|
||||
Add a changeset with your Pull Request is essential if you want your contribution get merged (unless is a change that does not affect library functionality, eg: typo, docs, readme, add additional test or linting code). To create a changeset please run:
|
||||
Adding a changeset with your Pull Request is essential if you want your
|
||||
contribution to get merged (unless is a change that does not affect library
|
||||
functionality, eg: typo, docs, readme, add additional test or linting code). To
|
||||
create a changeset please run:
|
||||
|
||||
```
|
||||
pnpm changeset
|
||||
```
|
||||
|
||||
Then select the packages you want to include in your changeset navigating through them and press the spacebar to check it, on finish press enter to move to the next step.
|
||||
Then select the packages you want to include in your changeset navigating
|
||||
through them and press the spacebar to check it, on finish press enter to move
|
||||
to the next step.
|
||||
|
||||
```
|
||||
🦋 Which packages would you like to include? …
|
||||
@@ -287,7 +323,9 @@ Then select the packages you want to include in your changeset navigating throug
|
||||
✔ @verdaccio/commons-api
|
||||
```
|
||||
|
||||
The next question would be if you want a _major bump_, this is not the usual scenario, most likely would be a patch, in that case press enter 2 times (to skip minor)
|
||||
The next question would be if you want a _major bump_. This is not the usual
|
||||
scenario, most likely you want a patch, and in that case press enter 2 times
|
||||
(to skip minor)
|
||||
|
||||
```
|
||||
🦋 Which packages should have a major bump? …
|
||||
@@ -295,7 +333,8 @@ The next question would be if you want a _major bump_, this is not the usual sce
|
||||
✔ @verdaccio/config@5.0.0-alpha.0
|
||||
```
|
||||
|
||||
Once the desired bump you need, the CLI will ask for a summary, here you have fully freedom what to include.
|
||||
Once you have the desired bump you need, the CLI will ask for a summary. Here
|
||||
you have full freedom on what to include:
|
||||
|
||||
```
|
||||
🦋 Which packages would you like to include? · @verdaccio/config
|
||||
@@ -307,7 +346,7 @@ Once the desired bump you need, the CLI will ask for a summary, here you have fu
|
||||
🦋 Summary ›
|
||||
```
|
||||
|
||||
The last step is confirm your changeset or abort the operation.
|
||||
The last step is to confirm your changeset or abort the operation:
|
||||
|
||||
```
|
||||
🦋 Is this your desired changeset? (Y/n) · true
|
||||
@@ -317,9 +356,13 @@ The last step is confirm your changeset or abort the operation.
|
||||
🦋 info /Users/user/verdaccio.clone/.changeset/light-scissors-smell.md
|
||||
```
|
||||
|
||||
Once the changeset is added (all will have an unique name) you can freely edit using markdown, adding additional information, code snippets or what you consider is relevant.
|
||||
Once the changeset is added (all will have an unique name) you can freely edit
|
||||
using markdown, adding additional information, code snippets or whatever else
|
||||
you consider to be relevant.
|
||||
|
||||
All that information will be part of the **changelog**, be concise but informative. It is considered a good option to add your nickname and GitHub link to your profile.
|
||||
All that information will be part of the **changelog**. Be concise but
|
||||
informative! It's recommended to add your nickname and GitHub link to your
|
||||
profile.
|
||||
|
||||
**PRs that do not follow the commit message guidelines will not be merged.**
|
||||
|
||||
@@ -327,7 +370,8 @@ All that information will be part of the **changelog**, be concise but informati
|
||||
|
||||
**Any change in source code must include test updates**.
|
||||
|
||||
If you need help with how testing works, please [refer to the following guide](https://github.com/verdaccio/verdaccio/wiki/Running-and-Debugging-tests).
|
||||
If you need help with how testing works, please [refer to the following guide
|
||||
](https://github.com/verdaccio/verdaccio/wiki/Running-and-Debugging-tests).
|
||||
|
||||
**If you are introducing new features, you MUST include new tests. PRs for
|
||||
features without tests will not be merged.**
|
||||
@@ -340,6 +384,8 @@ If you want to develop your own plugin:
|
||||
|
||||
1. Check whether there is a legacy Sinopia plugin for the feature that you need
|
||||
via [npmjs](https://www.npmjs.com/search?q=sinopia)
|
||||
2. Keep in mind the [life-cycle to load a plugin](https://verdaccio.org/docs/en/dev-plugins)
|
||||
2. Keep in mind the [life-cycle to load a plugin
|
||||
](https://verdaccio.org/docs/en/dev-plugins)
|
||||
3. You are free to host your plugin in your repository
|
||||
4. Provide a detailed description of your plugin to help users understand how to use it.
|
||||
4. Provide a detailed description of your plugin to help users understand how to
|
||||
use it
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM --platform=${BUILDPLATFORM:-linux/amd64} node:14.16.1-alpine as builder
|
||||
FROM --platform=${BUILDPLATFORM:-linux/amd64} node:14.17.6-alpine as builder
|
||||
|
||||
ENV NODE_ENV=development \
|
||||
VERDACCIO_BUILD_REGISTRY=https://registry.verdaccio.org
|
||||
@@ -12,14 +12,14 @@ RUN apk --no-cache add openssl ca-certificates wget && \
|
||||
WORKDIR /opt/verdaccio-build
|
||||
COPY . .
|
||||
|
||||
RUN npm -g i pnpm@latest && \
|
||||
RUN npm -g i pnpm@6.10.3 && \
|
||||
pnpm config set registry $VERDACCIO_BUILD_REGISTRY && \
|
||||
pnpm recursive install --frozen-lockfile --ignore-scripts && \
|
||||
pnpm run build
|
||||
# FIXME: need to remove devDependencies from the build
|
||||
# RUN pnpm install --prod --ignore-scripts
|
||||
|
||||
FROM node:14.16.1-alpine
|
||||
FROM node:14.17.6-alpine
|
||||
LABEL maintainer="https://github.com/verdaccio/verdaccio"
|
||||
|
||||
ENV VERDACCIO_APPDIR=/opt/verdaccio \
|
||||
|
||||
10
README.md
@@ -32,7 +32,7 @@ Google Cloud Storage** or create your own plugin.
|
||||
Install with npm:
|
||||
|
||||
```bash
|
||||
npm install --global verdaccio@6-next --https://registry.verdaccio.org/
|
||||
npm install --global verdaccio@6-next --registry https://registry.verdaccio.org/
|
||||
```
|
||||
|
||||
> Published on a temporary registry while setup is ready to publish on npmjs
|
||||
@@ -69,12 +69,14 @@ booted in a couple of seconds, fast enough for any CI. Many open source projects
|
||||
|
||||
## Talks
|
||||
|
||||
### **Node.js Dependency Confusion Attacks**.
|
||||
### **Testing the integrity of your React components by publishing in a private registry - React Finland 2021**.
|
||||
|
||||
[](https://www.youtube.com/watch?v=qTRADSp3Hpo)
|
||||
[](https://react-finland.fi/schedule/#testing-the-integrity-of-your-react-components-by-publishing-in-a-private-registry)
|
||||
|
||||
You might want to check out as well our previous talks:
|
||||
|
||||
- [BeerJS Cba Meetup No. 53 May 2021 - **Juan Picado**](https://www.youtube.com/watch?v=6SyjqBmS49Y&ab_channel=BeerJSCba)
|
||||
- [Node.js Dependency Confusion Attacks - April 2021 - **Juan Picado\***](https://www.youtube.com/watch?v=qTRADSp3Hpo)
|
||||
- [**OpenJS World 2020** about \*Cover your Projects with a Multi purpose Lightweight Node.js Registry - **Juan Picado\***](https://www.youtube.com/watch?v=oVCjDWeehAQ)
|
||||
- [ViennaJS Meetup - Introduction to Verdaccio by **Priscila Olivera** and **Juan Picado**](https://www.youtube.com/watch?v=hDIFKzmoCa)
|
||||
- [Open Source? trivago - Verdaccio (**Ayush** and **Juan Picado**) January 2020](https://www.youtube.com/watch?v=A5CWxJC9xzc)
|
||||
@@ -245,6 +247,8 @@ Thanks to the following companies to help us to achieve our goals providing free
|
||||
[](https://www.jetbrains.com/)
|
||||
[](https://crowdin.com/)
|
||||
[](https://www.browserstack.com/)
|
||||
[](https://www.netlify.com/)
|
||||
[](https://algolia.com/)
|
||||
|
||||
Verdaccio also is part of to the [Docker Open Source Program](https://www.docker.com/blog/expanded-support-for-open-source-software-projects/).
|
||||
|
||||
|
||||
16
SECURITY.md
@@ -4,13 +4,13 @@
|
||||
|
||||
The following table describes the versions of this project that are currently supported with security updates:
|
||||
|
||||
| Version | Supported |
|
||||
| --------- | ---------------------------------------- |
|
||||
| 2.x | :x: |
|
||||
| 3.x | :x: |
|
||||
| 4.x | :white_check_mark: (until 1st July 2021) |
|
||||
| 5.x | :white_check_mark: |
|
||||
| 6.x alpha | :x: |
|
||||
| Version | Supported |
|
||||
| --------- | ------------------ |
|
||||
| 2.x | :x: |
|
||||
| 3.x | :x: |
|
||||
| 4.x | :x: |
|
||||
| 5.x | :white_check_mark: |
|
||||
| 6.x alpha | :x: |
|
||||
|
||||
## Responsible disclosure security policy
|
||||
|
||||
@@ -32,7 +32,7 @@ If you discover a security vulnerability, please use one of the following means
|
||||
|
||||
Note that time-frame and processes are subject to each program’s own policy.
|
||||
|
||||
- Report the security issue to the project maintainers directly at verdaccio@pm.me. If the report contains highly sensitive information, please be advised to encrypt your findings using our [PGP key](https://verdaccio.nyc3.digitaloceanspaces.com/gpg/publickey.verdaccio@pm.me.asc) which is also available in this document.
|
||||
- Report the security issue to the project maintainers directly at verdaccio@pm.me. If the report contains highly sensitive information, please be advised to encrypt your findings using our [PGP key](https://cdn.verdaccio.dev/gpg/publickey.verdaccio@pm.me.asc) which is also available in this document.
|
||||
|
||||
Your efforts to responsibly disclose your findings are sincerely appreciated and will be taken into account to acknowledge your contributions.
|
||||
|
||||
|
||||
16
crowdin.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
project_id_env: CROWDIN_VERDACCIO_PROJECT_ID
|
||||
api_token_env: CROWDIN_VERDACCIO_API_KEY
|
||||
|
||||
preserve_hierarchy: true
|
||||
|
||||
files:
|
||||
[
|
||||
{
|
||||
source: '/website/i18n/en/**/*',
|
||||
translation: '/website/i18n/%locale%/**/%original_file_name%',
|
||||
},
|
||||
{
|
||||
source: '/website/docs/**/*',
|
||||
translation: '/website/i18n/%locale%/docusaurus-plugin-content-docs/current/**/%original_file_name%',
|
||||
}
|
||||
]
|
||||
@@ -2,23 +2,23 @@
|
||||
|
||||
#### Proxies
|
||||
|
||||
- [Docker + Apache + Verdaccio](v4/apache-verdaccio/README.md)
|
||||
- [Docker + Nginx + Verdaccio](v4/reverse_proxy/nginx/README.md)
|
||||
- [Docker + https-portal Example](v4/https-portal-example/README.md)
|
||||
- [Docker + Apache + Verdaccio](apache-verdaccio/README.md)
|
||||
- [Docker + Nginx + Verdaccio](reverse_proxy/nginx/README.md)
|
||||
- [Docker + https-portal Example](https-portal-example/README.md)
|
||||
|
||||
#### Plugins
|
||||
|
||||
- [Docker + Uplinks Multi Registry](v4/multi-registry-uplink/README.md)
|
||||
- [Docker + Local Storage](v4/docker-local-storage-volume/readme.md)
|
||||
- [Docker + External Plugins](v4/docker-plugin-external/README.md)
|
||||
- [Docker + Uplinks Multi Registry](multi-registry-uplink/README.md)
|
||||
- [Docker + Local Storage](docker-local-storage-volume/readme.md)
|
||||
- [Docker + External Plugins](docker-plugin-external/README.md)
|
||||
|
||||
#### Auth
|
||||
|
||||
- [Docker + LDAP (OpenLDAP) Server + Verdaccio 4](v4/ldap-verdaccio/readme.md) by **@kopax**
|
||||
- [Docker + LDAP (OpenLDAP) Server + Verdaccio 4](ldap-verdaccio/readme.md) by **@kopax**
|
||||
- [Docker + Gitlab](gitlab-verdaccio/README.md)
|
||||
- [Docker + Active Directory](https://github.com/Mateus-Oli/verdaccio-ad-docker)
|
||||
|
||||
#### Storage
|
||||
|
||||
- [Docker + AWS S3 Plugin(localstack) + Verdaccio 4](v4/amazon-s3-docker-example/v4/README.md)
|
||||
- [Docker + AWS S3 Plugin(localstack) + Verdaccio 4](amazon-s3-docker-example/README.md)
|
||||
- [Docker + Minio](https://github.com/barolab/verdaccio-minio/tree/master/example)
|
||||
|
||||
@@ -10,7 +10,7 @@ let _localMemory = require('./local-memory');
|
||||
let _localMemory2 = _interopRequireDefault(_localMemory);
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : { default: obj };
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
exports.LocalMemory = _localMemory2.default;
|
||||
|
||||
@@ -9,7 +9,7 @@ let _memoryHandler = require('./memory-handler');
|
||||
let _memoryHandler2 = _interopRequireDefault(_memoryHandler);
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : { default: obj };
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
const DEFAULT_LIMIT = 1000;
|
||||
@@ -43,8 +43,8 @@ class LocalMemory {
|
||||
cb(null);
|
||||
} else {
|
||||
this.logger.info(
|
||||
{ limit: this.limit },
|
||||
'Storage memory has reached limit of @{limit} packages'
|
||||
{limit: this.limit},
|
||||
'Storage memory has reached limit of @{limit} packages',
|
||||
);
|
||||
cb(new Error('Storage memory has reached limit of limit packages'));
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ let _memoryFs2 = _interopRequireDefault(_memoryFs);
|
||||
let _streams = require('@verdaccio/streams');
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : { default: obj };
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
// $FlowFixMe
|
||||
@@ -111,8 +111,8 @@ class MemoryHandler {
|
||||
const uploadStream = new _streams.UploadTarball();
|
||||
const temporalName = `/${name}`;
|
||||
|
||||
process.nextTick(function () {
|
||||
fs.exists(temporalName, function (exists) {
|
||||
process.nextTick(function() {
|
||||
fs.exists(temporalName, function(exists) {
|
||||
if (exists) {
|
||||
return uploadStream.emit('error', fSError(fileExist));
|
||||
}
|
||||
@@ -122,7 +122,7 @@ class MemoryHandler {
|
||||
|
||||
uploadStream.pipe(file);
|
||||
|
||||
uploadStream.done = function () {
|
||||
uploadStream.done = function() {
|
||||
const onEnd = function onEnd() {
|
||||
uploadStream.emit('success');
|
||||
};
|
||||
@@ -130,7 +130,7 @@ class MemoryHandler {
|
||||
uploadStream.on('end', onEnd);
|
||||
};
|
||||
|
||||
uploadStream.abort = function () {
|
||||
uploadStream.abort = function() {
|
||||
uploadStream.emit('error', fSError('transmision aborted', 400));
|
||||
file.end();
|
||||
};
|
||||
@@ -150,8 +150,8 @@ class MemoryHandler {
|
||||
|
||||
const readTarballStream = new _streams.ReadTarball();
|
||||
|
||||
process.nextTick(function () {
|
||||
fs.exists(pathName, function (exists) {
|
||||
process.nextTick(function() {
|
||||
fs.exists(pathName, function(exists) {
|
||||
if (!exists) {
|
||||
readTarballStream.emit('error', noPackageFoundError());
|
||||
} else {
|
||||
@@ -164,7 +164,7 @@ class MemoryHandler {
|
||||
readTarballStream.emit('error', error);
|
||||
});
|
||||
|
||||
readTarballStream.abort = function () {
|
||||
readTarballStream.abort = function() {
|
||||
readStream.destroy(fSError('read has been aborted', 400));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
FROM nginx:1.14.2-alpine
|
||||
FROM nginx:1.21-alpine
|
||||
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
> Before run examples, build the local image by running `pnpm docker`.
|
||||
|
||||
- [Docker + Nginx + Verdaccio](v5/reverse_proxy/nginx/README.md)
|
||||
- [Docker + Nginx + Verdaccio](reverse_proxy/nginx/README.md)
|
||||
|
||||
2
docker-examples/v5/reverse_proxy/nginx/relative_path/nginx/Dockerfile
Executable file → Normal file
@@ -1,2 +1,2 @@
|
||||
FROM nginx:1.14.2-alpine
|
||||
FROM nginx:1.21-alpine
|
||||
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
2
docker-examples/v5/reverse_proxy/nginx/relative_path/nginx_ssl/Dockerfile
Executable file → Normal file
@@ -1,4 +1,4 @@
|
||||
FROM nginx
|
||||
FROM nginx:1
|
||||
|
||||
COPY cert.crt /etc/nginx/cert.crt
|
||||
COPY cert.key /etc/nginx/cert.key
|
||||
|
||||
2
docker-examples/v5/reverse_proxy/nginx_relative/nginx/Dockerfile
Executable file → Normal file
@@ -1,2 +1,2 @@
|
||||
FROM nginx:1.14.2-alpine
|
||||
FROM nginx:1.21-alpine
|
||||
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
|
Before Width: | Height: | Size: 244 KiB After Width: | Height: | Size: 244 KiB |
|
Before Width: | Height: | Size: 269 KiB After Width: | Height: | Size: 269 KiB |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 3.5 MiB After Width: | Height: | Size: 3.5 MiB |
@@ -1,5 +0,0 @@
|
||||
## Where are the docs now?
|
||||
|
||||
The documentation was relocated to the following website:
|
||||
|
||||
https://github.com/verdaccio/website
|
||||
19
netlify.toml
Normal file
@@ -0,0 +1,19 @@
|
||||
[build]
|
||||
command = "pnpm build"
|
||||
publish = "build/"
|
||||
|
||||
[build.environment]
|
||||
NPM_FLAGS="--prefix=/dev/null"
|
||||
NODE_VERSION = "14"
|
||||
|
||||
[context.production]
|
||||
command = "pnpm netlify:build:production"
|
||||
|
||||
[context.deploy-preview]
|
||||
command = "pnpm netlify:build:deployPreview"
|
||||
|
||||
[context.branch-deploy]
|
||||
command = "pnpm netlify:build:deployPreview"
|
||||
|
||||
[[plugins]]
|
||||
package = "../.netlify/netlify-plugin-pnpm"
|
||||
174
package.json
@@ -1,4 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "verdaccio-dev",
|
||||
"author": {
|
||||
"name": "Verdaccio Maintainers",
|
||||
"email": "verdaccio.npm@gmail.com"
|
||||
@@ -8,113 +10,117 @@
|
||||
"url": "https://github.com/verdaccio/verdaccio"
|
||||
},
|
||||
"homepage": "https://verdaccio.org",
|
||||
"private": true,
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/verdaccio"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "7.13.14",
|
||||
"@babel/core": "7.13.15",
|
||||
"@babel/node": "7.13.13",
|
||||
"@babel/plugin-proposal-class-properties": "7.13.0",
|
||||
"@babel/plugin-proposal-decorators": "7.13.15",
|
||||
"@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.13.8",
|
||||
"@babel/plugin-proposal-numeric-separator": "7.12.13",
|
||||
"@babel/plugin-proposal-object-rest-spread": "7.13.8",
|
||||
"@babel/plugin-proposal-optional-chaining": "7.13.12",
|
||||
"@babel/plugin-proposal-throw-expressions": "7.12.13",
|
||||
"@babel/cli": "7.14.8",
|
||||
"@babel/core": "7.15.0",
|
||||
"@babel/node": "7.14.9",
|
||||
"@babel/plugin-proposal-class-properties": "7.14.5",
|
||||
"@babel/plugin-proposal-decorators": "7.14.5",
|
||||
"@babel/plugin-proposal-export-namespace-from": "7.14.5",
|
||||
"@babel/plugin-proposal-function-sent": "7.14.5",
|
||||
"@babel/plugin-proposal-json-strings": "7.14.5",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator": "7.14.5",
|
||||
"@babel/plugin-proposal-numeric-separator": "7.14.5",
|
||||
"@babel/plugin-proposal-object-rest-spread": "7.14.7",
|
||||
"@babel/plugin-proposal-optional-chaining": "7.14.5",
|
||||
"@babel/plugin-proposal-throw-expressions": "7.14.5",
|
||||
"@babel/plugin-syntax-dynamic-import": "7.8.3",
|
||||
"@babel/plugin-syntax-import-meta": "7.10.4",
|
||||
"@babel/plugin-transform-async-to-generator": "7.13.0",
|
||||
"@babel/plugin-transform-classes": "7.13.0",
|
||||
"@babel/plugin-transform-runtime": "7.13.15",
|
||||
"@babel/plugin-transform-async-to-generator": "7.14.5",
|
||||
"@babel/plugin-transform-classes": "7.14.9",
|
||||
"@babel/plugin-transform-runtime": "7.15.0",
|
||||
"@babel/polyfill": "7.12.1",
|
||||
"@babel/preset-env": "7.13.15",
|
||||
"@babel/preset-react": "7.13.13",
|
||||
"@babel/preset-typescript": "7.13.0",
|
||||
"@babel/register": "7.13.14",
|
||||
"@babel/runtime": "7.13.10",
|
||||
"@babel/preset-env": "7.15.0",
|
||||
"@babel/preset-react": "7.14.5",
|
||||
"@babel/preset-typescript": "7.15.0",
|
||||
"@babel/register": "7.15.3",
|
||||
"@babel/runtime": "7.15.3",
|
||||
"@changesets/changelog-github": "^0.2.8",
|
||||
"@changesets/cli": "^2.15.0",
|
||||
"@changesets/cli": "2.15.0",
|
||||
"@changesets/get-dependents-graph": "^1.2.0",
|
||||
"@commitlint/cli": "8.3.5",
|
||||
"@commitlint/config-conventional": "8.2.0",
|
||||
"@octokit/rest": "17.0.0",
|
||||
"@types/async": "3.2.5",
|
||||
"@crowdin/cli": "3.6.5",
|
||||
"@types/async": "3.2.7",
|
||||
"@types/autocannon": "4.1.1",
|
||||
"@types/autosuggest-highlight": "3.1.1",
|
||||
"@types/express": "4.17.6",
|
||||
"@types/http-errors": "1.8.0",
|
||||
"@types/jest": "^26.0.20",
|
||||
"@types/js-base64": "3.0.0",
|
||||
"@types/lodash": "4.14.167",
|
||||
"@types/lowdb": "^1.0.9",
|
||||
"@types/mime": "2.0.2",
|
||||
"@types/minimatch": "3.0.3",
|
||||
"@types/node": "^14.14.7",
|
||||
"@types/react": "16.14.2",
|
||||
"@types/react-autosuggest": "10.0.1",
|
||||
"@types/react-dom": "^16.9.10",
|
||||
"@types/react-router-dom": "5.1.6",
|
||||
"@types/react-virtualized": "9.21.10",
|
||||
"@types/request": "2.48.5",
|
||||
"@types/semver": "7.3.4",
|
||||
"@types/supertest": "2.0.10",
|
||||
"@types/testing-library__jest-dom": "^5.9.5",
|
||||
"@types/validator": "^13.1.3",
|
||||
"@types/webpack": "^4.41.26",
|
||||
"@types/webpack-env": "1.16.0",
|
||||
"@typescript-eslint/eslint-plugin": "4.13.0",
|
||||
"@typescript-eslint/parser": "4.13.0",
|
||||
"@types/express": "4.17.8",
|
||||
"@types/http-errors": "1.8.1",
|
||||
"@types/jest": "27.0.1",
|
||||
"@types/lodash": "4.14.172",
|
||||
"@types/lowdb": "1.0.11",
|
||||
"@types/mime": "2.0.3",
|
||||
"@types/minimatch": "3.0.5",
|
||||
"@types/node": "14.6.0",
|
||||
"@types/react": "17.0.19",
|
||||
"@types/react-autosuggest": "10.1.5",
|
||||
"@types/react-dom": "17.0.9",
|
||||
"@types/react-helmet": "6.1.2",
|
||||
"@types/react-router-dom": "5.1.8",
|
||||
"@types/react-virtualized": "9.21.13",
|
||||
"@types/request": "2.48.7",
|
||||
"@types/semver": "7.3.8",
|
||||
"@types/supertest": "2.0.11",
|
||||
"@types/testing-library__jest-dom": "5.14.1",
|
||||
"@types/validator": "13.6.3",
|
||||
"@types/webpack": "4.41.26",
|
||||
"@types/webpack-env": "1.16.2",
|
||||
"@typescript-eslint/eslint-plugin": "4.30.0",
|
||||
"@typescript-eslint/parser": "4.30.0",
|
||||
"@verdaccio/benchmark": "workspace:*",
|
||||
"@verdaccio/eslint-config": "workspace:*",
|
||||
"@verdaccio/types": "workspace:*",
|
||||
"@verdaccio/ui-theme": "workspace:*",
|
||||
"autocannon": "7.4.0",
|
||||
"babel-core": "7.0.0-bridge.0",
|
||||
"babel-eslint": "10.1.0",
|
||||
"babel-jest": "26.6.3",
|
||||
"babel-jest": "27.1.0",
|
||||
"babel-plugin-dynamic-import-node": "2.3.3",
|
||||
"babel-plugin-emotion": "11.0.0",
|
||||
"codecov": "3.8.1",
|
||||
"concurrently": "^5.3.0",
|
||||
"core-js": "^3.10.1",
|
||||
"babel-plugin-emotion": "10.0.33",
|
||||
"codecov": "3.8.3",
|
||||
"concurrently": "6.2.1",
|
||||
"cross-env": "7.0.3",
|
||||
"debug": "4.3.2",
|
||||
"detect-secrets": "1.0.6",
|
||||
"eslint": "7.19.0",
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-google": "0.14.0",
|
||||
"eslint-config-prettier": "7.2.0",
|
||||
"eslint-config-prettier": "8.3.0",
|
||||
"eslint-plugin-babel": "5.3.1",
|
||||
"eslint-plugin-import": "2.22.1",
|
||||
"eslint-plugin-jest": "24.1.3",
|
||||
"eslint-plugin-import": "2.24.2",
|
||||
"eslint-plugin-jest": "24.4.0",
|
||||
"eslint-plugin-jsx-a11y": "6.4.1",
|
||||
"eslint-plugin-react": "7.22.0",
|
||||
"eslint-plugin-prettier": "4.0.0",
|
||||
"eslint-plugin-react": "7.25.1",
|
||||
"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": "7.0.0",
|
||||
"eslint-plugin-verdaccio": "10.0.0",
|
||||
"fs-extra": "10.0.0",
|
||||
"husky": "2.7.0",
|
||||
"in-publish": "2.0.1",
|
||||
"jest": "26.6.3",
|
||||
"jest-environment-jsdom": "26.6.2",
|
||||
"jest-environment-jsdom-global": "^2.0.4",
|
||||
"jest-environment-node": "26.6.2",
|
||||
"jest": "27.1.0",
|
||||
"jest-environment-jsdom": "27.1.0",
|
||||
"jest-environment-jsdom-global": "3.0.0",
|
||||
"jest-environment-node": "27.1.0",
|
||||
"jest-fetch-mock": "3.0.3",
|
||||
"jest-junit": "11.0.1",
|
||||
"kleur": "4.1.4",
|
||||
"lint-staged": "8.2.1",
|
||||
"jest-junit": "12.2.0",
|
||||
"kleur": "3.0.3",
|
||||
"lint-staged": "9.5.0",
|
||||
"nock": "12.0.3",
|
||||
"nodemon": "^2.0.7",
|
||||
"node-fetch": "3.0.0-beta.6-exportfix",
|
||||
"nodemon": "2.0.12",
|
||||
"npm-run-all": "4.1.5",
|
||||
"prettier": "2.2.1",
|
||||
"prettier": "2.3.2",
|
||||
"rimraf": "3.0.2",
|
||||
"selfsigned": "1.10.8",
|
||||
"supertest": "4.0.2",
|
||||
"ts-node": "^9.1.1",
|
||||
"typescript": "^4.2.4",
|
||||
"update-ts-references": "2.3.0",
|
||||
"verdaccio": "^5.0.1",
|
||||
"selfsigned": "1.10.11",
|
||||
"supertest": "6.1.6",
|
||||
"ts-node": "10.2.1",
|
||||
"typescript": "4.4.2",
|
||||
"update-ts-references": "2.4.0",
|
||||
"verdaccio": "5.1.3",
|
||||
"verdaccio-audit": "workspace:*",
|
||||
"verdaccio-auth-memory": "workspace:*",
|
||||
"verdaccio-htpasswd": "workspace:*",
|
||||
@@ -122,15 +128,18 @@
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "pnpm recursive run clean",
|
||||
"build": "pnpm recursive run build",
|
||||
"build": "pnpm recursive run build --filter=!@verdaccio/website",
|
||||
"docker": "docker build -t verdaccio/verdaccio:local . --no-cache",
|
||||
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,yml,yaml,md}\"",
|
||||
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,yml,yaml,md}\"",
|
||||
"lint": "eslint \"**/*.{js,jsx,ts,tsx}\"",
|
||||
"lint": "eslint --max-warnings 49 \"**/*.{js,jsx,ts,tsx}\"",
|
||||
"test": "pnpm recursive test --filter ./packages",
|
||||
"test:e2e:cli": "pnpm test --filter ...@verdaccio/e2e-cli",
|
||||
"test:e2e:ui": "pnpm test --filter ...@verdaccio/e2e-ui",
|
||||
"start": "concurrently --kill-others \"pnpm _start:server\" \"pnpm _start:web\"",
|
||||
"benchmark:hyper": "verdaccio-benchmark hyper -r ./hyper-results.json",
|
||||
"benchmark:api": "verdaccio-benchmark api",
|
||||
"benchmark:submit": "pnpm ts-node ./scripts/submit-metrics.ts",
|
||||
"start:watch": "concurrently --kill-others \"pnpm _build:watch\" \"pnpm _start:server\" \"pnpm _debug:reload\"",
|
||||
"_build:watch": "pnpm run --parallel watch --filter ./packages",
|
||||
"_start:server": "node packages/verdaccio/debug/bootstrap.js --listen 8000",
|
||||
@@ -139,16 +148,17 @@
|
||||
"start:ts": "ts-node packages/verdaccio/src/start.ts -- --listen 8000",
|
||||
"debug": "node --inspect packages/verdaccio/debug/bootstrap.js",
|
||||
"debug:break": "node --inspect-brk packages/verdaccio/debug/bootstrap.js",
|
||||
"website:lint": "cd website && yarn lint",
|
||||
"website:develop": "cd website && yarn develop",
|
||||
"website:build": "cd website && yarn build",
|
||||
"changeset": "changeset",
|
||||
"changeset:check": "changeset status --since-master",
|
||||
"ci:version": "run-s ci:version:changeset ci:version:install",
|
||||
"ci:version:install": "pnpm install --frozen-lockfile=false",
|
||||
"ci:version:changeset": "changeset version",
|
||||
"ci:publish": "changeset publish",
|
||||
"ts:ref": "update-ts-references --discardComments"
|
||||
"ts:ref": "update-ts-references --discardComments",
|
||||
"website": "pnpm build --filter ...@verdaccio/website",
|
||||
"crowdin:upload": "crowdin upload sources --auto-update --config ./crowdin.yaml",
|
||||
"crowdin:download": "crowdin download --config ./crowdin.yaml",
|
||||
"crowdin:sync": "pnpm crowdin:upload && pnpm crowdin:download --verbose"
|
||||
},
|
||||
"license": "MIT",
|
||||
"commitlint": {
|
||||
|
||||
@@ -1,5 +1,25 @@
|
||||
# @verdaccio/api
|
||||
|
||||
## 6.0.0-6-next.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [d2c65da9]
|
||||
- @verdaccio/utils@6.0.0-6-next.5
|
||||
- @verdaccio/auth@6.0.0-6-next.9
|
||||
- @verdaccio/config@6.0.0-6-next.7
|
||||
- @verdaccio/tarball@11.0.0-6-next.6
|
||||
- @verdaccio/middleware@6.0.0-6-next.9
|
||||
- @verdaccio/store@6.0.0-6-next.10
|
||||
- @verdaccio/hooks@6.0.0-6-next.4
|
||||
|
||||
## 6.0.0-6-next.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5ddfa526]
|
||||
- @verdaccio/store@6.0.0-6-next.9
|
||||
|
||||
## 6.0.0-6-next.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@verdaccio/api",
|
||||
"version": "6.0.0-6-next.10",
|
||||
"version": "6.0.0-6-next.12",
|
||||
"description": "loaders logic",
|
||||
"main": "./build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
@@ -39,28 +39,28 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@verdaccio/auth": "workspace:6.0.0-6-next.8",
|
||||
"@verdaccio/auth": "workspace:6.0.0-6-next.9",
|
||||
"@verdaccio/commons-api": "workspace:11.0.0-alpha.3",
|
||||
"@verdaccio/config": "workspace:6.0.0-6-next.6",
|
||||
"@verdaccio/config": "workspace:6.0.0-6-next.7",
|
||||
"@verdaccio/hooks": "workspace:6.0.0-6-next.4",
|
||||
"@verdaccio/logger": "workspace:6.0.0-6-next.4",
|
||||
"@verdaccio/middleware": "workspace:6.0.0-6-next.8",
|
||||
"@verdaccio/store": "workspace:6.0.0-6-next.8",
|
||||
"@verdaccio/tarball": "workspace:11.0.0-6-next.5",
|
||||
"@verdaccio/utils": "workspace:6.0.0-6-next.4",
|
||||
"@verdaccio/middleware": "workspace:6.0.0-6-next.9",
|
||||
"@verdaccio/store": "workspace:6.0.0-6-next.10",
|
||||
"@verdaccio/tarball": "workspace:11.0.0-6-next.6",
|
||||
"@verdaccio/utils": "workspace:6.0.0-6-next.5",
|
||||
"cookies": "0.8.0",
|
||||
"debug": "^4.1.1",
|
||||
"debug": "4.3.2",
|
||||
"express": "4.17.1",
|
||||
"lodash": "^4.17.20",
|
||||
"mime": "2.4.4",
|
||||
"semver": "7.3.2"
|
||||
"lodash": "4.17.21",
|
||||
"mime": "2.5.2",
|
||||
"semver": "7.3.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@verdaccio/server": "workspace:6.0.0-6-next.13",
|
||||
"@verdaccio/types": "workspace:11.0.0-6-next.6",
|
||||
"@verdaccio/server": "workspace:6.0.0-6-next.17",
|
||||
"@verdaccio/types": "workspace:11.0.0-6-next.7",
|
||||
"body-parser": "1.19.0",
|
||||
"lodash": "^4.17.20",
|
||||
"supertest": "next"
|
||||
"lodash": "4.17.21",
|
||||
"supertest": "6.1.6"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import _ from 'lodash';
|
||||
import express, { Express } from 'express';
|
||||
|
||||
import express, { Router } from 'express';
|
||||
import {
|
||||
match,
|
||||
validateName,
|
||||
@@ -25,11 +23,7 @@ import profile from './v1/profile';
|
||||
import token from './v1/token';
|
||||
import v1Search from './v1/search';
|
||||
|
||||
export default function (
|
||||
config: Config,
|
||||
auth: IAuth,
|
||||
storage: IStorageHandler
|
||||
): Express.Application {
|
||||
export default function (config: Config, auth: IAuth, storage: IStorageHandler): Router {
|
||||
/* eslint new-cap:off */
|
||||
const app = express.Router();
|
||||
/* eslint new-cap:off */
|
||||
|
||||
@@ -269,7 +269,7 @@ export function publishPackage(storage: IStorageHandler, config: Config, auth: I
|
||||
req.remote_user,
|
||||
`${metadataCopy.name}@${versionToPublish}`
|
||||
);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
debug(
|
||||
'error on notify add a new tag %o',
|
||||
`${metadataCopy.name}@${versionToPublish}`
|
||||
@@ -319,7 +319,7 @@ export function publishPackage(storage: IStorageHandler, config: Config, auth: I
|
||||
afterChange(error, API_MESSAGE.PKG_CREATED, metadata);
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
debug('error on publish, bad package format %o', packageName);
|
||||
logger.error({ packageName }, 'error on publish, bad package data for @{packageName}');
|
||||
return next(ErrorCode.getBadData(API_ERROR.BAD_PACKAGE_DATA));
|
||||
|
||||
@@ -41,7 +41,7 @@ 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] = [
|
||||
'text',
|
||||
'size',
|
||||
'from' /* , 'quality', 'popularity', 'maintenance' */,
|
||||
|
||||
@@ -46,7 +46,7 @@ export default function (
|
||||
next: '', // TODO: pagination?
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
logger.error({ error: error.msg }, 'token list has failed: @{error}');
|
||||
return next(ErrorCode.getCode(HTTP_STATUS.INTERNAL_ERROR, error.message));
|
||||
}
|
||||
@@ -116,7 +116,7 @@ export default function (
|
||||
created: saveToken.created,
|
||||
})
|
||||
);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
logger.error({ error: error.msg }, 'token creation has failed: @{error}');
|
||||
return next(ErrorCode.getCode(HTTP_STATUS.INTERNAL_ERROR, error.message));
|
||||
}
|
||||
@@ -138,7 +138,7 @@ export default function (
|
||||
await storage.deleteToken(name, tokenKey);
|
||||
logger.info({ tokenKey, name }, 'token id @{tokenKey} was revoked for user @{name}');
|
||||
return next({});
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
logger.error({ error: error.msg }, 'token creation has failed: @{error}');
|
||||
return next(ErrorCode.getCode(HTTP_STATUS.INTERNAL_ERROR, error.message));
|
||||
}
|
||||
|
||||
@@ -5,10 +5,11 @@ import { $ResponseExtend, $RequestExtend } from '../../types/custom';
|
||||
import { initializeServer, publishTaggedVersion, publishVersion } from './_helper';
|
||||
|
||||
const mockApiJWTmiddleware = jest.fn(
|
||||
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: 'foo', groups: [], real_groups: [] };
|
||||
_next();
|
||||
}
|
||||
() =>
|
||||
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: 'foo', groups: [], real_groups: [] };
|
||||
_next();
|
||||
}
|
||||
);
|
||||
|
||||
jest.mock('@verdaccio/auth', () => ({
|
||||
@@ -33,30 +34,34 @@ describe('package', () => {
|
||||
app = await initializeServer('package.yaml');
|
||||
});
|
||||
|
||||
test('should return a package', async (done) => {
|
||||
test('should return a package', async () => {
|
||||
await publishVersion(app, 'package.yaml', 'foo', '1.0.0');
|
||||
return supertest(app)
|
||||
.get('/foo')
|
||||
.set('Accept', HEADERS.JSON)
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.OK)
|
||||
.then((response) => {
|
||||
expect(response.body.name).toEqual('foo');
|
||||
done();
|
||||
});
|
||||
return new Promise((resolve) => {
|
||||
supertest(app)
|
||||
.get('/foo')
|
||||
.set('Accept', HEADERS.JSON)
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.OK)
|
||||
.then((response) => {
|
||||
expect(response.body.name).toEqual('foo');
|
||||
resolve(response);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('should return a package by version', async (done) => {
|
||||
test('should return a package by version', async () => {
|
||||
await publishVersion(app, 'package.yaml', 'foo2', '1.0.0');
|
||||
return supertest(app)
|
||||
.get('/foo2/1.0.0')
|
||||
.set('Accept', HEADERS.JSON)
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.OK)
|
||||
.then((response) => {
|
||||
expect(response.body.name).toEqual('foo2');
|
||||
done();
|
||||
});
|
||||
return new Promise((resolve) => {
|
||||
supertest(app)
|
||||
.get('/foo2/1.0.0')
|
||||
.set('Accept', HEADERS.JSON)
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.OK)
|
||||
.then((response) => {
|
||||
expect(response.body.name).toEqual('foo2');
|
||||
resolve(response);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// TODO: investigate the 404
|
||||
|
||||
@@ -11,14 +11,13 @@ import { $ResponseExtend, $RequestExtend } from '../../types/custom';
|
||||
import { initializeServer, publishVersion } from './_helper';
|
||||
|
||||
const mockApiJWTmiddleware = jest.fn(
|
||||
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: 'foo', groups: [], real_groups: [] };
|
||||
_next();
|
||||
}
|
||||
() =>
|
||||
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: 'foo', groups: [], real_groups: [] };
|
||||
_next();
|
||||
}
|
||||
);
|
||||
|
||||
jest.setTimeout(50000000);
|
||||
|
||||
jest.mock('@verdaccio/auth', () => ({
|
||||
Auth: class {
|
||||
apiJWTmiddleware() {
|
||||
@@ -85,98 +84,108 @@ describe('publish', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('should fail on publish a bad versions package', async (done) => {
|
||||
test('should fail on publish a bad versions package', async () => {
|
||||
const app = await initializeServer('publish.yaml');
|
||||
return supertest(app)
|
||||
.put(`/${encodeURIComponent(pkgName)}`)
|
||||
.set(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON)
|
||||
.send(
|
||||
JSON.stringify(
|
||||
Object.assign({}, pkgMetadata, {
|
||||
versions: '',
|
||||
})
|
||||
return new Promise((resolve) => {
|
||||
supertest(app)
|
||||
.put(`/${encodeURIComponent(pkgName)}`)
|
||||
.set(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON)
|
||||
.send(
|
||||
JSON.stringify(
|
||||
Object.assign({}, pkgMetadata, {
|
||||
versions: '',
|
||||
})
|
||||
)
|
||||
)
|
||||
)
|
||||
.set('accept', HEADERS.GZIP)
|
||||
.expect(HTTP_STATUS.BAD_REQUEST)
|
||||
.then((response) => {
|
||||
console.log('response.body', response.body);
|
||||
expect(response.body.error).toEqual(API_ERROR.UNSUPORTED_REGISTRY_CALL);
|
||||
done();
|
||||
});
|
||||
.set('accept', HEADERS.GZIP)
|
||||
.expect(HTTP_STATUS.BAD_REQUEST)
|
||||
.then((response) => {
|
||||
console.log('response.body', response.body);
|
||||
expect(response.body.error).toEqual(API_ERROR.UNSUPORTED_REGISTRY_CALL);
|
||||
resolve(response);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('publish a package', () => {
|
||||
test('should publish a package', async (done) => {
|
||||
test('should publish a package', async () => {
|
||||
const app = await initializeServer('publish.yaml');
|
||||
return publishVersion(app, 'publish.yaml', 'foo', '1.0.0')
|
||||
.expect(HTTP_STATUS.CREATED)
|
||||
.then((response) => {
|
||||
expect(response.body.ok).toEqual(API_MESSAGE.PKG_CREATED);
|
||||
done();
|
||||
});
|
||||
return new Promise((resolve) => {
|
||||
publishVersion(app, 'publish.yaml', 'foo', '1.0.0')
|
||||
.expect(HTTP_STATUS.CREATED)
|
||||
.then((response) => {
|
||||
expect(response.body.ok).toEqual(API_MESSAGE.PKG_CREATED);
|
||||
resolve(response);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('should publish a new package', async (done) => {
|
||||
test('should publish a new package', async () => {
|
||||
const pkgName = 'test';
|
||||
const pkgMetadata = generatePackageMetadata(pkgName, '1.0.0');
|
||||
const app = await initializeServer('publish.yaml');
|
||||
return supertest(app)
|
||||
.put(`/${encodeURIComponent(pkgName)}`)
|
||||
.set(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON)
|
||||
.send(
|
||||
JSON.stringify(
|
||||
Object.assign({}, pkgMetadata, {
|
||||
_attachments: null,
|
||||
})
|
||||
return new Promise((resolve) => {
|
||||
supertest(app)
|
||||
.put(`/${encodeURIComponent(pkgName)}`)
|
||||
.set(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON)
|
||||
.send(
|
||||
JSON.stringify(
|
||||
Object.assign({}, pkgMetadata, {
|
||||
_attachments: null,
|
||||
})
|
||||
)
|
||||
)
|
||||
)
|
||||
.set('accept', HEADERS.GZIP)
|
||||
.expect(HTTP_STATUS.CREATED)
|
||||
.then((response) => {
|
||||
expect(response.body.ok).toEqual(API_MESSAGE.PKG_CREATED);
|
||||
done();
|
||||
});
|
||||
.set('accept', HEADERS.GZIP)
|
||||
.expect(HTTP_STATUS.CREATED)
|
||||
.then((response) => {
|
||||
expect(response.body.ok).toEqual(API_MESSAGE.PKG_CREATED);
|
||||
resolve(response);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('should publish a new package with no readme', async (done) => {
|
||||
test('should publish a new package with no readme', async () => {
|
||||
const pkgName = 'test';
|
||||
const pkgMetadata = generatePackageMetadata(pkgName, '1.0.0');
|
||||
const app = await initializeServer('publish.yaml');
|
||||
return supertest(app)
|
||||
.put(`/${encodeURIComponent(pkgName)}`)
|
||||
.set(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON)
|
||||
.send(
|
||||
JSON.stringify(
|
||||
Object.assign({}, pkgMetadata, {
|
||||
versions: {
|
||||
['1.0.0']: {
|
||||
readme: null,
|
||||
return new Promise((resolve) => {
|
||||
supertest(app)
|
||||
.put(`/${encodeURIComponent(pkgName)}`)
|
||||
.set(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON)
|
||||
.send(
|
||||
JSON.stringify(
|
||||
Object.assign({}, pkgMetadata, {
|
||||
versions: {
|
||||
['1.0.0']: {
|
||||
readme: null,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
})
|
||||
)
|
||||
)
|
||||
)
|
||||
.set('accept', HEADERS.GZIP)
|
||||
.expect(HTTP_STATUS.CREATED)
|
||||
.then((response) => {
|
||||
expect(response.body.ok).toEqual(API_MESSAGE.PKG_CREATED);
|
||||
done();
|
||||
});
|
||||
.set('accept', HEADERS.GZIP)
|
||||
.expect(HTTP_STATUS.CREATED)
|
||||
.then((response) => {
|
||||
expect(response.body.ok).toEqual(API_MESSAGE.PKG_CREATED);
|
||||
resolve(response);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('should fails on publish a duplicated package', async (done) => {
|
||||
test('should fails on publish a duplicated package', async () => {
|
||||
const app = await initializeServer('publish.yaml');
|
||||
await publishVersion(app, 'publish.yaml', 'foo', '1.0.0');
|
||||
return publishVersion(app, 'publish.yaml', 'foo', '1.0.0')
|
||||
.expect(HTTP_STATUS.CONFLICT)
|
||||
.then((response) => {
|
||||
console.log('response.body', response.body);
|
||||
expect(response.body.error).toEqual(API_ERROR.PACKAGE_EXIST);
|
||||
done();
|
||||
});
|
||||
return new Promise((resolve) => {
|
||||
publishVersion(app, 'publish.yaml', 'foo', '1.0.0')
|
||||
.expect(HTTP_STATUS.CONFLICT)
|
||||
.then((response) => {
|
||||
console.log('response.body', response.body);
|
||||
expect(response.body.error).toEqual(API_ERROR.PACKAGE_EXIST);
|
||||
resolve(response);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('unpublish a package', () => {
|
||||
|
||||
@@ -16,10 +16,11 @@ import { $RequestExtend, $ResponseExtend } from '../../types/custom';
|
||||
import { initializeServer } from './_helper';
|
||||
|
||||
const mockApiJWTmiddleware = jest.fn(
|
||||
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: 'test', groups: [], real_groups: [] };
|
||||
_next();
|
||||
}
|
||||
() =>
|
||||
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: 'test', groups: [], real_groups: [] };
|
||||
_next();
|
||||
}
|
||||
);
|
||||
|
||||
const mockAuthenticate = jest.fn(() => (_name, _password, callback): void => {
|
||||
@@ -51,83 +52,95 @@ jest.mock('@verdaccio/auth', () => ({
|
||||
describe('user', () => {
|
||||
const credentials = { name: 'test', password: 'test' };
|
||||
|
||||
test('should test add a new user', async (done) => {
|
||||
test('should test add a new user', async () => {
|
||||
mockApiJWTmiddleware.mockImplementationOnce(
|
||||
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: undefined };
|
||||
_next();
|
||||
}
|
||||
() =>
|
||||
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: undefined };
|
||||
_next();
|
||||
}
|
||||
);
|
||||
|
||||
mockAddUser.mockImplementationOnce(() => (_name, _password, callback): void => {
|
||||
return callback(null, true);
|
||||
});
|
||||
supertest(await initializeServer('user.yaml'))
|
||||
.put(`/-/user/org.couchdb.user:newUser`)
|
||||
.send({
|
||||
name: 'newUser',
|
||||
password: 'newUser',
|
||||
})
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.CREATED)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
expect(res.body.ok).toBeDefined();
|
||||
expect(res.body.token).toBeDefined();
|
||||
const token = res.body.token;
|
||||
expect(typeof token).toBe('string');
|
||||
expect(res.body.ok).toMatch(`user 'newUser' created`);
|
||||
done();
|
||||
});
|
||||
const app = await initializeServer('user.yaml');
|
||||
return new Promise((resolve, reject) => {
|
||||
supertest(app)
|
||||
.put(`/-/user/org.couchdb.user:newUser`)
|
||||
.send({
|
||||
name: 'newUser',
|
||||
password: 'newUser',
|
||||
})
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.CREATED)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
expect(res.body.ok).toBeDefined();
|
||||
expect(res.body.token).toBeDefined();
|
||||
const token = res.body.token;
|
||||
expect(typeof token).toBe('string');
|
||||
expect(res.body.ok).toMatch(`user 'newUser' created`);
|
||||
resolve(null);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('should test fails on add a existing user with login', async (done) => {
|
||||
test('should test fails on add a existing user with login', async () => {
|
||||
mockApiJWTmiddleware.mockImplementationOnce(
|
||||
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: undefined };
|
||||
_next();
|
||||
}
|
||||
() =>
|
||||
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: undefined };
|
||||
_next();
|
||||
}
|
||||
);
|
||||
supertest(await initializeServer('user.yaml'))
|
||||
.put('/-/user/org.couchdb.user:jotaNew')
|
||||
.send(credentials)
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.CONFLICT)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
expect(res.body.error).toBeDefined();
|
||||
expect(res.body.error).toMatch(API_ERROR.USERNAME_ALREADY_REGISTERED);
|
||||
done();
|
||||
});
|
||||
const app = await initializeServer('user.yaml');
|
||||
return new Promise((resolve, reject) => {
|
||||
supertest(app)
|
||||
.put('/-/user/org.couchdb.user:jotaNew')
|
||||
.send(credentials)
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.CONFLICT)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
expect(res.body.error).toBeDefined();
|
||||
expect(res.body.error).toMatch(API_ERROR.USERNAME_ALREADY_REGISTERED);
|
||||
resolve(res.body);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('should log in as existing user', async (done) => {
|
||||
supertest(await initializeServer('user.yaml'))
|
||||
.put(`/-/user/org.couchdb.user:${credentials.name}`)
|
||||
.send(credentials)
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.CREATED)
|
||||
.end((err, res) => {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
test('should log in as existing user', async () => {
|
||||
const app = await initializeServer('user.yaml');
|
||||
return new Promise((resolve, reject) => {
|
||||
supertest(app)
|
||||
.put(`/-/user/org.couchdb.user:${credentials.name}`)
|
||||
.send(credentials)
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.CREATED)
|
||||
.end((err, res) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
|
||||
expect(res.body).toBeTruthy();
|
||||
expect(res.body.ok).toMatch(`you are authenticated as \'${credentials.name}\'`);
|
||||
done();
|
||||
});
|
||||
expect(res.body).toBeTruthy();
|
||||
expect(res.body.ok).toMatch(`you are authenticated as \'${credentials.name}\'`);
|
||||
resolve(res);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('should test fails add a new user with missing name', async (done) => {
|
||||
test('should test fails add a new user with missing name', async () => {
|
||||
mockApiJWTmiddleware.mockImplementationOnce(
|
||||
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: undefined };
|
||||
_next();
|
||||
}
|
||||
() =>
|
||||
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: undefined };
|
||||
_next();
|
||||
}
|
||||
);
|
||||
mockAddUser.mockImplementationOnce(() => (_name, _password, callback): void => {
|
||||
return callback(getBadRequest(API_ERROR.USERNAME_PASSWORD_REQUIRED));
|
||||
@@ -135,56 +148,96 @@ describe('user', () => {
|
||||
const credentialsShort = _.cloneDeep(credentials);
|
||||
delete credentialsShort.name;
|
||||
|
||||
supertest(await initializeServer('user.yaml'))
|
||||
.put(`/-/user/org.couchdb.user:${credentials.name}`)
|
||||
.send(credentialsShort)
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.BAD_REQUEST)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
const app = await initializeServer('user.yaml');
|
||||
return new Promise((resolve, reject) => {
|
||||
supertest(app)
|
||||
.put(`/-/user/org.couchdb.user:${credentials.name}`)
|
||||
.send(credentialsShort)
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.BAD_REQUEST)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
|
||||
expect(res.body.error).toBeDefined();
|
||||
expect(res.body.error).toMatch(API_ERROR.USERNAME_PASSWORD_REQUIRED);
|
||||
done();
|
||||
});
|
||||
expect(res.body.error).toBeDefined();
|
||||
expect(res.body.error).toMatch(API_ERROR.USERNAME_PASSWORD_REQUIRED);
|
||||
resolve(app);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('should test fails add a new user with missing password', async (done) => {
|
||||
test('should test fails add a new user with missing password', async () => {
|
||||
mockApiJWTmiddleware.mockImplementationOnce(
|
||||
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: undefined };
|
||||
_next();
|
||||
}
|
||||
() =>
|
||||
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: undefined };
|
||||
_next();
|
||||
}
|
||||
);
|
||||
const credentialsShort = _.cloneDeep(credentials);
|
||||
delete credentialsShort.password;
|
||||
|
||||
supertest(await initializeServer('user.yaml'))
|
||||
.put(`/-/user/org.couchdb.user:${credentials.name}`)
|
||||
.send(credentialsShort)
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.BAD_REQUEST)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
const app = await initializeServer('user.yaml');
|
||||
return new Promise((resolve, reject) => {
|
||||
supertest(app)
|
||||
.put(`/-/user/org.couchdb.user:${credentials.name}`)
|
||||
.send(credentialsShort)
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.BAD_REQUEST)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
|
||||
expect(res.body.error).toBeDefined();
|
||||
// FIXME: message is not 100% accurate
|
||||
// eslint-disable-next-line new-cap
|
||||
expect(res.body.error).toMatch(API_ERROR.PASSWORD_SHORT());
|
||||
done();
|
||||
});
|
||||
expect(res.body.error).toBeDefined();
|
||||
// FIXME: message is not 100% accurate
|
||||
// eslint-disable-next-line new-cap
|
||||
expect(res.body.error).toMatch(API_ERROR.PASSWORD_SHORT());
|
||||
resolve(res);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('should test fails add a new user with wrong password', async (done) => {
|
||||
test('should test fails add a new user with wrong password', async () => {
|
||||
mockApiJWTmiddleware.mockImplementationOnce(
|
||||
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: 'test' };
|
||||
_next();
|
||||
}
|
||||
() =>
|
||||
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: 'test' };
|
||||
_next();
|
||||
}
|
||||
);
|
||||
mockAuthenticate.mockImplementationOnce(() => (_name, _password, callback): void => {
|
||||
return callback(getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));
|
||||
});
|
||||
const credentialsShort = _.cloneDeep(credentials);
|
||||
credentialsShort.password = 'failPassword';
|
||||
const app = await initializeServer('user.yaml');
|
||||
return new Promise((resolve, reject) => {
|
||||
supertest(app)
|
||||
.put('/-/user/org.couchdb.user:test')
|
||||
.send(credentialsShort)
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.UNAUTHORIZED)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
|
||||
expect(res.body.error).toBeDefined();
|
||||
expect(res.body.error).toMatch(API_ERROR.BAD_USERNAME_PASSWORD);
|
||||
resolve(res);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('should be able to logout an user', async () => {
|
||||
mockApiJWTmiddleware.mockImplementationOnce(
|
||||
() =>
|
||||
(req: $RequestExtend, _res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: 'test' };
|
||||
_next();
|
||||
}
|
||||
);
|
||||
mockAuthenticate.mockImplementationOnce(() => (_name, _password, callback): void => {
|
||||
return callback(getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));
|
||||
@@ -192,47 +245,21 @@ describe('user', () => {
|
||||
const credentialsShort = _.cloneDeep(credentials);
|
||||
credentialsShort.password = 'failPassword';
|
||||
|
||||
supertest(await initializeServer('user.yaml'))
|
||||
.put('/-/user/org.couchdb.user:test')
|
||||
.send(credentialsShort)
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.UNAUTHORIZED)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
const app = await initializeServer('user.yaml');
|
||||
return new Promise((resolve, reject) => {
|
||||
supertest(app)
|
||||
.delete('/-/user/token/someSecretToken')
|
||||
.send(credentialsShort)
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.OK)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
|
||||
expect(res.body.error).toBeDefined();
|
||||
expect(res.body.error).toMatch(API_ERROR.BAD_USERNAME_PASSWORD);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('should be able to logout an user', async (done) => {
|
||||
mockApiJWTmiddleware.mockImplementationOnce(
|
||||
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: 'test' };
|
||||
_next();
|
||||
}
|
||||
);
|
||||
mockAuthenticate.mockImplementationOnce(() => (_name, _password, callback): void => {
|
||||
return callback(getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));
|
||||
expect(res.body.ok).toMatch(API_MESSAGE.LOGGED_OUT);
|
||||
resolve(res);
|
||||
});
|
||||
});
|
||||
const credentialsShort = _.cloneDeep(credentials);
|
||||
credentialsShort.password = 'failPassword';
|
||||
|
||||
supertest(await initializeServer('user.yaml'))
|
||||
.delete('/-/user/token/someSecretToken')
|
||||
.send(credentialsShort)
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.OK)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
|
||||
expect(res.body.ok).toMatch(API_MESSAGE.LOGGED_OUT);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,10 +6,11 @@ import { $RequestExtend, $ResponseExtend } from '../../types/custom';
|
||||
import { initializeServer } from './_helper';
|
||||
|
||||
const mockApiJWTmiddleware = jest.fn(
|
||||
() => (req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: 'foo', groups: [], real_groups: [] };
|
||||
_next();
|
||||
}
|
||||
() =>
|
||||
(req: $RequestExtend, res: $ResponseExtend, _next): void => {
|
||||
req.remote_user = { name: 'foo', groups: [], real_groups: [] };
|
||||
_next();
|
||||
}
|
||||
);
|
||||
|
||||
jest.mock('@verdaccio/auth', () => ({
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# @verdaccio/auth
|
||||
|
||||
## 6.0.0-6-next.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [d2c65da9]
|
||||
- @verdaccio/utils@6.0.0-6-next.5
|
||||
- @verdaccio/config@6.0.0-6-next.7
|
||||
- @verdaccio/loaders@6.0.0-6-next.4
|
||||
|
||||
## 6.0.0-6-next.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@verdaccio/auth",
|
||||
"version": "6.0.0-6-next.8",
|
||||
"version": "6.0.0-6-next.9",
|
||||
"description": "logger",
|
||||
"main": "./build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
@@ -40,19 +40,19 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@verdaccio/commons-api": "workspace:11.0.0-alpha.3",
|
||||
"@verdaccio/config": "workspace:6.0.0-6-next.6",
|
||||
"@verdaccio/config": "workspace:6.0.0-6-next.7",
|
||||
"@verdaccio/loaders": "workspace:6.0.0-6-next.4",
|
||||
"@verdaccio/logger": "workspace:6.0.0-6-next.4",
|
||||
"@verdaccio/utils": "workspace:6.0.0-6-next.4",
|
||||
"verdaccio-htpasswd": "workspace:11.0.0-alpha.6",
|
||||
"debug": "^4.1.1",
|
||||
"@verdaccio/utils": "workspace:6.0.0-6-next.5",
|
||||
"debug": "4.3.2",
|
||||
"express": "4.17.1",
|
||||
"jsonwebtoken": "8.5.1",
|
||||
"lodash": "4.17.15"
|
||||
"lodash": "4.17.21",
|
||||
"verdaccio-htpasswd": "workspace:11.0.0-alpha.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@verdaccio/mock": "workspace:6.0.0-6-next.6",
|
||||
"@verdaccio/types": "workspace:11.0.0-6-next.6"
|
||||
"@verdaccio/mock": "workspace:6.0.0-6-next.7",
|
||||
"@verdaccio/types": "workspace:11.0.0-6-next.7"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
|
||||
@@ -116,7 +116,7 @@ class Auth implements IAuth {
|
||||
let authPlugin;
|
||||
try {
|
||||
authPlugin = new HTPasswd(plugingConf, pluginOptions);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
debug('error on loading auth htpasswd plugin stack: %o', error);
|
||||
return [];
|
||||
}
|
||||
@@ -559,7 +559,7 @@ class Auth implements IAuth {
|
||||
let credentials;
|
||||
try {
|
||||
credentials = verifyJWTPayload(token, this.config.secret);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// FIXME: intended behaviour, do we want it?
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ export function aesDecrypt(value: string, key: string): string | void {
|
||||
decrypted += decipher.final(inputEncoding);
|
||||
debug('token decrypted successfully');
|
||||
return decrypted.toString();
|
||||
} catch (_) {
|
||||
} catch (_: any) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ export function verifyJWTPayload(token: string, secret: string): RemoteUser {
|
||||
const payload: RemoteUser = verifyPayload(token, secret);
|
||||
|
||||
return payload;
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
// #168 this check should be removed as soon AES encrypt is removed.
|
||||
if (expireReasons.includes(error.name)) {
|
||||
// it might be possible the jwt configuration is enabled and
|
||||
|
||||
@@ -1,5 +1,38 @@
|
||||
# @verdaccio/cli
|
||||
|
||||
## 6.0.0-6-next.18
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @verdaccio/node-api@6.0.0-6-next.18
|
||||
|
||||
## 6.0.0-6-next.17
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 55ee3fdd: [Fastify] Add ping endpoint
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [55ee3fdd]
|
||||
- @verdaccio/fastify-migration@6.0.0-6-next.10
|
||||
- @verdaccio/config@6.0.0-6-next.7
|
||||
- @verdaccio/node-api@6.0.0-6-next.17
|
||||
|
||||
## 6.0.0-6-next.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @verdaccio/node-api@6.0.0-6-next.16
|
||||
|
||||
## 6.0.0-6-next.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @verdaccio/fastify-migration@6.0.0-6-next.9
|
||||
- @verdaccio/logger@6.0.0-6-next.4
|
||||
- @verdaccio/node-api@6.0.0-6-next.15
|
||||
|
||||
## 6.0.0-6-next.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@verdaccio/cli",
|
||||
"version": "6.0.0-6-next.14",
|
||||
"version": "6.0.0-6-next.18",
|
||||
"author": {
|
||||
"name": "Juan Picado",
|
||||
"email": "juanpicado19@gmail.com"
|
||||
@@ -40,18 +40,22 @@
|
||||
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
|
||||
"build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
|
||||
"watch": "pnpm build:js --F --watch",
|
||||
"build": "pnpm run build:js && pnpm run build:types"
|
||||
"build": "pnpm run build:js && pnpm run build:types",
|
||||
"start": "ts-node src/index.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@verdaccio/config": "workspace:6.0.0-6-next.6",
|
||||
"@verdaccio/config": "workspace:6.0.0-6-next.7",
|
||||
"@verdaccio/logger": "workspace:6.0.0-6-next.4",
|
||||
"@verdaccio/node-api": "workspace:6.0.0-6-next.14",
|
||||
"@verdaccio/fastify-migration": "workspace:6.0.0-6-next.9",
|
||||
"@verdaccio/node-api": "workspace:6.0.0-6-next.18",
|
||||
"@verdaccio/fastify-migration": "workspace:6.0.0-6-next.10",
|
||||
"commander": "6.2.0",
|
||||
"clipanion": "3.0.0-rc.11",
|
||||
"envinfo": "7.4.0",
|
||||
"clipanion": "3.0.1",
|
||||
"envinfo": "7.8.1",
|
||||
"kleur": "3.0.3",
|
||||
"semver": "7.3.2"
|
||||
"semver": "7.3.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ts-node": "10.2.1"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
|
||||
@@ -68,7 +68,7 @@ export class InitCommand extends Command {
|
||||
|
||||
await initServer(configParsed, this.port as string, version, name);
|
||||
logger.info('server started');
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { Command, Option } from 'clipanion';
|
||||
import { findConfigFile, parseConfigFile } from '@verdaccio/config';
|
||||
import { setup, logger } from '@verdaccio/logger';
|
||||
import server from '@verdaccio/fastify-migration';
|
||||
import { ConfigRuntime } from '@verdaccio/types';
|
||||
|
||||
export const DEFAULT_PROCESS_NAME: string = 'verdaccio';
|
||||
|
||||
@@ -19,18 +21,30 @@ export class NewServer extends Command {
|
||||
description: 'use this configuration file (default: ./config.yaml)',
|
||||
});
|
||||
|
||||
private initLogger(logConfig: ConfigRuntime) {
|
||||
try {
|
||||
if (logConfig.logs) {
|
||||
process.emitWarning('config.logs is deprecated, rename configuration to "config.log"');
|
||||
}
|
||||
// FUTURE: remove fallback when is ready
|
||||
setup(logConfig.log || logConfig.logs);
|
||||
} catch {
|
||||
throw new Error('error on init logger');
|
||||
}
|
||||
}
|
||||
|
||||
public async execute() {
|
||||
try {
|
||||
const configPathLocation = findConfigFile(this.config as string);
|
||||
const configParsed = parseConfigFile(configPathLocation);
|
||||
const { web } = configParsed;
|
||||
this.initLogger(configParsed);
|
||||
|
||||
process.title = web?.title || DEFAULT_PROCESS_NAME;
|
||||
// const { version, name } = require('../../package.json');
|
||||
const ser = await server();
|
||||
await ser.listen(4000);
|
||||
console.log('fastify running on port 4000');
|
||||
} catch (err) {
|
||||
const ser = await server({ logger, config: configParsed });
|
||||
await ser.listen(4873);
|
||||
} catch (err: any) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/explicit-member-accessibility */
|
||||
import { Command } from 'clipanion';
|
||||
|
||||
export class VersionCommand extends Command {
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @verdaccio/config
|
||||
|
||||
## 6.0.0-6-next.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [d2c65da9]
|
||||
- @verdaccio/utils@6.0.0-6-next.5
|
||||
|
||||
## 6.0.0-6-next.6
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@verdaccio/config",
|
||||
"version": "6.0.0-6-next.6",
|
||||
"version": "6.0.0-6-next.7",
|
||||
"description": "logger",
|
||||
"main": "./build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
@@ -40,16 +40,16 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@verdaccio/commons-api": "workspace:11.0.0-alpha.3",
|
||||
"@verdaccio/utils": "workspace:6.0.0-6-next.4",
|
||||
"debug": "^4.2.0",
|
||||
"@verdaccio/utils": "workspace:6.0.0-6-next.5",
|
||||
"debug": "4.3.2",
|
||||
"js-yaml": "3.14.0",
|
||||
"lodash": "^4.17.20",
|
||||
"lodash": "4.17.21",
|
||||
"minimatch": "3.0.4",
|
||||
"yup": "^0.29.3"
|
||||
"yup": "0.32.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/minimatch": "3.0.3",
|
||||
"@types/yup": "^0.29.9"
|
||||
"@types/minimatch": "3.0.5",
|
||||
"@types/yup": "0.29.13"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import Path from 'path';
|
||||
import _ from 'lodash';
|
||||
import buildDebug from 'debug';
|
||||
|
||||
@@ -27,28 +26,34 @@ const debug = buildDebug('verdaccio:config');
|
||||
* Find and get the first config file that match.
|
||||
* @return {String} the config file path
|
||||
*/
|
||||
function findConfigFile(configPath: string | undefined): string {
|
||||
function findConfigFile(configPath?: string): string {
|
||||
// console.log(process.env);
|
||||
if (typeof configPath !== 'undefined') {
|
||||
return Path.resolve(configPath);
|
||||
return path.resolve(configPath);
|
||||
}
|
||||
|
||||
const configPaths: SetupDirectory[] = getConfigPaths();
|
||||
|
||||
debug('%o posible locations found', configPaths.length);
|
||||
if (_.isEmpty(configPaths)) {
|
||||
// this should never happens
|
||||
throw new Error('no configuration files can be processed');
|
||||
}
|
||||
|
||||
const primaryConf: any = _.find(configPaths, (configLocation: any) =>
|
||||
// find the first location that already exist
|
||||
const primaryConf: SetupDirectory | void = _.find(configPaths, (configLocation: SetupDirectory) =>
|
||||
fileExists(configLocation.path)
|
||||
);
|
||||
if (_.isNil(primaryConf) === false) {
|
||||
|
||||
if (typeof primaryConf !== 'undefined') {
|
||||
debug('previous location exist already %s', primaryConf?.path);
|
||||
return primaryConf.path;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
return createConfigFile(_.head(configPaths)).path;
|
||||
}
|
||||
|
||||
function createConfigFile(configLocation: any): SetupDirectory {
|
||||
function createConfigFile(configLocation: SetupDirectory): SetupDirectory {
|
||||
createConfigFolder(configLocation);
|
||||
|
||||
const defaultConfig = updateStorageLinks(configLocation, readDefaultConfig());
|
||||
@@ -60,13 +65,18 @@ function createConfigFile(configLocation: any): SetupDirectory {
|
||||
|
||||
export function readDefaultConfig(): Buffer {
|
||||
const pathDefaultConf: string = path.resolve(__dirname, 'conf/default.yaml');
|
||||
|
||||
try {
|
||||
debug('default configuration file %s', pathDefaultConf);
|
||||
fs.accessSync(pathDefaultConf, fs.constants.R_OK);
|
||||
} catch {
|
||||
throw new TypeError('configuration file does not have enough permissions for reading');
|
||||
}
|
||||
// @ts-ignore
|
||||
return fs.readFileSync(pathDefaultConf, CHARACTER_ENCODING.UTF8);
|
||||
}
|
||||
|
||||
function createConfigFolder(configLocation): void {
|
||||
fs.mkdirSync(Path.dirname(configLocation.path), { recursive: true });
|
||||
fs.mkdirSync(path.dirname(configLocation.path), { recursive: true });
|
||||
debug(`Creating default config file in %o`, configLocation?.path);
|
||||
}
|
||||
|
||||
@@ -78,64 +88,89 @@ function updateStorageLinks(configLocation, defaultConfig): string {
|
||||
// $XDG_DATA_HOME defines the base directory relative to which user specific data
|
||||
// files should be stored, If $XDG_DATA_HOME is either not set or empty, a default
|
||||
// equal to $HOME/.local/share should be used.
|
||||
// $FlowFixMe
|
||||
let dataDir =
|
||||
process.env.XDG_DATA_HOME || Path.join(process.env.HOME as string, '.local', 'share');
|
||||
process.env.XDG_DATA_HOME || path.join(process.env.HOME as string, '.local', 'share');
|
||||
if (folderExists(dataDir)) {
|
||||
dataDir = Path.resolve(Path.join(dataDir, pkgJSON.name, 'storage'));
|
||||
debug(`previous storage located`);
|
||||
debug(`update storage links to %s`, dataDir);
|
||||
dataDir = path.resolve(path.join(dataDir, pkgJSON.name, 'storage'));
|
||||
return defaultConfig.replace(/^storage: .\/storage$/m, `storage: ${dataDir}`);
|
||||
}
|
||||
debug(`could not find a previous storage location, skip override`);
|
||||
return defaultConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of configuration locations by platform.
|
||||
* @returns
|
||||
*/
|
||||
function getConfigPaths(): SetupDirectory[] {
|
||||
const listPaths: SetupDirectory[] = [
|
||||
const listPaths: (SetupDirectory | void)[] = [
|
||||
getXDGDirectory(),
|
||||
getWindowsDirectory(),
|
||||
getRelativeDefaultDirectory(),
|
||||
getOldDirectory(),
|
||||
].reduce(function (acc, currentValue: any): SetupDirectory[] {
|
||||
if (_.isUndefined(currentValue) === false) {
|
||||
];
|
||||
|
||||
return listPaths.reduce(function (acc, currentValue: SetupDirectory | void): SetupDirectory[] {
|
||||
if (typeof currentValue !== 'undefined') {
|
||||
debug('directory detected path %s for type %s', currentValue?.path, currentValue.type);
|
||||
acc.push(currentValue);
|
||||
}
|
||||
return acc;
|
||||
}, [] as SetupDirectory[]);
|
||||
|
||||
return listPaths;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get XDG_CONFIG_HOME or HOME location (usually unix)
|
||||
* @returns
|
||||
*/
|
||||
const getXDGDirectory = (): SetupDirectory | void => {
|
||||
const XDGConfig = getXDGHome() || (process.env.HOME && Path.join(process.env.HOME, '.config'));
|
||||
|
||||
if (XDGConfig && folderExists(XDGConfig)) {
|
||||
const xDGConfigPath =
|
||||
process.env.XDG_CONFIG_HOME || (process.env.HOME && path.join(process.env.HOME, '.config'));
|
||||
if (xDGConfigPath && folderExists(xDGConfigPath)) {
|
||||
debug('XDGConfig folder path %s', xDGConfigPath);
|
||||
return {
|
||||
path: Path.join(XDGConfig, pkgJSON.name, CONFIG_FILE),
|
||||
path: path.join(xDGConfigPath, pkgJSON.name, CONFIG_FILE),
|
||||
type: XDG,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const getXDGHome = (): string | void => process.env.XDG_CONFIG_HOME;
|
||||
|
||||
/**
|
||||
* Detect windows location, APPDATA
|
||||
* usually something like C:\User\<Build User>\AppData\Local
|
||||
* @returns
|
||||
*/
|
||||
const getWindowsDirectory = (): SetupDirectory | void => {
|
||||
if (process.platform === WIN32 && process.env.APPDATA && folderExists(process.env.APPDATA)) {
|
||||
debug('is windows appdata: %s', process.env.APPDATA);
|
||||
return {
|
||||
path: Path.resolve(Path.join(process.env.APPDATA, pkgJSON.name, CONFIG_FILE)),
|
||||
path: path.resolve(path.join(process.env.APPDATA, pkgJSON.name, CONFIG_FILE)),
|
||||
type: WIN,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Return relative directory, this is the default.
|
||||
* It will cretate config in your {currentLocation/verdaccio/config.yaml}
|
||||
* @returns
|
||||
*/
|
||||
const getRelativeDefaultDirectory = (): SetupDirectory => {
|
||||
return {
|
||||
path: Path.resolve(Path.join('.', pkgJSON.name, CONFIG_FILE)),
|
||||
path: path.resolve(path.join('.', pkgJSON.name, CONFIG_FILE)),
|
||||
type: 'def',
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* This should never happens, consider it DEPRECATED
|
||||
* @returns
|
||||
*/
|
||||
const getOldDirectory = (): SetupDirectory => {
|
||||
return {
|
||||
path: Path.resolve(Path.join('.', CONFIG_FILE)),
|
||||
path: path.resolve(path.join('.', CONFIG_FILE)),
|
||||
type: 'old',
|
||||
};
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@ export function folderExists(path: string): boolean {
|
||||
try {
|
||||
const stat = fs.statSync(path);
|
||||
return stat.isDirectory();
|
||||
} catch (_) {
|
||||
} catch (_: any) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ export function fileExists(path: string): boolean {
|
||||
try {
|
||||
const stat = fs.statSync(path);
|
||||
return stat.isFile();
|
||||
} catch (_) {
|
||||
} catch (_: any) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class Config implements AppConfig {
|
||||
/**
|
||||
* Store or create whether receive a secret key
|
||||
*/
|
||||
public checkSecretKey(secret: string): string {
|
||||
public checkSecretKey(secret?: string): string {
|
||||
debug('check secret key');
|
||||
if (_.isString(secret) && _.isEmpty(secret) === false) {
|
||||
this.secret = secret;
|
||||
|
||||
@@ -16,7 +16,7 @@ export function parseConfigFile(configPath: string): ConfigRuntime {
|
||||
return Object.assign({}, jsonConfig, {
|
||||
config_path: configPath,
|
||||
});
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (e.code !== 'MODULE_NOT_FOUND') {
|
||||
e.message = APP_ERROR.CONFIG_NOT_VALID;
|
||||
}
|
||||
|
||||
105
packages/config/test/config.path.spec.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import os from 'os';
|
||||
import { findConfigFile } from '../src/config-path';
|
||||
|
||||
const mockmkDir = jest.fn();
|
||||
const mockaccessSync = jest.fn();
|
||||
const mockwriteFile = jest.fn();
|
||||
|
||||
jest.mock('fs', () => {
|
||||
const fsOri = jest.requireActual('fs');
|
||||
return {
|
||||
...fsOri,
|
||||
statSync: (path) => ({
|
||||
isDirectory: () => {
|
||||
if (path.match(/fail/)) {
|
||||
throw Error('file does not exist');
|
||||
}
|
||||
return true;
|
||||
},
|
||||
}),
|
||||
accessSync: (a) => mockaccessSync(a),
|
||||
mkdirSync: (a) => mockmkDir(a),
|
||||
writeFileSync: (a) => mockwriteFile(a),
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock('fs');
|
||||
|
||||
describe('config-path', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
|
||||
describe('findConfigFile', () => {
|
||||
if (os.platform() !== 'win32') {
|
||||
describe('using defiled location from arguments', () => {
|
||||
test('with custom location', () => {
|
||||
expect(findConfigFile('/home/user/custom/location/config.yaml')).toEqual(
|
||||
'/home/user/custom/location/config.yaml'
|
||||
);
|
||||
expect(mockwriteFile).not.toHaveBeenCalled();
|
||||
expect(mockmkDir).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('whith env variables', () => {
|
||||
test('with XDG_CONFIG_HOME if directory exist but config file is missing', () => {
|
||||
process.env.XDG_CONFIG_HOME = '/home/user';
|
||||
expect(findConfigFile()).toEqual('/home/user/verdaccio/config.yaml');
|
||||
expect(mockwriteFile).toHaveBeenCalledWith('/home/user/verdaccio/config.yaml');
|
||||
expect(mockmkDir).toHaveBeenCalledWith('/home/user/verdaccio');
|
||||
});
|
||||
|
||||
test('with HOME if directory exist but config file is missing', () => {
|
||||
delete process.env.XDG_CONFIG_HOME;
|
||||
process.env.HOME = '/home/user';
|
||||
expect(findConfigFile()).toEqual('/home/user/.config/verdaccio/config.yaml');
|
||||
expect(mockwriteFile).toHaveBeenCalledWith('/home/user/.config/verdaccio/config.yaml');
|
||||
expect(mockmkDir).toHaveBeenCalledWith('/home/user/.config/verdaccio');
|
||||
});
|
||||
|
||||
describe('error handling', () => {
|
||||
test('XDG_CONFIG_HOME is not directory fallback to default', () => {
|
||||
process.env.XDG_CONFIG_HOME = '/home/user/fail';
|
||||
mockaccessSync.mockImplementation(() => {});
|
||||
mockwriteFile.mockImplementation(() => {});
|
||||
expect(findConfigFile()).toMatch('packages/config/verdaccio/config.yaml');
|
||||
});
|
||||
|
||||
test('no permissions on read default config file', () => {
|
||||
process.env.XDG_CONFIG_HOME = '/home/user';
|
||||
mockaccessSync.mockImplementation(() => {
|
||||
throw new Error('error on write file');
|
||||
});
|
||||
|
||||
expect(function () {
|
||||
findConfigFile();
|
||||
}).toThrow(/configuration file does not have enough permissions for reading/);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('with no env variables', () => {
|
||||
test('with relative location', () => {
|
||||
mockaccessSync.mockImplementation(() => {});
|
||||
delete process.env.XDG_CONFIG_HOME;
|
||||
delete process.env.HOME;
|
||||
process.env.APPDATA = '/app/data/';
|
||||
expect(findConfigFile()).toMatch('packages/config/verdaccio/config.yaml');
|
||||
expect(mockwriteFile).toHaveBeenCalled();
|
||||
expect(mockmkDir).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
test('with windows as directory exist but config file is missing', () => {
|
||||
delete process.env.XDG_CONFIG_HOME;
|
||||
delete process.env.HOME;
|
||||
process.env.APPDATA = '/app/data/';
|
||||
expect(findConfigFile()).toEqual('D:\\app\\data\\verdaccio\\config.yaml');
|
||||
expect(mockwriteFile).toHaveBeenCalledWith('D:\\app\\data\\verdaccio\\config.yaml');
|
||||
expect(mockmkDir).toHaveBeenCalledWith('D:\\app\\data\\verdaccio');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -23,56 +23,56 @@ const checkDefaultUplink = (config) => {
|
||||
expect(config.uplinks[DEFAULT_UPLINK].url).toMatch(DEFAULT_REGISTRY);
|
||||
};
|
||||
|
||||
const checkDefaultConfPackages = (config) => {
|
||||
// auth
|
||||
expect(_.isObject(config.auth)).toBeTruthy();
|
||||
expect(_.isObject(config.auth.htpasswd)).toBeTruthy();
|
||||
expect(config.auth.htpasswd.file).toMatch(/htpasswd/);
|
||||
|
||||
// web
|
||||
expect(_.isObject(config.web)).toBeTruthy();
|
||||
expect(config.web.title).toBe(WEB_TITLE);
|
||||
expect(config.web.enable).toBeUndefined();
|
||||
|
||||
// packages
|
||||
expect(_.isObject(config.packages)).toBeTruthy();
|
||||
expect(Object.keys(config.packages).join('|')).toBe('@*/*|**');
|
||||
expect(config.packages['@*/*'].access).toBeDefined();
|
||||
expect(config.packages['@*/*'].access).toContainEqual(ROLES.$ALL);
|
||||
expect(config.packages['@*/*'].publish).toBeDefined();
|
||||
expect(config.packages['@*/*'].publish).toContainEqual(ROLES.$AUTH);
|
||||
expect(config.packages['@*/*'].proxy).toBeDefined();
|
||||
expect(config.packages['@*/*'].proxy).toContainEqual(DEFAULT_UPLINK);
|
||||
expect(config.packages['**'].access).toBeDefined();
|
||||
expect(config.packages['**'].access).toContainEqual(ROLES.$ALL);
|
||||
expect(config.packages['**'].publish).toBeDefined();
|
||||
expect(config.packages['**'].publish).toContainEqual(ROLES.$AUTH);
|
||||
expect(config.packages['**'].proxy).toBeDefined();
|
||||
expect(config.packages['**'].proxy).toContainEqual(DEFAULT_UPLINK);
|
||||
// uplinks
|
||||
expect(config.uplinks[DEFAULT_UPLINK]).toBeDefined();
|
||||
expect(config.uplinks[DEFAULT_UPLINK].url).toEqual(DEFAULT_REGISTRY);
|
||||
// audit
|
||||
expect(config.middlewares).toBeDefined();
|
||||
expect(config.middlewares.audit).toBeDefined();
|
||||
expect(config.middlewares.audit.enabled).toBeTruthy();
|
||||
// logs
|
||||
expect(config.logs).toBeDefined();
|
||||
expect(config.logs.type).toEqual('stdout');
|
||||
expect(config.logs.format).toEqual('pretty');
|
||||
expect(config.logs.level).toEqual('http');
|
||||
// must not be enabled by default
|
||||
expect(config.notify).toBeUndefined();
|
||||
expect(config.store).toBeUndefined();
|
||||
expect(config.publish).toBeUndefined();
|
||||
expect(config.url_prefix).toBeUndefined();
|
||||
expect(config.url_prefix).toBeUndefined();
|
||||
|
||||
expect(config.experiments).toBeUndefined();
|
||||
expect(config.security).toEqual(defaultSecurity);
|
||||
};
|
||||
|
||||
describe('check basic content parsed file', () => {
|
||||
const checkDefaultConfPackages = (config) => {
|
||||
// auth
|
||||
expect(_.isObject(config.auth)).toBeTruthy();
|
||||
expect(_.isObject(config.auth.htpasswd)).toBeTruthy();
|
||||
expect(config.auth.htpasswd.file).toMatch(/htpasswd/);
|
||||
|
||||
// web
|
||||
expect(_.isObject(config.web)).toBeTruthy();
|
||||
expect(config.web.title).toBe(WEB_TITLE);
|
||||
expect(config.web.enable).toBeUndefined();
|
||||
|
||||
// packages
|
||||
expect(_.isObject(config.packages)).toBeTruthy();
|
||||
expect(Object.keys(config.packages).join('|')).toBe('@*/*|**');
|
||||
expect(config.packages['@*/*'].access).toBeDefined();
|
||||
expect(config.packages['@*/*'].access).toContainEqual(ROLES.$ALL);
|
||||
expect(config.packages['@*/*'].publish).toBeDefined();
|
||||
expect(config.packages['@*/*'].publish).toContainEqual(ROLES.$AUTH);
|
||||
expect(config.packages['@*/*'].proxy).toBeDefined();
|
||||
expect(config.packages['@*/*'].proxy).toContainEqual(DEFAULT_UPLINK);
|
||||
expect(config.packages['**'].access).toBeDefined();
|
||||
expect(config.packages['**'].access).toContainEqual(ROLES.$ALL);
|
||||
expect(config.packages['**'].publish).toBeDefined();
|
||||
expect(config.packages['**'].publish).toContainEqual(ROLES.$AUTH);
|
||||
expect(config.packages['**'].proxy).toBeDefined();
|
||||
expect(config.packages['**'].proxy).toContainEqual(DEFAULT_UPLINK);
|
||||
// uplinks
|
||||
expect(config.uplinks[DEFAULT_UPLINK]).toBeDefined();
|
||||
expect(config.uplinks[DEFAULT_UPLINK].url).toEqual(DEFAULT_REGISTRY);
|
||||
// audit
|
||||
expect(config.middlewares).toBeDefined();
|
||||
expect(config.middlewares.audit).toBeDefined();
|
||||
expect(config.middlewares.audit.enabled).toBeTruthy();
|
||||
// logs
|
||||
expect(config.logs).toBeDefined();
|
||||
expect(config.logs.type).toEqual('stdout');
|
||||
expect(config.logs.format).toEqual('pretty');
|
||||
expect(config.logs.level).toEqual('http');
|
||||
// must not be enabled by default
|
||||
expect(config.notify).toBeUndefined();
|
||||
expect(config.store).toBeUndefined();
|
||||
expect(config.publish).toBeUndefined();
|
||||
expect(config.url_prefix).toBeUndefined();
|
||||
expect(config.url_prefix).toBeUndefined();
|
||||
|
||||
expect(config.experiments).toBeUndefined();
|
||||
expect(config.security).toEqual(defaultSecurity);
|
||||
};
|
||||
|
||||
test('parse default.yaml', () => {
|
||||
const config = new Config(parseConfigFile(resolveConf('default')));
|
||||
checkDefaultUplink(config);
|
||||
@@ -81,6 +81,57 @@ describe('check basic content parsed file', () => {
|
||||
checkDefaultConfPackages(config);
|
||||
});
|
||||
|
||||
test('parse docker.yaml', () => {
|
||||
const config = new Config(parseConfigFile(resolveConf('docker')));
|
||||
checkDefaultUplink(config);
|
||||
expect(config.storage).toBe('/verdaccio/storage/data');
|
||||
expect(config.auth.htpasswd.file).toBe('/verdaccio/storage/htpasswd');
|
||||
checkDefaultConfPackages(config);
|
||||
});
|
||||
});
|
||||
|
||||
describe('checkSecretKey', () => {
|
||||
test('with default.yaml and pre selected secret', () => {
|
||||
const config = new Config(parseConfigFile(resolveConf('default')));
|
||||
expect(config.checkSecretKey('12345')).toEqual('12345');
|
||||
});
|
||||
|
||||
test('with default.yaml and void secret', () => {
|
||||
const config = new Config(parseConfigFile(resolveConf('default')));
|
||||
expect(typeof config.checkSecretKey() === 'string').toBeTruthy();
|
||||
});
|
||||
|
||||
test('with default.yaml and emtpy string secret', () => {
|
||||
const config = new Config(parseConfigFile(resolveConf('default')));
|
||||
expect(typeof config.checkSecretKey('') === 'string').toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('getMatchedPackagesSpec', () => {
|
||||
test('should match with react as defined in config file', () => {
|
||||
const configParsed = parseConfigFile(parseConfigurationFile('config-getMatchedPackagesSpec'));
|
||||
const config = new Config(configParsed);
|
||||
expect(config.getMatchedPackagesSpec('react')).toEqual({
|
||||
access: ['admin'],
|
||||
proxy: ['facebook'],
|
||||
publish: ['admin'],
|
||||
unpublish: false,
|
||||
});
|
||||
});
|
||||
|
||||
test('should not match with react as defined in config file', () => {
|
||||
const configParsed = parseConfigFile(parseConfigurationFile('config-getMatchedPackagesSpec'));
|
||||
const config = new Config(configParsed);
|
||||
expect(config.getMatchedPackagesSpec('somePackage')).toEqual({
|
||||
access: [ROLES.$ALL],
|
||||
proxy: ['npmjs'],
|
||||
publish: [ROLES.$AUTH],
|
||||
unpublish: false,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('VERDACCIO_STORAGE_PATH', () => {
|
||||
test('should set storage to value set in VERDACCIO_STORAGE_PATH environment variable', () => {
|
||||
const storageLocation = '/tmp/verdaccio';
|
||||
process.env.VERDACCIO_STORAGE_PATH = storageLocation;
|
||||
@@ -106,12 +157,4 @@ describe('check basic content parsed file', () => {
|
||||
expect(config.storage).toBe(storageLocation);
|
||||
delete process.env.VERDACCIO_STORAGE_PATH;
|
||||
});
|
||||
|
||||
test('parse docker.yaml', () => {
|
||||
const config = new Config(parseConfigFile(resolveConf('docker')));
|
||||
checkDefaultUplink(config);
|
||||
expect(config.storage).toBe('/verdaccio/storage/data');
|
||||
expect(config.auth.htpasswd.file).toBe('/verdaccio/storage/htpasswd');
|
||||
checkDefaultConfPackages(config);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -88,26 +88,17 @@ describe('Package access utilities', () => {
|
||||
() => {
|
||||
const { packages } = parseConfigFile(parseConfigurationFile('deprecated-pkgs-basic'));
|
||||
const access = normalisePackageAccess(packages);
|
||||
|
||||
expect(access).toBeDefined();
|
||||
|
||||
const scoped = access[`${PACKAGE_ACCESS.SCOPE}`];
|
||||
const all = access[`${PACKAGE_ACCESS.ALL}`];
|
||||
const react = access['react-*'];
|
||||
|
||||
expect(react).toBeDefined();
|
||||
expect(react.access).toBeDefined();
|
||||
|
||||
// Intended checks, Typescript should catch this, we test the runtime part
|
||||
// @ts-ignore
|
||||
expect(react.access).toEqual([]);
|
||||
// @ts-ignore
|
||||
expect(react.publish[0]).toBe('admin');
|
||||
expect(react.proxy).toBeDefined();
|
||||
// @ts-ignore
|
||||
expect(react.proxy).toEqual([]);
|
||||
expect(react.storage).toBeDefined();
|
||||
|
||||
expect(react.storage).toBe('react-storage');
|
||||
expect(scoped).toBeDefined();
|
||||
expect(scoped.storage).not.toBeDefined();
|
||||
@@ -126,7 +117,6 @@ describe('Package access utilities', () => {
|
||||
|
||||
const scoped = access[`${PACKAGE_ACCESS.SCOPE}`];
|
||||
expect(scoped).toBeUndefined();
|
||||
|
||||
// ** should be added by default **
|
||||
const all = access[`${PACKAGE_ACCESS.ALL}`];
|
||||
expect(all).toBeDefined();
|
||||
@@ -141,23 +131,23 @@ describe('Package access utilities', () => {
|
||||
describe('getMatchedPackagesSpec', () => {
|
||||
test('should test basic config', () => {
|
||||
const { packages } = parseConfigFile(parseConfigurationFile('pkgs-custom'));
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
expect(getMatchedPackagesSpec('react', packages).proxy).toMatch('facebook');
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
expect(getMatchedPackagesSpec('angular', packages).proxy).toMatch('google');
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
expect(getMatchedPackagesSpec('vue', packages).proxy).toMatch('npmjs');
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
expect(getMatchedPackagesSpec('@scope/vue', packages).proxy).toMatch('npmjs');
|
||||
});
|
||||
|
||||
test('should test no ** wildcard on config', () => {
|
||||
const { packages } = parseConfigFile(parseConfigurationFile('pkgs-nosuper-wildcard-custom'));
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
expect(getMatchedPackagesSpec('react', packages).proxy).toMatch('facebook');
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
expect(getMatchedPackagesSpec('angular', packages).proxy).toMatch('google');
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
expect(getMatchedPackagesSpec('@fake/angular', packages).proxy).toMatch('npmjs');
|
||||
expect(getMatchedPackagesSpec('vue', packages)).toBeUndefined();
|
||||
expect(getMatchedPackagesSpec('@scope/vue', packages)).toBeUndefined();
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
packages:
|
||||
'react':
|
||||
access: admin
|
||||
publish: admin
|
||||
proxy: facebook
|
||||
'angular':
|
||||
access: admin
|
||||
publish: admin
|
||||
proxy: google
|
||||
'@*/*':
|
||||
access: $all
|
||||
publish: $authenticated
|
||||
proxy: npmjs
|
||||
'**':
|
||||
access: $all
|
||||
publish: $authenticated
|
||||
proxy: npmjs
|
||||
@@ -37,8 +37,8 @@
|
||||
"npm": ">=6"
|
||||
},
|
||||
"dependencies": {
|
||||
"http-errors": "^1.8.0",
|
||||
"http-status-codes": "^1.4.0"
|
||||
"http-errors": "1.8.0",
|
||||
"http-status-codes": "2.1.4"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf ./build",
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
"lockfile": "1.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@verdaccio/types": "workspace:11.0.0-6-next.6"
|
||||
"@verdaccio/types": "workspace:11.0.0-6-next.7"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf ./build",
|
||||
|
||||
@@ -68,7 +68,7 @@ function readFile(
|
||||
try {
|
||||
contents = JSON.parse(contents);
|
||||
return resolve(contents);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
return reject(err);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -36,15 +36,15 @@
|
||||
"dependencies": {
|
||||
"@verdaccio/commons-api": "workspace:11.0.0-alpha.3",
|
||||
"@verdaccio/file-locking": "workspace:11.0.0-alpha.3",
|
||||
"apache-md5": "1.1.2",
|
||||
"apache-md5": "1.1.7",
|
||||
"bcryptjs": "2.4.3",
|
||||
"http-errors": "1.8.0",
|
||||
"unix-crypt-td-js": "1.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bcryptjs": "^2.4.2",
|
||||
"@verdaccio/types": "workspace:11.0.0-6-next.6",
|
||||
"mockdate": "^3.0.2"
|
||||
"@types/bcryptjs": "2.4.2",
|
||||
"@verdaccio/types": "workspace:11.0.0-6-next.7",
|
||||
"mockdate": "3.0.5"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf ./build",
|
||||
|
||||
@@ -178,7 +178,7 @@ export default class HTPasswd implements IPluginAuth<HTPasswdConfig> {
|
||||
|
||||
try {
|
||||
this._writeFile(addUserToHTPasswd(body, user, password, this.hashConfig), cb);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
return cb(err);
|
||||
}
|
||||
});
|
||||
@@ -275,7 +275,7 @@ export default class HTPasswd implements IPluginAuth<HTPasswdConfig> {
|
||||
changePasswordToHTPasswd(body, user, password, newPassword, this.hashConfig),
|
||||
cb
|
||||
);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
return cb(err);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/explicit-member-accessibility */
|
||||
export default class Config {
|
||||
constructor() {
|
||||
this.storage = './test-storage';
|
||||
|
||||