@sern/cli
Version:
Official CLI for @sern/handler
25 lines (23 loc) • 1.18 kB
JavaScript
import { getConfig } from '../chunk-PZE2TMOK.js';
import { magentaBright } from 'colorette';
import { fork } from 'node:child_process';
import { fileURLToPath } from 'url';
async function publish(commandDir, args) {
if (!args.suppressWarnings) {
console.info(`${magentaBright("EXPERIMENTAL")}: This API has not been stabilized. add -W or --suppress-warnings flag to suppress`);
}
const config = await getConfig();
const rootPath = new URL("../", import.meta.url), publishScript = new URL("../dist/create-publish.js", rootPath);
args.import ??= [];
commandDir && console.info("Publishing with override path: ", commandDir);
const isBunOrPnpm = rootPath.pathname.includes(".bun") || rootPath.pathname.includes(".pnpm");
const esmLoader = new URL(`${isBunOrPnpm ? "../../" : "../"}node_modules/@esbuild-kit/esm-loader/dist/index.js`, rootPath);
await import('dotenv/config');
const command = fork(fileURLToPath(publishScript), [], {
execArgv: ["--loader", esmLoader.toString(), "--no-warnings"]
});
command.send({ config, preloads: args.import, commandDir });
}
export { publish };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=publish.js.map