fix(npm): upgraded to the beta version of the npm plugin (#2103)

This commit is contained in:
Matt Travi 2021-09-03 14:24:54 -05:00 committed by GitHub
parent 10fb716c09
commit 995469f7f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 830 additions and 2088 deletions

2871
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@
"@semantic-release/commit-analyzer": "^8.0.0", "@semantic-release/commit-analyzer": "^8.0.0",
"@semantic-release/error": "^3.0.0-beta.1", "@semantic-release/error": "^3.0.0-beta.1",
"@semantic-release/github": "^8.0.0-beta.1", "@semantic-release/github": "^8.0.0-beta.1",
"@semantic-release/npm": "^7.0.0", "@semantic-release/npm": "^8.0.0-beta.1",
"@semantic-release/release-notes-generator": "^10.0.0-beta.1", "@semantic-release/release-notes-generator": "^10.0.0-beta.1",
"aggregate-error": "^3.0.0", "aggregate-error": "^3.0.0",
"cosmiconfig": "^7.0.0", "cosmiconfig": "^7.0.0",

23
test/helpers/config.yaml Normal file
View File

@ -0,0 +1,23 @@
storage: /verdaccio/storage/data
plugins: /verdaccio/plugins
web:
title: Verdaccio
auth:
htpasswd:
file: /verdaccio/storage/htpasswd
packages:
'@*/*':
access: $all
publish: $authenticated
unpublish: $authenticated
'**':
access: $all
publish: $authenticated
unpublish: $authenticated
server:
keepAliveTimeout: 60
middlewares:
audit:
enabled: true
logs:
- { type: stdout, format: pretty, level: http }

View File

@ -1,15 +1,13 @@
const Docker = require('dockerode'); const Docker = require('dockerode');
const getStream = require('get-stream'); const getStream = require('get-stream');
const got = require('got'); const got = require('got');
const path = require('path');
const delay = require('delay'); const delay = require('delay');
const pRetry = require('p-retry'); const pRetry = require('p-retry');
const IMAGE = 'semanticrelease/npm-registry-docker:latest'; const IMAGE = 'verdaccio/verdaccio:4';
const SERVER_PORT = 15986; const REGISTRY_PORT = 4873;
const COUCHDB_PORT = 5984; const REGISTRY_HOST = 'localhost';
const SERVER_HOST = 'localhost';
const COUCHDB_USER = 'admin';
const COUCHDB_PASSWORD = 'password';
const NPM_USERNAME = 'integration'; const NPM_USERNAME = 'integration';
const NPM_PASSWORD = 'suchsecure'; const NPM_PASSWORD = 'suchsecure';
const NPM_EMAIL = 'integration@test.com'; const NPM_EMAIL = 'integration@test.com';
@ -25,8 +23,8 @@ async function start() {
container = await docker.createContainer({ container = await docker.createContainer({
Tty: true, Tty: true,
Image: IMAGE, Image: IMAGE,
PortBindings: {[`${COUCHDB_PORT}/tcp`]: [{HostPort: `${SERVER_PORT}`}]}, PortBindings: {[`${REGISTRY_PORT}/tcp`]: [{HostPort: `${REGISTRY_PORT}`}]},
Env: [`COUCHDB_USER=${COUCHDB_USER}`, `COUCHDB_PASSWORD=${COUCHDB_PASSWORD}`], Binds: [`${path.join(__dirname, 'config.yaml')}:/verdaccio/conf/config.yaml`],
}); });
await container.start(); await container.start();
@ -34,7 +32,7 @@ async function start() {
try { try {
// Wait for the registry to be ready // Wait for the registry to be ready
await pRetry(() => got(`http://${SERVER_HOST}:${SERVER_PORT}/registry/_design/app`, {cache: false}), { await pRetry(() => got(`http://${REGISTRY_HOST}:${REGISTRY_PORT}/`, {cache: false}), {
retries: 7, retries: 7,
minTimeout: 1000, minTimeout: 1000,
factor: 2, factor: 2,
@ -44,9 +42,7 @@ async function start() {
} }
// Create user // Create user
await got(`http://${SERVER_HOST}:${SERVER_PORT}/_users/org.couchdb.user:${NPM_USERNAME}`, { await got(`http://${REGISTRY_HOST}:${REGISTRY_PORT}/-/user/org.couchdb.user:${NPM_USERNAME}`, {
username: COUCHDB_USER,
password: COUCHDB_PASSWORD,
method: 'PUT', method: 'PUT',
json: { json: {
_id: `org.couchdb.user:${NPM_USERNAME}`, _id: `org.couchdb.user:${NPM_USERNAME}`,
@ -59,7 +55,7 @@ async function start() {
}); });
} }
const url = `http://${SERVER_HOST}:${SERVER_PORT}/registry/_design/app/_rewrite/`; const url = `http://${REGISTRY_HOST}:${REGISTRY_PORT}/`;
const authEnv = { const authEnv = {
npm_config_registry: url, // eslint-disable-line camelcase npm_config_registry: url, // eslint-disable-line camelcase