beesbuild
Version:
构建工具链
32 lines (31 loc) • 975 B
JavaScript
import path from "path";
import chalk from "chalk-unified";
import { consola, getPackageManifest, pnpm } from "@beesbuild/utils";
import { buildRollup } from "./rollup.mjs";
async function build(options) {
let manifests;
consola.info(chalk.cyan(">>> \u51C6\u5907\u5F00\u59CB"));
if (options.monorepo === false) {
const cwd = process.cwd();
const manifest = getPackageManifest(path.resolve(cwd, ".", "package.json"));
manifest.path = cwd;
manifests = [manifest];
} else {
options.json = true;
manifests = pnpm.exec("ls", options);
}
if (!Array.isArray(manifests) || manifests.length === 0) {
consola.info(chalk.cyan("\u6CA1\u6709\u83B7\u53D6\u5230\u7684\u9700\u8981\u6253\u5305\u9879\u76EE"));
return;
}
if (options.verbose) {
consola.info(
chalk.cyan("\u83B7\u53D6\u5230\u7684 manifest \u5217\u8868"),
manifests.map(({ name }) => name)
);
}
return buildRollup(manifests, options);
}
export {
build
};