mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-08 23:25:51 +01:00
chore: consume previous registry installed
This commit is contained in:
parent
3bf2196388
commit
e1685d205b
@ -78,6 +78,7 @@
|
||||
"cross-env": "6.0.3",
|
||||
"detect-secrets": "1.0.5",
|
||||
"eslint": "5.16.0",
|
||||
"fs-extra": "8.1.0",
|
||||
"get-stdin": "7.0.0",
|
||||
"husky": "2.7.0",
|
||||
"in-publish": "2.0.0",
|
||||
@ -92,9 +93,9 @@
|
||||
"standard-version": "7.0.0",
|
||||
"supertest": "4.0.2",
|
||||
"typescript": "3.7.1-rc",
|
||||
"verdaccio": "latest",
|
||||
"verdaccio-auth-memory": "8.3.0",
|
||||
"verdaccio-memory": "8.2.0",
|
||||
"verdaccio": "latest"
|
||||
"verdaccio-memory": "8.2.0"
|
||||
},
|
||||
"keywords": [
|
||||
"private",
|
||||
|
@ -1,5 +1,9 @@
|
||||
storage: ./storage
|
||||
|
||||
#store:
|
||||
# memory:
|
||||
# limit: 1000
|
||||
|
||||
auth:
|
||||
htpasswd:
|
||||
file: ./htpasswd
|
||||
@ -14,7 +18,7 @@ uplinks:
|
||||
url: https://registry.npmjs.org/
|
||||
|
||||
logs:
|
||||
- { type: stdout, format: pretty, level: info }
|
||||
- { type: stdout, format: pretty, level: warn }
|
||||
|
||||
packages:
|
||||
'@*/*':
|
||||
@ -23,7 +27,7 @@ packages:
|
||||
unpublish: $authenticated
|
||||
proxy: npmjs
|
||||
'verdaccio':
|
||||
access: $authenticated
|
||||
access: $all
|
||||
publish: $anonymous
|
||||
'**':
|
||||
access: $all
|
||||
|
35
test/e2e-cli/config/default.yaml
Normal file
35
test/e2e-cli/config/default.yaml
Normal file
@ -0,0 +1,35 @@
|
||||
storage: ./storage
|
||||
|
||||
#store:
|
||||
# memory:
|
||||
# limit: 1000
|
||||
|
||||
auth:
|
||||
htpasswd:
|
||||
file: ./htpasswd
|
||||
max_users: -1
|
||||
|
||||
web:
|
||||
enable: true
|
||||
title: verdaccio-default
|
||||
|
||||
uplinks:
|
||||
npmjs:
|
||||
url: http://localhost:4873
|
||||
|
||||
logs:
|
||||
- { type: stdout, format: pretty, level: info }
|
||||
|
||||
packages:
|
||||
'@*/*':
|
||||
access: $all
|
||||
publish: $anonymous
|
||||
unpublish: $authenticated
|
||||
proxy: npmjs
|
||||
'**':
|
||||
access: $all
|
||||
publish: $all
|
||||
unpublish: $authenticated
|
||||
proxy: npmjs
|
||||
|
||||
_debug: true
|
@ -11,8 +11,7 @@
|
||||
"sample"
|
||||
],
|
||||
"dependencies": {
|
||||
"jquery": "^3.4.1",
|
||||
"lodash": "^4.17.15"
|
||||
"verdaccio": "latest"
|
||||
},
|
||||
"author": "Juan Picado <juanpicado19@gmail.com>",
|
||||
"license": "MIT"
|
||||
|
@ -8,7 +8,7 @@
|
||||
},
|
||||
"keywords": ["verdaccio", "sample", "scoped"],
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.15"
|
||||
"verdaccio": "latest"
|
||||
},
|
||||
"author": "Juan Picado <juanpicado19@gmail.com>",
|
||||
"license": "MIT"
|
||||
|
@ -1,5 +1,8 @@
|
||||
import path from 'path';
|
||||
import { npm } from '../../utils/process';
|
||||
import fs from "fs";
|
||||
import * as __global from "../../utils/global";
|
||||
import {spawnRegistry} from "../../utils/registry";
|
||||
|
||||
function testExample() {
|
||||
console.log('running example');
|
||||
@ -11,19 +14,35 @@ export default async function() {
|
||||
}
|
||||
|
||||
describe('npm install', ()=> {
|
||||
jest.setTimeout(90000);
|
||||
|
||||
beforeAll(() => {
|
||||
// @ts-ignore
|
||||
const tempRootFolder = global.__namespace.getItem('dir-root');
|
||||
let registryProcess;
|
||||
|
||||
|
||||
beforeAll(async () => {
|
||||
const verdaccioInstall = path.join(tempRootFolder, 'verdaccio-root');
|
||||
await npm('install', '--prefix', verdaccioInstall, 'verdaccio', '--registry' ,'http://localhost:4873', '--no-package-lock');
|
||||
const configPath = path.join(tempRootFolder, 'verdaccio.yaml');
|
||||
fs.copyFileSync(path.join(__dirname, '../../config/default.yaml'), configPath);
|
||||
// @ts-ignore
|
||||
global.__namespace = __global;
|
||||
const pathVerdaccioModule = require.resolve('verdaccio/bin/verdaccio', {
|
||||
paths: [verdaccioInstall]
|
||||
});
|
||||
registryProcess = await spawnRegistry(pathVerdaccioModule,
|
||||
['-c', configPath, '-l', '9011'],
|
||||
{ cwd: verdaccioInstall, silent: false }
|
||||
);
|
||||
});
|
||||
|
||||
test('should install jquery', async () => {
|
||||
console.log(`New directory: ${process.cwd()}`, __dirname);
|
||||
process.chdir(path.join(__dirname, '../../projects/basic'));
|
||||
console.log(`New directory: ${process.cwd()}`);
|
||||
await npm('install', 'jquery', '--registry' ,'http://localhost:4873');
|
||||
|
||||
// @ts-ignore
|
||||
// console.log('--->', global.__namespace.getItem('dir-root'));
|
||||
await npm('info', 'verdaccio', '--registry' ,'http://localhost:9011');
|
||||
expect(true).toBe(true);
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
registryProcess.kill();
|
||||
});
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
import path from 'path';
|
||||
import { npm } from '../../utils/process';
|
||||
// import { npm } from '../../utils/process';
|
||||
|
||||
function testExample() {
|
||||
console.log('running example');
|
||||
@ -10,18 +10,18 @@ export default async function() {
|
||||
await testExample();
|
||||
}
|
||||
|
||||
describe('test example', ()=> {
|
||||
describe.skip('test example', ()=> {
|
||||
|
||||
beforeAll(() => {
|
||||
|
||||
});
|
||||
|
||||
test('sub example', async () => {
|
||||
test('sub example', async (done) => {
|
||||
console.log(`New directory: ${process.cwd()}`, __dirname);
|
||||
process.chdir(path.join(__dirname, '../../projects/basic'));
|
||||
console.log(`New directory: ${process.cwd()}`);
|
||||
await npm('install', '--registry' ,'http://localhost:4873');
|
||||
|
||||
// await npm('install', '--registry' ,'http://localhost:4873');
|
||||
done();
|
||||
// @ts-ignore
|
||||
// console.log('--->', global.__namespace.getItem('dir-root'));
|
||||
expect(true).toBe(true);
|
||||
|
@ -48,6 +48,7 @@ export async function _exec(options, cmd, args) {
|
||||
return new Promise((resolve, reject) => {
|
||||
childProcess.on('exit', (error) => {
|
||||
// _processes = _processes.filter(p => p !== childProcess);
|
||||
console.log("--EXIT PROCESS-->", error);
|
||||
|
||||
if (!error) {
|
||||
resolve({ stdout, stderr });
|
||||
|
26
test/e2e-cli/utils/registry.ts
Normal file
26
test/e2e-cli/utils/registry.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import {fork} from "child_process";
|
||||
|
||||
export function prepareEnvironment(rootFolder: string, folderName: string) {
|
||||
|
||||
}
|
||||
|
||||
export function spawnRegistry(
|
||||
verdaccioPath: string,
|
||||
args: string[],
|
||||
childOptions) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let _childOptions = {silent: true, ...childOptions};
|
||||
|
||||
const childFork = fork(verdaccioPath, args, _childOptions);
|
||||
|
||||
childFork.on('message', (msg) => {
|
||||
if ('verdaccio_started' in msg) {
|
||||
resolve(childFork);
|
||||
}
|
||||
});
|
||||
|
||||
childFork.on('error', (err) => reject([err]));
|
||||
childFork.on('disconnect', (err) => reject([err]));
|
||||
childFork.on('exit', (err) => reject([err]));
|
||||
});
|
||||
}
|
BIN
yarn.lock
BIN
yarn.lock
Binary file not shown.
Loading…
Reference in New Issue
Block a user