0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/test/e2e-cli/utils/utils.ts
Behrang Yarahmadi 13310814da
#2606 add prettier plugin sort imports (#2607)
* #2606 add prettier plugin sort imprts

* #2606 update pnpm-lock.yaml

* #2606 update eslint rules

* #2606 fixes website directory formatting

Co-authored-by: Ayush Sharma <ayush.sharma@trivago.com>
2021-10-29 17:33:05 +02:00

32 lines
892 B
TypeScript

import fs from 'fs-extra';
import os from 'os';
import path from 'path';
export function createProject(projectName: string) {
// @ts-ignore
const tempRootFolder = global.__namespace.getItem('dir-suite-root');
const verdaccioInstall = path.join(tempRootFolder, projectName);
fs.mkdirSync(verdaccioInstall);
return verdaccioInstall;
}
export function copyConfigFile(rootFolder, configTemplate): string {
const configPath = path.join(rootFolder, 'verdaccio.yaml');
copyTo(path.join(__dirname, configTemplate), configPath);
return configPath;
}
export function createTempFolder(prefix: string) {
return fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), prefix));
}
export function copyTo(from, to) {
fs.copyFileSync(from, to);
}
export function cleanUpTemp(tmpFolder) {
fs.rmdirSync(tmpFolder, { recursive: true });
}
export const SETUP_VERDACCIO_PORT = `6001`;