-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathglobal-setup.verdaccio.ts
42 lines (36 loc) · 1.28 KB
/
global-setup.verdaccio.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { bold, red } from 'ansis';
import { setup as globalSetup } from './global-setup';
import { nxRunManyNpmInstall } from './tools/src/npm/utils';
import { findLatestVersion, nxRunManyPublish } from './tools/src/publish/utils';
import {
VerdaccioEnvResult,
nxStartVerdaccioAndSetupEnv,
nxStopVerdaccioAndTeardownEnv,
} from './tools/src/verdaccio/env';
let activeRegistry: VerdaccioEnvResult;
export async function setup() {
await globalSetup();
try {
activeRegistry = await nxStartVerdaccioAndSetupEnv({
projectName: process.env['NX_TASK_TARGET_PROJECT'],
verbose: true,
});
} catch (error) {
console.error('Error starting local verdaccio registry:\n' + error.message);
throw error;
}
const { userconfig, workspaceRoot } = activeRegistry;
nxRunManyPublish({
registry: activeRegistry.registry.url,
nextVersion: findLatestVersion(),
userconfig,
parallel: 1,
});
nxRunManyNpmInstall({ prefix: workspaceRoot, userconfig, parallel: 1 });
}
export async function teardown() {
// potentially just skip as folder are deleted next line
// nxRunManyNpmUninstall({ userconfig, prefix: activeRegistry.workspaceRoot, parallel: 1 });
// comment out to see the folder and web interface
await nxStopVerdaccioAndTeardownEnv(activeRegistry);
}