@redocly/cli
Version:
[@Redocly](https://redocly.com) CLI is your all-in-one OpenAPI utility. It builds, manages, improves, and quality-checks your OpenAPI descriptions, all of which comes in handy for various phases of the API Lifecycle. Create your own rulesets to make API g
26 lines • 931 B
JavaScript
import { spawn } from 'node:child_process';
import { logger } from '@redocly/openapi-core';
import { getPlatformSpawnArgs, sanitizePath } from '../utils/platform.js';
export const handleEject = async ({ argv }) => {
logger.info(`\nLaunching eject using NPX.\n\n`);
const { npxExecutableName, sanitize, shell } = getPlatformSpawnArgs();
const path = sanitize(argv.path, sanitizePath);
const projectDir = sanitize(argv['project-dir'], sanitizePath);
const child = spawn(npxExecutableName, [
'-y',
'@redocly/realm',
'eject',
`${argv.type}`,
path,
`-d=${projectDir}`,
argv.force ? `--force=${argv.force}` : '',
], {
stdio: 'inherit',
shell,
});
child.on('error', (error) => {
logger.info(`Eject launch failed: ${error.message}`);
throw new Error('Eject launch failed.');
});
};
//# sourceMappingURL=eject.js.map