@shopify/cli-kit
Version:
A set of utilities, interfaces, and models that are common across all the platform features
29 lines • 1.09 kB
JavaScript
import { fileURLToPath } from 'node:url';
/**
* Launches the CLI through our custom OCLIF loader.
*
* @param options - Options.
* @returns A promise that resolves when the CLI has been launched.
*/
export async function launchCLI(options) {
const { errorHandler } = await import('./error-handler.js');
const { isDevelopment } = await import('./context/local.js');
const oclif = await import('@oclif/core');
const { ShopifyConfig } = await import('./custom-oclif-loader.js');
if (isDevelopment()) {
oclif.default.settings.debug = true;
}
try {
// Use a custom OCLIF config to customize the behavior of the CLI
const config = new ShopifyConfig({ root: fileURLToPath(options.moduleURL) });
await config.load();
await oclif.default.run(options.argv, config);
await oclif.default.flush();
// eslint-disable-next-line no-catch-all/no-catch-all
}
catch (error) {
await errorHandler(error);
return oclif.default.Errors.handle(error);
}
}
//# sourceMappingURL=cli-launcher.js.map