mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-23 22:27:34 -05:00
e364d073d7
* clean up tests * add dist-tag * chore: add npm 9 * Update CHANGELOG.md * Update publish.spec.js * add pnpm * yarn 1 * Update tag.spec.ts * Update README.md * more timeout * chore fix build * chore: fix export * chore: fix test * chore: fix tests
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { SpawnOptions } from 'child_process';
|
|
import { join } from 'path';
|
|
|
|
import { exec } from '@verdaccio/test-cli-commons';
|
|
import { addRegistry } from '@verdaccio/test-cli-commons';
|
|
|
|
function getCommand() {
|
|
return join(__dirname, './node_modules/.bin/pnpm');
|
|
}
|
|
|
|
function pnpm(options: SpawnOptions, ...args: string[]) {
|
|
return exec(options, getCommand(), args);
|
|
}
|
|
|
|
async function bumbUp(tempFolder, registry) {
|
|
await pnpm({ cwd: tempFolder }, 'version', 'minor', ...addRegistry(registry.getRegistryUrl()));
|
|
}
|
|
|
|
async function publish(tempFolder, pkgName, registry, arg: string[] = []) {
|
|
const resp = await pnpm(
|
|
{ cwd: tempFolder },
|
|
'publish',
|
|
...arg,
|
|
'--json',
|
|
...addRegistry(registry.getRegistryUrl())
|
|
);
|
|
const parsedBody = JSON.parse(resp.stdout as string);
|
|
expect(parsedBody.name).toEqual(pkgName);
|
|
}
|
|
|
|
async function getInfoVersions(pkgName, registry) {
|
|
const infoResp = await pnpm(
|
|
{},
|
|
'info',
|
|
pkgName,
|
|
'--json',
|
|
...addRegistry(registry.getRegistryUrl())
|
|
);
|
|
const infoBody = JSON.parse(infoResp.stdout as string);
|
|
return infoBody;
|
|
}
|
|
|
|
export { getInfoVersions, pnpm, publish, bumbUp };
|