mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
refactor: fix inject issue on debug mode
This commit is contained in:
parent
e59f282a27
commit
0fcbb8e1bd
2 changed files with 8 additions and 4 deletions
|
@ -29,7 +29,7 @@ class FunctionalEnvironment extends NodeEnvironment {
|
|||
async setup() {
|
||||
const SILENCE_LOG = !process.env.VERDACCIO_DEBUG;
|
||||
// $FlowFixMe
|
||||
const DEBUG_INJECT: boolean = process.env.VERDACCIO_DEBUG ? process.env.VERDACCIO_DEBUG : false;
|
||||
const DEBUG_INJECT: boolean = process.env.VERDACCIO_DEBUG_INJECT ? process.env.VERDACCIO_DEBUG_INJECT : false;
|
||||
const forkList = [];
|
||||
const serverList = [];
|
||||
const pathStore = path.join(__dirname, '../store');
|
||||
|
|
|
@ -4,6 +4,7 @@ import rimRaf from 'rimraf';
|
|||
import path from 'path';
|
||||
import {fork} from 'child_process';
|
||||
import type {IVerdaccioConfig, IServerBridge, IServerProcess} from '../types';
|
||||
import {CREDENTIALS} from '../functional/config.func';
|
||||
|
||||
export default class VerdaccioProcess implements IServerProcess {
|
||||
|
||||
|
@ -34,8 +35,10 @@ export default class VerdaccioProcess implements IServerProcess {
|
|||
};
|
||||
|
||||
if (this.isDebug) {
|
||||
const debugPort = parseInt(this.config.port, 10) + 5;
|
||||
|
||||
childOptions = Object.assign({}, childOptions, {
|
||||
execArgv: [`--inspect=${this.config.port + 5}`]
|
||||
execArgv: [`--inspect=${debugPort}`]
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -44,9 +47,9 @@ export default class VerdaccioProcess implements IServerProcess {
|
|||
this.childFork.on('message', (msg) => {
|
||||
if ('verdaccio_started' in msg) {
|
||||
this.bridge.debug().status(200).then((body) => {
|
||||
this.bridge.auth('test', 'test')
|
||||
this.bridge.auth(CREDENTIALS.user, CREDENTIALS.password)
|
||||
.status(201)
|
||||
.body_ok(/'test'/)
|
||||
.body_ok(new RegExp(CREDENTIALS.user))
|
||||
.then(() => {
|
||||
resolve([this, body.pid]);
|
||||
}, reject)
|
||||
|
@ -55,6 +58,7 @@ export default class VerdaccioProcess implements IServerProcess {
|
|||
});
|
||||
|
||||
this.childFork.on('error', (err) => {
|
||||
console.log('error process', err);
|
||||
reject([err, this]);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue