UNPKG

beesbuild

Version:

构建工具链

78 lines (77 loc) 2.91 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var stdin_exports = {}; __export(stdin_exports, { sync: () => sync }); module.exports = __toCommonJS(stdin_exports); var import_utils = require("@beesbuild/utils"); const sync = async options => { import_utils.consola.info(import_utils.chalk.cyan(`>>> \u5F00\u59CB\u83B7\u53D6\u672C\u5730 @yanzhen-*/* \u7248\u672C\u5305 ${options == null ? void 0 : options.monorepo}`)); if ((options == null ? void 0 : options.monorepo) === false) { const pkg = new import_utils.Packages({ path: process.cwd() }); import_utils.consola.info(import_utils.chalk.cyan(`>>>111 \u5F53\u524D\u5305: ${pkg.manifest.name}@${pkg.manifest.version}`)); await (0, import_utils.nextTick)(); if (options.version) { await pkg.write(options.version); } else { await pkg.sync(options); } return Promise.resolve(); } else { const manifest = await import_utils.pnpm.list(options); const manifestPromises = manifest.reduce((previousValue, { name, path, version }) => { if (!name) return previousValue; const pkg = new import_utils.Packages({ path }); import_utils.consola.info(import_utils.chalk.cyan(`>>> \u5F53\u524D\u5305: ${name}@${version}`)); if (options.version) { previousValue.push(pkg.write(options.version)); } else { previousValue.push(pkg.sync(options)); } return previousValue; }, []); if (manifestPromises.length === 0) return import_utils.consola.info(import_utils.chalk.cyan(">>> \u7248\u672C\u5DF2\u7ECF\u5B58\u5728\uFF0C\u4E0D\u9700\u8981\u66F4\u65B0")); return Promise.all(manifestPromises).then(r => { import_utils.consola.success("\u66F4\u65B0\u7248\u672C\u6210\u529F"); }).catch(e => { import_utils.consola.error("\u66F4\u65B0\u7248\u672C\u5931\u8D25", e.message); throw new Error("\u66F4\u65B0\u7248\u672C\u5931\u8D25"); }).finally(() => { import_utils.consola.info("\u66F4\u65B0\u7248\u672C Done."); }); } }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { sync });