0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-06 22:40:26 -05:00
verdaccio/test/e2e-cli/setup/setup.ts
Juan Picado 69d7df20d8
build: enable pnp yarn2 (#2253)
* chore: enable pnp yarn

* chore: ignore pnp

* fix type issues on run eslint

* add missing dependency and fix some errors

* fix most of the errors

some were just disabled, already fixed in master

* add missing jest-config

* update jest@26 align with other deps

* add missing @babel/register

* clean up

* use yarn node

* use yarn node on release

* chore: add husky 6

* chore: add husky 6

* chore: lint-stage

* chore: test

* chore: add hook git

* chore: test

* chore: test

* update deps

* chore: fix commit lint

* fix docker run

* update git ignore
2021-05-13 23:13:57 +02:00

46 lines
1.6 KiB
TypeScript

/* eslint-disable no-console */
import fs from 'fs';
import path from 'path';
import os from 'os';
import { spawn } from 'child_process';
import { green } from 'kleur';
import { npm } from '../utils/process';
import * as __global from '../utils/global.js';
module.exports = async () => {
const tempRoot = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), 'verdaccio-cli-e2e-'));
const tempConfigFile = path.join(tempRoot, 'verdaccio.yaml');
__global.addItem('dir-root', tempRoot);
console.log(green(`Global temp root folder: ${tempRoot}`));
fs.copyFileSync(path.join(__dirname, '../config/_bootstrap_verdaccio.yaml'), tempConfigFile);
console.log(green(`global temp root conf: ${tempConfigFile}`));
// @ts-ignore
global.__namespace = __global;
console.log(`current directory: ${process.cwd()}`);
const rootVerdaccio = path.resolve('./bin/verdaccio');
console.log(green(`verdaccio root path: ${rootVerdaccio}`));
// @ts-ignore
global.registryProcess = spawn('node', [path.resolve('./bin/verdaccio'), '-c', './verdaccio.yaml'], {
cwd: tempRoot,
// stdio: 'pipe'
});
// @ts-ignore
global.registryProcess.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
// @ts-ignore
global.registryProcess.stderr.on('data', (data) => {
console.log(`stderr: ${data}`);
});
// @ts-ignore
global.registryProcess.on('close', (code) => {
console.log(`child process exited with code ${code}`);
});
// publish current build version on local registry
await npm('publish', '--registry', 'http://localhost:4873', '--verbose');
};