@icebreakers/monorepo 3.1.0 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/package.json +5 -5
- package/assets/vitest.config.ts +2 -2
- package/dist/cli.cjs +7 -3
- package/dist/cli.mjs +7 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{upgrade-C44ctrkn.mjs → upgrade-B1j5KS32.mjs} +81 -9
- package/dist/{upgrade-Z5FWxm4y.cjs → upgrade-BUKca70w.cjs} +82 -9
- package/package.json +3 -2
- package/templates/apps/client/package.json +4 -4
- package/templates/apps/server/package.json +1 -1
- package/templates/packages/vue-lib-template/package.json +2 -2
package/assets/package.json
CHANGED
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@changesets/changelog-github": "^0.5.2",
|
|
44
44
|
"@changesets/cli": "^2.29.8",
|
|
45
|
-
"@commitlint/cli": "^20.
|
|
46
|
-
"@icebreakers/commitlint-config": "^1.2.
|
|
47
|
-
"@icebreakers/eslint-config": "^1.6.
|
|
45
|
+
"@commitlint/cli": "^20.2.0",
|
|
46
|
+
"@icebreakers/commitlint-config": "^1.2.3",
|
|
47
|
+
"@icebreakers/eslint-config": "^1.6.4",
|
|
48
48
|
"@icebreakers/monorepo": "workspace:*",
|
|
49
49
|
"@icebreakers/stylelint-config": "^1.2.3",
|
|
50
50
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -65,11 +65,11 @@
|
|
|
65
65
|
"pkg-types": "^2.3.0",
|
|
66
66
|
"rimraf": "^6.1.2",
|
|
67
67
|
"stylelint": "^16.26.1",
|
|
68
|
-
"tsdown": "0.17.0
|
|
68
|
+
"tsdown": "0.17.0",
|
|
69
69
|
"tslib": "^2.8.1",
|
|
70
70
|
"tsup": "^8.5.1",
|
|
71
71
|
"tsx": "^4.21.0",
|
|
72
|
-
"turbo": "^2.6.
|
|
72
|
+
"turbo": "^2.6.3",
|
|
73
73
|
"type-fest": "^5.3.0",
|
|
74
74
|
"typescript": "^5.9.3",
|
|
75
75
|
"unbuild": "^3.6.1",
|
package/assets/vitest.config.ts
CHANGED
|
@@ -82,7 +82,7 @@ function resolveProjects(): string[] {
|
|
|
82
82
|
|
|
83
83
|
const rootConfig = findConfig(rootPath)
|
|
84
84
|
if (rootConfig) {
|
|
85
|
-
projects.push(
|
|
85
|
+
projects.push(rootConfig)
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
const entries = fs.readdirSync(rootPath, { withFileTypes: true })
|
|
@@ -94,7 +94,7 @@ function resolveProjects(): string[] {
|
|
|
94
94
|
const projectDir = path.join(rootPath, entry.name)
|
|
95
95
|
const configPath = findConfig(projectDir)
|
|
96
96
|
if (configPath) {
|
|
97
|
-
projects.push(
|
|
97
|
+
projects.push(configPath)
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
}
|
package/dist/cli.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_upgrade = require('./upgrade-
|
|
1
|
+
const require_upgrade = require('./upgrade-BUKca70w.cjs');
|
|
2
2
|
let node_process = require("node:process");
|
|
3
3
|
node_process = require_upgrade.__toESM(node_process);
|
|
4
4
|
let __inquirer_input = require("@inquirer/input");
|
|
@@ -29,8 +29,12 @@ commander.program.command("sync").description("向 npmmirror 同步所有子包"
|
|
|
29
29
|
await require_upgrade.syncNpmMirror(cwd);
|
|
30
30
|
require_upgrade.logger.success("sync npm mirror finished!");
|
|
31
31
|
});
|
|
32
|
-
commander.program.command("clean").description("清除选中的包").action(async () => {
|
|
33
|
-
|
|
32
|
+
commander.program.command("clean").description("清除选中的包").option("-y, --yes", "跳过交互直接清理(等价 autoConfirm)").option("--include-private", "包含 private 包").option("--pinned-version <version>", "覆盖写入的 @icebreakers/monorepo 版本").action(async (opts) => {
|
|
33
|
+
const overrides = {};
|
|
34
|
+
if (opts.yes) overrides.autoConfirm = true;
|
|
35
|
+
if (opts.includePrivate) overrides.includePrivate = true;
|
|
36
|
+
if (opts.pinnedVersion) overrides.pinnedVersion = opts.pinnedVersion;
|
|
37
|
+
await require_upgrade.cleanProjects(cwd, overrides);
|
|
34
38
|
require_upgrade.logger.success("clean projects finished!");
|
|
35
39
|
});
|
|
36
40
|
commander.program.command("mirror").description("设置 VscodeBinaryMirror").action(async () => {
|
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as defaultAgenticBaseDir, C as name, M as generateAgenticTemplates, N as loadAgenticTasks, O as resolveCommandConfig, P as logger, T as cleanProjects, c as getCreateChoices, i as init, j as generateAgenticTemplate, k as createTimestampFolderName, n as syncNpmMirror, o as createNewProject, r as setVscodeBinaryMirror, s as defaultTemplate, t as upgradeMonorepo, w as version } from "./upgrade-
|
|
1
|
+
import { A as defaultAgenticBaseDir, C as name, M as generateAgenticTemplates, N as loadAgenticTasks, O as resolveCommandConfig, P as logger, T as cleanProjects, c as getCreateChoices, i as init, j as generateAgenticTemplate, k as createTimestampFolderName, n as syncNpmMirror, o as createNewProject, r as setVscodeBinaryMirror, s as defaultTemplate, t as upgradeMonorepo, w as version } from "./upgrade-B1j5KS32.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import input from "@inquirer/input";
|
|
4
4
|
import select from "@inquirer/select";
|
|
@@ -26,8 +26,12 @@ program.command("sync").description("向 npmmirror 同步所有子包").action(a
|
|
|
26
26
|
await syncNpmMirror(cwd);
|
|
27
27
|
logger.success("sync npm mirror finished!");
|
|
28
28
|
});
|
|
29
|
-
program.command("clean").description("清除选中的包").action(async () => {
|
|
30
|
-
|
|
29
|
+
program.command("clean").description("清除选中的包").option("-y, --yes", "跳过交互直接清理(等价 autoConfirm)").option("--include-private", "包含 private 包").option("--pinned-version <version>", "覆盖写入的 @icebreakers/monorepo 版本").action(async (opts) => {
|
|
30
|
+
const overrides = {};
|
|
31
|
+
if (opts.yes) overrides.autoConfirm = true;
|
|
32
|
+
if (opts.includePrivate) overrides.includePrivate = true;
|
|
33
|
+
if (opts.pinnedVersion) overrides.pinnedVersion = opts.pinnedVersion;
|
|
34
|
+
await cleanProjects(cwd, overrides);
|
|
31
35
|
logger.success("clean projects finished!");
|
|
32
36
|
});
|
|
33
37
|
program.command("mirror").description("设置 VscodeBinaryMirror").action(async () => {
|
package/dist/index.cjs
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -428,7 +428,7 @@ declare function getWorkspaceData(cwd: string, options?: GetWorkspacePackagesOpt
|
|
|
428
428
|
/**
|
|
429
429
|
* 交互式清理被选中的包目录,同时重写根 package.json 中的 @icebreakers/monorepo 版本。
|
|
430
430
|
*/
|
|
431
|
-
declare function cleanProjects(cwd: string): Promise<void>;
|
|
431
|
+
declare function cleanProjects(cwd: string, overrides?: Partial<CleanCommandConfig>): Promise<void>;
|
|
432
432
|
//#endregion
|
|
433
433
|
//#region src/commands/init/index.d.ts
|
|
434
434
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -428,7 +428,7 @@ declare function getWorkspaceData(cwd: string, options?: GetWorkspacePackagesOpt
|
|
|
428
428
|
/**
|
|
429
429
|
* 交互式清理被选中的包目录,同时重写根 package.json 中的 @icebreakers/monorepo 版本。
|
|
430
430
|
*/
|
|
431
|
-
declare function cleanProjects(cwd: string): Promise<void>;
|
|
431
|
+
declare function cleanProjects(cwd: string, overrides?: Partial<CleanCommandConfig>): Promise<void>;
|
|
432
432
|
//#endregion
|
|
433
433
|
//#region src/commands/init/index.d.ts
|
|
434
434
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as defaultAgenticBaseDir, C as name, D as loadMonorepoConfig, E as defineMonorepoConfig, F as getWorkspaceData, I as getWorkspacePackages, L as GitClient, M as generateAgenticTemplates, N as loadAgenticTasks, O as resolveCommandConfig, P as logger, S as templatesDir, T as cleanProjects, _ as toWorkspaceGitignorePath, a as createContext, b as packageDir, c as getCreateChoices, d as escapeStringRegexp, f as isMatch, g as toPublishGitignorePath, h as isGitignoreFile, i as init, j as generateAgenticTemplate, k as createTimestampFolderName, l as getTemplateMap, m as isFileChanged, n as syncNpmMirror, o as createNewProject, p as getFileHash, r as setVscodeBinaryMirror, t as upgradeMonorepo, u as templateMap, v as isIgnorableFsError, w as version, x as rootDir, y as assetsDir } from "./upgrade-
|
|
1
|
+
import { A as defaultAgenticBaseDir, C as name, D as loadMonorepoConfig, E as defineMonorepoConfig, F as getWorkspaceData, I as getWorkspacePackages, L as GitClient, M as generateAgenticTemplates, N as loadAgenticTasks, O as resolveCommandConfig, P as logger, S as templatesDir, T as cleanProjects, _ as toWorkspaceGitignorePath, a as createContext, b as packageDir, c as getCreateChoices, d as escapeStringRegexp, f as isMatch, g as toPublishGitignorePath, h as isGitignoreFile, i as init, j as generateAgenticTemplate, k as createTimestampFolderName, l as getTemplateMap, m as isFileChanged, n as syncNpmMirror, o as createNewProject, p as getFileHash, r as setVscodeBinaryMirror, t as upgradeMonorepo, u as templateMap, v as isIgnorableFsError, w as version, x as rootDir, y as assetsDir } from "./upgrade-B1j5KS32.mjs";
|
|
2
2
|
|
|
3
3
|
export { GitClient, assetsDir, cleanProjects, createContext, createNewProject, createTimestampFolderName, defaultAgenticBaseDir, defineMonorepoConfig, escapeStringRegexp, generateAgenticTemplate, generateAgenticTemplates, getCreateChoices, getFileHash, getTemplateMap, getWorkspaceData, getWorkspacePackages, init, isFileChanged, isGitignoreFile, isIgnorableFsError, isMatch, loadAgenticTasks, loadMonorepoConfig, logger, name, packageDir, resolveCommandConfig, rootDir, setVscodeBinaryMirror, syncNpmMirror, templateMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath, upgradeMonorepo, version };
|
|
@@ -19,6 +19,7 @@ import os from "node:os";
|
|
|
19
19
|
import { execaCommand } from "execa";
|
|
20
20
|
import PQueue from "p-queue";
|
|
21
21
|
import klaw from "klaw";
|
|
22
|
+
import YAML from "yaml";
|
|
22
23
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
23
24
|
import { coerce, gte, minVersion } from "semver";
|
|
24
25
|
|
|
@@ -187,7 +188,7 @@ var GitClient = class {
|
|
|
187
188
|
|
|
188
189
|
//#endregion
|
|
189
190
|
//#region ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
190
|
-
function isPlainObject$
|
|
191
|
+
function isPlainObject$2(value) {
|
|
191
192
|
if (value === null || typeof value !== "object") return false;
|
|
192
193
|
const prototype = Object.getPrototypeOf(value);
|
|
193
194
|
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
|
|
@@ -196,7 +197,7 @@ function isPlainObject$1(value) {
|
|
|
196
197
|
return true;
|
|
197
198
|
}
|
|
198
199
|
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
199
|
-
if (!isPlainObject$
|
|
200
|
+
if (!isPlainObject$2(defaults)) return _defu(baseObject, {}, namespace, merger);
|
|
200
201
|
const object = Object.assign({}, defaults);
|
|
201
202
|
for (const key in baseObject) {
|
|
202
203
|
if (key === "__proto__" || key === "constructor") continue;
|
|
@@ -204,7 +205,7 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
|
204
205
|
if (value === null || value === void 0) continue;
|
|
205
206
|
if (merger && merger(object, key, value, namespace)) continue;
|
|
206
207
|
if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
|
|
207
|
-
else if (isPlainObject$
|
|
208
|
+
else if (isPlainObject$2(value) && isPlainObject$2(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
208
209
|
else object[key] = value;
|
|
209
210
|
}
|
|
210
211
|
return object;
|
|
@@ -384,7 +385,7 @@ var require_is_plain_object = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
384
385
|
function isObjectObject(o) {
|
|
385
386
|
return isObject$1(o) === true && Object.prototype.toString.call(o) === "[object Object]";
|
|
386
387
|
}
|
|
387
|
-
module.exports = function isPlainObject$
|
|
388
|
+
module.exports = function isPlainObject$3(o) {
|
|
388
389
|
var ctor, prot;
|
|
389
390
|
if (isObjectObject(o) === false) return false;
|
|
390
391
|
ctor = o.constructor;
|
|
@@ -407,7 +408,7 @@ var require_is_plain_object = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
407
408
|
var require_set_value = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
408
409
|
const { deleteProperty } = Reflect;
|
|
409
410
|
const isPrimitive = require_is_primitive();
|
|
410
|
-
const isPlainObject = require_is_plain_object();
|
|
411
|
+
const isPlainObject$1 = require_is_plain_object();
|
|
411
412
|
const isObject = (value) => {
|
|
412
413
|
return typeof value === "object" && value !== null || typeof value === "function";
|
|
413
414
|
};
|
|
@@ -476,7 +477,7 @@ var require_set_value = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
476
477
|
if (value === void 0) deleteProperty(obj, prop);
|
|
477
478
|
else if (options && options.merge) {
|
|
478
479
|
const merge = options.merge === "function" ? options.merge : Object.assign;
|
|
479
|
-
if (merge && isPlainObject(obj[prop]) && isPlainObject(value)) obj[prop] = merge(obj[prop], value);
|
|
480
|
+
if (merge && isPlainObject$1(obj[prop]) && isPlainObject$1(value)) obj[prop] = merge(obj[prop], value);
|
|
480
481
|
else obj[prop] = value;
|
|
481
482
|
} else obj[prop] = value;
|
|
482
483
|
return obj;
|
|
@@ -558,11 +559,19 @@ async function resolveCommandConfig(name$1, cwd) {
|
|
|
558
559
|
//#endregion
|
|
559
560
|
//#region src/commands/clean.ts
|
|
560
561
|
var import_set_value$5 = /* @__PURE__ */ __toESM(require_set_value(), 1);
|
|
562
|
+
function mergeCleanConfig(base, overrides) {
|
|
563
|
+
if (!overrides) return base;
|
|
564
|
+
const definedOverrides = Object.fromEntries(Object.entries(overrides).filter(([, value]) => value !== void 0));
|
|
565
|
+
return {
|
|
566
|
+
...base,
|
|
567
|
+
...definedOverrides
|
|
568
|
+
};
|
|
569
|
+
}
|
|
561
570
|
/**
|
|
562
571
|
* 交互式清理被选中的包目录,同时重写根 package.json 中的 @icebreakers/monorepo 版本。
|
|
563
572
|
*/
|
|
564
|
-
async function cleanProjects(cwd) {
|
|
565
|
-
const cleanConfig = await resolveCommandConfig("clean", cwd);
|
|
573
|
+
async function cleanProjects(cwd, overrides) {
|
|
574
|
+
const cleanConfig = mergeCleanConfig(await resolveCommandConfig("clean", cwd), overrides);
|
|
566
575
|
const { packages, workspaceDir } = await getWorkspaceData(cwd, cleanConfig?.includePrivate ? { ignorePrivatePackage: false } : void 0);
|
|
567
576
|
const filteredPackages = packages.filter((pkg) => {
|
|
568
577
|
const name$2 = pkg.manifest.name ?? "";
|
|
@@ -596,7 +605,7 @@ async function cleanProjects(cwd) {
|
|
|
596
605
|
//#endregion
|
|
597
606
|
//#region package.json
|
|
598
607
|
var name = "@icebreakers/monorepo";
|
|
599
|
-
var version = "3.1.
|
|
608
|
+
var version = "3.1.2";
|
|
600
609
|
|
|
601
610
|
//#endregion
|
|
602
611
|
//#region src/constants.ts
|
|
@@ -1249,6 +1258,47 @@ function getAssetTargets(core) {
|
|
|
1249
1258
|
return list;
|
|
1250
1259
|
}
|
|
1251
1260
|
|
|
1261
|
+
//#endregion
|
|
1262
|
+
//#region src/commands/upgrade/workspace.ts
|
|
1263
|
+
function isPlainObject(value) {
|
|
1264
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1265
|
+
}
|
|
1266
|
+
function normalizeWorkspaceManifest(manifest) {
|
|
1267
|
+
if (isPlainObject(manifest)) return { ...manifest };
|
|
1268
|
+
return {};
|
|
1269
|
+
}
|
|
1270
|
+
function mergeUniqueArray(target, source) {
|
|
1271
|
+
const result = [...target];
|
|
1272
|
+
for (const item of source) if (!result.includes(item)) result.push(item);
|
|
1273
|
+
return result;
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Merge pnpm workspace manifests by filling missing fields only.
|
|
1277
|
+
* Existing values take precedence; arrays are deduped while keeping target order.
|
|
1278
|
+
*/
|
|
1279
|
+
function mergeWorkspaceManifest(source, target) {
|
|
1280
|
+
const normalizedSource = normalizeWorkspaceManifest(source);
|
|
1281
|
+
const normalizedTarget = normalizeWorkspaceManifest(target);
|
|
1282
|
+
const result = { ...normalizedTarget };
|
|
1283
|
+
for (const [key, value] of Object.entries(normalizedSource)) {
|
|
1284
|
+
const current = normalizedTarget[key];
|
|
1285
|
+
if (current === void 0) {
|
|
1286
|
+
result[key] = value;
|
|
1287
|
+
continue;
|
|
1288
|
+
}
|
|
1289
|
+
if (Array.isArray(current) && Array.isArray(value)) {
|
|
1290
|
+
result[key] = mergeUniqueArray(current, value);
|
|
1291
|
+
continue;
|
|
1292
|
+
}
|
|
1293
|
+
if (isPlainObject(current) && isPlainObject(value)) {
|
|
1294
|
+
result[key] = mergeWorkspaceManifest(value, current);
|
|
1295
|
+
continue;
|
|
1296
|
+
}
|
|
1297
|
+
result[key] = current;
|
|
1298
|
+
}
|
|
1299
|
+
return result;
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1252
1302
|
//#endregion
|
|
1253
1303
|
//#region src/commands/upgrade/index.ts
|
|
1254
1304
|
var import_set_value = /* @__PURE__ */ __toESM(require_set_value(), 1);
|
|
@@ -1319,6 +1369,28 @@ async function upgradeMonorepo(opts) {
|
|
|
1319
1369
|
});
|
|
1320
1370
|
continue;
|
|
1321
1371
|
}
|
|
1372
|
+
if (relPath === "pnpm-workspace.yaml") {
|
|
1373
|
+
const sourceManifest = normalizeWorkspaceManifest(YAML.parse(await fs.readFile(file.path, "utf8")));
|
|
1374
|
+
const exists = await fs.pathExists(targetPath);
|
|
1375
|
+
const targetManifest = exists ? normalizeWorkspaceManifest(YAML.parse(await fs.readFile(targetPath, "utf8"))) : normalizeWorkspaceManifest({});
|
|
1376
|
+
const mergedManifest = exists ? mergeWorkspaceManifest(sourceManifest, targetManifest) : sourceManifest;
|
|
1377
|
+
const data = YAML.stringify(mergedManifest);
|
|
1378
|
+
const intent$1 = await evaluateWriteIntent(targetPath, {
|
|
1379
|
+
skipOverwrite,
|
|
1380
|
+
source: data
|
|
1381
|
+
});
|
|
1382
|
+
const action$1 = async () => {
|
|
1383
|
+
await fs.outputFile(targetPath, data, "utf8");
|
|
1384
|
+
logger.success(targetPath);
|
|
1385
|
+
};
|
|
1386
|
+
await scheduleOverwrite(intent$1, {
|
|
1387
|
+
relPath,
|
|
1388
|
+
targetPath,
|
|
1389
|
+
action: action$1,
|
|
1390
|
+
pending: pendingOverwrites
|
|
1391
|
+
});
|
|
1392
|
+
continue;
|
|
1393
|
+
}
|
|
1322
1394
|
if (relPath === ".changeset/config.json" && repoName) {
|
|
1323
1395
|
const changesetJson = await fs.readJson(file.path);
|
|
1324
1396
|
(0, import_set_value.default)(changesetJson, "changelog.1.repo", repoName);
|
|
@@ -58,6 +58,8 @@ let p_queue = require("p-queue");
|
|
|
58
58
|
p_queue = __toESM(p_queue);
|
|
59
59
|
let klaw = require("klaw");
|
|
60
60
|
klaw = __toESM(klaw);
|
|
61
|
+
let yaml = require("yaml");
|
|
62
|
+
yaml = __toESM(yaml);
|
|
61
63
|
let node_buffer = require("node:buffer");
|
|
62
64
|
let semver = require("semver");
|
|
63
65
|
|
|
@@ -198,7 +200,7 @@ var GitClient = class {
|
|
|
198
200
|
|
|
199
201
|
//#endregion
|
|
200
202
|
//#region ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
201
|
-
function isPlainObject$
|
|
203
|
+
function isPlainObject$2(value) {
|
|
202
204
|
if (value === null || typeof value !== "object") return false;
|
|
203
205
|
const prototype = Object.getPrototypeOf(value);
|
|
204
206
|
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
|
|
@@ -207,7 +209,7 @@ function isPlainObject$1(value) {
|
|
|
207
209
|
return true;
|
|
208
210
|
}
|
|
209
211
|
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
210
|
-
if (!isPlainObject$
|
|
212
|
+
if (!isPlainObject$2(defaults)) return _defu(baseObject, {}, namespace, merger);
|
|
211
213
|
const object = Object.assign({}, defaults);
|
|
212
214
|
for (const key in baseObject) {
|
|
213
215
|
if (key === "__proto__" || key === "constructor") continue;
|
|
@@ -215,7 +217,7 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
|
215
217
|
if (value === null || value === void 0) continue;
|
|
216
218
|
if (merger && merger(object, key, value, namespace)) continue;
|
|
217
219
|
if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
|
|
218
|
-
else if (isPlainObject$
|
|
220
|
+
else if (isPlainObject$2(value) && isPlainObject$2(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
219
221
|
else object[key] = value;
|
|
220
222
|
}
|
|
221
223
|
return object;
|
|
@@ -395,7 +397,7 @@ var require_is_plain_object = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
395
397
|
function isObjectObject(o) {
|
|
396
398
|
return isObject$1(o) === true && Object.prototype.toString.call(o) === "[object Object]";
|
|
397
399
|
}
|
|
398
|
-
module.exports = function isPlainObject$
|
|
400
|
+
module.exports = function isPlainObject$3(o) {
|
|
399
401
|
var ctor, prot;
|
|
400
402
|
if (isObjectObject(o) === false) return false;
|
|
401
403
|
ctor = o.constructor;
|
|
@@ -418,7 +420,7 @@ var require_is_plain_object = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
418
420
|
var require_set_value = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
419
421
|
const { deleteProperty } = Reflect;
|
|
420
422
|
const isPrimitive = require_is_primitive();
|
|
421
|
-
const isPlainObject = require_is_plain_object();
|
|
423
|
+
const isPlainObject$1 = require_is_plain_object();
|
|
422
424
|
const isObject = (value) => {
|
|
423
425
|
return typeof value === "object" && value !== null || typeof value === "function";
|
|
424
426
|
};
|
|
@@ -487,7 +489,7 @@ var require_set_value = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
487
489
|
if (value === void 0) deleteProperty(obj, prop);
|
|
488
490
|
else if (options && options.merge) {
|
|
489
491
|
const merge = options.merge === "function" ? options.merge : Object.assign;
|
|
490
|
-
if (merge && isPlainObject(obj[prop]) && isPlainObject(value)) obj[prop] = merge(obj[prop], value);
|
|
492
|
+
if (merge && isPlainObject$1(obj[prop]) && isPlainObject$1(value)) obj[prop] = merge(obj[prop], value);
|
|
491
493
|
else obj[prop] = value;
|
|
492
494
|
} else obj[prop] = value;
|
|
493
495
|
return obj;
|
|
@@ -569,11 +571,19 @@ async function resolveCommandConfig(name$1, cwd) {
|
|
|
569
571
|
//#endregion
|
|
570
572
|
//#region src/commands/clean.ts
|
|
571
573
|
var import_set_value$5 = /* @__PURE__ */ __toESM(require_set_value(), 1);
|
|
574
|
+
function mergeCleanConfig(base, overrides) {
|
|
575
|
+
if (!overrides) return base;
|
|
576
|
+
const definedOverrides = Object.fromEntries(Object.entries(overrides).filter(([, value]) => value !== void 0));
|
|
577
|
+
return {
|
|
578
|
+
...base,
|
|
579
|
+
...definedOverrides
|
|
580
|
+
};
|
|
581
|
+
}
|
|
572
582
|
/**
|
|
573
583
|
* 交互式清理被选中的包目录,同时重写根 package.json 中的 @icebreakers/monorepo 版本。
|
|
574
584
|
*/
|
|
575
|
-
async function cleanProjects(cwd) {
|
|
576
|
-
const cleanConfig = await resolveCommandConfig("clean", cwd);
|
|
585
|
+
async function cleanProjects(cwd, overrides) {
|
|
586
|
+
const cleanConfig = mergeCleanConfig(await resolveCommandConfig("clean", cwd), overrides);
|
|
577
587
|
const { packages, workspaceDir } = await getWorkspaceData(cwd, cleanConfig?.includePrivate ? { ignorePrivatePackage: false } : void 0);
|
|
578
588
|
const filteredPackages = packages.filter((pkg) => {
|
|
579
589
|
const name$2 = pkg.manifest.name ?? "";
|
|
@@ -607,7 +617,7 @@ async function cleanProjects(cwd) {
|
|
|
607
617
|
//#endregion
|
|
608
618
|
//#region package.json
|
|
609
619
|
var name = "@icebreakers/monorepo";
|
|
610
|
-
var version = "3.1.
|
|
620
|
+
var version = "3.1.2";
|
|
611
621
|
|
|
612
622
|
//#endregion
|
|
613
623
|
//#region src/constants.ts
|
|
@@ -1260,6 +1270,47 @@ function getAssetTargets(core) {
|
|
|
1260
1270
|
return list;
|
|
1261
1271
|
}
|
|
1262
1272
|
|
|
1273
|
+
//#endregion
|
|
1274
|
+
//#region src/commands/upgrade/workspace.ts
|
|
1275
|
+
function isPlainObject(value) {
|
|
1276
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1277
|
+
}
|
|
1278
|
+
function normalizeWorkspaceManifest(manifest) {
|
|
1279
|
+
if (isPlainObject(manifest)) return { ...manifest };
|
|
1280
|
+
return {};
|
|
1281
|
+
}
|
|
1282
|
+
function mergeUniqueArray(target, source) {
|
|
1283
|
+
const result = [...target];
|
|
1284
|
+
for (const item of source) if (!result.includes(item)) result.push(item);
|
|
1285
|
+
return result;
|
|
1286
|
+
}
|
|
1287
|
+
/**
|
|
1288
|
+
* Merge pnpm workspace manifests by filling missing fields only.
|
|
1289
|
+
* Existing values take precedence; arrays are deduped while keeping target order.
|
|
1290
|
+
*/
|
|
1291
|
+
function mergeWorkspaceManifest(source, target) {
|
|
1292
|
+
const normalizedSource = normalizeWorkspaceManifest(source);
|
|
1293
|
+
const normalizedTarget = normalizeWorkspaceManifest(target);
|
|
1294
|
+
const result = { ...normalizedTarget };
|
|
1295
|
+
for (const [key, value] of Object.entries(normalizedSource)) {
|
|
1296
|
+
const current = normalizedTarget[key];
|
|
1297
|
+
if (current === void 0) {
|
|
1298
|
+
result[key] = value;
|
|
1299
|
+
continue;
|
|
1300
|
+
}
|
|
1301
|
+
if (Array.isArray(current) && Array.isArray(value)) {
|
|
1302
|
+
result[key] = mergeUniqueArray(current, value);
|
|
1303
|
+
continue;
|
|
1304
|
+
}
|
|
1305
|
+
if (isPlainObject(current) && isPlainObject(value)) {
|
|
1306
|
+
result[key] = mergeWorkspaceManifest(value, current);
|
|
1307
|
+
continue;
|
|
1308
|
+
}
|
|
1309
|
+
result[key] = current;
|
|
1310
|
+
}
|
|
1311
|
+
return result;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1263
1314
|
//#endregion
|
|
1264
1315
|
//#region src/commands/upgrade/index.ts
|
|
1265
1316
|
var import_set_value = /* @__PURE__ */ __toESM(require_set_value(), 1);
|
|
@@ -1330,6 +1381,28 @@ async function upgradeMonorepo(opts) {
|
|
|
1330
1381
|
});
|
|
1331
1382
|
continue;
|
|
1332
1383
|
}
|
|
1384
|
+
if (relPath === "pnpm-workspace.yaml") {
|
|
1385
|
+
const sourceManifest = normalizeWorkspaceManifest(yaml.default.parse(await fs_extra.default.readFile(file.path, "utf8")));
|
|
1386
|
+
const exists = await fs_extra.default.pathExists(targetPath);
|
|
1387
|
+
const targetManifest = exists ? normalizeWorkspaceManifest(yaml.default.parse(await fs_extra.default.readFile(targetPath, "utf8"))) : normalizeWorkspaceManifest({});
|
|
1388
|
+
const mergedManifest = exists ? mergeWorkspaceManifest(sourceManifest, targetManifest) : sourceManifest;
|
|
1389
|
+
const data = yaml.default.stringify(mergedManifest);
|
|
1390
|
+
const intent$1 = await evaluateWriteIntent(targetPath, {
|
|
1391
|
+
skipOverwrite,
|
|
1392
|
+
source: data
|
|
1393
|
+
});
|
|
1394
|
+
const action$1 = async () => {
|
|
1395
|
+
await fs_extra.default.outputFile(targetPath, data, "utf8");
|
|
1396
|
+
logger.success(targetPath);
|
|
1397
|
+
};
|
|
1398
|
+
await scheduleOverwrite(intent$1, {
|
|
1399
|
+
relPath,
|
|
1400
|
+
targetPath,
|
|
1401
|
+
action: action$1,
|
|
1402
|
+
pending: pendingOverwrites
|
|
1403
|
+
});
|
|
1404
|
+
continue;
|
|
1405
|
+
}
|
|
1333
1406
|
if (relPath === ".changeset/config.json" && repoName) {
|
|
1334
1407
|
const changesetJson = await fs_extra.default.readJson(file.path);
|
|
1335
1408
|
(0, import_set_value.default)(changesetJson, "changelog.1.repo", repoName);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icebreakers/monorepo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.1.
|
|
4
|
+
"version": "3.1.2",
|
|
5
5
|
"description": "The icebreaker's monorepo manager",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -79,7 +79,8 @@
|
|
|
79
79
|
"pathe": "^2.0.3",
|
|
80
80
|
"picocolors": "^1.1.1",
|
|
81
81
|
"semver": "^7.7.3",
|
|
82
|
-
"simple-git": "^3.30.0"
|
|
82
|
+
"simple-git": "^3.30.0",
|
|
83
|
+
"yaml": "^2.8.2"
|
|
83
84
|
},
|
|
84
85
|
"devDependencies": {
|
|
85
86
|
"@types/klaw": "^3.0.7",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"vue-router": "^4.6.3"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@cloudflare/vite-plugin": "^1.
|
|
32
|
+
"@cloudflare/vite-plugin": "^1.17.0",
|
|
33
33
|
"@hono/node-server": "^1.19.6",
|
|
34
34
|
"@hono/trpc-server": "^0.4.0",
|
|
35
35
|
"@tailwindcss/vite": "^4.1.17",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"hono": "^4.10.7",
|
|
41
41
|
"tailwindcss": "^4.1.17",
|
|
42
42
|
"typescript": "~5.9.3",
|
|
43
|
-
"unplugin-vue-router": "^0.
|
|
43
|
+
"unplugin-vue-router": "^0.19.0",
|
|
44
44
|
"vite": "^7.2.6",
|
|
45
45
|
"vite-plugin-vue-devtools": "^8.0.5",
|
|
46
46
|
"vite-tsconfig-paths": "^5.1.4",
|
|
47
|
-
"vue-tsc": "3.1.
|
|
48
|
-
"wrangler": "^4.
|
|
47
|
+
"vue-tsc": "3.1.6",
|
|
48
|
+
"wrangler": "^4.53.0",
|
|
49
49
|
"zod": "^4.1.13"
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"@vue/tsconfig": "^0.8.1",
|
|
52
52
|
"jsdom": "^27.2.0",
|
|
53
53
|
"tailwindcss": "^4.1.17",
|
|
54
|
-
"unplugin-vue-router": "^0.
|
|
54
|
+
"unplugin-vue-router": "^0.19.0",
|
|
55
55
|
"vite": "^7.2.6",
|
|
56
56
|
"vite-plugin-dts": "^4.5.4",
|
|
57
57
|
"vue": "^3.5.25",
|
|
58
58
|
"vue-router": "^4.6.3",
|
|
59
|
-
"vue-tsc": "^3.1.
|
|
59
|
+
"vue-tsc": "^3.1.6"
|
|
60
60
|
}
|
|
61
61
|
}
|