@yarn-tool/pkg-entry-util 3.0.2 → 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 +58 -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,5 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 處理 package.json publishConfig 欄位的工具模組
|
|
3
|
+
* Utility module for handling package.json publishConfig field
|
|
4
|
+
*/
|
|
1
5
|
import { IPackageJson } from '@ts-type/package-dts/package-json';
|
|
2
6
|
import { IPackageJsonPublishConfig } from '@ts-type/package-dts/lib/package-json/types';
|
|
7
|
+
/**
|
|
8
|
+
* 修復 publishConfig 欄位
|
|
9
|
+
* Fix publishConfig field
|
|
10
|
+
*
|
|
11
|
+
* 為 scoped package(如 @scope/package)自動添加 publishConfig.access = 'public'
|
|
12
|
+
* Automatically add publishConfig.access = 'public' for scoped packages (e.g., @scope/package)
|
|
13
|
+
*
|
|
14
|
+
* 當套件名稱包含 '/' 且非私有套件時,確保 npm 發布時能正確設定存取權限
|
|
15
|
+
* When package name contains '/' and is not private, ensure correct access settings for npm publish
|
|
16
|
+
*
|
|
17
|
+
* @template T - package.json 類型 / package.json type
|
|
18
|
+
* @param {T} pkg - package.json 物件 / package.json object
|
|
19
|
+
* @returns {T & { publishConfig: IPackageJsonPublishConfig }} 修正後的 package.json 物件 / Corrected package.json object
|
|
20
|
+
*/
|
|
3
21
|
export declare function fixPublishConfig<T extends IPackageJson>(pkg: T): T & {
|
|
4
22
|
publishConfig: IPackageJsonPublishConfig;
|
|
5
23
|
};
|
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fixPublishConfig = fixPublishConfig;
|
|
4
|
+
/**
|
|
5
|
+
* 修復 publishConfig 欄位
|
|
6
|
+
* Fix publishConfig field
|
|
7
|
+
*
|
|
8
|
+
* 為 scoped package(如 @scope/package)自動添加 publishConfig.access = 'public'
|
|
9
|
+
* Automatically add publishConfig.access = 'public' for scoped packages (e.g., @scope/package)
|
|
10
|
+
*
|
|
11
|
+
* 當套件名稱包含 '/' 且非私有套件時,確保 npm 發布時能正確設定存取權限
|
|
12
|
+
* When package name contains '/' and is not private, ensure correct access settings for npm publish
|
|
13
|
+
*
|
|
14
|
+
* @template T - package.json 類型 / package.json type
|
|
15
|
+
* @param {T} pkg - package.json 物件 / package.json object
|
|
16
|
+
* @returns {T & { publishConfig: IPackageJsonPublishConfig }} 修正後的 package.json 物件 / Corrected package.json object
|
|
17
|
+
*/
|
|
4
18
|
function fixPublishConfig(pkg) {
|
|
19
|
+
// 檢查是否需要添加 publishConfig:
|
|
20
|
+
// 1. 尚未有 publishConfig
|
|
21
|
+
// 2. 非私有套件
|
|
22
|
+
// 3. 有套件名稱
|
|
23
|
+
// 4. 套件名稱包含 '/'(scoped package)
|
|
24
|
+
// Check if publishConfig needs to be added:
|
|
25
|
+
// 1. No existing publishConfig
|
|
26
|
+
// 2. Not a private package
|
|
27
|
+
// 3. Has package name
|
|
28
|
+
// 4. Package name contains '/' (scoped package)
|
|
5
29
|
if (!pkg.publishConfig
|
|
6
30
|
&& !pkg.private
|
|
7
31
|
&& pkg.name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publishConfig.js","sourceRoot":"","sources":["publishConfig.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"publishConfig.js","sourceRoot":"","sources":["publishConfig.ts"],"names":[],"mappings":";;AAqBA,4CAyBC;AAvCD;;;;;;;;;;;;;GAaG;AACH,SAAgB,gBAAgB,CAAyB,GAAM;IAE9D,0BAA0B;IAC1B,uBAAuB;IACvB,WAAW;IACX,WAAW;IACX,gCAAgC;IAChC,4CAA4C;IAC5C,+BAA+B;IAC/B,2BAA2B;IAC3B,sBAAsB;IACtB,gDAAgD;IAChD,IAAI,CAAC,GAAG,CAAC,aAAa;WAClB,CAAC,GAAG,CAAC,OAAO;WACZ,GAAG,CAAC,IAAI;WACR,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAEvB,CAAC;QACA,GAAG,CAAC,aAAa,GAAG;YACnB,MAAM,EAAE,QAAQ;SAChB,CAAC;IACH,CAAC;IACD,OAAO,GAEN,CAAA;AACF,CAAC","sourcesContent":["/**\n * 處理 package.json publishConfig 欄位的工具模組\n * Utility module for handling package.json publishConfig field\n */\nimport { IPackageJson } from '@ts-type/package-dts/package-json';\nimport { IPackageJsonPublishConfig } from '@ts-type/package-dts/lib/package-json/types';\n\n/**\n * 修復 publishConfig 欄位\n * Fix publishConfig field\n *\n * 為 scoped package(如 @scope/package)自動添加 publishConfig.access = 'public'\n * Automatically add publishConfig.access = 'public' for scoped packages (e.g., @scope/package)\n *\n * 當套件名稱包含 '/' 且非私有套件時,確保 npm 發布時能正確設定存取權限\n * When package name contains '/' and is not private, ensure correct access settings for npm publish\n *\n * @template T - package.json 類型 / package.json type\n * @param {T} pkg - package.json 物件 / package.json object\n * @returns {T & { publishConfig: IPackageJsonPublishConfig }} 修正後的 package.json 物件 / Corrected package.json object\n */\nexport function fixPublishConfig<T extends IPackageJson>(pkg: T)\n{\n\t// 檢查是否需要添加 publishConfig:\n\t// 1. 尚未有 publishConfig\n\t// 2. 非私有套件\n\t// 3. 有套件名稱\n\t// 4. 套件名稱包含 '/'(scoped package)\n\t// Check if publishConfig needs to be added:\n\t// 1. No existing publishConfig\n\t// 2. Not a private package\n\t// 3. Has package name\n\t// 4. Package name contains '/' (scoped package)\n\tif (!pkg.publishConfig\n\t\t&& !pkg.private\n\t\t&& pkg.name\n\t\t&& /\\//.test(pkg.name)\n\t)\n\t{\n\t\tpkg.publishConfig = {\n\t\t\taccess: \"public\",\n\t\t};\n\t}\n\treturn pkg as T & {\n\t\tpublishConfig: IPackageJsonPublishConfig\n\t}\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @yarn-tool/pkg-entry-util
|
|
3
|
+
*
|
|
4
|
+
* 用於處理 package.json entry 相關欄位的工具庫
|
|
5
|
+
* Utility library for handling package.json entry-related fields
|
|
6
|
+
*
|
|
7
|
+
* 包含 bin、exports、publishConfig 欄位的修復與驗證功能
|
|
8
|
+
* Includes fix and verification for bin, exports, and publishConfig fields
|
|
9
|
+
*
|
|
10
|
+
* 同時提供各類套件的預設 npm scripts 集合
|
|
11
|
+
* Also provides default npm scripts collections for various package types
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* 匯出 bin 欄位修復功能 / Export bin field fix functionality
|
|
15
|
+
*
|
|
16
|
+
* 修復 package.json 中 bin 欄位的路徑問題
|
|
17
|
+
* Fix path issues in package.json bin field
|
|
18
|
+
*/
|
|
1
19
|
export { fixPkgBinField } from './field/bin';
|
|
20
|
+
/**
|
|
21
|
+
* 匯出 publishConfig 欄位修復功能 / Export publishConfig field fix functionality
|
|
22
|
+
*
|
|
23
|
+
* 修復 publishConfig 欄位以符合發布需求
|
|
24
|
+
* Fix publishConfig field for publishing requirements
|
|
25
|
+
*/
|
|
2
26
|
export { fixPublishConfig } from './field/publishConfig';
|
|
27
|
+
/**
|
|
28
|
+
* 匯出 exports 欄位處理功能 / Export exports field handling functionality
|
|
29
|
+
*
|
|
30
|
+
* 驗證與修復 package exports 路徑
|
|
31
|
+
* Verify and fix package exports paths
|
|
32
|
+
*/
|
|
3
33
|
export { pkgExportsAddPJsonEntry, pkgExportsVerify } from './field/exports';
|
package/lib/index.js
CHANGED
|
@@ -1,10 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @yarn-tool/pkg-entry-util
|
|
4
|
+
*
|
|
5
|
+
* 用於處理 package.json entry 相關欄位的工具庫
|
|
6
|
+
* Utility library for handling package.json entry-related fields
|
|
7
|
+
*
|
|
8
|
+
* 包含 bin、exports、publishConfig 欄位的修復與驗證功能
|
|
9
|
+
* Includes fix and verification for bin, exports, and publishConfig fields
|
|
10
|
+
*
|
|
11
|
+
* 同時提供各類套件的預設 npm scripts 集合
|
|
12
|
+
* Also provides default npm scripts collections for various package types
|
|
13
|
+
*/
|
|
2
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
15
|
exports.pkgExportsVerify = exports.pkgExportsAddPJsonEntry = exports.fixPublishConfig = exports.fixPkgBinField = void 0;
|
|
16
|
+
/**
|
|
17
|
+
* 匯出 bin 欄位修復功能 / Export bin field fix functionality
|
|
18
|
+
*
|
|
19
|
+
* 修復 package.json 中 bin 欄位的路徑問題
|
|
20
|
+
* Fix path issues in package.json bin field
|
|
21
|
+
*/
|
|
4
22
|
var bin_1 = require("./field/bin");
|
|
5
23
|
Object.defineProperty(exports, "fixPkgBinField", { enumerable: true, get: function () { return bin_1.fixPkgBinField; } });
|
|
24
|
+
/**
|
|
25
|
+
* 匯出 publishConfig 欄位修復功能 / Export publishConfig field fix functionality
|
|
26
|
+
*
|
|
27
|
+
* 修復 publishConfig 欄位以符合發布需求
|
|
28
|
+
* Fix publishConfig field for publishing requirements
|
|
29
|
+
*/
|
|
6
30
|
var publishConfig_1 = require("./field/publishConfig");
|
|
7
31
|
Object.defineProperty(exports, "fixPublishConfig", { enumerable: true, get: function () { return publishConfig_1.fixPublishConfig; } });
|
|
32
|
+
/**
|
|
33
|
+
* 匯出 exports 欄位處理功能 / Export exports field handling functionality
|
|
34
|
+
*
|
|
35
|
+
* 驗證與修復 package exports 路徑
|
|
36
|
+
* Verify and fix package exports paths
|
|
37
|
+
*/
|
|
8
38
|
var exports_1 = require("./field/exports");
|
|
9
39
|
Object.defineProperty(exports, "pkgExportsAddPJsonEntry", { enumerable: true, get: function () { return exports_1.pkgExportsAddPJsonEntry; } });
|
|
10
40
|
Object.defineProperty(exports, "pkgExportsVerify", { enumerable: true, get: function () { return exports_1.pkgExportsVerify; } });
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH;;;;;GAKG;AACH,mCAA6C;AAApC,qGAAA,cAAc,OAAA;AAEvB;;;;;GAKG;AACH,uDAAyD;AAAhD,iHAAA,gBAAgB,OAAA;AAEzB;;;;;GAKG;AACH,2CAA4E;AAAnE,kHAAA,uBAAuB,OAAA;AAAE,2GAAA,gBAAgB,OAAA","sourcesContent":["/**\n * @yarn-tool/pkg-entry-util\n *\n * 用於處理 package.json entry 相關欄位的工具庫\n * Utility library for handling package.json entry-related fields\n *\n * 包含 bin、exports、publishConfig 欄位的修復與驗證功能\n * Includes fix and verification for bin, exports, and publishConfig fields\n *\n * 同時提供各類套件的預設 npm scripts 集合\n * Also provides default npm scripts collections for various package types\n */\n\n/**\n * 匯出 bin 欄位修復功能 / Export bin field fix functionality\n *\n * 修復 package.json 中 bin 欄位的路徑問題\n * Fix path issues in package.json bin field\n */\nexport { fixPkgBinField } from './field/bin';\n\n/**\n * 匯出 publishConfig 欄位修復功能 / Export publishConfig field fix functionality\n *\n * 修復 publishConfig 欄位以符合發布需求\n * Fix publishConfig field for publishing requirements\n */\nexport { fixPublishConfig } from './field/publishConfig';\n\n/**\n * 匯出 exports 欄位處理功能 / Export exports field handling functionality\n *\n * 驗證與修復 package exports 路徑\n * Verify and fix package exports paths\n */\nexport { pkgExportsAddPJsonEntry, pkgExportsVerify } from './field/exports';\n"]}
|
|
@@ -1,3 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 虛擬腳本填充工具 / Dummy Scripts Filler Utility
|
|
3
|
+
*
|
|
4
|
+
* 提供用於填充 package.json scripts 欄位中生命週期腳本佔位符的功能
|
|
5
|
+
* Provides functionality to fill lifecycle script placeholders in package.json scripts field
|
|
6
|
+
*/
|
|
1
7
|
import { ITSArrayListMaybeReadonly } from 'ts-type/lib/type/base';
|
|
8
|
+
/**
|
|
9
|
+
* 核心虛擬腳本填充函數 / Core dummy scripts filler function
|
|
10
|
+
*
|
|
11
|
+
* 為指定的腳本欄位填充 echo 命令作為佔位符
|
|
12
|
+
* Fills echo commands as placeholders for specified script fields
|
|
13
|
+
*
|
|
14
|
+
* @template T - 腳本物件類型 / Script object type
|
|
15
|
+
* @param scripts - 腳本物件 / Script object
|
|
16
|
+
* @param prefix - echo 前綴文字 / Echo prefix text
|
|
17
|
+
* @param fields - 要填充的腳本名稱陣列 / Array of script names to fill
|
|
18
|
+
* @returns 填充後的腳本物件 / Filled script object
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* _fillDummyScriptsCore({}, 'workspaces', ['preversion', 'postversion'])
|
|
23
|
+
* // 返回: { preversion: 'echo workspaces preversion', postversion: 'echo workspaces postversion' }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
2
26
|
export declare function _fillDummyScriptsCore<T extends Record<string, string>>(scripts: T, prefix: string, fields: ITSArrayListMaybeReadonly<string>): T;
|
|
27
|
+
/**
|
|
28
|
+
* 填充虛擬生命週期腳本 / Fill dummy lifecycle scripts
|
|
29
|
+
*
|
|
30
|
+
* 為 package.json 的標準生命週期腳本填充佔位符命令
|
|
31
|
+
* Fills placeholder commands for standard lifecycle scripts in package.json
|
|
32
|
+
*
|
|
33
|
+
* 包含以下腳本 / Includes following scripts:
|
|
34
|
+
* - preversion: 版本更新前執行 / Run before version bump
|
|
35
|
+
* - version: 版本更新時執行 / Run on version bump
|
|
36
|
+
* - prepublishOnly: 發布前執行 / Run before publish
|
|
37
|
+
* - postversion: 版本更新後執行 / Run after version bump
|
|
38
|
+
* - publish: 發布時執行 / Run on publish
|
|
39
|
+
* - prepublish: 發布前執行(舊版)/ Run before publish (legacy)
|
|
40
|
+
* - postpublish: 發布後執行 / Run after publish
|
|
41
|
+
* - postpublishOnly: 發布後執行 / Run after publish only
|
|
42
|
+
* - prepare: 準備階段執行 / Run during prepare
|
|
43
|
+
* - prepack: 打包前執行 / Run before pack
|
|
44
|
+
* - pack: 打包時執行 / Run on pack
|
|
45
|
+
* - postpack: 打包後執行 / Run after pack
|
|
46
|
+
* - pretest: 測試前執行 / Run before test
|
|
47
|
+
* - ci:build: CI 建置階段 / CI build stage
|
|
48
|
+
* - ci:install: CI 安裝階段 / CI install stage
|
|
49
|
+
*
|
|
50
|
+
* @template T - 腳本物件類型 / Script object type
|
|
51
|
+
* @param scripts - 腳本物件(可選)/ Script object (optional)
|
|
52
|
+
* @param prefix - echo 前綴文字(可選)/ Echo prefix text (optional)
|
|
53
|
+
* @returns 填充後的腳本物件 / Filled script object
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* fillDummyScripts({}, 'my-package')
|
|
58
|
+
* // 返回包含所有生命週期腳本的物件
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
3
61
|
export declare function fillDummyScripts<T extends Record<string, string>>(scripts?: T, prefix?: string): T;
|
|
@@ -1,8 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 虛擬腳本填充工具 / Dummy Scripts Filler Utility
|
|
4
|
+
*
|
|
5
|
+
* 提供用於填充 package.json scripts 欄位中生命週期腳本佔位符的功能
|
|
6
|
+
* Provides functionality to fill lifecycle script placeholders in package.json scripts field
|
|
7
|
+
*/
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports._fillDummyScriptsCore = _fillDummyScriptsCore;
|
|
4
10
|
exports.fillDummyScripts = fillDummyScripts;
|
|
5
11
|
const dummy_1 = require("../../util/scripts/dummy");
|
|
12
|
+
/**
|
|
13
|
+
* 核心虛擬腳本填充函數 / Core dummy scripts filler function
|
|
14
|
+
*
|
|
15
|
+
* 為指定的腳本欄位填充 echo 命令作為佔位符
|
|
16
|
+
* Fills echo commands as placeholders for specified script fields
|
|
17
|
+
*
|
|
18
|
+
* @template T - 腳本物件類型 / Script object type
|
|
19
|
+
* @param scripts - 腳本物件 / Script object
|
|
20
|
+
* @param prefix - echo 前綴文字 / Echo prefix text
|
|
21
|
+
* @param fields - 要填充的腳本名稱陣列 / Array of script names to fill
|
|
22
|
+
* @returns 填充後的腳本物件 / Filled script object
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* _fillDummyScriptsCore({}, 'workspaces', ['preversion', 'postversion'])
|
|
27
|
+
* // 返回: { preversion: 'echo workspaces preversion', postversion: 'echo workspaces postversion' }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
6
30
|
function _fillDummyScriptsCore(scripts, prefix, fields) {
|
|
7
31
|
// @ts-ignore
|
|
8
32
|
scripts !== null && scripts !== void 0 ? scripts : (scripts = {});
|
|
@@ -14,6 +38,40 @@ function _fillDummyScriptsCore(scripts, prefix, fields) {
|
|
|
14
38
|
});
|
|
15
39
|
return scripts;
|
|
16
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* 填充虛擬生命週期腳本 / Fill dummy lifecycle scripts
|
|
43
|
+
*
|
|
44
|
+
* 為 package.json 的標準生命週期腳本填充佔位符命令
|
|
45
|
+
* Fills placeholder commands for standard lifecycle scripts in package.json
|
|
46
|
+
*
|
|
47
|
+
* 包含以下腳本 / Includes following scripts:
|
|
48
|
+
* - preversion: 版本更新前執行 / Run before version bump
|
|
49
|
+
* - version: 版本更新時執行 / Run on version bump
|
|
50
|
+
* - prepublishOnly: 發布前執行 / Run before publish
|
|
51
|
+
* - postversion: 版本更新後執行 / Run after version bump
|
|
52
|
+
* - publish: 發布時執行 / Run on publish
|
|
53
|
+
* - prepublish: 發布前執行(舊版)/ Run before publish (legacy)
|
|
54
|
+
* - postpublish: 發布後執行 / Run after publish
|
|
55
|
+
* - postpublishOnly: 發布後執行 / Run after publish only
|
|
56
|
+
* - prepare: 準備階段執行 / Run during prepare
|
|
57
|
+
* - prepack: 打包前執行 / Run before pack
|
|
58
|
+
* - pack: 打包時執行 / Run on pack
|
|
59
|
+
* - postpack: 打包後執行 / Run after pack
|
|
60
|
+
* - pretest: 測試前執行 / Run before test
|
|
61
|
+
* - ci:build: CI 建置階段 / CI build stage
|
|
62
|
+
* - ci:install: CI 安裝階段 / CI install stage
|
|
63
|
+
*
|
|
64
|
+
* @template T - 腳本物件類型 / Script object type
|
|
65
|
+
* @param scripts - 腳本物件(可選)/ Script object (optional)
|
|
66
|
+
* @param prefix - echo 前綴文字(可選)/ Echo prefix text (optional)
|
|
67
|
+
* @returns 填充後的腳本物件 / Filled script object
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* fillDummyScripts({}, 'my-package')
|
|
72
|
+
* // 返回包含所有生命週期腳本的物件
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
17
75
|
function fillDummyScripts(scripts, prefix) {
|
|
18
76
|
return _fillDummyScriptsCore(scripts, prefix, [
|
|
19
77
|
'preversion',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dummy.js","sourceRoot":"","sources":["dummy.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"dummy.js","sourceRoot":"","sources":["dummy.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAuBH,sDAcC;AAoCD,4CAmBC;AAzFD,oDAA4D;AAE5D;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,qBAAqB,CAAmC,OAAU,EAAE,MAAc,EAAE,MAAyC;IAE5I,aAAa;IACb,OAAO,aAAP,OAAO,cAAP,OAAO,IAAP,OAAO,GAAK,EAAE,EAAC;IAEf,IAAI,IAAI,GAAG,IAAA,wBAAgB,EAAC,MAAM,CAAC,CAAC;IAEpC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;;QAElB,aAAa;QACb,MAAA,OAAO,CAAC,CAAC,qCAAT,OAAO,CAAC,CAAC,IAAM,GAAG,IAAI,IAAI,CAAC,EAAE,EAAA;IAC9B,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,SAAgB,gBAAgB,CAAmC,OAAW,EAAE,MAAe;IAE9F,OAAO,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE;QAC7C,YAAY;QACZ,SAAS;QACT,gBAAgB;QAChB,aAAa;QACb,SAAS;QACT,YAAY;QACZ,aAAa;QACb,iBAAiB;QACjB,SAAS;QACT,SAAS;QACT,MAAM;QACN,UAAU;QACV,SAAS;QACT,UAAU;QACV,YAAY;KACH,CAAC,CAAC;AACb,CAAC","sourcesContent":["/**\n * 虛擬腳本填充工具 / Dummy Scripts Filler Utility\n *\n * 提供用於填充 package.json scripts 欄位中生命週期腳本佔位符的功能\n * Provides functionality to fill lifecycle script placeholders in package.json scripts field\n */\n\nimport { ITSArrayListMaybeReadonly } from 'ts-type/lib/type/base';\nimport { _dummyEchoPrefix } from '../../util/scripts/dummy';\n\n/**\n * 核心虛擬腳本填充函數 / Core dummy scripts filler function\n *\n * 為指定的腳本欄位填充 echo 命令作為佔位符\n * Fills echo commands as placeholders for specified script fields\n *\n * @template T - 腳本物件類型 / Script object type\n * @param scripts - 腳本物件 / Script object\n * @param prefix - echo 前綴文字 / Echo prefix text\n * @param fields - 要填充的腳本名稱陣列 / Array of script names to fill\n * @returns 填充後的腳本物件 / Filled script object\n *\n * @example\n * ```typescript\n * _fillDummyScriptsCore({}, 'workspaces', ['preversion', 'postversion'])\n * // 返回: { preversion: 'echo workspaces preversion', postversion: 'echo workspaces postversion' }\n * ```\n */\nexport function _fillDummyScriptsCore<T extends Record<string, string>>(scripts: T, prefix: string, fields: ITSArrayListMaybeReadonly<string>)\n{\n\t// @ts-ignore\n\tscripts ??= {};\n\n\tlet text = _dummyEchoPrefix(prefix);\n\n\tfields.forEach(k =>\n\t{\n\t\t// @ts-ignore\n\t\tscripts[k] ??= `${text} ${k}`\n\t});\n\n\treturn scripts;\n}\n\n/**\n * 填充虛擬生命週期腳本 / Fill dummy lifecycle scripts\n *\n * 為 package.json 的標準生命週期腳本填充佔位符命令\n * Fills placeholder commands for standard lifecycle scripts in package.json\n *\n * 包含以下腳本 / Includes following scripts:\n * - preversion: 版本更新前執行 / Run before version bump\n * - version: 版本更新時執行 / Run on version bump\n * - prepublishOnly: 發布前執行 / Run before publish\n * - postversion: 版本更新後執行 / Run after version bump\n * - publish: 發布時執行 / Run on publish\n * - prepublish: 發布前執行(舊版)/ Run before publish (legacy)\n * - postpublish: 發布後執行 / Run after publish\n * - postpublishOnly: 發布後執行 / Run after publish only\n * - prepare: 準備階段執行 / Run during prepare\n * - prepack: 打包前執行 / Run before pack\n * - pack: 打包時執行 / Run on pack\n * - postpack: 打包後執行 / Run after pack\n * - pretest: 測試前執行 / Run before test\n * - ci:build: CI 建置階段 / CI build stage\n * - ci:install: CI 安裝階段 / CI install stage\n *\n * @template T - 腳本物件類型 / Script object type\n * @param scripts - 腳本物件(可選)/ Script object (optional)\n * @param prefix - echo 前綴文字(可選)/ Echo prefix text (optional)\n * @returns 填充後的腳本物件 / Filled script object\n *\n * @example\n * ```typescript\n * fillDummyScripts({}, 'my-package')\n * // 返回包含所有生命週期腳本的物件\n * ```\n */\nexport function fillDummyScripts<T extends Record<string, string>>(scripts?: T, prefix?: string)\n{\n\treturn _fillDummyScriptsCore(scripts, prefix, [\n\t\t'preversion',\n\t\t'version',\n\t\t'prepublishOnly',\n\t\t'postversion',\n\t\t'publish',\n\t\t'prepublish',\n\t\t'postpublish',\n\t\t'postpublishOnly',\n\t\t'prepare',\n\t\t'prepack',\n\t\t'pack',\n\t\t'postpack',\n\t\t'pretest',\n\t\t'ci:build',\n\t\t'ci:install',\n\t] as const);\n}\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 腳本預設模組統一匯出 / Scripts Preset Module Unified Exports
|
|
3
|
+
*
|
|
4
|
+
* 提供各種套件類型的預設 npm scripts,支援 monorepo 與獨立套件開發流程
|
|
5
|
+
* Provides default npm scripts for various package types, supporting monorepo and standalone package development workflows
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // 工作區根目錄 / Workspace root
|
|
10
|
+
* import { defaultWorkspaceRootScripts } from '@yarn-tool/pkg-entry-util/lib/preset/scripts';
|
|
11
|
+
* const scripts = defaultWorkspaceRootScripts();
|
|
12
|
+
*
|
|
13
|
+
* // 一般套件 / Regular package
|
|
14
|
+
* import { defaultPkgScripts } from '@yarn-tool/pkg-entry-util/lib/preset/scripts';
|
|
15
|
+
* const scripts = defaultPkgScripts();
|
|
16
|
+
*
|
|
17
|
+
* // 填充虛擬腳本 / Fill dummy scripts
|
|
18
|
+
* import { fillDummyScripts } from '@yarn-tool/pkg-entry-util/lib/preset/scripts';
|
|
19
|
+
* fillDummyScripts(pkg.scripts, 'my-package');
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* 虛擬腳本填充工具 / Dummy scripts filler utility
|
|
24
|
+
*
|
|
25
|
+
* 用於填充 package.json 生命週期腳本佔位符
|
|
26
|
+
* For filling package.json lifecycle script placeholders
|
|
27
|
+
*/
|
|
28
|
+
export { _fillDummyScriptsCore, fillDummyScripts, } from './dummy';
|
|
29
|
+
/**
|
|
30
|
+
* 套件腳本預設 / Package scripts preset
|
|
31
|
+
*
|
|
32
|
+
* 標準套件的測試與建構腳本
|
|
33
|
+
* Test and build scripts for standard packages
|
|
34
|
+
*/
|
|
35
|
+
export { defaultPkgScripts, defaultPkgNotOldExists, } from './pkg-scripts';
|
|
36
|
+
/**
|
|
37
|
+
* 根目錄套件腳本預設 / Root package scripts preset
|
|
38
|
+
*
|
|
39
|
+
* 獨立套件或 monorepo 根目錄的發布與版本管理腳本
|
|
40
|
+
* Publishing and version management scripts for standalone packages or monorepo root
|
|
41
|
+
*/
|
|
42
|
+
export { defaultRootScripts, } from './root-scripts';
|
|
43
|
+
/**
|
|
44
|
+
* 共享根目錄腳本預設 / Shared root scripts preset
|
|
45
|
+
*
|
|
46
|
+
* 根目錄套件共用的通用管理腳本
|
|
47
|
+
* Common management scripts shared by root packages
|
|
48
|
+
*/
|
|
49
|
+
export { defaultSharedRootScripts, } from './shared-root-scripts';
|
|
50
|
+
/**
|
|
51
|
+
* 工作區根目錄腳本預設 / Workspace root scripts preset
|
|
52
|
+
*
|
|
53
|
+
* Yarn/Lerna 工作區根目錄的完整管理腳本
|
|
54
|
+
* Complete management scripts for Yarn/Lerna workspace root
|
|
55
|
+
*/
|
|
56
|
+
export { _runAllOrSince, defaultWorkspaceRootScripts, } from './ws-root-scripts';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 腳本預設模組統一匯出 / Scripts Preset Module Unified Exports
|
|
4
|
+
*
|
|
5
|
+
* 提供各種套件類型的預設 npm scripts,支援 monorepo 與獨立套件開發流程
|
|
6
|
+
* Provides default npm scripts for various package types, supporting monorepo and standalone package development workflows
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // 工作區根目錄 / Workspace root
|
|
11
|
+
* import { defaultWorkspaceRootScripts } from '@yarn-tool/pkg-entry-util/lib/preset/scripts';
|
|
12
|
+
* const scripts = defaultWorkspaceRootScripts();
|
|
13
|
+
*
|
|
14
|
+
* // 一般套件 / Regular package
|
|
15
|
+
* import { defaultPkgScripts } from '@yarn-tool/pkg-entry-util/lib/preset/scripts';
|
|
16
|
+
* const scripts = defaultPkgScripts();
|
|
17
|
+
*
|
|
18
|
+
* // 填充虛擬腳本 / Fill dummy scripts
|
|
19
|
+
* import { fillDummyScripts } from '@yarn-tool/pkg-entry-util/lib/preset/scripts';
|
|
20
|
+
* fillDummyScripts(pkg.scripts, 'my-package');
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.defaultWorkspaceRootScripts = exports._runAllOrSince = exports.defaultSharedRootScripts = exports.defaultRootScripts = exports.defaultPkgNotOldExists = exports.defaultPkgScripts = exports.fillDummyScripts = exports._fillDummyScriptsCore = void 0;
|
|
25
|
+
/**
|
|
26
|
+
* 虛擬腳本填充工具 / Dummy scripts filler utility
|
|
27
|
+
*
|
|
28
|
+
* 用於填充 package.json 生命週期腳本佔位符
|
|
29
|
+
* For filling package.json lifecycle script placeholders
|
|
30
|
+
*/
|
|
31
|
+
var dummy_1 = require("./dummy");
|
|
32
|
+
Object.defineProperty(exports, "_fillDummyScriptsCore", { enumerable: true, get: function () { return dummy_1._fillDummyScriptsCore; } });
|
|
33
|
+
Object.defineProperty(exports, "fillDummyScripts", { enumerable: true, get: function () { return dummy_1.fillDummyScripts; } });
|
|
34
|
+
/**
|
|
35
|
+
* 套件腳本預設 / Package scripts preset
|
|
36
|
+
*
|
|
37
|
+
* 標準套件的測試與建構腳本
|
|
38
|
+
* Test and build scripts for standard packages
|
|
39
|
+
*/
|
|
40
|
+
var pkg_scripts_1 = require("./pkg-scripts");
|
|
41
|
+
Object.defineProperty(exports, "defaultPkgScripts", { enumerable: true, get: function () { return pkg_scripts_1.defaultPkgScripts; } });
|
|
42
|
+
Object.defineProperty(exports, "defaultPkgNotOldExists", { enumerable: true, get: function () { return pkg_scripts_1.defaultPkgNotOldExists; } });
|
|
43
|
+
/**
|
|
44
|
+
* 根目錄套件腳本預設 / Root package scripts preset
|
|
45
|
+
*
|
|
46
|
+
* 獨立套件或 monorepo 根目錄的發布與版本管理腳本
|
|
47
|
+
* Publishing and version management scripts for standalone packages or monorepo root
|
|
48
|
+
*/
|
|
49
|
+
var root_scripts_1 = require("./root-scripts");
|
|
50
|
+
Object.defineProperty(exports, "defaultRootScripts", { enumerable: true, get: function () { return root_scripts_1.defaultRootScripts; } });
|
|
51
|
+
/**
|
|
52
|
+
* 共享根目錄腳本預設 / Shared root scripts preset
|
|
53
|
+
*
|
|
54
|
+
* 根目錄套件共用的通用管理腳本
|
|
55
|
+
* Common management scripts shared by root packages
|
|
56
|
+
*/
|
|
57
|
+
var shared_root_scripts_1 = require("./shared-root-scripts");
|
|
58
|
+
Object.defineProperty(exports, "defaultSharedRootScripts", { enumerable: true, get: function () { return shared_root_scripts_1.defaultSharedRootScripts; } });
|
|
59
|
+
/**
|
|
60
|
+
* 工作區根目錄腳本預設 / Workspace root scripts preset
|
|
61
|
+
*
|
|
62
|
+
* Yarn/Lerna 工作區根目錄的完整管理腳本
|
|
63
|
+
* Complete management scripts for Yarn/Lerna workspace root
|
|
64
|
+
*/
|
|
65
|
+
var ws_root_scripts_1 = require("./ws-root-scripts");
|
|
66
|
+
Object.defineProperty(exports, "_runAllOrSince", { enumerable: true, get: function () { return ws_root_scripts_1._runAllOrSince; } });
|
|
67
|
+
Object.defineProperty(exports, "defaultWorkspaceRootScripts", { enumerable: true, get: function () { return ws_root_scripts_1.defaultWorkspaceRootScripts; } });
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH;;;;;GAKG;AACH,iCAGiB;AAFhB,8GAAA,qBAAqB,OAAA;AACrB,yGAAA,gBAAgB,OAAA;AAGjB;;;;;GAKG;AACH,6CAGuB;AAFtB,gHAAA,iBAAiB,OAAA;AACjB,qHAAA,sBAAsB,OAAA;AAGvB;;;;;GAKG;AACH,+CAEwB;AADvB,kHAAA,kBAAkB,OAAA;AAGnB;;;;;GAKG;AACH,6DAE+B;AAD9B,+HAAA,wBAAwB,OAAA;AAGzB;;;;;GAKG;AACH,qDAG2B;AAF1B,iHAAA,cAAc,OAAA;AACd,8HAAA,2BAA2B,OAAA","sourcesContent":["/**\n * 腳本預設模組統一匯出 / Scripts Preset Module Unified Exports\n *\n * 提供各種套件類型的預設 npm scripts,支援 monorepo 與獨立套件開發流程\n * Provides default npm scripts for various package types, supporting monorepo and standalone package development workflows\n *\n * @example\n * ```typescript\n * // 工作區根目錄 / Workspace root\n * import { defaultWorkspaceRootScripts } from '@yarn-tool/pkg-entry-util/lib/preset/scripts';\n * const scripts = defaultWorkspaceRootScripts();\n *\n * // 一般套件 / Regular package\n * import { defaultPkgScripts } from '@yarn-tool/pkg-entry-util/lib/preset/scripts';\n * const scripts = defaultPkgScripts();\n *\n * // 填充虛擬腳本 / Fill dummy scripts\n * import { fillDummyScripts } from '@yarn-tool/pkg-entry-util/lib/preset/scripts';\n * fillDummyScripts(pkg.scripts, 'my-package');\n * ```\n */\n\n/**\n * 虛擬腳本填充工具 / Dummy scripts filler utility\n *\n * 用於填充 package.json 生命週期腳本佔位符\n * For filling package.json lifecycle script placeholders\n */\nexport {\n\t_fillDummyScriptsCore,\n\tfillDummyScripts,\n} from './dummy';\n\n/**\n * 套件腳本預設 / Package scripts preset\n *\n * 標準套件的測試與建構腳本\n * Test and build scripts for standard packages\n */\nexport {\n\tdefaultPkgScripts,\n\tdefaultPkgNotOldExists,\n} from './pkg-scripts';\n\n/**\n * 根目錄套件腳本預設 / Root package scripts preset\n *\n * 獨立套件或 monorepo 根目錄的發布與版本管理腳本\n * Publishing and version management scripts for standalone packages or monorepo root\n */\nexport {\n\tdefaultRootScripts,\n} from './root-scripts';\n\n/**\n * 共享根目錄腳本預設 / Shared root scripts preset\n *\n * 根目錄套件共用的通用管理腳本\n * Common management scripts shared by root packages\n */\nexport {\n\tdefaultSharedRootScripts,\n} from './shared-root-scripts';\n\n/**\n * 工作區根目錄腳本預設 / Workspace root scripts preset\n *\n * Yarn/Lerna 工作區根目錄的完整管理腳本\n * Complete management scripts for Yarn/Lerna workspace root\n */\nexport {\n\t_runAllOrSince,\n\tdefaultWorkspaceRootScripts,\n} from './ws-root-scripts';\n"]}
|
|
@@ -1,4 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 套件腳本預設 / Package Scripts Preset
|
|
3
|
+
*
|
|
4
|
+
* 提供標準套件(非根目錄、非工作區根目錄)的預設 npm scripts
|
|
5
|
+
* Provides default npm scripts for standard packages (non-root, non-workspace-root)
|
|
6
|
+
*/
|
|
1
7
|
import { EnumScriptsEntry } from '../../field/scripts';
|
|
8
|
+
/**
|
|
9
|
+
* 標準套件預設腳本 / Default scripts for standard packages
|
|
10
|
+
*
|
|
11
|
+
* 適用於一般套件專案的常用測試與建構腳本
|
|
12
|
+
* Common test and build scripts for general package projects
|
|
13
|
+
*
|
|
14
|
+
* @returns 包含標準腳本的物件 / Object containing standard scripts
|
|
15
|
+
*
|
|
16
|
+
* 包含腳本 / Includes scripts:
|
|
17
|
+
* - test: 執行 Jest 測試 / Run Jest tests
|
|
18
|
+
* - coverage: 執行測試並產生覆蓋率報告 / Run tests with coverage
|
|
19
|
+
* - test:jest: Jest 測試命令 / Jest test command
|
|
20
|
+
* - test:snapshot: 更新測試快照 / Update test snapshots
|
|
21
|
+
* - test:jest:snapshot: 更新 Jest 快照 / Update Jest snapshots
|
|
22
|
+
* - test:jest:coverage: Jest 測試含覆蓋率 / Jest test with coverage
|
|
23
|
+
* - test:tsd: 執行 TypeScript 型別檢查 / Run TypeScript type checking
|
|
24
|
+
* - tsc:showConfig: 顯示 TypeScript 設定 / Show TypeScript config
|
|
25
|
+
*/
|
|
2
26
|
export declare function defaultPkgScripts(): {
|
|
3
27
|
test: string;
|
|
4
28
|
coverage: string;
|
|
@@ -9,6 +33,32 @@ export declare function defaultPkgScripts(): {
|
|
|
9
33
|
"test:tsd": string;
|
|
10
34
|
"tsc:showConfig": string;
|
|
11
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* 新套件預設腳本 / Default scripts for new packages
|
|
38
|
+
*
|
|
39
|
+
* 適用於初始化新套件時的完整腳本集合
|
|
40
|
+
* Complete set of scripts for initializing new packages
|
|
41
|
+
*
|
|
42
|
+
* @returns 包含完整開發腳本的物件 / Object containing complete development scripts
|
|
43
|
+
*
|
|
44
|
+
* 額外包含腳本 / Additional scripts:
|
|
45
|
+
* - test:mocha: Mocha 測試執行 / Mocha test execution
|
|
46
|
+
* - test:tsdx: TSDX 測試 / TSDX testing
|
|
47
|
+
* - build:dts:bundle: 建構型別宣告檔 / Build type declaration files
|
|
48
|
+
* - build:dts:copy: 複製型別宣告檔 / Copy type declaration files
|
|
49
|
+
* - build:dts:tsc:emit: TypeScript 型別輸出 / TypeScript type emit
|
|
50
|
+
* - build:dts:tsc: 完整型別建構 / Complete type build
|
|
51
|
+
* - build:tsdx: TSDX 建構 / TSDX build
|
|
52
|
+
* - build:microbundle: Microbundle 建構 / Microbundle build
|
|
53
|
+
* - lint: ESLint 檢查 / ESLint check
|
|
54
|
+
* - lint:eslint: ESLint 執行 / ESLint execution
|
|
55
|
+
* - review: 完整審查流程 / Complete review process
|
|
56
|
+
* - review:test: 測試審查 / Test review
|
|
57
|
+
* - review:coverage: 覆蓋率審查 / Coverage review
|
|
58
|
+
* - sort-package-json: 排序 package.json / Sort package.json
|
|
59
|
+
* - tsc:default: 預設 TypeScript 編譯 / Default TypeScript compilation
|
|
60
|
+
* - tsc:esm: ESM TypeScript 編譯 / ESM TypeScript compilation
|
|
61
|
+
*/
|
|
12
62
|
export declare function defaultPkgNotOldExists(): {
|
|
13
63
|
"test:mocha": string;
|
|
14
64
|
"test:tsdx": string;
|
|
@@ -1,19 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 套件腳本預設 / Package Scripts Preset
|
|
4
|
+
*
|
|
5
|
+
* 提供標準套件(非根目錄、非工作區根目錄)的預設 npm scripts
|
|
6
|
+
* Provides default npm scripts for standard packages (non-root, non-workspace-root)
|
|
7
|
+
*/
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.defaultPkgScripts = defaultPkgScripts;
|
|
4
10
|
exports.defaultPkgNotOldExists = defaultPkgNotOldExists;
|
|
11
|
+
/**
|
|
12
|
+
* 標準套件預設腳本 / Default scripts for standard packages
|
|
13
|
+
*
|
|
14
|
+
* 適用於一般套件專案的常用測試與建構腳本
|
|
15
|
+
* Common test and build scripts for general package projects
|
|
16
|
+
*
|
|
17
|
+
* @returns 包含標準腳本的物件 / Object containing standard scripts
|
|
18
|
+
*
|
|
19
|
+
* 包含腳本 / Includes scripts:
|
|
20
|
+
* - test: 執行 Jest 測試 / Run Jest tests
|
|
21
|
+
* - coverage: 執行測試並產生覆蓋率報告 / Run tests with coverage
|
|
22
|
+
* - test:jest: Jest 測試命令 / Jest test command
|
|
23
|
+
* - test:snapshot: 更新測試快照 / Update test snapshots
|
|
24
|
+
* - test:jest:snapshot: 更新 Jest 快照 / Update Jest snapshots
|
|
25
|
+
* - test:jest:coverage: Jest 測試含覆蓋率 / Jest test with coverage
|
|
26
|
+
* - test:tsd: 執行 TypeScript 型別檢查 / Run TypeScript type checking
|
|
27
|
+
* - tsc:showConfig: 顯示 TypeScript 設定 / Show TypeScript config
|
|
28
|
+
*/
|
|
5
29
|
function defaultPkgScripts() {
|
|
6
30
|
return {
|
|
7
|
-
"test": "
|
|
31
|
+
"test": "node --run test:jest",
|
|
8
32
|
"coverage": "yarn run test -- --coverage",
|
|
9
33
|
"test:jest": "jest --passWithNoTests" /* EnumScriptsEntry.JEST_TEST */,
|
|
10
34
|
"test:snapshot": "yarn run test -- -u",
|
|
11
|
-
"test:jest:snapshot": "
|
|
12
|
-
"test:jest:coverage": "
|
|
35
|
+
"test:jest:snapshot": "node --run test:jest -- -u",
|
|
36
|
+
"test:jest:coverage": "node --run test:jest -- --coverage",
|
|
13
37
|
"test:tsd": "ynpx tsd",
|
|
14
38
|
"tsc:showConfig": "ynpx get-current-tsconfig -p",
|
|
15
39
|
};
|
|
16
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* 新套件預設腳本 / Default scripts for new packages
|
|
43
|
+
*
|
|
44
|
+
* 適用於初始化新套件時的完整腳本集合
|
|
45
|
+
* Complete set of scripts for initializing new packages
|
|
46
|
+
*
|
|
47
|
+
* @returns 包含完整開發腳本的物件 / Object containing complete development scripts
|
|
48
|
+
*
|
|
49
|
+
* 額外包含腳本 / Additional scripts:
|
|
50
|
+
* - test:mocha: Mocha 測試執行 / Mocha test execution
|
|
51
|
+
* - test:tsdx: TSDX 測試 / TSDX testing
|
|
52
|
+
* - build:dts:bundle: 建構型別宣告檔 / Build type declaration files
|
|
53
|
+
* - build:dts:copy: 複製型別宣告檔 / Copy type declaration files
|
|
54
|
+
* - build:dts:tsc:emit: TypeScript 型別輸出 / TypeScript type emit
|
|
55
|
+
* - build:dts:tsc: 完整型別建構 / Complete type build
|
|
56
|
+
* - build:tsdx: TSDX 建構 / TSDX build
|
|
57
|
+
* - build:microbundle: Microbundle 建構 / Microbundle build
|
|
58
|
+
* - lint: ESLint 檢查 / ESLint check
|
|
59
|
+
* - lint:eslint: ESLint 執行 / ESLint execution
|
|
60
|
+
* - review: 完整審查流程 / Complete review process
|
|
61
|
+
* - review:test: 測試審查 / Test review
|
|
62
|
+
* - review:coverage: 覆蓋率審查 / Coverage review
|
|
63
|
+
* - sort-package-json: 排序 package.json / Sort package.json
|
|
64
|
+
* - tsc:default: 預設 TypeScript 編譯 / Default TypeScript compilation
|
|
65
|
+
* - tsc:esm: ESM TypeScript 編譯 / ESM TypeScript compilation
|
|
66
|
+
*/
|
|
17
67
|
function defaultPkgNotOldExists() {
|
|
18
68
|
return {
|
|
19
69
|
...defaultPkgScripts(),
|
|
@@ -22,12 +72,12 @@ function defaultPkgNotOldExists() {
|
|
|
22
72
|
"build:dts:bundle": "ynpx @bluelovers/dts-bundle-generator -o ./dist/index.d.ts ./src/index.ts --no-banner --inline-declare-global & echo build:dts:bundle" /* EnumScriptsEntry.BUILD_DTS_BUNDLE */,
|
|
23
73
|
"build:dts:copy": "copy .\\src\\index.d.ts .\\dist\\index.d.ts & echo build:dts",
|
|
24
74
|
"build:dts:tsc:emit": "tsc --emitDeclarationOnly --declaration --noEmit false",
|
|
25
|
-
"build:dts:tsc": "
|
|
75
|
+
"build:dts:tsc": "node --run build:dts:tsc:emit && node --run build:dts:copy",
|
|
26
76
|
"build:tsdx": "ynpx @bluelovers/tsdx build --target node --name index",
|
|
27
77
|
"build:microbundle": "ynpx microbundle --target node",
|
|
28
|
-
"lint": "
|
|
78
|
+
"lint": "node --run lint:eslint",
|
|
29
79
|
"lint:eslint": "ynpx eslint --ext .ts,.tsx,.mts,.cts ./",
|
|
30
|
-
"review": "
|
|
80
|
+
"review": "node --run review:coverage",
|
|
31
81
|
"review:test": "yarn run lint && yarn run test",
|
|
32
82
|
"review:coverage": "yarn run lint && yarn run coverage",
|
|
33
83
|
"sort-package-json": "yarn-tool sort",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pkg-scripts.js","sourceRoot":"","sources":["pkg-scripts.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"pkg-scripts.js","sourceRoot":"","sources":["pkg-scripts.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAsBH,8CAYC;AA4BD,wDAqBC;AA/ED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,iBAAiB;IAEhC,OAAO;QACN,MAAM,EAAE,sBAAsB;QAC9B,UAAU,EAAE,6BAA6B;QACzC,WAAW,2DAA4B;QACvC,eAAe,EAAE,qBAAqB;QACtC,oBAAoB,EAAE,4BAA4B;QAClD,oBAAoB,EAAE,oCAAoC;QAC1D,UAAU,EAAE,UAAU;QACtB,gBAAgB,EAAE,8BAA8B;KAChD,CAAA;AACF,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,sBAAsB;IAErC,OAAO;QACN,GAAG,iBAAiB,EAAE;QACtB,YAAY,EAAE,oHAAoH;QAClI,WAAW,EAAE,8CAA8C;QAC3D,kBAAkB,iLAAmC;QACrD,gBAAgB,EAAE,8DAA8D;QAChF,oBAAoB,EAAE,wDAAwD;QAC9E,eAAe,EAAE,4DAA4D;QAC7E,YAAY,EAAE,wDAAwD;QACtE,mBAAmB,EAAE,gCAAgC;QACrD,MAAM,EAAE,wBAAwB;QAChC,aAAa,EAAE,yCAAyC;QACxD,QAAQ,EAAE,4BAA4B;QACtC,aAAa,EAAE,gCAAgC;QAC/C,iBAAiB,EAAE,oCAAoC;QACvD,mBAAmB,EAAE,gBAAgB;QACrC,aAAa,EAAE,sBAAsB;QACrC,SAAS,EAAE,0BAA0B;KACrC,CAAA;AACF,CAAC","sourcesContent":["/**\n * 套件腳本預設 / Package Scripts Preset\n *\n * 提供標準套件(非根目錄、非工作區根目錄)的預設 npm scripts\n * Provides default npm scripts for standard packages (non-root, non-workspace-root)\n */\n\nimport { EnumScriptsEntry } from '../../field/scripts';\n\n/**\n * 標準套件預設腳本 / Default scripts for standard packages\n *\n * 適用於一般套件專案的常用測試與建構腳本\n * Common test and build scripts for general package projects\n *\n * @returns 包含標準腳本的物件 / Object containing standard scripts\n *\n * 包含腳本 / Includes scripts:\n * - test: 執行 Jest 測試 / Run Jest tests\n * - coverage: 執行測試並產生覆蓋率報告 / Run tests with coverage\n * - test:jest: Jest 測試命令 / Jest test command\n * - test:snapshot: 更新測試快照 / Update test snapshots\n * - test:jest:snapshot: 更新 Jest 快照 / Update Jest snapshots\n * - test:jest:coverage: Jest 測試含覆蓋率 / Jest test with coverage\n * - test:tsd: 執行 TypeScript 型別檢查 / Run TypeScript type checking\n * - tsc:showConfig: 顯示 TypeScript 設定 / Show TypeScript config\n */\nexport function defaultPkgScripts()\n{\n\treturn {\n\t\t\"test\": \"node --run test:jest\",\n\t\t\"coverage\": \"yarn run test -- --coverage\",\n\t\t\"test:jest\": EnumScriptsEntry.JEST_TEST,\n\t\t\"test:snapshot\": \"yarn run test -- -u\",\n\t\t\"test:jest:snapshot\": \"node --run test:jest -- -u\",\n\t\t\"test:jest:coverage\": \"node --run test:jest -- --coverage\",\n\t\t\"test:tsd\": \"ynpx tsd\",\n\t\t\"tsc:showConfig\": \"ynpx get-current-tsconfig -p\",\n\t}\n}\n\n/**\n * 新套件預設腳本 / Default scripts for new packages\n *\n * 適用於初始化新套件時的完整腳本集合\n * Complete set of scripts for initializing new packages\n *\n * @returns 包含完整開發腳本的物件 / Object containing complete development scripts\n *\n * 額外包含腳本 / Additional scripts:\n * - test:mocha: Mocha 測試執行 / Mocha test execution\n * - test:tsdx: TSDX 測試 / TSDX testing\n * - build:dts:bundle: 建構型別宣告檔 / Build type declaration files\n * - build:dts:copy: 複製型別宣告檔 / Copy type declaration files\n * - build:dts:tsc:emit: TypeScript 型別輸出 / TypeScript type emit\n * - build:dts:tsc: 完整型別建構 / Complete type build\n * - build:tsdx: TSDX 建構 / TSDX build\n * - build:microbundle: Microbundle 建構 / Microbundle build\n * - lint: ESLint 檢查 / ESLint check\n * - lint:eslint: ESLint 執行 / ESLint execution\n * - review: 完整審查流程 / Complete review process\n * - review:test: 測試審查 / Test review\n * - review:coverage: 覆蓋率審查 / Coverage review\n * - sort-package-json: 排序 package.json / Sort package.json\n * - tsc:default: 預設 TypeScript 編譯 / Default TypeScript compilation\n * - tsc:esm: ESM TypeScript 編譯 / ESM TypeScript compilation\n */\nexport function defaultPkgNotOldExists()\n{\n\treturn {\n\t\t...defaultPkgScripts(),\n\t\t\"test:mocha\": \"ynpx --quiet -p ts-node -p mocha mocha -- --require ts-node/register \\\"!(node_modules)/**/*.{test,spec}.{ts,tsx}\\\"\",\n\t\t\"test:tsdx\": \"ynpx @bluelovers/tsdx test --passWithNoTests\",\n\t\t\"build:dts:bundle\": EnumScriptsEntry.BUILD_DTS_BUNDLE,\n\t\t\"build:dts:copy\": \"copy .\\\\src\\\\index.d.ts .\\\\dist\\\\index.d.ts & echo build:dts\",\n\t\t\"build:dts:tsc:emit\": \"tsc --emitDeclarationOnly --declaration --noEmit false\",\n\t\t\"build:dts:tsc\": \"node --run build:dts:tsc:emit && node --run build:dts:copy\",\n\t\t\"build:tsdx\": \"ynpx @bluelovers/tsdx build --target node --name index\",\n\t\t\"build:microbundle\": \"ynpx microbundle --target node\",\n\t\t\"lint\": \"node --run lint:eslint\",\n\t\t\"lint:eslint\": \"ynpx eslint --ext .ts,.tsx,.mts,.cts ./\",\n\t\t\"review\": \"node --run review:coverage\",\n\t\t\"review:test\": \"yarn run lint && yarn run test\",\n\t\t\"review:coverage\": \"yarn run lint && yarn run coverage\",\n\t\t\"sort-package-json\": \"yarn-tool sort\",\n\t\t\"tsc:default\": \"tsc -p tsconfig.json\",\n\t\t\"tsc:esm\": \"tsc -p tsconfig.esm.json\",\n\t}\n}\n"]}
|