mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-23 22:27:34 -05:00
459b6fa72b
* Refactor local-storage async refactor local storage search stream Remove async from local-storage, refactor search with streams refactor search with undici fetch finish search refactor stream multiple request to single stream refactor storage types remove async dependency #1225 add score and refactor metadata remove old search async fix missing stream local data clean up clean up refactor folder search format fix some test fix issue on publish filter preview update ci delete package folder refactor refactor get packages methods fix tests fix lock file add changeset fix test windows disable some test update package json versions * fix merge * fix e2e cli * restore e2e * Update process.ts * Update process.ts * add improvement * format * Update utils.ts * test * test * Update search.spec.ts * Update search.spec.ts * Update search.spec.ts * test * Update ci.yml * clean up * fix tests * Update tags.ts * Update index.spec.ts * document changeset * format
66 lines
2 KiB
TypeScript
66 lines
2 KiB
TypeScript
import fs from 'fs';
|
|
import path from 'path';
|
|
import os from 'os';
|
|
import { spawn } from 'child_process';
|
|
import buildDebug from 'debug';
|
|
import { yellow } from 'kleur';
|
|
import { pnpmGlobal } from '../utils/process';
|
|
import * as __global from '../utils/global.js';
|
|
import { SETUP_VERDACCIO_PORT } from '../utils/utils';
|
|
// import { waitOnRegistry } from '../utils/registry';
|
|
|
|
const debug = buildDebug('verdaccio:e2e:setup');
|
|
|
|
module.exports = async () => {
|
|
const tempRoot = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), 'verdaccio-cli-e2e-'));
|
|
debug('dirname folder %o', __dirname);
|
|
debug('temporary folder %o', tempRoot);
|
|
// @ts-ignore
|
|
__global.addItem('dir-root', tempRoot);
|
|
debug(yellow(`Add temp root folder: ${tempRoot}`));
|
|
const destinationConfigFile = path.join(tempRoot, 'verdaccio.yaml');
|
|
debug('destination config file %o', destinationConfigFile);
|
|
fs.copyFileSync(
|
|
path.join(__dirname, '../config/_bootstrap_verdaccio.yaml'),
|
|
destinationConfigFile
|
|
);
|
|
// @ts-ignore
|
|
global.__namespace = __global;
|
|
debug(`current directory %o`, process.cwd());
|
|
const verdaccioPath = path.normalize(
|
|
path.join(process.cwd(), '../../packages/verdaccio/debug/bootstrap.js')
|
|
);
|
|
debug(process.env.DEBUG);
|
|
debug('verdaccio path %o', verdaccioPath);
|
|
const childProcess = spawn(
|
|
'node',
|
|
[verdaccioPath, '-c', './verdaccio.yaml', '-l', SETUP_VERDACCIO_PORT],
|
|
// @ts-ignore
|
|
{
|
|
cwd: tempRoot,
|
|
env: {
|
|
...process.env,
|
|
},
|
|
stdio: 'ignore',
|
|
}
|
|
);
|
|
// @ts-ignore
|
|
global.registryProcess = childProcess;
|
|
// await waitOnRegistry(SETUP_VERDACCIO_PORT);
|
|
// publish current build version on local registry
|
|
const rootFolder = path.normalize(path.join(process.cwd(), '../../'));
|
|
// install the local changes to verdaccio
|
|
// the published package will be installed from every suite
|
|
await pnpmGlobal(
|
|
rootFolder,
|
|
'publish',
|
|
'--filter',
|
|
' ./packages',
|
|
'--access',
|
|
'public',
|
|
'--git-checks',
|
|
'false',
|
|
'--registry',
|
|
`http://localhost:${SETUP_VERDACCIO_PORT}`
|
|
);
|
|
};
|