@yarn-tool/pkg-entry-util 3.0.3 → 3.0.4
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/CHANGELOG.md +50 -0
- package/README.md +155 -3
- package/lib/field/bin.d.ts +27 -0
- package/lib/field/bin.js +29 -0
- package/lib/field/bin.js.map +1 -1
- package/lib/field/exports.d.ts +48 -0
- package/lib/field/exports.js +59 -4
- package/lib/field/exports.js.map +1 -1
- package/lib/field/fixEmpty.d.ts +43 -0
- package/lib/field/fixEmpty.js +58 -0
- package/lib/field/fixEmpty.js.map +1 -0
- package/lib/field/publishConfig.d.ts +18 -0
- package/lib/field/publishConfig.js +24 -0
- package/lib/field/publishConfig.js.map +1 -1
- package/lib/index.d.ts +30 -0
- package/lib/index.js +30 -0
- package/lib/index.js.map +1 -1
- package/lib/preset/scripts/dummy.d.ts +58 -0
- package/lib/preset/scripts/dummy.js +58 -0
- package/lib/preset/scripts/dummy.js.map +1 -1
- package/lib/preset/scripts/index.d.ts +56 -0
- package/lib/preset/scripts/index.js +68 -0
- package/lib/preset/scripts/index.js.map +1 -0
- package/lib/preset/scripts/pkg-scripts.d.ts +50 -0
- package/lib/preset/scripts/pkg-scripts.js +56 -6
- package/lib/preset/scripts/pkg-scripts.js.map +1 -1
- package/lib/preset/scripts/root-scripts.d.ts +39 -1
- package/lib/preset/scripts/root-scripts.js +48 -4
- package/lib/preset/scripts/root-scripts.js.map +1 -1
- package/lib/preset/scripts/shared-root-scripts.d.ts +36 -0
- package/lib/preset/scripts/shared-root-scripts.js +38 -1
- package/lib/preset/scripts/shared-root-scripts.js.map +1 -1
- package/lib/preset/scripts/ws-root-scripts.d.ts +76 -0
- package/lib/preset/scripts/ws-root-scripts.js +93 -8
- package/lib/preset/scripts/ws-root-scripts.js.map +1 -1
- package/package.json +18 -8
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 根目錄套件腳本預設 / Root Package Scripts Preset
|
|
3
|
+
*
|
|
4
|
+
* 提供根目錄套件(非工作區)的預設 npm scripts
|
|
5
|
+
* Provides default npm scripts for root packages (non-workspace)
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* 根目錄套件預設腳本 / Default scripts for root packages
|
|
9
|
+
*
|
|
10
|
+
* 適用於 monorepo 根目錄或獨立套件的發布與版本管理
|
|
11
|
+
* Suitable for monorepo root or standalone package publishing and version management
|
|
12
|
+
*
|
|
13
|
+
* @returns 包含根目錄管理腳本的物件 / Object containing root management scripts
|
|
14
|
+
*
|
|
15
|
+
* 核心功能 / Core features:
|
|
16
|
+
* - 版本號遞增與發布 / Version bumping and publishing
|
|
17
|
+
* - npm 發布流程 / npm publishing workflow
|
|
18
|
+
* - 發布後自動化(changelog、git 提交與標籤)/ Post-publish automation (changelog, git commit, tags)
|
|
19
|
+
* - 依賴更新與清理 / Dependency updates and cleanup
|
|
20
|
+
*
|
|
21
|
+
* 包含腳本 / Includes scripts:
|
|
22
|
+
* - prepublishOnly:check-bin: 發布前檢查二進位檔 / Check binaries before publish
|
|
23
|
+
* - version:bump: 版本號遞增 / Version bump
|
|
24
|
+
* - npm:publish: npm 發布 / npm publish
|
|
25
|
+
* - npm:publish:bump: 遞增並發布 / Bump and publish
|
|
26
|
+
* - version:bump:patch|minor|major|prerelease: 特定版本遞增 / Specific version bumps
|
|
27
|
+
* - npm:publish:bump:patch|minor|major|prerelease: 特定版本發布 / Specific version publishing
|
|
28
|
+
* - postpublish:git:commit: 發布後提交 / Post-publish git commit
|
|
29
|
+
* - postpublish:git:tag: 發布後標籤 / Post-publish git tag
|
|
30
|
+
* - postpublish:changelog: 更新變更日誌 / Update changelog
|
|
31
|
+
* - postpublish:git:push: 推送標籤 / Push tags
|
|
32
|
+
* - postpublish: 完整發布後流程 / Complete post-publish workflow
|
|
33
|
+
* - ncu: 更新依賴 / Update dependencies
|
|
34
|
+
* - pnpm:dedupe: 清理重複依賴 / Deduplicate dependencies
|
|
35
|
+
* - ncu:pnpm: pnpm 更新 / pnpm update
|
|
36
|
+
*/
|
|
1
37
|
export declare function defaultRootScripts(): {
|
|
2
38
|
"postpublish:git:commit": string;
|
|
3
39
|
"postpublish:git:tag": string;
|
|
@@ -5,6 +41,8 @@ export declare function defaultRootScripts(): {
|
|
|
5
41
|
"postpublish:git:push": string;
|
|
6
42
|
postpublish: string;
|
|
7
43
|
ncu: string;
|
|
44
|
+
"pnpm:dedupe": string;
|
|
45
|
+
"ncu:pnpm": string;
|
|
8
46
|
"prepublishOnly:check-bin": string;
|
|
9
47
|
"version:bump": string;
|
|
10
48
|
"npm:publish": string;
|
|
@@ -17,7 +55,7 @@ export declare function defaultRootScripts(): {
|
|
|
17
55
|
"ws:fix-all:resetStaticFiles": string;
|
|
18
56
|
test: string;
|
|
19
57
|
coverage: string;
|
|
20
|
-
"test:jest": import("
|
|
58
|
+
"test:jest": import("../..").EnumScriptsEntry;
|
|
21
59
|
"test:snapshot": string;
|
|
22
60
|
"test:jest:snapshot": string;
|
|
23
61
|
"test:jest:coverage": string;
|
|
@@ -1,12 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 根目錄套件腳本預設 / Root Package Scripts Preset
|
|
4
|
+
*
|
|
5
|
+
* 提供根目錄套件(非工作區)的預設 npm scripts
|
|
6
|
+
* Provides default npm scripts for root packages (non-workspace)
|
|
7
|
+
*/
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.defaultRootScripts = defaultRootScripts;
|
|
4
10
|
const shared_root_scripts_1 = require("./shared-root-scripts");
|
|
5
11
|
const pkg_scripts_1 = require("./pkg-scripts");
|
|
12
|
+
/**
|
|
13
|
+
* 根目錄套件預設腳本 / Default scripts for root packages
|
|
14
|
+
*
|
|
15
|
+
* 適用於 monorepo 根目錄或獨立套件的發布與版本管理
|
|
16
|
+
* Suitable for monorepo root or standalone package publishing and version management
|
|
17
|
+
*
|
|
18
|
+
* @returns 包含根目錄管理腳本的物件 / Object containing root management scripts
|
|
19
|
+
*
|
|
20
|
+
* 核心功能 / Core features:
|
|
21
|
+
* - 版本號遞增與發布 / Version bumping and publishing
|
|
22
|
+
* - npm 發布流程 / npm publishing workflow
|
|
23
|
+
* - 發布後自動化(changelog、git 提交與標籤)/ Post-publish automation (changelog, git commit, tags)
|
|
24
|
+
* - 依賴更新與清理 / Dependency updates and cleanup
|
|
25
|
+
*
|
|
26
|
+
* 包含腳本 / Includes scripts:
|
|
27
|
+
* - prepublishOnly:check-bin: 發布前檢查二進位檔 / Check binaries before publish
|
|
28
|
+
* - version:bump: 版本號遞增 / Version bump
|
|
29
|
+
* - npm:publish: npm 發布 / npm publish
|
|
30
|
+
* - npm:publish:bump: 遞增並發布 / Bump and publish
|
|
31
|
+
* - version:bump:patch|minor|major|prerelease: 特定版本遞增 / Specific version bumps
|
|
32
|
+
* - npm:publish:bump:patch|minor|major|prerelease: 特定版本發布 / Specific version publishing
|
|
33
|
+
* - postpublish:git:commit: 發布後提交 / Post-publish git commit
|
|
34
|
+
* - postpublish:git:tag: 發布後標籤 / Post-publish git tag
|
|
35
|
+
* - postpublish:changelog: 更新變更日誌 / Update changelog
|
|
36
|
+
* - postpublish:git:push: 推送標籤 / Push tags
|
|
37
|
+
* - postpublish: 完整發布後流程 / Complete post-publish workflow
|
|
38
|
+
* - ncu: 更新依賴 / Update dependencies
|
|
39
|
+
* - pnpm:dedupe: 清理重複依賴 / Deduplicate dependencies
|
|
40
|
+
* - ncu:pnpm: pnpm 更新 / pnpm update
|
|
41
|
+
*/
|
|
6
42
|
function defaultRootScripts() {
|
|
43
|
+
/**
|
|
44
|
+
* 產生版本遞增與發布命令 / Generate version bump and publish command
|
|
45
|
+
*
|
|
46
|
+
* @param bump - 版本遞增類型 / Version bump type
|
|
47
|
+
* @returns 組合命令字串 / Combined command string
|
|
48
|
+
*/
|
|
7
49
|
const bumpVersion = (bump) => {
|
|
8
50
|
return [
|
|
9
|
-
`
|
|
51
|
+
`node --run version:bump` + (bump ? ` -- --bump ${bump}` : ''),
|
|
10
52
|
`npm publish`,
|
|
11
53
|
].join(' && ');
|
|
12
54
|
};
|
|
@@ -16,15 +58,15 @@ function defaultRootScripts() {
|
|
|
16
58
|
"prepublishOnly:check-bin": "ynpx --quiet @yarn-tool/check-pkg-bin",
|
|
17
59
|
"version:bump": "yarn-tool version",
|
|
18
60
|
"npm:publish": "npm publish",
|
|
19
|
-
//"npm:publish:bump": "yarn run version:bump && npm publish",
|
|
20
61
|
"npm:publish:bump": bumpVersion(),
|
|
62
|
+
// 動態產生各類版本遞增腳本 / Dynamically generate version bump scripts
|
|
21
63
|
...[
|
|
22
64
|
'patch',
|
|
23
65
|
'minor',
|
|
24
66
|
'major',
|
|
25
67
|
'prerelease',
|
|
26
68
|
].reduce((a, bump, idx) => {
|
|
27
|
-
a[`version:bump:${bump}`] = `
|
|
69
|
+
a[`version:bump:${bump}`] = `node --run version:bump` + (bump ? ` -- --bump ${bump}` : '');
|
|
28
70
|
a[`npm:publish:bump:${bump}`] = bumpVersion(bump);
|
|
29
71
|
return a;
|
|
30
72
|
}, {}),
|
|
@@ -32,8 +74,10 @@ function defaultRootScripts() {
|
|
|
32
74
|
"postpublish:git:tag": `ynpx --quiet @yarn-tool/tag`,
|
|
33
75
|
"postpublish:changelog": `ynpx --quiet @yarn-tool/changelog && git add ./CHANGELOG.md`,
|
|
34
76
|
"postpublish:git:push": `git push --follow-tags`,
|
|
35
|
-
"postpublish": `
|
|
77
|
+
"postpublish": `node --run postpublish:changelog && node --run postpublish:git:commit && node --run postpublish:git:tag && node --run postpublish:git:push`,
|
|
36
78
|
"ncu": "yarn-tool ncu -u",
|
|
79
|
+
"pnpm:dedupe": "pnpm dedupe",
|
|
80
|
+
"ncu:pnpm": "pnpm update",
|
|
37
81
|
};
|
|
38
82
|
}
|
|
39
83
|
//# sourceMappingURL=root-scripts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root-scripts.js","sourceRoot":"","sources":["root-scripts.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"root-scripts.js","sourceRoot":"","sources":["root-scripts.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAmCH,gDA8CC;AA/ED,+DAAiE;AACjE,+CAAkD;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,SAAgB,kBAAkB;IAEjC;;;;;OAKG;IACH,MAAM,WAAW,GAAG,CAAC,IAAiD,EAAE,EAAE;QAEzE,OAAO;YACN,yBAAyB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9D,aAAa;SACb,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACf,CAAC,CAAA;IAED,OAAO;QACN,GAAG,IAAA,+BAAiB,GAAE;QACtB,GAAG,IAAA,8CAAwB,GAAE;QAC7B,0BAA0B,EAAE,uCAAuC;QACnE,cAAc,EAAE,mBAAmB;QACnC,aAAa,EAAE,aAAa;QAC5B,kBAAkB,EAAE,WAAW,EAAE;QAEjC,2DAA2D;QAC3D,GAAI;YACH,OAAO;YACP,OAAO;YACP,OAAO;YACP,YAAY;SACF,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;YAEnC,CAAC,CAAC,gBAAgB,IAAI,EAAE,CAAC,GAAG,yBAAyB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC3F,CAAC,CAAC,oBAAoB,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;YAClD,OAAO,CAAC,CAAA;QACT,CAAC,EAAE,EAA4B,CAAC;QAEhC,wBAAwB,EAAE,yEAAyE;QACnG,qBAAqB,EAAE,6BAA6B;QACpD,uBAAuB,EAAE,6DAA6D;QACtF,sBAAsB,EAAE,wBAAwB;QAChD,aAAa,EAAE,4IAA4I;QAC3J,KAAK,EAAE,kBAAkB;QACzB,aAAa,EAAE,aAAa;QAC5B,UAAU,EAAE,aAAa;KACzB,CAAA;AACF,CAAC","sourcesContent":["/**\n * 根目錄套件腳本預設 / Root Package Scripts Preset\n *\n * 提供根目錄套件(非工作區)的預設 npm scripts\n * Provides default npm scripts for root packages (non-workspace)\n */\n\nimport { defaultSharedRootScripts } from './shared-root-scripts';\nimport { defaultPkgScripts } from './pkg-scripts';\n\n/**\n * 根目錄套件預設腳本 / Default scripts for root packages\n *\n * 適用於 monorepo 根目錄或獨立套件的發布與版本管理\n * Suitable for monorepo root or standalone package publishing and version management\n *\n * @returns 包含根目錄管理腳本的物件 / Object containing root management scripts\n *\n * 核心功能 / Core features:\n * - 版本號遞增與發布 / Version bumping and publishing\n * - npm 發布流程 / npm publishing workflow\n * - 發布後自動化(changelog、git 提交與標籤)/ Post-publish automation (changelog, git commit, tags)\n * - 依賴更新與清理 / Dependency updates and cleanup\n *\n * 包含腳本 / Includes scripts:\n * - prepublishOnly:check-bin: 發布前檢查二進位檔 / Check binaries before publish\n * - version:bump: 版本號遞增 / Version bump\n * - npm:publish: npm 發布 / npm publish\n * - npm:publish:bump: 遞增並發布 / Bump and publish\n * - version:bump:patch|minor|major|prerelease: 特定版本遞增 / Specific version bumps\n * - npm:publish:bump:patch|minor|major|prerelease: 特定版本發布 / Specific version publishing\n * - postpublish:git:commit: 發布後提交 / Post-publish git commit\n * - postpublish:git:tag: 發布後標籤 / Post-publish git tag\n * - postpublish:changelog: 更新變更日誌 / Update changelog\n * - postpublish:git:push: 推送標籤 / Push tags\n * - postpublish: 完整發布後流程 / Complete post-publish workflow\n * - ncu: 更新依賴 / Update dependencies\n * - pnpm:dedupe: 清理重複依賴 / Deduplicate dependencies\n * - ncu:pnpm: pnpm 更新 / pnpm update\n */\nexport function defaultRootScripts()\n{\n\t/**\n\t * 產生版本遞增與發布命令 / Generate version bump and publish command\n\t *\n\t * @param bump - 版本遞增類型 / Version bump type\n\t * @returns 組合命令字串 / Combined command string\n\t */\n\tconst bumpVersion = (bump?: 'major' | 'minor' | 'patch' | 'prerelease') =>\n\t{\n\t\treturn [\n\t\t\t`node --run version:bump` + (bump ? ` -- --bump ${bump}` : ''),\n\t\t\t`npm publish`,\n\t\t].join(' && ')\n\t}\n\n\treturn {\n\t\t...defaultPkgScripts(),\n\t\t...defaultSharedRootScripts(),\n\t\t\"prepublishOnly:check-bin\": \"ynpx --quiet @yarn-tool/check-pkg-bin\",\n\t\t\"version:bump\": \"yarn-tool version\",\n\t\t\"npm:publish\": \"npm publish\",\n\t\t\"npm:publish:bump\": bumpVersion(),\n\n\t\t// 動態產生各類版本遞增腳本 / Dynamically generate version bump scripts\n\t\t...([\n\t\t\t'patch',\n\t\t\t'minor',\n\t\t\t'major',\n\t\t\t'prerelease',\n\t\t] as const).reduce((a, bump, idx) =>\n\t\t{\n\t\t\ta[`version:bump:${bump}`] = `node --run version:bump` + (bump ? ` -- --bump ${bump}` : '');\n\t\t\ta[`npm:publish:bump:${bump}`] = bumpVersion(bump);\n\t\t\treturn a\n\t\t}, {} as Record<string, string>),\n\n\t\t\"postpublish:git:commit\": `git commit -m \"chore(release): publish\" . & echo postpublish:git:commit`,\n\t\t\"postpublish:git:tag\": `ynpx --quiet @yarn-tool/tag`,\n\t\t\"postpublish:changelog\": `ynpx --quiet @yarn-tool/changelog && git add ./CHANGELOG.md`,\n\t\t\"postpublish:git:push\": `git push --follow-tags`,\n\t\t\"postpublish\": `node --run postpublish:changelog && node --run postpublish:git:commit && node --run postpublish:git:tag && node --run postpublish:git:push`,\n\t\t\"ncu\": \"yarn-tool ncu -u\",\n\t\t\"pnpm:dedupe\": \"pnpm dedupe\",\n\t\t\"ncu:pnpm\": \"pnpm update\",\n\t}\n}\n"]}
|
|
@@ -1,8 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 共享根目錄腳本預設 / Shared Root Scripts Preset
|
|
3
|
+
*
|
|
4
|
+
* 提供根目錄套件共用的預設 npm scripts
|
|
5
|
+
* Provides shared npm scripts for root packages
|
|
6
|
+
*
|
|
7
|
+
* 此模組被 root-scripts 和 ws-root-scripts 共用
|
|
8
|
+
* This module is shared by root-scripts and ws-root-scripts
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* 共享根目錄預設腳本 / Shared root default scripts
|
|
12
|
+
*
|
|
13
|
+
* 適用於所有根目錄類型的通用管理腳本
|
|
14
|
+
* General management scripts for all root package types
|
|
15
|
+
*
|
|
16
|
+
* @returns 包含共享根目錄腳本的物件 / Object containing shared root scripts
|
|
17
|
+
*
|
|
18
|
+
* 包含腳本 / Includes scripts:
|
|
19
|
+
* - ci:install: CI 環境安裝與依賴設定 / CI environment install and dependency setup
|
|
20
|
+
* - test:jest:clearCache: 清除 Jest 快取 / Clear Jest cache
|
|
21
|
+
* - install:resetLockfile: 重置鎖定檔安裝 / Install with reset lockfile
|
|
22
|
+
* - install:frozenLockfile: 凍結鎖定檔安裝 / Install with frozen lockfile
|
|
23
|
+
* - ws:fix-all: 修復所有工作區問題 / Fix all workspace issues
|
|
24
|
+
* - ws:fix-all:resetStaticFiles: 修復並重置靜態檔 / Fix and reset static files
|
|
25
|
+
*/
|
|
1
26
|
export declare function defaultSharedRootScripts(): {
|
|
27
|
+
/**
|
|
28
|
+
* CI 環境安裝腳本 / CI environment install script
|
|
29
|
+
*
|
|
30
|
+
* 安裝核心開發工具:yarn-tool、lerna、ynpx、ts-node、ts-jest、jest、typescript、jest-config、tsx、pnpm
|
|
31
|
+
* Installs core development tools
|
|
32
|
+
*/
|
|
2
33
|
"ci:install": string;
|
|
34
|
+
/** 清除 Jest 快取 / Clear Jest cache */
|
|
3
35
|
"test:jest:clearCache": string;
|
|
36
|
+
/** 重置鎖定檔安裝 / Install with reset lockfile */
|
|
4
37
|
"install:resetLockfile": string;
|
|
38
|
+
/** 凍結鎖定檔安裝 / Install with frozen lockfile */
|
|
5
39
|
"install:frozenLockfile": string;
|
|
40
|
+
/** 修復所有工作區問題 / Fix all workspace issues */
|
|
6
41
|
"ws:fix-all": string;
|
|
42
|
+
/** 修復並重置靜態檔 / Fix and reset static files */
|
|
7
43
|
"ws:fix-all:resetStaticFiles": string;
|
|
8
44
|
};
|
|
@@ -1,8 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 共享根目錄腳本預設 / Shared Root Scripts Preset
|
|
4
|
+
*
|
|
5
|
+
* 提供根目錄套件共用的預設 npm scripts
|
|
6
|
+
* Provides shared npm scripts for root packages
|
|
7
|
+
*
|
|
8
|
+
* 此模組被 root-scripts 和 ws-root-scripts 共用
|
|
9
|
+
* This module is shared by root-scripts and ws-root-scripts
|
|
10
|
+
*/
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.defaultSharedRootScripts = defaultSharedRootScripts;
|
|
13
|
+
/**
|
|
14
|
+
* 共享根目錄預設腳本 / Shared root default scripts
|
|
15
|
+
*
|
|
16
|
+
* 適用於所有根目錄類型的通用管理腳本
|
|
17
|
+
* General management scripts for all root package types
|
|
18
|
+
*
|
|
19
|
+
* @returns 包含共享根目錄腳本的物件 / Object containing shared root scripts
|
|
20
|
+
*
|
|
21
|
+
* 包含腳本 / Includes scripts:
|
|
22
|
+
* - ci:install: CI 環境安裝與依賴設定 / CI environment install and dependency setup
|
|
23
|
+
* - test:jest:clearCache: 清除 Jest 快取 / Clear Jest cache
|
|
24
|
+
* - install:resetLockfile: 重置鎖定檔安裝 / Install with reset lockfile
|
|
25
|
+
* - install:frozenLockfile: 凍結鎖定檔安裝 / Install with frozen lockfile
|
|
26
|
+
* - ws:fix-all: 修復所有工作區問題 / Fix all workspace issues
|
|
27
|
+
* - ws:fix-all:resetStaticFiles: 修復並重置靜態檔 / Fix and reset static files
|
|
28
|
+
*/
|
|
4
29
|
function defaultSharedRootScripts() {
|
|
5
30
|
return {
|
|
31
|
+
/**
|
|
32
|
+
* CI 環境安裝腳本 / CI environment install script
|
|
33
|
+
*
|
|
34
|
+
* 安裝核心開發工具:yarn-tool、lerna、ynpx、ts-node、ts-jest、jest、typescript、jest-config、tsx、pnpm
|
|
35
|
+
* Installs core development tools
|
|
36
|
+
*/
|
|
6
37
|
"ci:install": `yarn install --frozen-lockfile && yarn add -W ${[
|
|
7
38
|
"yarn-tool",
|
|
8
39
|
"lerna@6",
|
|
@@ -13,12 +44,18 @@ function defaultSharedRootScripts() {
|
|
|
13
44
|
"typescript@next",
|
|
14
45
|
'@bluelovers/jest-config',
|
|
15
46
|
'tsx',
|
|
47
|
+
'pnpm',
|
|
16
48
|
].join(" ")}`,
|
|
49
|
+
/** 清除 Jest 快取 / Clear Jest cache */
|
|
17
50
|
"test:jest:clearCache": "jest --clearCache",
|
|
51
|
+
/** 重置鎖定檔安裝 / Install with reset lockfile */
|
|
18
52
|
"install:resetLockfile": "yarn-tool install --reset-lockfile",
|
|
53
|
+
/** 凍結鎖定檔安裝 / Install with frozen lockfile */
|
|
19
54
|
"install:frozenLockfile": "yarn-tool install --frozen-lockfile",
|
|
55
|
+
/** 修復所有工作區問題 / Fix all workspace issues */
|
|
20
56
|
"ws:fix-all": "yarn-tool fix-all --overwriteHostedGitInfo",
|
|
21
|
-
|
|
57
|
+
/** 修復並重置靜態檔 / Fix and reset static files */
|
|
58
|
+
"ws:fix-all:resetStaticFiles": "node --run ws:fix-all -- --resetStaticFiles",
|
|
22
59
|
};
|
|
23
60
|
}
|
|
24
61
|
//# sourceMappingURL=shared-root-scripts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-root-scripts.js","sourceRoot":"","sources":["shared-root-scripts.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"shared-root-scripts.js","sourceRoot":"","sources":["shared-root-scripts.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAkBH,4DAqCC;AArDD;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,wBAAwB;IAEvC,OAAO;QACN;;;;;WAKG;QACH,YAAY,EAAE,iDAAiD;YAC9D,WAAW;YACX,SAAS;YACT,MAAM;YACN,SAAS;YACT,SAAS;YACT,MAAM;YACN,iBAAiB;YACjB,yBAAyB;YACzB,KAAK;YACL,MAAM;SACN,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAEb,oCAAoC;QACpC,sBAAsB,EAAE,mBAAmB;QAE3C,4CAA4C;QAC5C,uBAAuB,EAAE,oCAAoC;QAE7D,6CAA6C;QAC7C,wBAAwB,EAAE,qCAAqC;QAE/D,2CAA2C;QAC3C,YAAY,EAAE,6CAA6C;QAE3D,4CAA4C;QAC5C,6BAA6B,EAAE,6CAA6C;KAC5E,CAAA;AACF,CAAC","sourcesContent":["/**\n * 共享根目錄腳本預設 / Shared Root Scripts Preset\n *\n * 提供根目錄套件共用的預設 npm scripts\n * Provides shared npm scripts for root packages\n *\n * 此模組被 root-scripts 和 ws-root-scripts 共用\n * This module is shared by root-scripts and ws-root-scripts\n */\n\n/**\n * 共享根目錄預設腳本 / Shared root default scripts\n *\n * 適用於所有根目錄類型的通用管理腳本\n * General management scripts for all root package types\n *\n * @returns 包含共享根目錄腳本的物件 / Object containing shared root scripts\n *\n * 包含腳本 / Includes scripts:\n * - ci:install: CI 環境安裝與依賴設定 / CI environment install and dependency setup\n * - test:jest:clearCache: 清除 Jest 快取 / Clear Jest cache\n * - install:resetLockfile: 重置鎖定檔安裝 / Install with reset lockfile\n * - install:frozenLockfile: 凍結鎖定檔安裝 / Install with frozen lockfile\n * - ws:fix-all: 修復所有工作區問題 / Fix all workspace issues\n * - ws:fix-all:resetStaticFiles: 修復並重置靜態檔 / Fix and reset static files\n */\nexport function defaultSharedRootScripts()\n{\n\treturn {\n\t\t/**\n\t\t * CI 環境安裝腳本 / CI environment install script\n\t\t *\n\t\t * 安裝核心開發工具:yarn-tool、lerna、ynpx、ts-node、ts-jest、jest、typescript、jest-config、tsx、pnpm\n\t\t * Installs core development tools\n\t\t */\n\t\t\"ci:install\": `yarn install --frozen-lockfile && yarn add -W ${[\n\t\t\t\"yarn-tool\",\n\t\t\t\"lerna@6\",\n\t\t\t\"ynpx\",\n\t\t\t\"ts-node\",\n\t\t\t\"ts-jest\",\n\t\t\t\"jest\",\n\t\t\t\"typescript@next\",\n\t\t\t'@bluelovers/jest-config',\n\t\t\t'tsx',\n\t\t\t'pnpm',\n\t\t].join(\" \")}`,\n\n\t\t/** 清除 Jest 快取 / Clear Jest cache */\n\t\t\"test:jest:clearCache\": \"jest --clearCache\",\n\n\t\t/** 重置鎖定檔安裝 / Install with reset lockfile */\n\t\t\"install:resetLockfile\": \"yarn-tool install --reset-lockfile\",\n\n\t\t/** 凍結鎖定檔安裝 / Install with frozen lockfile */\n\t\t\"install:frozenLockfile\": \"yarn-tool install --frozen-lockfile\",\n\n\t\t/** 修復所有工作區問題 / Fix all workspace issues */\n\t\t\"ws:fix-all\": \"yarn-tool fix-all --overwriteHostedGitInfo\",\n\n\t\t/** 修復並重置靜態檔 / Fix and reset static files */\n\t\t\"ws:fix-all:resetStaticFiles\": \"node --run ws:fix-all -- --resetStaticFiles\",\n\t}\n}\n"]}
|
|
@@ -1,22 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 工作區根目錄腳本預設 / Workspace Root Scripts Preset
|
|
3
|
+
*
|
|
4
|
+
* 提供 Yarn/Lerna 工作區根目錄的預設 npm scripts
|
|
5
|
+
* Provides default npm scripts for Yarn/Lerna workspace root
|
|
6
|
+
*/
|
|
1
7
|
import { EnumScriptsEntry } from '../../field/scripts';
|
|
8
|
+
/**
|
|
9
|
+
* 產生「全部執行」與「僅變更執行」腳本對 / Generate "all" and "since" script pairs
|
|
10
|
+
*
|
|
11
|
+
* 為指定腳本名稱產生對應的 `:all`(全部工作區)與 `:since`(僅變更)版本
|
|
12
|
+
* Generates corresponding `:all` (all workspaces) and `:since` (changed only) versions
|
|
13
|
+
*
|
|
14
|
+
* @template T - 基礎腳本名稱 / Base script name
|
|
15
|
+
* @param script - 基礎腳本名稱 / Base script name
|
|
16
|
+
* @returns 包含 all 與 since 變體的腳本物件 / Object containing all and since variants
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* _runAllOrSince('test')
|
|
21
|
+
* // 返回: { 'test:all': 'yarn-tool ws run test --concurrency 1', 'test:since': 'node --run test:all -- --since' }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
2
24
|
export declare function _runAllOrSince<T extends string>(script: T): ({ [x in `${T}:all`]: string; } & { [y in `${T}:since`]: string; });
|
|
25
|
+
/**
|
|
26
|
+
* 工作區根目錄預設腳本 / Default scripts for workspace root
|
|
27
|
+
*
|
|
28
|
+
* 適用於 monorepo 工作區根目錄的完整管理腳本集合
|
|
29
|
+
* Complete management script set for monorepo workspace root
|
|
30
|
+
*
|
|
31
|
+
* @returns 包含工作區管理腳本的物件 / Object containing workspace management scripts
|
|
32
|
+
*
|
|
33
|
+
* 核心功能 / Core features:
|
|
34
|
+
* - 跨工作區腳本執行(全部或僅變更)/ Cross-workspace script execution (all or changed only)
|
|
35
|
+
* - Lerna 發布流程 / Lerna publishing workflow
|
|
36
|
+
* - 發布前檢查與準備 / Pre-publish checks and preparation
|
|
37
|
+
* - 相依工作區連結修復 / Dependency workspace links fixing
|
|
38
|
+
* - 統一依賴更新 / Unified dependency updates
|
|
39
|
+
* - 發布後變更日誌更新 / Post-publish changelog updates
|
|
40
|
+
*
|
|
41
|
+
* 包含腳本 / Includes scripts:
|
|
42
|
+
* - test: 執行變更工作區測試 / Run changed workspaces tests
|
|
43
|
+
* - test:all|test:since: 全部/變更測試 / All/changed tests
|
|
44
|
+
* - test:tsd:all|test:tsd:since: 型別檢查 / Type checking
|
|
45
|
+
* - test:snapshot:all|test:snapshot:since: 快照更新 / Snapshot updates
|
|
46
|
+
* - build:all|build:since: 建構 / Build
|
|
47
|
+
* - review:all|review:since: 審查 / Review
|
|
48
|
+
* - coverage:all|coverage:since: 覆蓋率 / Coverage
|
|
49
|
+
* - lint:all|lint:since: 檢查 / Lint
|
|
50
|
+
* - preversion: 版本更新前測試 / Pre-version test
|
|
51
|
+
* - postversion: 版本更新後修復 / Post-version fix
|
|
52
|
+
* - lerna:publish: Lerna 發布 / Lerna publish
|
|
53
|
+
* - lerna:publish:yes|lerna:publish:yes:force: 確認發布 / Confirmed publish
|
|
54
|
+
* - lerna:publish:yes:patch|minor|major: 特定版本發布 / Specific version publish
|
|
55
|
+
* - prepublishOnly:root: 發布前檢查與修復 / Pre-publish checks and fixes
|
|
56
|
+
* - prepublishOnly:lockfile: 鎖定檔同步 / Lockfile sync
|
|
57
|
+
* - prepublishOnly:check-bin: 二進位檔檢查 / Binary check
|
|
58
|
+
* - prepare:fix-ws-links: 工作區連結修復 / Workspace links fix
|
|
59
|
+
* - prepublishOnly:update: 發布前更新 / Pre-publish update
|
|
60
|
+
* - ncu:root|ncu:ws: 根目錄/工作區依賴更新 / Root/workspace dependency updates
|
|
61
|
+
* - sort-package-json:root|sort-package-json:ws: package.json 排序 / package.json sorting
|
|
62
|
+
* - postpublishOnly: 發布後執行 / Post-publish execution
|
|
63
|
+
* - postpublishOnly:ws-root-changelog: 根目錄變更日誌更新 / Root changelog update
|
|
64
|
+
* - tsc:showConfig: TypeScript 設定顯示 / TypeScript config display
|
|
65
|
+
*/
|
|
3
66
|
export declare function defaultWorkspaceRootScripts(): {
|
|
67
|
+
/** 發布前檢查與修復 / Pre-publish checks and fixes */
|
|
4
68
|
"prepublishOnly:root": string;
|
|
69
|
+
/** 鎖定檔同步 / Lockfile sync */
|
|
5
70
|
"prepublishOnly:lockfile": string;
|
|
71
|
+
/** 二進位檔檢查 / Binary check */
|
|
6
72
|
"prepublishOnly:check-bin": string;
|
|
73
|
+
/** 工作區連結修復 / Workspace links fix */
|
|
7
74
|
"prepare:fix-ws-links": string;
|
|
75
|
+
/** 發布前更新 / Pre-publish update */
|
|
8
76
|
"prepublishOnly:update": string;
|
|
77
|
+
/** 依賴更新 / Dependency updates */
|
|
9
78
|
ncu: string;
|
|
10
79
|
"ncu:root": string;
|
|
11
80
|
"ncu:ws": string;
|
|
81
|
+
/** package.json 排序 / package.json sorting */
|
|
12
82
|
"sort-package-json": string;
|
|
13
83
|
"sort-package-json:root": string;
|
|
14
84
|
"sort-package-json:ws": string;
|
|
85
|
+
/** 發布後執行 / Post-publish execution */
|
|
15
86
|
postpublishOnly: string;
|
|
87
|
+
/** 根目錄變更日誌更新 / Root changelog update */
|
|
16
88
|
"postpublishOnly:ws-root-changelog": string;
|
|
89
|
+
/** TypeScript 設定顯示 / TypeScript config display */
|
|
17
90
|
"tsc:showConfig": string;
|
|
91
|
+
/** 版本更新前測試 / Test before version bump */
|
|
18
92
|
preversion: EnumScriptsEntry;
|
|
93
|
+
/** 版本更新後修復 / Fix after version bump */
|
|
19
94
|
postversion: string;
|
|
95
|
+
/** Lerna 發布 / Lerna publish */
|
|
20
96
|
"lerna:publish": string;
|
|
21
97
|
"lint:all": string;
|
|
22
98
|
"lint:since": string;
|
|
@@ -1,27 +1,97 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 工作區根目錄腳本預設 / Workspace Root Scripts Preset
|
|
4
|
+
*
|
|
5
|
+
* 提供 Yarn/Lerna 工作區根目錄的預設 npm scripts
|
|
6
|
+
* Provides default npm scripts for Yarn/Lerna workspace root
|
|
7
|
+
*/
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports._runAllOrSince = _runAllOrSince;
|
|
4
10
|
exports.defaultWorkspaceRootScripts = defaultWorkspaceRootScripts;
|
|
5
11
|
const shared_root_scripts_1 = require("./shared-root-scripts");
|
|
12
|
+
/**
|
|
13
|
+
* 產生「全部執行」與「僅變更執行」腳本對 / Generate "all" and "since" script pairs
|
|
14
|
+
*
|
|
15
|
+
* 為指定腳本名稱產生對應的 `:all`(全部工作區)與 `:since`(僅變更)版本
|
|
16
|
+
* Generates corresponding `:all` (all workspaces) and `:since` (changed only) versions
|
|
17
|
+
*
|
|
18
|
+
* @template T - 基礎腳本名稱 / Base script name
|
|
19
|
+
* @param script - 基礎腳本名稱 / Base script name
|
|
20
|
+
* @returns 包含 all 與 since 變體的腳本物件 / Object containing all and since variants
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* _runAllOrSince('test')
|
|
25
|
+
* // 返回: { 'test:all': 'yarn-tool ws run test --concurrency 1', 'test:since': 'node --run test:all -- --since' }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
6
28
|
function _runAllOrSince(script) {
|
|
7
29
|
const all = `${script}:all`;
|
|
8
30
|
const since = `${script}:since`;
|
|
9
31
|
return {
|
|
10
32
|
[all]: `yarn-tool ws run ${script} --concurrency 1`,
|
|
11
|
-
[since]: `
|
|
33
|
+
[since]: `node --run ${script}:all -- --since`,
|
|
12
34
|
};
|
|
13
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* 工作區根目錄預設腳本 / Default scripts for workspace root
|
|
38
|
+
*
|
|
39
|
+
* 適用於 monorepo 工作區根目錄的完整管理腳本集合
|
|
40
|
+
* Complete management script set for monorepo workspace root
|
|
41
|
+
*
|
|
42
|
+
* @returns 包含工作區管理腳本的物件 / Object containing workspace management scripts
|
|
43
|
+
*
|
|
44
|
+
* 核心功能 / Core features:
|
|
45
|
+
* - 跨工作區腳本執行(全部或僅變更)/ Cross-workspace script execution (all or changed only)
|
|
46
|
+
* - Lerna 發布流程 / Lerna publishing workflow
|
|
47
|
+
* - 發布前檢查與準備 / Pre-publish checks and preparation
|
|
48
|
+
* - 相依工作區連結修復 / Dependency workspace links fixing
|
|
49
|
+
* - 統一依賴更新 / Unified dependency updates
|
|
50
|
+
* - 發布後變更日誌更新 / Post-publish changelog updates
|
|
51
|
+
*
|
|
52
|
+
* 包含腳本 / Includes scripts:
|
|
53
|
+
* - test: 執行變更工作區測試 / Run changed workspaces tests
|
|
54
|
+
* - test:all|test:since: 全部/變更測試 / All/changed tests
|
|
55
|
+
* - test:tsd:all|test:tsd:since: 型別檢查 / Type checking
|
|
56
|
+
* - test:snapshot:all|test:snapshot:since: 快照更新 / Snapshot updates
|
|
57
|
+
* - build:all|build:since: 建構 / Build
|
|
58
|
+
* - review:all|review:since: 審查 / Review
|
|
59
|
+
* - coverage:all|coverage:since: 覆蓋率 / Coverage
|
|
60
|
+
* - lint:all|lint:since: 檢查 / Lint
|
|
61
|
+
* - preversion: 版本更新前測試 / Pre-version test
|
|
62
|
+
* - postversion: 版本更新後修復 / Post-version fix
|
|
63
|
+
* - lerna:publish: Lerna 發布 / Lerna publish
|
|
64
|
+
* - lerna:publish:yes|lerna:publish:yes:force: 確認發布 / Confirmed publish
|
|
65
|
+
* - lerna:publish:yes:patch|minor|major: 特定版本發布 / Specific version publish
|
|
66
|
+
* - prepublishOnly:root: 發布前檢查與修復 / Pre-publish checks and fixes
|
|
67
|
+
* - prepublishOnly:lockfile: 鎖定檔同步 / Lockfile sync
|
|
68
|
+
* - prepublishOnly:check-bin: 二進位檔檢查 / Binary check
|
|
69
|
+
* - prepare:fix-ws-links: 工作區連結修復 / Workspace links fix
|
|
70
|
+
* - prepublishOnly:update: 發布前更新 / Pre-publish update
|
|
71
|
+
* - ncu:root|ncu:ws: 根目錄/工作區依賴更新 / Root/workspace dependency updates
|
|
72
|
+
* - sort-package-json:root|sort-package-json:ws: package.json 排序 / package.json sorting
|
|
73
|
+
* - postpublishOnly: 發布後執行 / Post-publish execution
|
|
74
|
+
* - postpublishOnly:ws-root-changelog: 根目錄變更日誌更新 / Root changelog update
|
|
75
|
+
* - tsc:showConfig: TypeScript 設定顯示 / TypeScript config display
|
|
76
|
+
*/
|
|
14
77
|
function defaultWorkspaceRootScripts() {
|
|
78
|
+
/**
|
|
79
|
+
* 產生 Lerna 版本遞增與發布命令 / Generate Lerna version bump and publish command
|
|
80
|
+
*
|
|
81
|
+
* @param bump - 版本遞增類型(patch|minor|major)/ Version bump type
|
|
82
|
+
* @returns 組合命令字串 / Combined command string
|
|
83
|
+
*/
|
|
15
84
|
const bumpVersion = (bump) => {
|
|
16
85
|
return [
|
|
17
|
-
`
|
|
86
|
+
`node --run prepublishOnly:root`,
|
|
18
87
|
`lerna publish --no-private` + (bump ? ` --yes --bump ${bump}` : ''),
|
|
19
88
|
`yarn run postpublishOnly`,
|
|
20
89
|
].join(' && ');
|
|
21
90
|
};
|
|
22
91
|
return {
|
|
23
92
|
...(0, shared_root_scripts_1.defaultSharedRootScripts)(),
|
|
24
|
-
"test": "
|
|
93
|
+
"test": "node --run test:since",
|
|
94
|
+
// 動態產生 all/since 腳本對 / Dynamically generate all/since script pairs
|
|
25
95
|
..._runAllOrSince('test'),
|
|
26
96
|
..._runAllOrSince('test:tsd'),
|
|
27
97
|
..._runAllOrSince('test:snapshot'),
|
|
@@ -29,33 +99,48 @@ function defaultWorkspaceRootScripts() {
|
|
|
29
99
|
..._runAllOrSince('review'),
|
|
30
100
|
..._runAllOrSince('coverage'),
|
|
31
101
|
..._runAllOrSince('lint'),
|
|
102
|
+
/** 版本更新前測試 / Test before version bump */
|
|
32
103
|
"preversion": "yarn run test" /* EnumScriptsEntry.preversion */,
|
|
104
|
+
/** 版本更新後修復 / Fix after version bump */
|
|
33
105
|
"postversion": "yarn-tool fix-all",
|
|
106
|
+
/** Lerna 發布 / Lerna publish */
|
|
34
107
|
"lerna:publish": bumpVersion(),
|
|
108
|
+
// 動態產生各類版本發布腳本 / Dynamically generate version publish scripts
|
|
35
109
|
...[
|
|
36
110
|
'patch',
|
|
37
111
|
'minor',
|
|
38
112
|
'major',
|
|
39
113
|
].reduce((a, bump, idx) => {
|
|
40
114
|
if (idx === 0) {
|
|
41
|
-
a[`lerna:publish:yes`] = `
|
|
115
|
+
a[`lerna:publish:yes`] = `node --run lerna:publish:yes:${bump}`;
|
|
116
|
+
a[`lerna:publish:yes:force`] = `node --run lerna:publish:yes:${bump} -- --force-publish`;
|
|
42
117
|
}
|
|
43
118
|
a[`lerna:publish:yes:${bump}`] = bumpVersion(bump);
|
|
44
119
|
return a;
|
|
45
120
|
}, {}),
|
|
46
|
-
|
|
121
|
+
/** 發布前檢查與修復 / Pre-publish checks and fixes */
|
|
122
|
+
"prepublishOnly:root": "node --run prepublishOnly:check-bin && node --run prepare:fix-ws-links",
|
|
123
|
+
/** 鎖定檔同步 / Lockfile sync */
|
|
47
124
|
"prepublishOnly:lockfile": "ynpx --quiet sync-lockfile",
|
|
125
|
+
/** 二進位檔檢查 / Binary check */
|
|
48
126
|
"prepublishOnly:check-bin": "ynpx --quiet @yarn-tool/check-pkg-bin",
|
|
127
|
+
/** 工作區連結修復 / Workspace links fix */
|
|
49
128
|
"prepare:fix-ws-links": "ynpx --quiet @yarn-tool/fix-ws-links",
|
|
129
|
+
/** 發布前更新 / Pre-publish update */
|
|
50
130
|
"prepublishOnly:update": "yarn run ncu && yarn run sort-package-json",
|
|
51
|
-
|
|
131
|
+
/** 依賴更新 / Dependency updates */
|
|
132
|
+
"ncu": "node --run ncu:ws",
|
|
52
133
|
"ncu:root": "yarn-tool ncu -u",
|
|
53
134
|
"ncu:ws": "yarn-tool ncu -u --AA",
|
|
54
|
-
|
|
135
|
+
/** package.json 排序 / package.json sorting */
|
|
136
|
+
"sort-package-json": "node --run sort-package-json:root && node --run sort-package-json:ws",
|
|
55
137
|
"sort-package-json:root": "yarn-tool sort",
|
|
56
138
|
"sort-package-json:ws": "yarn-tool ws sort",
|
|
57
|
-
|
|
139
|
+
/** 發布後執行 / Post-publish execution */
|
|
140
|
+
"postpublishOnly": "node --run postpublishOnly:ws-root-changelog & echo postpublishOnly",
|
|
141
|
+
/** 根目錄變更日誌更新 / Root changelog update */
|
|
58
142
|
"postpublishOnly:ws-root-changelog": "ynpx ws-root-changelog & git add ./CHANGELOG.md & git commit ./CHANGELOG.md -m \"chore(changelog): update changelog toc in workspaces root\" & echo update changelog toc in workspaces root",
|
|
143
|
+
/** TypeScript 設定顯示 / TypeScript config display */
|
|
59
144
|
"tsc:showConfig": "ynpx get-current-tsconfig -p",
|
|
60
145
|
};
|
|
61
146
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws-root-scripts.js","sourceRoot":"","sources":["ws-root-scripts.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"ws-root-scripts.js","sourceRoot":"","sources":["ws-root-scripts.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAqBH,wCAaC;AA2CD,kEAwFC;AAnKD,+DAAiE;AAGjE;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,cAAc,CAAmB,MAAS;IAEzD,MAAM,GAAG,GAAG,GAAG,MAAM,MAAe,CAAC;IACrC,MAAM,KAAK,GAAG,GAAG,MAAM,QAAiB,CAAC;IAEzC,OAAO;QACN,CAAC,GAAG,CAAC,EAAE,oBAAoB,MAAM,kBAAkB;QACnD,CAAC,KAAK,CAAC,EAAE,cAAc,MAAM,iBAAiB;KAK7C,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,SAAgB,2BAA2B;IAE1C;;;;;OAKG;IACH,MAAM,WAAW,GAAG,CAAC,IAAkC,EAAE,EAAE;QAC1D,OAAO;YACN,gCAAgC;YAChC,4BAA4B,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACpE,0BAA0B;SAC1B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACf,CAAC,CAAA;IAED,OAAO;QACN,GAAG,IAAA,8CAAwB,GAAE;QAE7B,MAAM,EAAE,uBAAuB;QAE/B,mEAAmE;QACnE,GAAG,cAAc,CAAC,MAAM,CAAC;QACzB,GAAG,cAAc,CAAC,UAAU,CAAC;QAC7B,GAAG,cAAc,CAAC,eAAe,CAAC;QAClC,GAAG,cAAc,CAAC,OAAO,CAAC;QAC1B,GAAG,cAAc,CAAC,QAAQ,CAAC;QAC3B,GAAG,cAAc,CAAC,UAAU,CAAC;QAC7B,GAAG,cAAc,CAAC,MAAM,CAAC;QAEzB,yCAAyC;QACzC,YAAY,mDAA6B;QAEzC,uCAAuC;QACvC,aAAa,EAAE,mBAAmB;QAElC,+BAA+B;QAC/B,eAAe,EAAE,WAAW,EAAE;QAE9B,8DAA8D;QAC9D,GAAI;YACH,OAAO;YACP,OAAO;YACP,OAAO;SACG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;YACnC,IAAI,GAAG,KAAK,CAAC,EACb,CAAC;gBACA,CAAC,CAAC,mBAAmB,CAAC,GAAG,gCAAgC,IAAI,EAAE,CAAC;gBAChE,CAAC,CAAC,yBAAyB,CAAC,GAAG,gCAAgC,IAAI,qBAAqB,CAAC;YAC1F,CAAC;YACD,CAAC,CAAC,qBAAqB,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;YACnD,OAAO,CAAC,CAAA;QACT,CAAC,EAAE,EAA4B,CAAC;QAEhC,8CAA8C;QAC9C,qBAAqB,EAAE,wEAAwE;QAE/F,4BAA4B;QAC5B,yBAAyB,EAAE,4BAA4B;QAEvD,4BAA4B;QAC5B,0BAA0B,EAAE,uCAAuC;QAEnE,oCAAoC;QACpC,sBAAsB,EAAE,sCAAsC;QAE9D,iCAAiC;QACjC,uBAAuB,EAAE,4CAA4C;QAErE,gCAAgC;QAChC,KAAK,EAAE,mBAAmB;QAC1B,UAAU,EAAE,kBAAkB;QAC9B,QAAQ,EAAE,uBAAuB;QAEjC,6CAA6C;QAC7C,mBAAmB,EAAE,sEAAsE;QAC3F,wBAAwB,EAAE,gBAAgB;QAC1C,sBAAsB,EAAE,mBAAmB;QAE3C,qCAAqC;QACrC,iBAAiB,EAAE,qEAAqE;QAExF,wCAAwC;QACxC,mCAAmC,EAAE,6LAA6L;QAElO,kDAAkD;QAClD,gBAAgB,EAAE,8BAA8B;KAChD,CAAA;AACF,CAAC","sourcesContent":["/**\n * 工作區根目錄腳本預設 / Workspace Root Scripts Preset\n *\n * 提供 Yarn/Lerna 工作區根目錄的預設 npm scripts\n * Provides default npm scripts for Yarn/Lerna workspace root\n */\n\nimport { defaultSharedRootScripts } from './shared-root-scripts';\nimport { EnumScriptsEntry } from '../../field/scripts';\n\n/**\n * 產生「全部執行」與「僅變更執行」腳本對 / Generate \"all\" and \"since\" script pairs\n *\n * 為指定腳本名稱產生對應的 `:all`(全部工作區)與 `:since`(僅變更)版本\n * Generates corresponding `:all` (all workspaces) and `:since` (changed only) versions\n *\n * @template T - 基礎腳本名稱 / Base script name\n * @param script - 基礎腳本名稱 / Base script name\n * @returns 包含 all 與 since 變體的腳本物件 / Object containing all and since variants\n *\n * @example\n * ```typescript\n * _runAllOrSince('test')\n * // 返回: { 'test:all': 'yarn-tool ws run test --concurrency 1', 'test:since': 'node --run test:all -- --since' }\n * ```\n */\nexport function _runAllOrSince<T extends string>(script: T)\n{\n\tconst all = `${script}:all` as const;\n\tconst since = `${script}:since` as const;\n\n\treturn {\n\t\t[all]: `yarn-tool ws run ${script} --concurrency 1`,\n\t\t[since]: `node --run ${script}:all -- --since`,\n\t} as ({\n\t\t[x in `${T}:all`]: string;\n\t} & {\n\t\t[y in `${T}:since`]: string;\n\t})\n}\n\n/**\n * 工作區根目錄預設腳本 / Default scripts for workspace root\n *\n * 適用於 monorepo 工作區根目錄的完整管理腳本集合\n * Complete management script set for monorepo workspace root\n *\n * @returns 包含工作區管理腳本的物件 / Object containing workspace management scripts\n *\n * 核心功能 / Core features:\n * - 跨工作區腳本執行(全部或僅變更)/ Cross-workspace script execution (all or changed only)\n * - Lerna 發布流程 / Lerna publishing workflow\n * - 發布前檢查與準備 / Pre-publish checks and preparation\n * - 相依工作區連結修復 / Dependency workspace links fixing\n * - 統一依賴更新 / Unified dependency updates\n * - 發布後變更日誌更新 / Post-publish changelog updates\n *\n * 包含腳本 / Includes scripts:\n * - test: 執行變更工作區測試 / Run changed workspaces tests\n * - test:all|test:since: 全部/變更測試 / All/changed tests\n * - test:tsd:all|test:tsd:since: 型別檢查 / Type checking\n * - test:snapshot:all|test:snapshot:since: 快照更新 / Snapshot updates\n * - build:all|build:since: 建構 / Build\n * - review:all|review:since: 審查 / Review\n * - coverage:all|coverage:since: 覆蓋率 / Coverage\n * - lint:all|lint:since: 檢查 / Lint\n * - preversion: 版本更新前測試 / Pre-version test\n * - postversion: 版本更新後修復 / Post-version fix\n * - lerna:publish: Lerna 發布 / Lerna publish\n * - lerna:publish:yes|lerna:publish:yes:force: 確認發布 / Confirmed publish\n * - lerna:publish:yes:patch|minor|major: 特定版本發布 / Specific version publish\n * - prepublishOnly:root: 發布前檢查與修復 / Pre-publish checks and fixes\n * - prepublishOnly:lockfile: 鎖定檔同步 / Lockfile sync\n * - prepublishOnly:check-bin: 二進位檔檢查 / Binary check\n * - prepare:fix-ws-links: 工作區連結修復 / Workspace links fix\n * - prepublishOnly:update: 發布前更新 / Pre-publish update\n * - ncu:root|ncu:ws: 根目錄/工作區依賴更新 / Root/workspace dependency updates\n * - sort-package-json:root|sort-package-json:ws: package.json 排序 / package.json sorting\n * - postpublishOnly: 發布後執行 / Post-publish execution\n * - postpublishOnly:ws-root-changelog: 根目錄變更日誌更新 / Root changelog update\n * - tsc:showConfig: TypeScript 設定顯示 / TypeScript config display\n */\nexport function defaultWorkspaceRootScripts()\n{\n\t/**\n\t * 產生 Lerna 版本遞增與發布命令 / Generate Lerna version bump and publish command\n\t *\n\t * @param bump - 版本遞增類型(patch|minor|major)/ Version bump type\n\t * @returns 組合命令字串 / Combined command string\n\t */\n\tconst bumpVersion = (bump?: 'major' | 'minor' | 'patch') => {\n\t\treturn [\n\t\t\t`node --run prepublishOnly:root`,\n\t\t\t`lerna publish --no-private` + (bump ? ` --yes --bump ${bump}` : ''),\n\t\t\t`yarn run postpublishOnly`,\n\t\t].join(' && ')\n\t}\n\n\treturn {\n\t\t...defaultSharedRootScripts(),\n\n\t\t\"test\": \"node --run test:since\",\n\n\t\t// 動態產生 all/since 腳本對 / Dynamically generate all/since script pairs\n\t\t..._runAllOrSince('test'),\n\t\t..._runAllOrSince('test:tsd'),\n\t\t..._runAllOrSince('test:snapshot'),\n\t\t..._runAllOrSince('build'),\n\t\t..._runAllOrSince('review'),\n\t\t..._runAllOrSince('coverage'),\n\t\t..._runAllOrSince('lint'),\n\n\t\t/** 版本更新前測試 / Test before version bump */\n\t\t\"preversion\": EnumScriptsEntry.preversion,\n\n\t\t/** 版本更新後修復 / Fix after version bump */\n\t\t\"postversion\": \"yarn-tool fix-all\",\n\n\t\t/** Lerna 發布 / Lerna publish */\n\t\t\"lerna:publish\": bumpVersion(),\n\n\t\t// 動態產生各類版本發布腳本 / Dynamically generate version publish scripts\n\t\t...([\n\t\t\t'patch',\n\t\t\t'minor',\n\t\t\t'major',\n\t\t] as const).reduce((a, bump, idx) => {\n\t\t\tif (idx === 0)\n\t\t\t{\n\t\t\t\ta[`lerna:publish:yes`] = `node --run lerna:publish:yes:${bump}`;\n\t\t\t\ta[`lerna:publish:yes:force`] = `node --run lerna:publish:yes:${bump} -- --force-publish`;\n\t\t\t}\n\t\t\ta[`lerna:publish:yes:${bump}`] = bumpVersion(bump);\n\t\t\treturn a\n\t\t}, {} as Record<string, string>),\n\n\t\t/** 發布前檢查與修復 / Pre-publish checks and fixes */\n\t\t\"prepublishOnly:root\": \"node --run prepublishOnly:check-bin && node --run prepare:fix-ws-links\",\n\n\t\t/** 鎖定檔同步 / Lockfile sync */\n\t\t\"prepublishOnly:lockfile\": \"ynpx --quiet sync-lockfile\",\n\n\t\t/** 二進位檔檢查 / Binary check */\n\t\t\"prepublishOnly:check-bin\": \"ynpx --quiet @yarn-tool/check-pkg-bin\",\n\n\t\t/** 工作區連結修復 / Workspace links fix */\n\t\t\"prepare:fix-ws-links\": \"ynpx --quiet @yarn-tool/fix-ws-links\",\n\n\t\t/** 發布前更新 / Pre-publish update */\n\t\t\"prepublishOnly:update\": \"yarn run ncu && yarn run sort-package-json\",\n\n\t\t/** 依賴更新 / Dependency updates */\n\t\t\"ncu\": \"node --run ncu:ws\",\n\t\t\"ncu:root\": \"yarn-tool ncu -u\",\n\t\t\"ncu:ws\": \"yarn-tool ncu -u --AA\",\n\n\t\t/** package.json 排序 / package.json sorting */\n\t\t\"sort-package-json\": \"node --run sort-package-json:root && node --run sort-package-json:ws\",\n\t\t\"sort-package-json:root\": \"yarn-tool sort\",\n\t\t\"sort-package-json:ws\": \"yarn-tool ws sort\",\n\n\t\t/** 發布後執行 / Post-publish execution */\n\t\t\"postpublishOnly\": \"node --run postpublishOnly:ws-root-changelog & echo postpublishOnly\",\n\n\t\t/** 根目錄變更日誌更新 / Root changelog update */\n\t\t\"postpublishOnly:ws-root-changelog\": \"ynpx ws-root-changelog & git add ./CHANGELOG.md & git commit ./CHANGELOG.md -m \\\"chore(changelog): update changelog toc in workspaces root\\\" & echo update changelog toc in workspaces root\",\n\n\t\t/** TypeScript 設定顯示 / TypeScript config display */\n\t\t\"tsc:showConfig\": \"ynpx get-current-tsconfig -p\",\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarn-tool/pkg-entry-util",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"description": "",
|
|
3
|
+
"version": "3.0.4",
|
|
4
|
+
"description": "用於處理 package.json entry 相關欄位的工具庫,包含 bin、exports、publishConfig 欄位的修復與驗證功能,並提供各類套件的預設 npm scripts(工作區根目錄、一般套件、根目錄套件)/ Utility for handling package.json entry fields including bin, exports, publishConfig fix/verification, plus preset npm scripts for workspace root, regular packages, and root packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"yarn",
|
|
7
7
|
"yarn-tool",
|
|
@@ -15,6 +15,17 @@
|
|
|
15
15
|
"node-modules",
|
|
16
16
|
"packages",
|
|
17
17
|
"package",
|
|
18
|
+
"scripts",
|
|
19
|
+
"preset",
|
|
20
|
+
"npm-scripts",
|
|
21
|
+
"lifecycle",
|
|
22
|
+
"init",
|
|
23
|
+
"npm-init",
|
|
24
|
+
"create-yarn-workspaces",
|
|
25
|
+
"workspace-root",
|
|
26
|
+
"bin",
|
|
27
|
+
"exports",
|
|
28
|
+
"publish-config",
|
|
18
29
|
"create-by-yarn-tool"
|
|
19
30
|
],
|
|
20
31
|
"homepage": "https://github.com/bluelovers/ws-yarn-workspaces/tree/master/packages/@yarn-tool/pkg-entry-util#readme",
|
|
@@ -57,15 +68,14 @@
|
|
|
57
68
|
},
|
|
58
69
|
"dependencies": {
|
|
59
70
|
"@ts-type/package-dts": "^2.0.8",
|
|
60
|
-
"@yarn-tool/find-root": "^2.0.
|
|
61
|
-
"@yarn-tool/resolve-package": "^
|
|
62
|
-
"fs-extra": "^11.
|
|
71
|
+
"@yarn-tool/find-root": "^2.0.16",
|
|
72
|
+
"@yarn-tool/resolve-package": "^3.0.1",
|
|
73
|
+
"fs-extra": "^11.3.3",
|
|
63
74
|
"tslib": ">=2",
|
|
64
|
-
"upath2": "^3.1.
|
|
75
|
+
"upath2": "^3.1.23"
|
|
65
76
|
},
|
|
66
|
-
"packageManager": "yarn@1.22.19",
|
|
67
77
|
"publishConfig": {
|
|
68
78
|
"access": "public"
|
|
69
79
|
},
|
|
70
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "ae9b0817b25b1019ba68c88e541bbffc7d84047c"
|
|
71
81
|
}
|