Skip to content

Commit a15c017

Browse files
authoredMar 30, 2021
feat: use npm v7 (#304)
1 parent 7338fc2 commit a15c017

File tree

5 files changed

+4227
-2032
lines changed

5 files changed

+4227
-2032
lines changed
 

‎package-lock.json

+4,194-1,992
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"lodash": "^4.17.15",
2525
"nerf-dart": "^1.0.0",
2626
"normalize-url": "^5.0.0",
27-
"npm": "^6.14.9",
27+
"npm": "^7.0.0",
2828
"rc": "^1.2.8",
2929
"read-pkg": "^5.0.0",
3030
"registry-auth-token": "^4.0.0",

‎test/helpers/config.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
storage: /verdaccio/storage/data
2+
plugins: /verdaccio/plugins
3+
web:
4+
title: Verdaccio
5+
auth:
6+
htpasswd:
7+
file: /verdaccio/storage/htpasswd
8+
packages:
9+
'@*/*':
10+
access: $all
11+
publish: $authenticated
12+
unpublish: $authenticated
13+
'**':
14+
access: $all
15+
publish: $authenticated
16+
unpublish: $authenticated
17+
server:
18+
keepAliveTimeout: 60
19+
middlewares:
20+
audit:
21+
enabled: true
22+
logs:
23+
- { type: stdout, format: pretty, level: http }

‎test/helpers/npm-registry.js

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
const Docker = require('dockerode');
22
const getStream = require('get-stream');
33
const got = require('got');
4+
const path = require('path');
45
const delay = require('delay');
56
const pRetry = require('p-retry');
67

7-
const IMAGE = 'semanticrelease/npm-registry-docker:latest';
8-
const SERVER_PORT = 25986;
9-
const COUCHDB_PORT = 5984;
10-
const SERVER_HOST = 'localhost';
11-
const COUCHDB_USER = 'admin';
12-
const COUCHDB_PASSWORD = 'password';
8+
const IMAGE = 'verdaccio/verdaccio:4';
9+
const REGISTRY_PORT = 4873;
10+
const REGISTRY_HOST = 'localhost';
1311
const NPM_USERNAME = 'integration';
1412
const NPM_PASSWORD = 'suchsecure';
1513
const NPM_EMAIL = 'integration@test.com';
@@ -25,16 +23,16 @@ async function start() {
2523
container = await docker.createContainer({
2624
Tty: true,
2725
Image: IMAGE,
28-
PortBindings: {[`${COUCHDB_PORT}/tcp`]: [{HostPort: `${SERVER_PORT}`}]},
29-
Env: [`COUCHDB_USER=${COUCHDB_USER}`, `COUCHDB_PASSWORD=${COUCHDB_PASSWORD}`],
26+
PortBindings: {[`${REGISTRY_PORT}/tcp`]: [{HostPort: `${REGISTRY_PORT}`}]},
27+
Binds: [`${path.join(__dirname, 'config.yaml')}:/verdaccio/conf/config.yaml`],
3028
});
3129

3230
await container.start();
3331
await delay(4000);
3432

3533
try {
3634
// Wait for the registry to be ready
37-
await pRetry(() => got(`http://${SERVER_HOST}:${SERVER_PORT}/registry/_design/app`, {cache: false}), {
35+
await pRetry(() => got(`http://${REGISTRY_HOST}:${REGISTRY_PORT}/`, {cache: false}), {
3836
retries: 7,
3937
minTimeout: 1000,
4038
factor: 2,
@@ -44,9 +42,7 @@ async function start() {
4442
}
4543

4644
// Create user
47-
await got(`http://${SERVER_HOST}:${SERVER_PORT}/_users/org.couchdb.user:${NPM_USERNAME}`, {
48-
username: COUCHDB_USER,
49-
password: COUCHDB_PASSWORD,
45+
await got(`http://${REGISTRY_HOST}:${REGISTRY_PORT}/-/user/org.couchdb.user:${NPM_USERNAME}`, {
5046
method: 'PUT',
5147
json: {
5248
_id: `org.couchdb.user:${NPM_USERNAME}`,
@@ -59,7 +55,7 @@ async function start() {
5955
});
6056
}
6157

62-
const url = `http://${SERVER_HOST}:${SERVER_PORT}/registry/_design/app/_rewrite/`;
58+
const url = `http://${REGISTRY_HOST}:${REGISTRY_PORT}/`;
6359

6460
const authEnv = {
6561
npm_config_registry: url, // eslint-disable-line camelcase

‎test/prepare.test.js

-26
Original file line numberDiff line numberDiff line change
@@ -189,32 +189,6 @@ test('Preserve indentation and newline', async (t) => {
189189
t.deepEqual(t.context.log.args[0], ['Write version %s to package.json in %s', '1.0.0', cwd]);
190190
});
191191

192-
test('Use default indentation and newline if it cannot be detected', async (t) => {
193-
const cwd = tempy.directory();
194-
const npmrc = tempy.file({name: '.npmrc'});
195-
const packagePath = path.resolve(cwd, 'package.json');
196-
await outputFile(packagePath, `{"name": "package-name","version": "0.0.0-dev"}`);
197-
198-
await prepare(
199-
npmrc,
200-
{},
201-
{
202-
cwd,
203-
env: {},
204-
stdout: t.context.stdout,
205-
stderr: t.context.stderr,
206-
nextRelease: {version: '1.0.0'},
207-
logger: t.context.logger,
208-
}
209-
);
210-
211-
// Verify package.json has been updated
212-
t.is(await readFile(packagePath, 'utf-8'), `{\n "name": "package-name",\n "version": "1.0.0"\n}\n`);
213-
214-
// Verify the logger has been called with the version updated
215-
t.deepEqual(t.context.log.args[0], ['Write version %s to package.json in %s', '1.0.0', cwd]);
216-
});
217-
218192
test('Create the package in the "tarballDir" directory', async (t) => {
219193
const cwd = tempy.directory();
220194
const npmrc = tempy.file({name: '.npmrc'});

0 commit comments

Comments
 (0)
Please sign in to comment.