2022-10-25 14:12:43 +00:00
|
|
|
import * as utils from '@n1ru4l/dockest/test-helper';
|
|
|
|
|
import { execa } from '@n1ru4l/dockest';
|
2022-06-24 14:51:53 +00:00
|
|
|
import { resolve } from 'path';
|
2022-05-18 07:26:57 +00:00
|
|
|
|
|
|
|
|
const registryAddress = utils.getServiceAddress('server', 3001);
|
2022-11-11 08:54:11 +00:00
|
|
|
const cliDevLocation = resolve(__dirname, '../../packages/libraries/cli/bin/run');
|
2022-06-24 14:51:53 +00:00
|
|
|
|
|
|
|
|
async function exec(cmd: string) {
|
|
|
|
|
const result = execa(`${cliDevLocation} ${cmd}`);
|
|
|
|
|
|
|
|
|
|
if (result.failed) {
|
|
|
|
|
throw result.stderr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result.stdout;
|
|
|
|
|
}
|
2022-05-18 07:26:57 +00:00
|
|
|
|
|
|
|
|
export async function schemaPublish(args: string[]) {
|
2022-11-24 10:00:41 +00:00
|
|
|
return exec(
|
|
|
|
|
['schema:publish', `--registry`, `http://${registryAddress}/graphql`, ...args].join(' '),
|
|
|
|
|
);
|
2022-05-18 07:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function schemaCheck(args: string[]) {
|
2022-11-24 10:00:41 +00:00
|
|
|
return exec(
|
|
|
|
|
['schema:check', `--registry`, `http://${registryAddress}/graphql`, ...args].join(' '),
|
|
|
|
|
);
|
2022-05-18 07:26:57 +00:00
|
|
|
}
|