1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/test/e2e-cli/setup/setup.ts
Juan Picado 8c730c0694 refactor: max-len and printWidth to 100 (#1941)
* refactor: max-len and printWidth to 100

* chore: ci specific pnpm version

* fix: add types peer package

literally get rid of types package
2021-04-09 17:54:20 +02:00

31 lines
1010 B
TypeScript

import fs from 'fs';
import path from 'path';
import os from 'os';
import { spawn } from 'child_process';
import { yellow } 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-'));
__global.addItem('dir-root', tempRoot);
console.log(yellow(`Add temp root folder: ${tempRoot}`));
fs.copyFileSync(
path.join(__dirname, '../config/_bootstrap_verdaccio.yaml'),
path.join(tempRoot, 'verdaccio.yaml')
);
// @ts-ignore
global.__namespace = __global;
console.log(`current directory: ${process.cwd()}`);
// @ts-ignore
global.registryProcess = spawn(
'node',
[require.resolve('verdaccio/bin/verdaccio'), '-c', './verdaccio.yaml'],
// @ts-ignore
{ cwd: tempRoot, silence: true }
);
// publish current build version on local registry
await npm('publish', '--registry', 'http://localhost:4873');
};