@icebreakers/monorepo 3.1.11 → 3.1.13
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/.dockerignore +40 -2
- package/assets/.github/workflows/ci.yml +13 -5
- package/assets/package.json +13 -8
- package/assets/tsconfig.json +33 -0
- package/assets/turbo.json +43 -3
- package/dist/cli.cjs +8 -8
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{upgrade-CaZT1d_7.mjs → upgrade-D_D08NHx.mjs} +40 -37
- package/dist/{upgrade-B4VYs4jD.cjs → upgrade-DmloQL5e.cjs} +51 -48
- package/package.json +5 -5
- package/templates/apps/cli/package.json +3 -0
- package/templates/apps/cli/src/index.ts +2 -1
- package/templates/apps/client/package.json +10 -9
- package/templates/apps/client/vite.config.ts +15 -1
- package/templates/apps/client/worker/node-entry.ts +2 -2
- package/templates/apps/server/package.json +2 -1
- package/templates/apps/server/src/node-entry.ts +2 -2
- package/templates/apps/website/package.json +1 -1
- package/templates/packages/vue-lib-template/package.json +2 -2
package/assets/.dockerignore
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
|
+
# Dependencies
|
|
1
2
|
node_modules
|
|
3
|
+
**/node_modules/
|
|
4
|
+
|
|
5
|
+
# Build outputs
|
|
6
|
+
dist
|
|
7
|
+
**/dist/
|
|
8
|
+
|
|
9
|
+
# Version control
|
|
2
10
|
.git
|
|
3
11
|
.gitignore
|
|
12
|
+
.github
|
|
13
|
+
|
|
14
|
+
# Documentation
|
|
4
15
|
*.md
|
|
5
|
-
|
|
6
|
-
|
|
16
|
+
README*
|
|
17
|
+
|
|
18
|
+
# Testing
|
|
19
|
+
coverage
|
|
20
|
+
**/coverage/
|
|
21
|
+
**/*.test.ts
|
|
22
|
+
**/*.test.js
|
|
23
|
+
**/*.spec.ts
|
|
24
|
+
**/*.spec.js
|
|
25
|
+
|
|
26
|
+
# Build caches
|
|
27
|
+
.turbo
|
|
28
|
+
**/.turbo/
|
|
29
|
+
.vitepress/cache
|
|
30
|
+
**/.vitepress/cache
|
|
31
|
+
|
|
32
|
+
# Development
|
|
33
|
+
.vscode
|
|
34
|
+
.idea
|
|
35
|
+
*.log
|
|
36
|
+
.DS_Store
|
|
37
|
+
|
|
38
|
+
# CI/CD
|
|
39
|
+
.github/workflows
|
|
40
|
+
|
|
41
|
+
# Environment
|
|
42
|
+
.env
|
|
43
|
+
.env.*
|
|
44
|
+
!.env.example
|
|
@@ -20,10 +20,10 @@ jobs:
|
|
|
20
20
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
21
21
|
node-version: [20, 22, 24]
|
|
22
22
|
runs-on: ${{ matrix.os }}
|
|
23
|
-
#
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
# Remote Caching enabled - configure TURBO_TOKEN and TURBO_TEAM in repository settings
|
|
24
|
+
env:
|
|
25
|
+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
26
|
+
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
|
27
27
|
|
|
28
28
|
steps:
|
|
29
29
|
- name: Check out code
|
|
@@ -38,9 +38,17 @@ jobs:
|
|
|
38
38
|
with:
|
|
39
39
|
node-version: ${{ matrix.node-version }}
|
|
40
40
|
cache: pnpm
|
|
41
|
+
cache-dependency-path: pnpm-lock.yaml
|
|
41
42
|
|
|
42
43
|
- name: Install dependencies
|
|
43
|
-
run: pnpm install
|
|
44
|
+
run: pnpm install --frozen-lockfile
|
|
45
|
+
|
|
46
|
+
- name: Security Audit
|
|
47
|
+
run: pnpm audit --audit-level=moderate
|
|
48
|
+
continue-on-error: true
|
|
49
|
+
|
|
50
|
+
- name: Lint
|
|
51
|
+
run: pnpm lint
|
|
44
52
|
|
|
45
53
|
- name: Build
|
|
46
54
|
run: pnpm build
|
package/assets/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"version": "0.0.0",
|
|
5
5
|
"private": true,
|
|
6
|
-
"packageManager": "pnpm@10.26.
|
|
6
|
+
"packageManager": "pnpm@10.26.2",
|
|
7
7
|
"author": "ice breaker <1324318532@qq.com>",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -21,6 +21,11 @@
|
|
|
21
21
|
"test": "vitest run",
|
|
22
22
|
"test:dev": "vitest",
|
|
23
23
|
"lint": "turbo run lint",
|
|
24
|
+
"audit": "pnpm audit --audit-level=moderate",
|
|
25
|
+
"audit:fix": "pnpm audit --fix",
|
|
26
|
+
"typecheck": "turbo run typecheck",
|
|
27
|
+
"format": "eslint . --fix",
|
|
28
|
+
"validate": "pnpm run typecheck && pnpm run lint && pnpm run test",
|
|
24
29
|
"release": "changeset",
|
|
25
30
|
"publish-packages": "turbo run build lint test && changeset version && changeset publish",
|
|
26
31
|
"------": "--------------",
|
|
@@ -44,20 +49,20 @@
|
|
|
44
49
|
"@changesets/cli": "^2.29.8",
|
|
45
50
|
"@commitlint/cli": "^20.2.0",
|
|
46
51
|
"@icebreakers/commitlint-config": "^1.2.3",
|
|
47
|
-
"@icebreakers/eslint-config": "^1.6.
|
|
52
|
+
"@icebreakers/eslint-config": "^1.6.9",
|
|
48
53
|
"@icebreakers/monorepo": "workspace:*",
|
|
49
54
|
"@icebreakers/stylelint-config": "^1.2.4",
|
|
50
55
|
"@types/fs-extra": "^11.0.4",
|
|
51
|
-
"@types/node": "^25.0.
|
|
56
|
+
"@types/node": "^25.0.3",
|
|
52
57
|
"@types/semver": "^7.7.1",
|
|
53
|
-
"@vitest/coverage-v8": "~4.0.
|
|
58
|
+
"@vitest/coverage-v8": "~4.0.16",
|
|
54
59
|
"ci-info": "^4.3.1",
|
|
55
60
|
"cross-env": "^10.1.0",
|
|
56
61
|
"defu": "^6.1.4",
|
|
57
62
|
"es-toolkit": "^1.43.0",
|
|
58
63
|
"eslint": "^9.39.2",
|
|
59
64
|
"execa": "^9.6.1",
|
|
60
|
-
"fs-extra": "^11.3.
|
|
65
|
+
"fs-extra": "^11.3.3",
|
|
61
66
|
"husky": "^9.1.7",
|
|
62
67
|
"lint-staged": "^16.2.7",
|
|
63
68
|
"only-allow": "^1.2.2",
|
|
@@ -65,15 +70,15 @@
|
|
|
65
70
|
"pkg-types": "^2.3.0",
|
|
66
71
|
"rimraf": "^6.1.2",
|
|
67
72
|
"stylelint": "^16.26.1",
|
|
68
|
-
"tsdown": "0.18.
|
|
73
|
+
"tsdown": "0.18.3",
|
|
69
74
|
"tslib": "^2.8.1",
|
|
70
75
|
"tsup": "^8.5.1",
|
|
71
76
|
"tsx": "^4.21.0",
|
|
72
|
-
"turbo": "^2.
|
|
77
|
+
"turbo": "^2.7.2",
|
|
73
78
|
"type-fest": "^5.3.1",
|
|
74
79
|
"typescript": "^5.9.3",
|
|
75
80
|
"unbuild": "^3.6.1",
|
|
76
|
-
"vitest": "~4.0.
|
|
81
|
+
"vitest": "~4.0.16",
|
|
77
82
|
"yaml": "^2.8.2"
|
|
78
83
|
},
|
|
79
84
|
"publishConfig": {
|
package/assets/tsconfig.json
CHANGED
|
@@ -1,18 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
+
// 指定 ECMAScript 目标版本,ESNext 表示支持最新的 ES 特性
|
|
3
4
|
"target": "ESNext",
|
|
5
|
+
|
|
6
|
+
// 指定模块系统,ESNext 使用原生 ES 模块 (import/export)
|
|
4
7
|
"module": "ESNext",
|
|
8
|
+
|
|
9
|
+
// 模块解析策略,Bundler 模式适用于打包工具(如 Vite、Webpack),支持更宽松的解析规则
|
|
5
10
|
"moduleResolution": "Bundler",
|
|
11
|
+
|
|
12
|
+
// 允许导入 .json 文件,并自动生成类型声明
|
|
6
13
|
"resolveJsonModule": true,
|
|
14
|
+
|
|
15
|
+
// 指定要包含的类型声明文件,node 提供 Node.js API 类型,vitest/globals 提供测试全局变量类型
|
|
7
16
|
"types": [
|
|
8
17
|
"node",
|
|
9
18
|
"vitest/globals"
|
|
10
19
|
],
|
|
20
|
+
|
|
21
|
+
// 允许编译 JavaScript 文件,使其可以被导入和进行类型检查
|
|
11
22
|
"allowJs": true,
|
|
23
|
+
|
|
24
|
+
// 启用所有严格类型检查选项,包括 noImplicitAny、strictNullChecks 等
|
|
12
25
|
"strict": true,
|
|
26
|
+
|
|
27
|
+
// 严格检查可选属性类型,区分 undefined 和缺失的属性
|
|
28
|
+
"exactOptionalPropertyTypes": true,
|
|
29
|
+
|
|
30
|
+
// 要求子类重写父类方法时必须使用 override 关键字
|
|
31
|
+
"noImplicitOverride": true,
|
|
32
|
+
|
|
33
|
+
// 禁止通过索引签名(如 obj['key'])访问未在索引签名中定义的属性
|
|
34
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
35
|
+
|
|
36
|
+
// 访问索引签名时返回 undefined | T,而不是 T(防止未定义访问错误)
|
|
37
|
+
"noUncheckedIndexedAccess": true,
|
|
38
|
+
|
|
39
|
+
// 不生成输出文件(仅用于类型检查,实际由打包工具处理编译)
|
|
13
40
|
"noEmit": true,
|
|
41
|
+
|
|
42
|
+
// 允许从没有默认导出的模块中默认导入(如 import React from 'react')
|
|
14
43
|
"allowSyntheticDefaultImports": true,
|
|
44
|
+
|
|
45
|
+
// 启用 ES 模块互操作性,为 CommonJS 模块提供 synthetic default imports
|
|
15
46
|
"esModuleInterop": true,
|
|
47
|
+
|
|
48
|
+
// 跳过库文件的类型检查,提高编译速度(库文件通常已经有类型声明)
|
|
16
49
|
"skipLibCheck": true
|
|
17
50
|
}
|
|
18
51
|
}
|
package/assets/turbo.json
CHANGED
|
@@ -5,28 +5,68 @@
|
|
|
5
5
|
"dependsOn": [
|
|
6
6
|
"^build"
|
|
7
7
|
],
|
|
8
|
+
"inputs": [
|
|
9
|
+
"src/**",
|
|
10
|
+
"lib/**",
|
|
11
|
+
"package.json",
|
|
12
|
+
"tsconfig*.json",
|
|
13
|
+
"*.config.{js,ts,mjs,mts}"
|
|
14
|
+
],
|
|
8
15
|
"outputs": [
|
|
9
|
-
"dist/**"
|
|
16
|
+
"dist/**",
|
|
17
|
+
"bin/**"
|
|
10
18
|
]
|
|
11
19
|
},
|
|
12
20
|
"lint": {
|
|
13
21
|
"dependsOn": [
|
|
14
22
|
"^lint"
|
|
15
23
|
],
|
|
24
|
+
"inputs": [
|
|
25
|
+
"src/**",
|
|
26
|
+
"lib/**",
|
|
27
|
+
"test/**",
|
|
28
|
+
"*.config.{js,ts}",
|
|
29
|
+
".eslintrc*",
|
|
30
|
+
".stylelintrc*"
|
|
31
|
+
],
|
|
16
32
|
"outputs": []
|
|
17
33
|
},
|
|
18
34
|
"dev": {
|
|
19
|
-
"cache": false
|
|
35
|
+
"cache": false,
|
|
36
|
+
"persistent": true
|
|
20
37
|
},
|
|
21
38
|
"test": {
|
|
22
39
|
"dependsOn": [
|
|
23
40
|
"^test"
|
|
24
41
|
],
|
|
42
|
+
"inputs": [
|
|
43
|
+
"src/**",
|
|
44
|
+
"lib/**",
|
|
45
|
+
"test/**",
|
|
46
|
+
"package.json",
|
|
47
|
+
"vitest.config.{js,ts}",
|
|
48
|
+
"tsconfig*.json"
|
|
49
|
+
],
|
|
25
50
|
"outputs": [
|
|
26
51
|
"coverage/**"
|
|
27
52
|
]
|
|
28
53
|
},
|
|
29
|
-
"
|
|
54
|
+
"typecheck": {
|
|
55
|
+
"dependsOn": [
|
|
56
|
+
"^typecheck"
|
|
57
|
+
],
|
|
58
|
+
"inputs": [
|
|
59
|
+
"src/**",
|
|
60
|
+
"lib/**",
|
|
61
|
+
"test/**",
|
|
62
|
+
"package.json",
|
|
63
|
+
"tsconfig*.json"
|
|
64
|
+
],
|
|
65
|
+
"outputs": []
|
|
66
|
+
},
|
|
67
|
+
"release": {
|
|
68
|
+
"cache": false
|
|
69
|
+
},
|
|
30
70
|
"sync": {
|
|
31
71
|
"cache": false
|
|
32
72
|
}
|
package/dist/cli.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const require_upgrade = require('./upgrade-
|
|
1
|
+
const require_upgrade = require('./upgrade-DmloQL5e.cjs');
|
|
2
2
|
let node_process = require("node:process");
|
|
3
3
|
node_process = require_upgrade.__toESM(node_process);
|
|
4
|
-
let
|
|
5
|
-
|
|
6
|
-
let
|
|
7
|
-
|
|
4
|
+
let _inquirer_input = require("@inquirer/input");
|
|
5
|
+
_inquirer_input = require_upgrade.__toESM(_inquirer_input);
|
|
6
|
+
let _inquirer_select = require("@inquirer/select");
|
|
7
|
+
_inquirer_select = require_upgrade.__toESM(_inquirer_select);
|
|
8
8
|
let commander = require("commander");
|
|
9
9
|
|
|
10
10
|
//#region src/cli/program.ts
|
|
@@ -62,7 +62,7 @@ commander.program.command("ai").description("AI 助手工具集").command("creat
|
|
|
62
62
|
let folderName;
|
|
63
63
|
if (!output && !name$1) {
|
|
64
64
|
const generated = require_upgrade.createTimestampFolderName();
|
|
65
|
-
folderName = ((await (0,
|
|
65
|
+
folderName = ((await (0, _inquirer_input.default)({
|
|
66
66
|
message: "提示词将写入哪个文件夹?(可回车确认或自定义)",
|
|
67
67
|
default: generated
|
|
68
68
|
}))?.trim?.() ?? generated) || generated;
|
|
@@ -79,11 +79,11 @@ commander.program.command("ai").description("AI 助手工具集").command("creat
|
|
|
79
79
|
});
|
|
80
80
|
commander.program.command("new").description("创建一个新的子包").alias("create").argument("[name]").action(async (name$1) => {
|
|
81
81
|
const createConfig = await require_upgrade.resolveCommandConfig("create", cwd);
|
|
82
|
-
if (!name$1) name$1 = await (0,
|
|
82
|
+
if (!name$1) name$1 = await (0, _inquirer_input.default)({
|
|
83
83
|
message: "请输入包名",
|
|
84
84
|
default: createConfig?.name ?? "my-package"
|
|
85
85
|
});
|
|
86
|
-
const type = await (0,
|
|
86
|
+
const type = await (0, _inquirer_select.default)({
|
|
87
87
|
message: "请选择模板类型",
|
|
88
88
|
choices: require_upgrade.getCreateChoices(createConfig?.choices),
|
|
89
89
|
default: createConfig?.type ?? createConfig?.defaultTemplate ?? require_upgrade.defaultTemplate
|
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as createTimestampFolderName, E as cleanProjects, F as logger, M as generateAgenticTemplate, N as generateAgenticTemplates, P as loadAgenticTasks, T as version, c as getCreateChoices, i as init, j as defaultAgenticBaseDir, k as resolveCommandConfig, n as syncNpmMirror, o as createNewProject, r as setVscodeBinaryMirror, s as defaultTemplate, t as upgradeMonorepo, w as name } from "./upgrade-
|
|
1
|
+
import { A as createTimestampFolderName, E as cleanProjects, F as logger, M as generateAgenticTemplate, N as generateAgenticTemplates, P as loadAgenticTasks, T as version, c as getCreateChoices, i as init, j as defaultAgenticBaseDir, k as resolveCommandConfig, n as syncNpmMirror, o as createNewProject, r as setVscodeBinaryMirror, s as defaultTemplate, t as upgradeMonorepo, w as name } from "./upgrade-D_D08NHx.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import input from "@inquirer/input";
|
|
4
4
|
import select from "@inquirer/select";
|
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as createTimestampFolderName, C as templatesDir, D as defineMonorepoConfig, E as cleanProjects, F as logger, I as getWorkspaceData, L as getWorkspacePackages, M as generateAgenticTemplate, N as generateAgenticTemplates, O as loadMonorepoConfig, P as loadAgenticTasks, R as GitClient, S as rootDir, T as version, _ as toWorkspaceGitignorePath, a as createContext, b as assetsDir, c as getCreateChoices, d as escapeStringRegexp, f as isMatch, g as toPublishGitignorePath, h as isGitignoreFile, i as init, j as defaultAgenticBaseDir, k as resolveCommandConfig, 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 updateIssueTemplateConfig, w as name, x as packageDir, y as isIgnorableFsError } from "./upgrade-
|
|
1
|
+
import { A as createTimestampFolderName, C as templatesDir, D as defineMonorepoConfig, E as cleanProjects, F as logger, I as getWorkspaceData, L as getWorkspacePackages, M as generateAgenticTemplate, N as generateAgenticTemplates, O as loadMonorepoConfig, P as loadAgenticTasks, R as GitClient, S as rootDir, T as version, _ as toWorkspaceGitignorePath, a as createContext, b as assetsDir, c as getCreateChoices, d as escapeStringRegexp, f as isMatch, g as toPublishGitignorePath, h as isGitignoreFile, i as init, j as defaultAgenticBaseDir, k as resolveCommandConfig, 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 updateIssueTemplateConfig, w as name, x as packageDir, y as isIgnorableFsError } from "./upgrade-D_D08NHx.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, updateIssueTemplateConfig, upgradeMonorepo, version };
|
|
@@ -57,12 +57,12 @@ var __name = (target, value) => __defProp(target, "name", {
|
|
|
57
57
|
value,
|
|
58
58
|
configurable: true
|
|
59
59
|
});
|
|
60
|
-
var isObject
|
|
60
|
+
var isObject = /* @__PURE__ */ __name((v) => v !== null && typeof v === "object", "isObject");
|
|
61
61
|
var join = /* @__PURE__ */ __name((segs, joinChar, options) => {
|
|
62
62
|
if (typeof options.join === "function") return options.join(segs);
|
|
63
63
|
return segs[0] + joinChar + segs[1];
|
|
64
64
|
}, "join");
|
|
65
|
-
var split
|
|
65
|
+
var split = /* @__PURE__ */ __name((path$2, splitChar, options) => {
|
|
66
66
|
if (typeof options.split === "function") return options.split(path$2);
|
|
67
67
|
return path$2.split(splitChar);
|
|
68
68
|
}, "split");
|
|
@@ -71,10 +71,10 @@ var isValid = /* @__PURE__ */ __name((key, target = {}, options) => {
|
|
|
71
71
|
return true;
|
|
72
72
|
}, "isValid");
|
|
73
73
|
var isValidObject = /* @__PURE__ */ __name((v) => {
|
|
74
|
-
return isObject
|
|
74
|
+
return isObject(v) || typeof v === "function";
|
|
75
75
|
}, "isValidObject");
|
|
76
76
|
var index_default = /* @__PURE__ */ __name((target, path$2, options = {}) => {
|
|
77
|
-
if (!isObject
|
|
77
|
+
if (!isObject(options)) options = { default: options };
|
|
78
78
|
if (!isValidObject(target)) return typeof options.default !== "undefined" ? options.default : target;
|
|
79
79
|
if (typeof path$2 === "number") path$2 = String(path$2);
|
|
80
80
|
const pathIsArray = Array.isArray(path$2);
|
|
@@ -83,7 +83,7 @@ var index_default = /* @__PURE__ */ __name((target, path$2, options = {}) => {
|
|
|
83
83
|
const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
|
|
84
84
|
if (!pathIsString && !pathIsArray) return target;
|
|
85
85
|
if (target[path$2] !== void 0) return isValid(path$2, target, options) ? target[path$2] : options.default;
|
|
86
|
-
const segs = pathIsArray ? path$2 : split
|
|
86
|
+
const segs = pathIsArray ? path$2 : split(path$2, splitChar, options);
|
|
87
87
|
const len = segs.length;
|
|
88
88
|
let idx = 0;
|
|
89
89
|
do {
|
|
@@ -188,7 +188,7 @@ var GitClient = class {
|
|
|
188
188
|
|
|
189
189
|
//#endregion
|
|
190
190
|
//#region ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
191
|
-
function isPlainObject$
|
|
191
|
+
function isPlainObject$1(value) {
|
|
192
192
|
if (value === null || typeof value !== "object") return false;
|
|
193
193
|
const prototype = Object.getPrototypeOf(value);
|
|
194
194
|
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
|
|
@@ -197,7 +197,7 @@ function isPlainObject$2(value) {
|
|
|
197
197
|
return true;
|
|
198
198
|
}
|
|
199
199
|
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
200
|
-
if (!isPlainObject$
|
|
200
|
+
if (!isPlainObject$1(defaults)) return _defu(baseObject, {}, namespace, merger);
|
|
201
201
|
const object = Object.assign({}, defaults);
|
|
202
202
|
for (const key in baseObject) {
|
|
203
203
|
if (key === "__proto__" || key === "constructor") continue;
|
|
@@ -205,7 +205,7 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
|
205
205
|
if (value === null || value === void 0) continue;
|
|
206
206
|
if (merger && merger(object, key, value, namespace)) continue;
|
|
207
207
|
if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
|
|
208
|
-
else if (isPlainObject$
|
|
208
|
+
else if (isPlainObject$1(value) && isPlainObject$1(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
209
209
|
else object[key] = value;
|
|
210
210
|
}
|
|
211
211
|
return object;
|
|
@@ -352,7 +352,7 @@ async function generateAgenticTemplates(tasks, defaults = {}) {
|
|
|
352
352
|
* Released under the MIT License.
|
|
353
353
|
*/
|
|
354
354
|
var require_is_primitive = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
355
|
-
module.exports = function isPrimitive
|
|
355
|
+
module.exports = function isPrimitive(val) {
|
|
356
356
|
if (typeof val === "object") return val === null;
|
|
357
357
|
return typeof val !== "function";
|
|
358
358
|
};
|
|
@@ -367,7 +367,7 @@ var require_is_primitive = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
367
367
|
* Released under the MIT License.
|
|
368
368
|
*/
|
|
369
369
|
var require_isobject = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
370
|
-
module.exports = function isObject$
|
|
370
|
+
module.exports = function isObject$1(val) {
|
|
371
371
|
return val != null && typeof val === "object" && Array.isArray(val) === false;
|
|
372
372
|
};
|
|
373
373
|
}));
|
|
@@ -381,11 +381,11 @@ var require_isobject = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
381
381
|
* Released under the MIT License.
|
|
382
382
|
*/
|
|
383
383
|
var require_is_plain_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
384
|
-
var isObject
|
|
384
|
+
var isObject = require_isobject();
|
|
385
385
|
function isObjectObject(o) {
|
|
386
|
-
return isObject
|
|
386
|
+
return isObject(o) === true && Object.prototype.toString.call(o) === "[object Object]";
|
|
387
387
|
}
|
|
388
|
-
module.exports = function isPlainObject$
|
|
388
|
+
module.exports = function isPlainObject$2(o) {
|
|
389
389
|
var ctor, prot;
|
|
390
390
|
if (isObjectObject(o) === false) return false;
|
|
391
391
|
ctor = o.constructor;
|
|
@@ -408,7 +408,7 @@ var require_is_plain_object = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
408
408
|
var require_set_value = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
409
409
|
const { deleteProperty } = Reflect;
|
|
410
410
|
const isPrimitive = require_is_primitive();
|
|
411
|
-
const isPlainObject
|
|
411
|
+
const isPlainObject = require_is_plain_object();
|
|
412
412
|
const isObject = (value) => {
|
|
413
413
|
return typeof value === "object" && value !== null || typeof value === "function";
|
|
414
414
|
};
|
|
@@ -477,7 +477,7 @@ var require_set_value = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
477
477
|
if (value === void 0) deleteProperty(obj, prop);
|
|
478
478
|
else if (options && options.merge) {
|
|
479
479
|
const merge = options.merge === "function" ? options.merge : Object.assign;
|
|
480
|
-
if (merge && isPlainObject
|
|
480
|
+
if (merge && isPlainObject(obj[prop]) && isPlainObject(value)) obj[prop] = merge(obj[prop], value);
|
|
481
481
|
else obj[prop] = value;
|
|
482
482
|
} else obj[prop] = value;
|
|
483
483
|
return obj;
|
|
@@ -558,7 +558,7 @@ async function resolveCommandConfig(name$1, cwd) {
|
|
|
558
558
|
|
|
559
559
|
//#endregion
|
|
560
560
|
//#region src/commands/clean.ts
|
|
561
|
-
var import_set_value
|
|
561
|
+
var import_set_value = /* @__PURE__ */ __toESM(require_set_value(), 1);
|
|
562
562
|
function mergeCleanConfig(base, overrides) {
|
|
563
563
|
const normalizedBase = base ?? {};
|
|
564
564
|
if (!overrides) return normalizedBase;
|
|
@@ -585,29 +585,37 @@ async function cleanProjects(cwd, overrides) {
|
|
|
585
585
|
else cleanDirs = await checkbox({
|
|
586
586
|
message: "请选择需要清理的目录",
|
|
587
587
|
choices: filteredPackages.map((x) => {
|
|
588
|
-
|
|
588
|
+
const baseChoice = {
|
|
589
589
|
name: path.relative(workspaceDir, x.rootDir),
|
|
590
590
|
value: x.rootDir,
|
|
591
|
-
checked: true
|
|
592
|
-
description: x.manifest.name
|
|
591
|
+
checked: true
|
|
593
592
|
};
|
|
593
|
+
return x.manifest.name ? {
|
|
594
|
+
...baseChoice,
|
|
595
|
+
description: x.manifest.name
|
|
596
|
+
} : baseChoice;
|
|
594
597
|
})
|
|
595
598
|
});
|
|
596
599
|
const readmeZh = path.resolve(workspaceDir, "README.zh-CN.md");
|
|
597
|
-
const
|
|
600
|
+
const qoderDir = path.resolve(workspaceDir, ".qoder");
|
|
601
|
+
const candidates = Array.from(new Set([
|
|
602
|
+
...cleanDirs.filter(Boolean),
|
|
603
|
+
readmeZh,
|
|
604
|
+
qoderDir
|
|
605
|
+
]));
|
|
598
606
|
await Promise.all(candidates.map(async (dir) => {
|
|
599
607
|
if (await fs.pathExists(dir)) await fs.remove(dir);
|
|
600
608
|
}));
|
|
601
609
|
const name$1 = path.resolve(workspaceDir, "package.json");
|
|
602
610
|
const pkgJson = await fs.readJson(name$1);
|
|
603
|
-
(0, import_set_value
|
|
611
|
+
(0, import_set_value.default)(pkgJson, "devDependencies.@icebreakers/monorepo", cleanConfig?.pinnedVersion ?? "latest", { preservePaths: false });
|
|
604
612
|
await fs.outputJson(name$1, pkgJson, { spaces: 2 });
|
|
605
613
|
}
|
|
606
614
|
|
|
607
615
|
//#endregion
|
|
608
616
|
//#region package.json
|
|
609
617
|
var name = "@icebreakers/monorepo";
|
|
610
|
-
var version = "3.1.
|
|
618
|
+
var version = "3.1.13";
|
|
611
619
|
|
|
612
620
|
//#endregion
|
|
613
621
|
//#region src/constants.ts
|
|
@@ -770,7 +778,6 @@ function isMatch(str, arr) {
|
|
|
770
778
|
|
|
771
779
|
//#endregion
|
|
772
780
|
//#region src/commands/create.ts
|
|
773
|
-
var import_set_value$4 = /* @__PURE__ */ __toESM(require_set_value(), 1);
|
|
774
781
|
/**
|
|
775
782
|
* 内置模板映射表,value 指向仓库中对应模板所在路径。
|
|
776
783
|
*/
|
|
@@ -842,7 +849,7 @@ async function applyGitMetadata(pkgJson, repoDir, targetDir) {
|
|
|
842
849
|
const git = new GitClient({ baseDir: repoDir });
|
|
843
850
|
const repoName = await git.getRepoName();
|
|
844
851
|
if (!repoName) return;
|
|
845
|
-
(0, import_set_value
|
|
852
|
+
(0, import_set_value.default)(pkgJson, ["bugs", "url"], `https://github.com/${repoName}/issues`);
|
|
846
853
|
const repository = {
|
|
847
854
|
type: "git",
|
|
848
855
|
url: `git+https://github.com/${repoName}.git`
|
|
@@ -850,9 +857,9 @@ async function applyGitMetadata(pkgJson, repoDir, targetDir) {
|
|
|
850
857
|
const directoryBase = await git.getRepoRoot() ?? repoDir;
|
|
851
858
|
const relative = path.relative(directoryBase, targetDir);
|
|
852
859
|
if (relative && relative !== ".") repository.directory = relative.split(path.sep).join("/");
|
|
853
|
-
(0, import_set_value
|
|
860
|
+
(0, import_set_value.default)(pkgJson, "repository", repository);
|
|
854
861
|
const gitUser = await git.getUser();
|
|
855
|
-
if (gitUser?.name && gitUser?.email) (0, import_set_value
|
|
862
|
+
if (gitUser?.name && gitUser?.email) (0, import_set_value.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
|
|
856
863
|
} catch {}
|
|
857
864
|
}
|
|
858
865
|
/**
|
|
@@ -890,8 +897,8 @@ async function createNewProject(options) {
|
|
|
890
897
|
if (filelist.includes("package.json")) {
|
|
891
898
|
const sourceJsonPath = path.resolve(from, "package.json");
|
|
892
899
|
const sourceJson = await fs.readJson(sourceJsonPath);
|
|
893
|
-
(0, import_set_value
|
|
894
|
-
(0, import_set_value
|
|
900
|
+
(0, import_set_value.default)(sourceJson, "version", "0.0.0");
|
|
901
|
+
(0, import_set_value.default)(sourceJson, "name", name$1?.startsWith("@") ? name$1 : path.basename(targetName));
|
|
895
902
|
await applyGitMetadata(sourceJson, cwd, to);
|
|
896
903
|
await fs.outputJson(path.resolve(to, renameJson ? "package.mock.json" : "package.json"), sourceJson, { spaces: 2 });
|
|
897
904
|
}
|
|
@@ -921,7 +928,6 @@ async function createContext(cwd) {
|
|
|
921
928
|
|
|
922
929
|
//#endregion
|
|
923
930
|
//#region src/commands/init/setChangeset.ts
|
|
924
|
-
var import_set_value$3 = /* @__PURE__ */ __toESM(require_set_value(), 1);
|
|
925
931
|
/**
|
|
926
932
|
* 将 changeset 配置中的仓库地址指向当前项目,方便自动生成变更日志链接。
|
|
927
933
|
*/
|
|
@@ -932,7 +938,7 @@ async function setChangeset_default(ctx) {
|
|
|
932
938
|
if (await fs.exists(changesetConfigPath)) {
|
|
933
939
|
const changesetConfig = await fs.readJson(changesetConfigPath);
|
|
934
940
|
if (gitUrl.full_name) {
|
|
935
|
-
(0, import_set_value
|
|
941
|
+
(0, import_set_value.default)(changesetConfig, "changelog.1.repo", gitUrl.full_name);
|
|
936
942
|
await fs.outputJson(changesetConfigPath, changesetConfig, { spaces: 2 });
|
|
937
943
|
}
|
|
938
944
|
}
|
|
@@ -956,7 +962,6 @@ async function setIssueTemplateConfig_default(ctx) {
|
|
|
956
962
|
|
|
957
963
|
//#endregion
|
|
958
964
|
//#region src/commands/init/setPkgJson.ts
|
|
959
|
-
var import_set_value$2 = /* @__PURE__ */ __toESM(require_set_value(), 1);
|
|
960
965
|
/**
|
|
961
966
|
* 根据当前仓库信息同步 package.json 的仓库、作者等字段。
|
|
962
967
|
*/
|
|
@@ -967,14 +972,14 @@ async function setPkgJson_default(ctx) {
|
|
|
967
972
|
if (!await fs.pathExists(pkg.pkgJsonPath)) return;
|
|
968
973
|
const pkgJson = JSON.parse(JSON.stringify(pkg.manifest));
|
|
969
974
|
const directory = path.relative(cwd, pkg.rootDir);
|
|
970
|
-
(0, import_set_value
|
|
975
|
+
(0, import_set_value.default)(pkgJson, ["bugs", "url"], `https://github.com/${gitUrl.full_name}/issues`);
|
|
971
976
|
const repository = {
|
|
972
977
|
type: "git",
|
|
973
978
|
url: `git+https://github.com/${gitUrl.full_name}.git`
|
|
974
979
|
};
|
|
975
980
|
if (directory) repository.directory = directory;
|
|
976
|
-
(0, import_set_value
|
|
977
|
-
if (gitUser?.name && gitUser?.email) (0, import_set_value
|
|
981
|
+
(0, import_set_value.default)(pkgJson, "repository", repository);
|
|
982
|
+
if (gitUser?.name && gitUser?.email) (0, import_set_value.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
|
|
978
983
|
const nextContent = `${JSON.stringify(pkgJson, void 0, 2)}\n`;
|
|
979
984
|
if (await fs.readFile(pkg.pkgJsonPath, "utf8") !== nextContent) await fs.writeFile(pkg.pkgJsonPath, nextContent, "utf8");
|
|
980
985
|
}));
|
|
@@ -1074,7 +1079,6 @@ const chinaMirrorsEnvs = {
|
|
|
1074
1079
|
|
|
1075
1080
|
//#endregion
|
|
1076
1081
|
//#region src/commands/mirror/utils.ts
|
|
1077
|
-
var import_set_value$1 = /* @__PURE__ */ __toESM(require_set_value(), 1);
|
|
1078
1082
|
/**
|
|
1079
1083
|
* 在 vscode 里面设置镜像下载地址的环境变量,避免下载缓慢
|
|
1080
1084
|
*/
|
|
@@ -1085,7 +1089,7 @@ function setMirror(obj, envs = chinaMirrorsEnvs) {
|
|
|
1085
1089
|
"osx"
|
|
1086
1090
|
];
|
|
1087
1091
|
const prefix = "terminal.integrated.env";
|
|
1088
|
-
if (typeof obj === "object" && obj) for (const platform of platforms) (0, import_set_value
|
|
1092
|
+
if (typeof obj === "object" && obj) for (const platform of platforms) (0, import_set_value.default)(obj, [prefix, platform].join(".").replaceAll(".", "\\."), envs);
|
|
1089
1093
|
}
|
|
1090
1094
|
|
|
1091
1095
|
//#endregion
|
|
@@ -1371,7 +1375,6 @@ function mergeWorkspaceManifest(source, target) {
|
|
|
1371
1375
|
|
|
1372
1376
|
//#endregion
|
|
1373
1377
|
//#region src/commands/upgrade/index.ts
|
|
1374
|
-
var import_set_value = /* @__PURE__ */ __toESM(require_set_value(), 1);
|
|
1375
1378
|
/**
|
|
1376
1379
|
* 将 assets 目录的模版文件同步到工程中,实现一键升级脚手架能力。
|
|
1377
1380
|
*/
|
|
@@ -29,9 +29,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
let git_url_parse = require("git-url-parse");
|
|
30
30
|
git_url_parse = __toESM(git_url_parse);
|
|
31
31
|
let simple_git = require("simple-git");
|
|
32
|
-
let
|
|
33
|
-
let
|
|
34
|
-
let
|
|
32
|
+
let _pnpm_find_workspace_dir = require("@pnpm/find-workspace-dir");
|
|
33
|
+
let _pnpm_workspace_find_packages = require("@pnpm/workspace.find-packages");
|
|
34
|
+
let _pnpm_workspace_read_manifest = require("@pnpm/workspace.read-manifest");
|
|
35
35
|
let pathe = require("pathe");
|
|
36
36
|
pathe = __toESM(pathe);
|
|
37
37
|
let node_process = require("node:process");
|
|
@@ -39,8 +39,8 @@ node_process = __toESM(node_process);
|
|
|
39
39
|
let fs_extra = require("fs-extra");
|
|
40
40
|
fs_extra = __toESM(fs_extra);
|
|
41
41
|
let consola = require("consola");
|
|
42
|
-
let
|
|
43
|
-
|
|
42
|
+
let _inquirer_checkbox = require("@inquirer/checkbox");
|
|
43
|
+
_inquirer_checkbox = __toESM(_inquirer_checkbox);
|
|
44
44
|
let c12 = require("c12");
|
|
45
45
|
let picocolors = require("picocolors");
|
|
46
46
|
picocolors = __toESM(picocolors);
|
|
@@ -69,12 +69,12 @@ var __name = (target, value) => __defProp(target, "name", {
|
|
|
69
69
|
value,
|
|
70
70
|
configurable: true
|
|
71
71
|
});
|
|
72
|
-
var isObject
|
|
72
|
+
var isObject = /* @__PURE__ */ __name((v) => v !== null && typeof v === "object", "isObject");
|
|
73
73
|
var join = /* @__PURE__ */ __name((segs, joinChar, options) => {
|
|
74
74
|
if (typeof options.join === "function") return options.join(segs);
|
|
75
75
|
return segs[0] + joinChar + segs[1];
|
|
76
76
|
}, "join");
|
|
77
|
-
var split
|
|
77
|
+
var split = /* @__PURE__ */ __name((path$14, splitChar, options) => {
|
|
78
78
|
if (typeof options.split === "function") return options.split(path$14);
|
|
79
79
|
return path$14.split(splitChar);
|
|
80
80
|
}, "split");
|
|
@@ -83,10 +83,10 @@ var isValid = /* @__PURE__ */ __name((key, target = {}, options) => {
|
|
|
83
83
|
return true;
|
|
84
84
|
}, "isValid");
|
|
85
85
|
var isValidObject = /* @__PURE__ */ __name((v) => {
|
|
86
|
-
return isObject
|
|
86
|
+
return isObject(v) || typeof v === "function";
|
|
87
87
|
}, "isValidObject");
|
|
88
88
|
var index_default = /* @__PURE__ */ __name((target, path$14, options = {}) => {
|
|
89
|
-
if (!isObject
|
|
89
|
+
if (!isObject(options)) options = { default: options };
|
|
90
90
|
if (!isValidObject(target)) return typeof options.default !== "undefined" ? options.default : target;
|
|
91
91
|
if (typeof path$14 === "number") path$14 = String(path$14);
|
|
92
92
|
const pathIsArray = Array.isArray(path$14);
|
|
@@ -95,7 +95,7 @@ var index_default = /* @__PURE__ */ __name((target, path$14, options = {}) => {
|
|
|
95
95
|
const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
|
|
96
96
|
if (!pathIsString && !pathIsArray) return target;
|
|
97
97
|
if (target[path$14] !== void 0) return isValid(path$14, target, options) ? target[path$14] : options.default;
|
|
98
|
-
const segs = pathIsArray ? path$14 : split
|
|
98
|
+
const segs = pathIsArray ? path$14 : split(path$14, splitChar, options);
|
|
99
99
|
const len = segs.length;
|
|
100
100
|
let idx = 0;
|
|
101
101
|
do {
|
|
@@ -200,7 +200,7 @@ var GitClient = class {
|
|
|
200
200
|
|
|
201
201
|
//#endregion
|
|
202
202
|
//#region ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
203
|
-
function isPlainObject$
|
|
203
|
+
function isPlainObject$1(value) {
|
|
204
204
|
if (value === null || typeof value !== "object") return false;
|
|
205
205
|
const prototype = Object.getPrototypeOf(value);
|
|
206
206
|
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
|
|
@@ -209,7 +209,7 @@ function isPlainObject$2(value) {
|
|
|
209
209
|
return true;
|
|
210
210
|
}
|
|
211
211
|
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
212
|
-
if (!isPlainObject$
|
|
212
|
+
if (!isPlainObject$1(defaults)) return _defu(baseObject, {}, namespace, merger);
|
|
213
213
|
const object = Object.assign({}, defaults);
|
|
214
214
|
for (const key in baseObject) {
|
|
215
215
|
if (key === "__proto__" || key === "constructor") continue;
|
|
@@ -217,7 +217,7 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
|
217
217
|
if (value === null || value === void 0) continue;
|
|
218
218
|
if (merger && merger(object, key, value, namespace)) continue;
|
|
219
219
|
if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
|
|
220
|
-
else if (isPlainObject$
|
|
220
|
+
else if (isPlainObject$1(value) && isPlainObject$1(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
221
221
|
else object[key] = value;
|
|
222
222
|
}
|
|
223
223
|
return object;
|
|
@@ -249,8 +249,8 @@ async function getWorkspacePackages(workspaceDir, options) {
|
|
|
249
249
|
ignoreRootPackage: true,
|
|
250
250
|
ignorePrivatePackage: true
|
|
251
251
|
});
|
|
252
|
-
const manifest = await (0,
|
|
253
|
-
let pkgs = (await (0,
|
|
252
|
+
const manifest = await (0, _pnpm_workspace_read_manifest.readWorkspaceManifest)(workspaceDir);
|
|
253
|
+
let pkgs = (await (0, _pnpm_workspace_find_packages.findWorkspacePackages)(workspaceDir, { patterns: patterns ?? manifest?.packages })).filter((x) => {
|
|
254
254
|
if (ignorePrivatePackage && x.manifest.private) return false;
|
|
255
255
|
return true;
|
|
256
256
|
}).map((project) => {
|
|
@@ -269,7 +269,7 @@ async function getWorkspacePackages(workspaceDir, options) {
|
|
|
269
269
|
* 将工作区绝对路径、包列表与当前 cwd 打包返回,方便调用方一次获取所有信息。
|
|
270
270
|
*/
|
|
271
271
|
async function getWorkspaceData(cwd, options) {
|
|
272
|
-
const workspaceDir = await (0,
|
|
272
|
+
const workspaceDir = await (0, _pnpm_find_workspace_dir.findWorkspaceDir)(cwd) ?? cwd;
|
|
273
273
|
return {
|
|
274
274
|
cwd,
|
|
275
275
|
workspaceDir,
|
|
@@ -364,7 +364,7 @@ async function generateAgenticTemplates(tasks, defaults = {}) {
|
|
|
364
364
|
* Released under the MIT License.
|
|
365
365
|
*/
|
|
366
366
|
var require_is_primitive = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
367
|
-
module.exports = function isPrimitive
|
|
367
|
+
module.exports = function isPrimitive(val) {
|
|
368
368
|
if (typeof val === "object") return val === null;
|
|
369
369
|
return typeof val !== "function";
|
|
370
370
|
};
|
|
@@ -379,7 +379,7 @@ var require_is_primitive = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
379
379
|
* Released under the MIT License.
|
|
380
380
|
*/
|
|
381
381
|
var require_isobject = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
382
|
-
module.exports = function isObject$
|
|
382
|
+
module.exports = function isObject$1(val) {
|
|
383
383
|
return val != null && typeof val === "object" && Array.isArray(val) === false;
|
|
384
384
|
};
|
|
385
385
|
}));
|
|
@@ -393,11 +393,11 @@ var require_isobject = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
393
393
|
* Released under the MIT License.
|
|
394
394
|
*/
|
|
395
395
|
var require_is_plain_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
396
|
-
var isObject
|
|
396
|
+
var isObject = require_isobject();
|
|
397
397
|
function isObjectObject(o) {
|
|
398
|
-
return isObject
|
|
398
|
+
return isObject(o) === true && Object.prototype.toString.call(o) === "[object Object]";
|
|
399
399
|
}
|
|
400
|
-
module.exports = function isPlainObject$
|
|
400
|
+
module.exports = function isPlainObject$2(o) {
|
|
401
401
|
var ctor, prot;
|
|
402
402
|
if (isObjectObject(o) === false) return false;
|
|
403
403
|
ctor = o.constructor;
|
|
@@ -420,7 +420,7 @@ var require_is_plain_object = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
420
420
|
var require_set_value = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
421
421
|
const { deleteProperty } = Reflect;
|
|
422
422
|
const isPrimitive = require_is_primitive();
|
|
423
|
-
const isPlainObject
|
|
423
|
+
const isPlainObject = require_is_plain_object();
|
|
424
424
|
const isObject = (value) => {
|
|
425
425
|
return typeof value === "object" && value !== null || typeof value === "function";
|
|
426
426
|
};
|
|
@@ -489,7 +489,7 @@ var require_set_value = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
489
489
|
if (value === void 0) deleteProperty(obj, prop);
|
|
490
490
|
else if (options && options.merge) {
|
|
491
491
|
const merge = options.merge === "function" ? options.merge : Object.assign;
|
|
492
|
-
if (merge && isPlainObject
|
|
492
|
+
if (merge && isPlainObject(obj[prop]) && isPlainObject(value)) obj[prop] = merge(obj[prop], value);
|
|
493
493
|
else obj[prop] = value;
|
|
494
494
|
} else obj[prop] = value;
|
|
495
495
|
return obj;
|
|
@@ -570,7 +570,7 @@ async function resolveCommandConfig(name$1, cwd) {
|
|
|
570
570
|
|
|
571
571
|
//#endregion
|
|
572
572
|
//#region src/commands/clean.ts
|
|
573
|
-
var import_set_value
|
|
573
|
+
var import_set_value = /* @__PURE__ */ __toESM(require_set_value(), 1);
|
|
574
574
|
function mergeCleanConfig(base, overrides) {
|
|
575
575
|
const normalizedBase = base ?? {};
|
|
576
576
|
if (!overrides) return normalizedBase;
|
|
@@ -594,32 +594,40 @@ async function cleanProjects(cwd, overrides) {
|
|
|
594
594
|
});
|
|
595
595
|
let cleanDirs = [];
|
|
596
596
|
if (cleanConfig?.autoConfirm) cleanDirs = filteredPackages.map((pkg) => pkg.rootDir);
|
|
597
|
-
else cleanDirs = await (0,
|
|
597
|
+
else cleanDirs = await (0, _inquirer_checkbox.default)({
|
|
598
598
|
message: "请选择需要清理的目录",
|
|
599
599
|
choices: filteredPackages.map((x) => {
|
|
600
|
-
|
|
600
|
+
const baseChoice = {
|
|
601
601
|
name: pathe.default.relative(workspaceDir, x.rootDir),
|
|
602
602
|
value: x.rootDir,
|
|
603
|
-
checked: true
|
|
604
|
-
description: x.manifest.name
|
|
603
|
+
checked: true
|
|
605
604
|
};
|
|
605
|
+
return x.manifest.name ? {
|
|
606
|
+
...baseChoice,
|
|
607
|
+
description: x.manifest.name
|
|
608
|
+
} : baseChoice;
|
|
606
609
|
})
|
|
607
610
|
});
|
|
608
611
|
const readmeZh = pathe.default.resolve(workspaceDir, "README.zh-CN.md");
|
|
609
|
-
const
|
|
612
|
+
const qoderDir = pathe.default.resolve(workspaceDir, ".qoder");
|
|
613
|
+
const candidates = Array.from(new Set([
|
|
614
|
+
...cleanDirs.filter(Boolean),
|
|
615
|
+
readmeZh,
|
|
616
|
+
qoderDir
|
|
617
|
+
]));
|
|
610
618
|
await Promise.all(candidates.map(async (dir) => {
|
|
611
619
|
if (await fs_extra.default.pathExists(dir)) await fs_extra.default.remove(dir);
|
|
612
620
|
}));
|
|
613
621
|
const name$1 = pathe.default.resolve(workspaceDir, "package.json");
|
|
614
622
|
const pkgJson = await fs_extra.default.readJson(name$1);
|
|
615
|
-
(0, import_set_value
|
|
623
|
+
(0, import_set_value.default)(pkgJson, "devDependencies.@icebreakers/monorepo", cleanConfig?.pinnedVersion ?? "latest", { preservePaths: false });
|
|
616
624
|
await fs_extra.default.outputJson(name$1, pkgJson, { spaces: 2 });
|
|
617
625
|
}
|
|
618
626
|
|
|
619
627
|
//#endregion
|
|
620
628
|
//#region package.json
|
|
621
629
|
var name = "@icebreakers/monorepo";
|
|
622
|
-
var version = "3.1.
|
|
630
|
+
var version = "3.1.13";
|
|
623
631
|
|
|
624
632
|
//#endregion
|
|
625
633
|
//#region src/constants.ts
|
|
@@ -782,7 +790,6 @@ function isMatch(str, arr) {
|
|
|
782
790
|
|
|
783
791
|
//#endregion
|
|
784
792
|
//#region src/commands/create.ts
|
|
785
|
-
var import_set_value$4 = /* @__PURE__ */ __toESM(require_set_value(), 1);
|
|
786
793
|
/**
|
|
787
794
|
* 内置模板映射表,value 指向仓库中对应模板所在路径。
|
|
788
795
|
*/
|
|
@@ -854,7 +861,7 @@ async function applyGitMetadata(pkgJson, repoDir, targetDir) {
|
|
|
854
861
|
const git = new GitClient({ baseDir: repoDir });
|
|
855
862
|
const repoName = await git.getRepoName();
|
|
856
863
|
if (!repoName) return;
|
|
857
|
-
(0, import_set_value
|
|
864
|
+
(0, import_set_value.default)(pkgJson, ["bugs", "url"], `https://github.com/${repoName}/issues`);
|
|
858
865
|
const repository = {
|
|
859
866
|
type: "git",
|
|
860
867
|
url: `git+https://github.com/${repoName}.git`
|
|
@@ -862,9 +869,9 @@ async function applyGitMetadata(pkgJson, repoDir, targetDir) {
|
|
|
862
869
|
const directoryBase = await git.getRepoRoot() ?? repoDir;
|
|
863
870
|
const relative = pathe.default.relative(directoryBase, targetDir);
|
|
864
871
|
if (relative && relative !== ".") repository.directory = relative.split(pathe.default.sep).join("/");
|
|
865
|
-
(0, import_set_value
|
|
872
|
+
(0, import_set_value.default)(pkgJson, "repository", repository);
|
|
866
873
|
const gitUser = await git.getUser();
|
|
867
|
-
if (gitUser?.name && gitUser?.email) (0, import_set_value
|
|
874
|
+
if (gitUser?.name && gitUser?.email) (0, import_set_value.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
|
|
868
875
|
} catch {}
|
|
869
876
|
}
|
|
870
877
|
/**
|
|
@@ -902,8 +909,8 @@ async function createNewProject(options) {
|
|
|
902
909
|
if (filelist.includes("package.json")) {
|
|
903
910
|
const sourceJsonPath = pathe.default.resolve(from, "package.json");
|
|
904
911
|
const sourceJson = await fs_extra.default.readJson(sourceJsonPath);
|
|
905
|
-
(0, import_set_value
|
|
906
|
-
(0, import_set_value
|
|
912
|
+
(0, import_set_value.default)(sourceJson, "version", "0.0.0");
|
|
913
|
+
(0, import_set_value.default)(sourceJson, "name", name$1?.startsWith("@") ? name$1 : pathe.default.basename(targetName));
|
|
907
914
|
await applyGitMetadata(sourceJson, cwd, to);
|
|
908
915
|
await fs_extra.default.outputJson(pathe.default.resolve(to, renameJson ? "package.mock.json" : "package.json"), sourceJson, { spaces: 2 });
|
|
909
916
|
}
|
|
@@ -933,7 +940,6 @@ async function createContext(cwd) {
|
|
|
933
940
|
|
|
934
941
|
//#endregion
|
|
935
942
|
//#region src/commands/init/setChangeset.ts
|
|
936
|
-
var import_set_value$3 = /* @__PURE__ */ __toESM(require_set_value(), 1);
|
|
937
943
|
/**
|
|
938
944
|
* 将 changeset 配置中的仓库地址指向当前项目,方便自动生成变更日志链接。
|
|
939
945
|
*/
|
|
@@ -944,7 +950,7 @@ async function setChangeset_default(ctx) {
|
|
|
944
950
|
if (await fs_extra.default.exists(changesetConfigPath)) {
|
|
945
951
|
const changesetConfig = await fs_extra.default.readJson(changesetConfigPath);
|
|
946
952
|
if (gitUrl.full_name) {
|
|
947
|
-
(0, import_set_value
|
|
953
|
+
(0, import_set_value.default)(changesetConfig, "changelog.1.repo", gitUrl.full_name);
|
|
948
954
|
await fs_extra.default.outputJson(changesetConfigPath, changesetConfig, { spaces: 2 });
|
|
949
955
|
}
|
|
950
956
|
}
|
|
@@ -968,7 +974,6 @@ async function setIssueTemplateConfig_default(ctx) {
|
|
|
968
974
|
|
|
969
975
|
//#endregion
|
|
970
976
|
//#region src/commands/init/setPkgJson.ts
|
|
971
|
-
var import_set_value$2 = /* @__PURE__ */ __toESM(require_set_value(), 1);
|
|
972
977
|
/**
|
|
973
978
|
* 根据当前仓库信息同步 package.json 的仓库、作者等字段。
|
|
974
979
|
*/
|
|
@@ -979,14 +984,14 @@ async function setPkgJson_default(ctx) {
|
|
|
979
984
|
if (!await fs_extra.default.pathExists(pkg.pkgJsonPath)) return;
|
|
980
985
|
const pkgJson = JSON.parse(JSON.stringify(pkg.manifest));
|
|
981
986
|
const directory = pathe.default.relative(cwd, pkg.rootDir);
|
|
982
|
-
(0, import_set_value
|
|
987
|
+
(0, import_set_value.default)(pkgJson, ["bugs", "url"], `https://github.com/${gitUrl.full_name}/issues`);
|
|
983
988
|
const repository = {
|
|
984
989
|
type: "git",
|
|
985
990
|
url: `git+https://github.com/${gitUrl.full_name}.git`
|
|
986
991
|
};
|
|
987
992
|
if (directory) repository.directory = directory;
|
|
988
|
-
(0, import_set_value
|
|
989
|
-
if (gitUser?.name && gitUser?.email) (0, import_set_value
|
|
993
|
+
(0, import_set_value.default)(pkgJson, "repository", repository);
|
|
994
|
+
if (gitUser?.name && gitUser?.email) (0, import_set_value.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
|
|
990
995
|
const nextContent = `${JSON.stringify(pkgJson, void 0, 2)}\n`;
|
|
991
996
|
if (await fs_extra.default.readFile(pkg.pkgJsonPath, "utf8") !== nextContent) await fs_extra.default.writeFile(pkg.pkgJsonPath, nextContent, "utf8");
|
|
992
997
|
}));
|
|
@@ -1086,7 +1091,6 @@ const chinaMirrorsEnvs = {
|
|
|
1086
1091
|
|
|
1087
1092
|
//#endregion
|
|
1088
1093
|
//#region src/commands/mirror/utils.ts
|
|
1089
|
-
var import_set_value$1 = /* @__PURE__ */ __toESM(require_set_value(), 1);
|
|
1090
1094
|
/**
|
|
1091
1095
|
* 在 vscode 里面设置镜像下载地址的环境变量,避免下载缓慢
|
|
1092
1096
|
*/
|
|
@@ -1097,7 +1101,7 @@ function setMirror(obj, envs = chinaMirrorsEnvs) {
|
|
|
1097
1101
|
"osx"
|
|
1098
1102
|
];
|
|
1099
1103
|
const prefix = "terminal.integrated.env";
|
|
1100
|
-
if (typeof obj === "object" && obj) for (const platform of platforms) (0, import_set_value
|
|
1104
|
+
if (typeof obj === "object" && obj) for (const platform of platforms) (0, import_set_value.default)(obj, [prefix, platform].join(".").replaceAll(".", "\\."), envs);
|
|
1101
1105
|
}
|
|
1102
1106
|
|
|
1103
1107
|
//#endregion
|
|
@@ -1202,7 +1206,7 @@ async function scheduleOverwrite(intent, options) {
|
|
|
1202
1206
|
}
|
|
1203
1207
|
async function flushPendingOverwrites(pending) {
|
|
1204
1208
|
if (!pending.length) return;
|
|
1205
|
-
const selected = await (0,
|
|
1209
|
+
const selected = await (0, _inquirer_checkbox.default)({
|
|
1206
1210
|
message: "检测到以下文件内容与当前仓库不同,选择需要覆盖的文件",
|
|
1207
1211
|
choices: pending.map((item) => ({
|
|
1208
1212
|
name: picocolors.default.greenBright(item.relPath),
|
|
@@ -1383,7 +1387,6 @@ function mergeWorkspaceManifest(source, target) {
|
|
|
1383
1387
|
|
|
1384
1388
|
//#endregion
|
|
1385
1389
|
//#region src/commands/upgrade/index.ts
|
|
1386
|
-
var import_set_value = /* @__PURE__ */ __toESM(require_set_value(), 1);
|
|
1387
1390
|
/**
|
|
1388
1391
|
* 将 assets 目录的模版文件同步到工程中,实现一键升级脚手架能力。
|
|
1389
1392
|
*/
|
|
@@ -1405,7 +1408,7 @@ async function upgradeMonorepo(opts) {
|
|
|
1405
1408
|
const configTargets = upgradeConfig?.targets ?? [];
|
|
1406
1409
|
const mergeTargets = upgradeConfig?.mergeTargets;
|
|
1407
1410
|
let targets = configTargets.length ? mergeTargets === false ? [...configTargets] : Array.from(new Set([...baseTargets, ...configTargets])) : baseTargets;
|
|
1408
|
-
if (merged.interactive) targets = await (0,
|
|
1411
|
+
if (merged.interactive) targets = await (0, _inquirer_checkbox.default)({
|
|
1409
1412
|
message: "选择你需要的文件",
|
|
1410
1413
|
choices: targets.map((x) => {
|
|
1411
1414
|
return {
|
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.13",
|
|
5
5
|
"description": "The icebreaker's monorepo manager",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -64,15 +64,15 @@
|
|
|
64
64
|
"@pnpm/find-workspace-dir": "^1000.1.3",
|
|
65
65
|
"@pnpm/logger": "^1001.0.1",
|
|
66
66
|
"@pnpm/types": "^1001.2.0",
|
|
67
|
-
"@pnpm/worker": "^1000.
|
|
68
|
-
"@pnpm/workspace.find-packages": "^1000.0.
|
|
67
|
+
"@pnpm/worker": "^1000.6.0",
|
|
68
|
+
"@pnpm/workspace.find-packages": "^1000.0.52",
|
|
69
69
|
"@pnpm/workspace.read-manifest": "^1000.2.9",
|
|
70
|
-
"c12": "^3.3.
|
|
70
|
+
"c12": "^3.3.3",
|
|
71
71
|
"commander": "^14.0.2",
|
|
72
72
|
"comment-json": "^4.5.0",
|
|
73
73
|
"consola": "^3.4.2",
|
|
74
74
|
"execa": "^9.6.1",
|
|
75
|
-
"fs-extra": "^11.3.
|
|
75
|
+
"fs-extra": "^11.3.3",
|
|
76
76
|
"git-url-parse": "^16.1.0",
|
|
77
77
|
"klaw": "^4.1.0",
|
|
78
78
|
"p-queue": "^9.0.1",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
2
|
import { pathToFileURL } from 'node:url'
|
|
3
|
+
import { consola } from 'consola'
|
|
3
4
|
|
|
4
5
|
export function runCli(argv: string[] = process.argv) {
|
|
5
|
-
|
|
6
|
+
consola.info('[@icebreakers/cli]:', argv)
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
const executedFile = process.argv[1]
|
|
@@ -19,33 +19,34 @@
|
|
|
19
19
|
"@tanstack/vue-query-devtools": "^6.1.2",
|
|
20
20
|
"@tanstack/vue-table": "^8.21.3",
|
|
21
21
|
"@tanstack/vue-virtual": "^3.13.13",
|
|
22
|
-
"@trpc/client": "^11.8.
|
|
22
|
+
"@trpc/client": "^11.8.1",
|
|
23
23
|
"clsx": "^2.1.1",
|
|
24
24
|
"pinia": "^3.0.4",
|
|
25
25
|
"tailwind-merge": "^3.4.0",
|
|
26
26
|
"tailwind-variants": "^3.2.2",
|
|
27
|
-
"vue": "^3.5.
|
|
28
|
-
"vue-i18n": "^11.2.
|
|
27
|
+
"vue": "^3.5.26",
|
|
28
|
+
"vue-i18n": "^11.2.7",
|
|
29
29
|
"vue-router": "^4.6.4"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@cloudflare/vite-plugin": "^1.
|
|
32
|
+
"@cloudflare/vite-plugin": "^1.19.0",
|
|
33
33
|
"@hono/node-server": "^1.19.7",
|
|
34
34
|
"@hono/trpc-server": "^0.4.1",
|
|
35
35
|
"@tailwindcss/vite": "^4.1.18",
|
|
36
|
-
"@trpc/server": "^11.8.
|
|
36
|
+
"@trpc/server": "^11.8.1",
|
|
37
37
|
"@vitejs/plugin-vue": "^6.0.3",
|
|
38
|
-
"@vitejs/plugin-vue-jsx": "^5.1.
|
|
38
|
+
"@vitejs/plugin-vue-jsx": "^5.1.3",
|
|
39
39
|
"@vue/tsconfig": "^0.8.1",
|
|
40
|
+
"consola": "^3.4.2",
|
|
40
41
|
"hono": "^4.11.1",
|
|
41
42
|
"tailwindcss": "^4.1.18",
|
|
42
43
|
"typescript": "~5.9.3",
|
|
43
44
|
"unplugin-vue-router": "^0.19.1",
|
|
44
45
|
"vite": "^7.3.0",
|
|
45
46
|
"vite-plugin-vue-devtools": "^8.0.5",
|
|
46
|
-
"vite-tsconfig-paths": "^6.0.
|
|
47
|
-
"vue-tsc": "3.1
|
|
48
|
-
"wrangler": "^4.
|
|
47
|
+
"vite-tsconfig-paths": "^6.0.3",
|
|
48
|
+
"vue-tsc": "3.2.1",
|
|
49
|
+
"wrangler": "^4.56.0",
|
|
49
50
|
"zod": "^4.2.1"
|
|
50
51
|
}
|
|
51
52
|
}
|
|
@@ -31,12 +31,26 @@ export default defineConfig({
|
|
|
31
31
|
ensureVitePlugin(cloudflare()),
|
|
32
32
|
ensureVitePlugin(VueDevTools()),
|
|
33
33
|
],
|
|
34
|
+
build: {
|
|
35
|
+
target: 'esnext',
|
|
36
|
+
minify: 'esbuild',
|
|
37
|
+
chunkSizeWarningLimit: 1000,
|
|
38
|
+
rollupOptions: {
|
|
39
|
+
output: {
|
|
40
|
+
manualChunks: {
|
|
41
|
+
'vue-vendor': ['vue', 'vue-router', 'pinia'],
|
|
42
|
+
'query-vendor': ['@tanstack/vue-query'],
|
|
43
|
+
'trpc-vendor': ['@trpc/client'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
34
48
|
server: {
|
|
35
49
|
// proxy: {
|
|
36
50
|
// '/api': {
|
|
37
51
|
// target: `http://localhost:8787`,
|
|
38
52
|
// changeOrigin: true,
|
|
39
|
-
// // rewrite: path => path.replace(
|
|
53
|
+
// // rewrite: path => path.replace(/^/api/, ''),
|
|
40
54
|
// },
|
|
41
55
|
// },
|
|
42
56
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
1
|
import { serve } from '@hono/node-server'
|
|
2
|
+
import { consola } from 'consola'
|
|
3
3
|
import { logger } from 'hono/logger'
|
|
4
4
|
import { app } from './app'
|
|
5
5
|
import { port } from './config'
|
|
@@ -10,4 +10,4 @@ serve({
|
|
|
10
10
|
port,
|
|
11
11
|
})
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
consola.success(`Server listening on http://localhost:${port}`)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
1
|
import { serve } from '@hono/node-server'
|
|
2
|
+
import { consola } from 'consola'
|
|
3
3
|
import { logger } from 'hono/logger'
|
|
4
4
|
import { app } from './app'
|
|
5
5
|
import { port } from './config'
|
|
@@ -10,4 +10,4 @@ serve({
|
|
|
10
10
|
port,
|
|
11
11
|
})
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
consola.success(`Server listening on http://localhost:${port}`)
|