@yarn-tool/setup-module-env 3.0.3 → 3.0.5

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 CHANGED
@@ -3,6 +3,42 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.0.5](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/setup-module-env@3.0.4...@yarn-tool/setup-module-env@3.0.5) (2026-03-04)
7
+
8
+ **Note:** Version bump only for package @yarn-tool/setup-module-env
9
+
10
+
11
+
12
+
13
+
14
+ ## [3.0.4](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/setup-module-env@3.0.3...@yarn-tool/setup-module-env@3.0.4) (2026-03-02)
15
+
16
+
17
+
18
+ ### ✨ Features
19
+
20
+ * **yarn-tool:** 簡化靜態檔案複製配置並新增測試路徑常數 ([8f7660c](https://github.com/bluelovers/ws-yarn-workspaces/commit/8f7660c6df39b7cfd2c69a019f02a5f840193092))
21
+
22
+
23
+ ### 📚 Documentation
24
+
25
+ * **setup-module-env:** 為 tsdx 設定模組添加完整的 JSDoc 文檔註釋 ([5def98a](https://github.com/bluelovers/ws-yarn-workspaces/commit/5def98ab905bb3dc50d2d00e5f3f3d4da5d23cf3))
26
+
27
+
28
+ ### 🛠 Build System
29
+
30
+ * update build ([51d49ad](https://github.com/bluelovers/ws-yarn-workspaces/commit/51d49adaa1f1fbfac4a299007dbf406d7ee7a4c7))
31
+
32
+
33
+ ### ♻️ Chores
34
+
35
+ * Add test config and global types for tsdx ([88a8df6](https://github.com/bluelovers/ws-yarn-workspaces/commit/88a8df6eef5dc59d9e0d9268b21706dceb5ab2a1))
36
+ * 更新 Jest 快照連結並增強類型定義與文件 ([b663b97](https://github.com/bluelovers/ws-yarn-workspaces/commit/b663b97d78d223dc8b3927ea2433938350144de7))
37
+ * remove empty resolutions and redundant packageManager fields ([65b5c5f](https://github.com/bluelovers/ws-yarn-workspaces/commit/65b5c5f929aae82474408b2b46cfc5a471c919f6))
38
+ * add __root.ts test utility to workspace packages ([a771727](https://github.com/bluelovers/ws-yarn-workspaces/commit/a7717278883c86d9ed8ab89f42070d3385c173a7))
39
+
40
+
41
+
6
42
  ## [3.0.3](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/setup-module-env@3.0.2...@yarn-tool/setup-module-env@3.0.3) (2025-09-07)
7
43
 
8
44
  **Note:** Version bump only for package @yarn-tool/setup-module-env
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # README.md
1
+ # @yarn-tool/setup-module-env
2
2
 
3
-
3
+ 用於設定 tsdx 專案環境的工具,自動配置 package.json 與靜態檔案 (Tool for setting up tsdx project environment, auto-configuring package.json and static files)
4
4
 
5
5
  ## install
6
6
 
@@ -8,5 +8,9 @@
8
8
  yarn add @yarn-tool/setup-module-env
9
9
  yarn-tool add @yarn-tool/setup-module-env
10
10
  yt add @yarn-tool/setup-module-env
11
+
12
+ pnpm add @yarn-tool/setup-module-env
13
+
14
+ npm install @yarn-tool/setup-module-env
11
15
  ```
12
16
 
package/index.d.ts CHANGED
@@ -1 +1,13 @@
1
+ /**
2
+ * @yarn-tool/setup-module-env 入口檔案
3
+ * Entry file for @yarn-tool/setup-module-env
4
+ *
5
+ * 此模組提供設定模組環境的工具函式,主要用於設定 tsdx 專案。
6
+ * This module provides utility functions for setting up module environments,
7
+ * primarily used for configuring tsdx projects.
8
+ *
9
+ * 匯出 setupTsdx 函式,用於初始化和設定 tsdx 專案的 package.json 及相關靜態檔案。
10
+ * Exports the setupTsdx function for initializing and configuring
11
+ * tsdx project's package.json and related static files.
12
+ */
1
13
  export { setup as setupTsdx } from './lib/preset/tsdx/index';
package/index.js CHANGED
@@ -1,6 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setupTsdx = void 0;
4
+ /**
5
+ * @yarn-tool/setup-module-env 入口檔案
6
+ * Entry file for @yarn-tool/setup-module-env
7
+ *
8
+ * 此模組提供設定模組環境的工具函式,主要用於設定 tsdx 專案。
9
+ * This module provides utility functions for setting up module environments,
10
+ * primarily used for configuring tsdx projects.
11
+ *
12
+ * 匯出 setupTsdx 函式,用於初始化和設定 tsdx 專案的 package.json 及相關靜態檔案。
13
+ * Exports the setupTsdx function for initializing and configuring
14
+ * tsdx project's package.json and related static files.
15
+ */
4
16
  var index_1 = require("./lib/preset/tsdx/index");
5
17
  Object.defineProperty(exports, "setupTsdx", { enumerable: true, get: function () { return index_1.setup; } });
6
18
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AACA,iDAA6D;AAApD,kGAAA,KAAK,OAAa","sourcesContent":["\nexport { setup as setupTsdx } from './lib/preset/tsdx/index';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;GAWG;AACH,iDAA6D;AAApD,kGAAA,KAAK,OAAa","sourcesContent":["/**\n * @yarn-tool/setup-module-env 入口檔案\n * Entry file for @yarn-tool/setup-module-env\n *\n * 此模組提供設定模組環境的工具函式,主要用於設定 tsdx 專案。\n * This module provides utility functions for setting up module environments,\n * primarily used for configuring tsdx projects.\n *\n * 匯出 setupTsdx 函式,用於初始化和設定 tsdx 專案的 package.json 及相關靜態檔案。\n * Exports the setupTsdx function for initializing and configuring\n * tsdx project's package.json and related static files.\n */\nexport { setup as setupTsdx } from './lib/preset/tsdx/index';\n"]}
@@ -1,3 +1,18 @@
1
+ /**
2
+ * tsdx 相關常數定義
3
+ * Constants definition for tsdx related operations
4
+ */
5
+ /**
6
+ * tsdx 列舉常數
7
+ * Enum constants for tsdx
8
+ *
9
+ * 定義用於識別 tsdx 專案的關鍵字常數。
10
+ * Defines keyword constants for identifying tsdx projects.
11
+ */
1
12
  export declare const enum EnumTsdx {
13
+ /**
14
+ * 用於標識由 tsdx 建立的專案
15
+ * Keyword to identify projects created by tsdx
16
+ */
2
17
  keyword = "create-by-tsdx"
3
18
  }
@@ -1,8 +1,23 @@
1
1
  "use strict";
2
+ /**
3
+ * tsdx 相關常數定義
4
+ * Constants definition for tsdx related operations
5
+ */
2
6
  Object.defineProperty(exports, "__esModule", { value: true });
3
7
  exports.EnumTsdx = void 0;
8
+ /**
9
+ * tsdx 列舉常數
10
+ * Enum constants for tsdx
11
+ *
12
+ * 定義用於識別 tsdx 專案的關鍵字常數。
13
+ * Defines keyword constants for identifying tsdx projects.
14
+ */
4
15
  var EnumTsdx;
5
16
  (function (EnumTsdx) {
17
+ /**
18
+ * 用於標識由 tsdx 建立的專案
19
+ * Keyword to identify projects created by tsdx
20
+ */
6
21
  EnumTsdx["keyword"] = "create-by-tsdx";
7
22
  })(EnumTsdx || (exports.EnumTsdx = EnumTsdx = {}));
8
23
  //# sourceMappingURL=const.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"const.js","sourceRoot":"","sources":["const.ts"],"names":[],"mappings":";;;AACA,IAAkB,QAGjB;AAHD,WAAkB,QAAQ;IAEzB,sCAA0B,CAAA;AAC3B,CAAC,EAHiB,QAAQ,wBAAR,QAAQ,QAGzB","sourcesContent":["\nexport const enum EnumTsdx\n{\n\tkeyword = 'create-by-tsdx'\n}\n"]}
1
+ {"version":3,"file":"const.js","sourceRoot":"","sources":["const.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;;GAMG;AACH,IAAkB,QAOjB;AAPD,WAAkB,QAAQ;IAEzB;;;OAGG;IACH,sCAA0B,CAAA;AAC3B,CAAC,EAPiB,QAAQ,wBAAR,QAAQ,QAOzB","sourcesContent":["/**\n * tsdx 相關常數定義\n * Constants definition for tsdx related operations\n */\n\n/**\n * tsdx 列舉常數\n * Enum constants for tsdx\n *\n * 定義用於識別 tsdx 專案的關鍵字常數。\n * Defines keyword constants for identifying tsdx projects.\n */\nexport const enum EnumTsdx\n{\n\t/**\n\t * 用於標識由 tsdx 建立的專案\n\t * Keyword to identify projects created by tsdx\n\t */\n\tkeyword = 'create-by-tsdx'\n}\n"]}
@@ -1,4 +1,25 @@
1
+ /**
2
+ * tsdx package.json 修復與調整工具函式
3
+ * Utility functions for fixing and adjusting tsdx package.json
4
+ */
1
5
  import { IPackageJson } from '@ts-type/package-dts/package-json';
2
6
  import { ISetupTsdxOptions } from './index';
3
7
  import { ITSPickExtra } from 'ts-type/lib/type/record';
8
+ /**
9
+ * 修復 tsdx 專案的 package.json 設定
10
+ * Fix tsdx project's package.json configuration
11
+ *
12
+ * 根據工作區 (workspace) 的狀態調整 tslib 依賴的位置:
13
+ * Adjusts tslib dependency location based on workspace status:
14
+ *
15
+ * - 如果位於工作區內但不是工作區根目錄:移除 tslib 依賴(由根目錄統一管理)
16
+ * If inside a workspace but not the workspace root: removes tslib dependency (managed by root)
17
+ *
18
+ * - 如果是獨立專案或工作區根目錄:將 tslib 從 dependencies 移至 devDependencies
19
+ * If standalone project or workspace root: moves tslib from dependencies to devDependencies
20
+ *
21
+ * @param pkg - package.json 物件 / package.json object
22
+ * @param config - 包含 rootData 的設定選項 / configuration options containing rootData
23
+ * @returns 修改後的 package.json 物件 / Modified package.json object
24
+ */
4
25
  export declare function fixTsdxPackage<P extends IPackageJson>(pkg: P, config: ITSPickExtra<ISetupTsdxOptions<P>, 'rootData'>): P;
@@ -1,20 +1,51 @@
1
1
  "use strict";
2
+ /**
3
+ * tsdx package.json 修復與調整工具函式
4
+ * Utility functions for fixing and adjusting tsdx package.json
5
+ */
2
6
  Object.defineProperty(exports, "__esModule", { value: true });
3
7
  exports.fixTsdxPackage = fixTsdxPackage;
4
8
  const dot_values2_1 = require("dot-values2");
9
+ /**
10
+ * 修復 tsdx 專案的 package.json 設定
11
+ * Fix tsdx project's package.json configuration
12
+ *
13
+ * 根據工作區 (workspace) 的狀態調整 tslib 依賴的位置:
14
+ * Adjusts tslib dependency location based on workspace status:
15
+ *
16
+ * - 如果位於工作區內但不是工作區根目錄:移除 tslib 依賴(由根目錄統一管理)
17
+ * If inside a workspace but not the workspace root: removes tslib dependency (managed by root)
18
+ *
19
+ * - 如果是獨立專案或工作區根目錄:將 tslib 從 dependencies 移至 devDependencies
20
+ * If standalone project or workspace root: moves tslib from dependencies to devDependencies
21
+ *
22
+ * @param pkg - package.json 物件 / package.json object
23
+ * @param config - 包含 rootData 的設定選項 / configuration options containing rootData
24
+ * @returns 修改後的 package.json 物件 / Modified package.json object
25
+ */
5
26
  function fixTsdxPackage(pkg, config) {
6
27
  var _a, _b, _c, _d, _e;
7
28
  var _f, _g;
29
+ // 檢查是否在工作區內但不是工作區本身(即子套件)
30
+ // Check if inside a workspace but not the workspace itself (i.e., sub-package)
8
31
  if (config.rootData.hasWorkspace && !config.rootData.isWorkspace) {
32
+ // 在工作區子套件中,移除 tslib 依賴(由根目錄統一管理)
33
+ // In workspace sub-packages, remove tslib dependency (managed by root)
9
34
  (0, dot_values2_1.deleteValue)(pkg, ['dependencies', 'tslib']);
10
35
  (0, dot_values2_1.deleteValue)(pkg, ['devDependencies', 'tslib']);
11
36
  }
12
37
  else {
38
+ // 確保 devDependencies 存在
39
+ // Ensure devDependencies exists
13
40
  (_a = pkg.devDependencies) !== null && _a !== void 0 ? _a : (pkg.devDependencies = {});
41
+ // 如果 tslib 在 dependencies 中,將其移至 devDependencies
42
+ // If tslib is in dependencies, move it to devDependencies
14
43
  if (((_c = (_b = pkg.dependencies) === null || _b === void 0 ? void 0 : _b['tslib']) === null || _c === void 0 ? void 0 : _c.length) > 0) {
15
44
  (_d = (_f = pkg.devDependencies)['tslib']) !== null && _d !== void 0 ? _d : (_f['tslib'] = pkg.dependencies['tslib']);
16
45
  (0, dot_values2_1.deleteValue)(pkg, ['dependencies', 'tslib']);
17
46
  }
47
+ // 如果是根目錄,確保 @bluelovers/tsconfig 存在
48
+ // If it's the root directory, ensure @bluelovers/tsconfig exists
18
49
  if (config.rootData.isRoot) {
19
50
  (_e = (_g = pkg.devDependencies)['@bluelovers/tsconfig']) !== null && _e !== void 0 ? _e : (_g['@bluelovers/tsconfig'] = '*');
20
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fix.js","sourceRoot":"","sources":["fix.ts"],"names":[],"mappings":";;AAKA,wCAwBC;AA3BD,6CAA0C;AAG1C,SAAgB,cAAc,CAAyB,GAAM,EAAE,MAAsD;;;IAEpH,IAAI,MAAM,CAAC,QAAQ,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAChE,CAAC;QACA,IAAA,yBAAW,EAAC,GAAG,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;QAC5C,IAAA,yBAAW,EAAC,GAAG,EAAE,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,CAAC;IAChD,CAAC;SAED,CAAC;QACA,MAAA,GAAG,CAAC,eAAe,oCAAnB,GAAG,CAAC,eAAe,GAAK,EAAE,EAAC;QAE3B,IAAI,CAAA,MAAA,MAAA,GAAG,CAAC,YAAY,0CAAG,OAAO,CAAC,0CAAE,MAAM,IAAG,CAAC,EAC3C,CAAC;YACA,YAAA,GAAG,CAAC,eAAe,EAAC,OAAO,wCAAP,OAAO,IAAM,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,EAAC;YAC3D,IAAA,yBAAW,EAAC,GAAG,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;QAC7C,CAAC;QAED,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,EAC1B,CAAC;YACA,YAAA,GAAG,CAAC,eAAe,EAAC,sBAAsB,wCAAtB,sBAAsB,IAAM,GAAG,EAAC;QACrD,CAAC;IACF,CAAC;IAED,OAAO,GAAG,CAAA;AACX,CAAC","sourcesContent":["import { IPackageJson } from '@ts-type/package-dts/package-json';\nimport { ISetupTsdxOptions } from './index';\nimport { deleteValue } from 'dot-values2';\nimport { ITSPickExtra } from 'ts-type/lib/type/record';\n\nexport function fixTsdxPackage<P extends IPackageJson>(pkg: P, config: ITSPickExtra<ISetupTsdxOptions<P>, 'rootData'>)\n{\n\tif (config.rootData.hasWorkspace && !config.rootData.isWorkspace)\n\t{\n\t\tdeleteValue(pkg, ['dependencies', 'tslib']);\n\t\tdeleteValue(pkg, ['devDependencies', 'tslib']);\n\t}\n\telse\n\t{\n\t\tpkg.devDependencies ??= {};\n\n\t\tif (pkg.dependencies?.['tslib']?.length > 0)\n\t\t{\n\t\t\tpkg.devDependencies['tslib'] ??= pkg.dependencies['tslib'];\n\t\t\tdeleteValue(pkg, ['dependencies', 'tslib']);\n\t\t}\n\n\t\tif (config.rootData.isRoot)\n\t\t{\n\t\t\tpkg.devDependencies['@bluelovers/tsconfig'] ??= '*';\n\t\t}\n\t}\n\n\treturn pkg\n}\n"]}
1
+ {"version":3,"file":"fix.js","sourceRoot":"","sources":["fix.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAwBH,wCAkCC;AAtDD,6CAA0C;AAG1C;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,cAAc,CAAyB,GAAM,EAAE,MAAsD;;;IAEpH,0BAA0B;IAC1B,+EAA+E;IAC/E,IAAI,MAAM,CAAC,QAAQ,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAChE,CAAC;QACA,iCAAiC;QACjC,uEAAuE;QACvE,IAAA,yBAAW,EAAC,GAAG,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;QAC5C,IAAA,yBAAW,EAAC,GAAG,EAAE,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,CAAC;IAChD,CAAC;SAED,CAAC;QACA,wBAAwB;QACxB,gCAAgC;QAChC,MAAA,GAAG,CAAC,eAAe,oCAAnB,GAAG,CAAC,eAAe,GAAK,EAAE,EAAC;QAE3B,iDAAiD;QACjD,0DAA0D;QAC1D,IAAI,CAAA,MAAA,MAAA,GAAG,CAAC,YAAY,0CAAG,OAAO,CAAC,0CAAE,MAAM,IAAG,CAAC,EAC3C,CAAC;YACA,YAAA,GAAG,CAAC,eAAe,EAAC,OAAO,wCAAP,OAAO,IAAM,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,EAAC;YAC3D,IAAA,yBAAW,EAAC,GAAG,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;QAC7C,CAAC;QAED,oCAAoC;QACpC,iEAAiE;QACjE,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,EAC1B,CAAC;YACA,YAAA,GAAG,CAAC,eAAe,EAAC,sBAAsB,wCAAtB,sBAAsB,IAAM,GAAG,EAAC;QACrD,CAAC;IACF,CAAC;IAED,OAAO,GAAG,CAAA;AACX,CAAC","sourcesContent":["/**\n * tsdx package.json 修復與調整工具函式\n * Utility functions for fixing and adjusting tsdx package.json\n */\n\nimport { IPackageJson } from '@ts-type/package-dts/package-json';\nimport { ISetupTsdxOptions } from './index';\nimport { deleteValue } from 'dot-values2';\nimport { ITSPickExtra } from 'ts-type/lib/type/record';\n\n/**\n * 修復 tsdx 專案的 package.json 設定\n * Fix tsdx project's package.json configuration\n *\n * 根據工作區 (workspace) 的狀態調整 tslib 依賴的位置:\n * Adjusts tslib dependency location based on workspace status:\n *\n * - 如果位於工作區內但不是工作區根目錄:移除 tslib 依賴(由根目錄統一管理)\n * If inside a workspace but not the workspace root: removes tslib dependency (managed by root)\n *\n * - 如果是獨立專案或工作區根目錄:將 tslib 從 dependencies 移至 devDependencies\n * If standalone project or workspace root: moves tslib from dependencies to devDependencies\n *\n * @param pkg - package.json 物件 / package.json object\n * @param config - 包含 rootData 的設定選項 / configuration options containing rootData\n * @returns 修改後的 package.json 物件 / Modified package.json object\n */\nexport function fixTsdxPackage<P extends IPackageJson>(pkg: P, config: ITSPickExtra<ISetupTsdxOptions<P>, 'rootData'>)\n{\n\t// 檢查是否在工作區內但不是工作區本身(即子套件)\n\t// Check if inside a workspace but not the workspace itself (i.e., sub-package)\n\tif (config.rootData.hasWorkspace && !config.rootData.isWorkspace)\n\t{\n\t\t// 在工作區子套件中,移除 tslib 依賴(由根目錄統一管理)\n\t\t// In workspace sub-packages, remove tslib dependency (managed by root)\n\t\tdeleteValue(pkg, ['dependencies', 'tslib']);\n\t\tdeleteValue(pkg, ['devDependencies', 'tslib']);\n\t}\n\telse\n\t{\n\t\t// 確保 devDependencies 存在\n\t\t// Ensure devDependencies exists\n\t\tpkg.devDependencies ??= {};\n\n\t\t// 如果 tslib 在 dependencies 中,將其移至 devDependencies\n\t\t// If tslib is in dependencies, move it to devDependencies\n\t\tif (pkg.dependencies?.['tslib']?.length > 0)\n\t\t{\n\t\t\tpkg.devDependencies['tslib'] ??= pkg.dependencies['tslib'];\n\t\t\tdeleteValue(pkg, ['dependencies', 'tslib']);\n\t\t}\n\n\t\t// 如果是根目錄,確保 @bluelovers/tsconfig 存在\n\t\t// If it's the root directory, ensure @bluelovers/tsconfig exists\n\t\tif (config.rootData.isRoot)\n\t\t{\n\t\t\tpkg.devDependencies['@bluelovers/tsconfig'] ??= '*';\n\t\t}\n\t}\n\n\treturn pkg\n}\n"]}
@@ -1,25 +1,108 @@
1
+ /**
2
+ * tsdx 專案設定模組
3
+ * tsdx project setup module
4
+ *
5
+ * 此模組提供設定 tsdx 專案的核心功能,包括更新 package.json、
6
+ * 設定靜態檔案映射以及主要設定函式。
7
+ * This module provides core functionality for setting up tsdx projects,
8
+ * including updating package.json, configuring static file mappings,
9
+ * and the main setup function.
10
+ */
1
11
  import { IPackageJson } from '@ts-type/package-dts/package-json';
2
12
  import { IFindRootReturnType } from '@yarn-tool/find-root';
3
13
  import { _Key, IStaticFilesMapArray } from '@yarn-tool/static-file/lib/types';
14
+ /**
15
+ * 更新 package.json 以符合 tsdx 專案標準
16
+ * Update package.json to conform to tsdx project standards
17
+ *
18
+ * 此函式會設定以下內容:
19
+ * This function configures the following:
20
+ *
21
+ * - scripts: test, posttest, build, build:dts:bundle, build:tsdx 等
22
+ * scripts: test, posttest, build, build:dts:bundle, build:tsdx, etc.
23
+ *
24
+ * - main/module/types: 設定輸出檔案路徑
25
+ * main/module/types: configure output file paths
26
+ *
27
+ * - exports: 設定模組匯出映射
28
+ * exports: configure module export mappings
29
+ *
30
+ * - keywords: 添加 tsdx 標識關鍵字
31
+ * keywords: add tsdx identifier keyword
32
+ *
33
+ * @param pkg - 要更新的 package.json 物件 / package.json object to update
34
+ * @param config - 設定選項 (可選) / configuration options (optional)
35
+ * @returns 更新後的 package.json 物件 / Updated package.json object
36
+ */
4
37
  export declare function updatePackageJson<P extends IPackageJson>(pkg: P, config?: ISetupTsdxOptions<P>): P;
5
- declare const _defaultCopyStaticFilesTsdx: readonly [readonly ["tsconfig.json", "file/tsconfig.tsdx.json.tpl", "tsconfig.json"], readonly ["test/tsconfig.json", "file/test/tsconfig.json.tpl", "test/tsconfig.json"], readonly ["src/index.cts", "file/tsdx/index.cts"]];
38
+ /**
39
+ * 預設的靜態檔案複製映射表
40
+ * Default static file copy mapping table
41
+ *
42
+ * 定義需要複製到目標專案的靜態檔案,每個項目為 [目標路徑, 來源路徑, ?來源檔名] 的格式。
43
+ * Defines static files that need to be copied to the target project,
44
+ * each entry follows [targetPath, sourcePath, ?sourceFileName] format.
45
+ */
46
+ declare const _defaultCopyStaticFilesTsdx: readonly [readonly ["tsconfig.json", "file/tsconfig.tsdx.json.tpl"], readonly ["test/tsconfig.json", "file/test/tsconfig.json.tpl"], readonly ["src/index.cts", "file/tsdx/index.cts"], readonly ["src/tsconfig.json", "file/tsdx/tsconfig.json.tpl"]];
47
+ /**
48
+ * 凍結的預設靜態檔案映射表
49
+ * Frozen default static file mapping table
50
+ */
6
51
  export declare const defaultCopyStaticFilesTsdx: IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFilesTsdx>>;
52
+ /**
53
+ * tsdx 設定選項介面
54
+ * tsdx setup options interface
55
+ *
56
+ * @template P - package.json 類型 / package.json type
57
+ */
7
58
  export interface ISetupTsdxOptions<P extends IPackageJson> {
59
+ /** 目標目錄路徑 / Target directory path */
8
60
  targetDir: string;
61
+ /** package.json 物件 / package.json object */
9
62
  pkg: P;
63
+ /** 工作區根目錄資訊 / Workspace root directory information */
10
64
  rootData: IFindRootReturnType;
65
+ /** 靜態檔案映射表 / Static file mapping table */
11
66
  file_map: IStaticFilesMapArray<string>;
67
+ /** README 檔案名稱 / README file name */
12
68
  mdFile: string;
69
+ /** 是否存在 README 檔案 / Whether README file exists */
13
70
  existsReadme: boolean;
71
+ /** 是否為已存在的專案 / Whether it's an existing project */
14
72
  oldExists: boolean;
15
73
  }
74
+ /**
75
+ * 設定 tsdx 專案的主要函式
76
+ * Main function for setting up tsdx project
77
+ *
78
+ * 此函式執行以下操作:
79
+ * This function performs the following operations:
80
+ *
81
+ * 1. 更新 package.json 設定
82
+ * Update package.json configuration
83
+ *
84
+ * 2. 合併預設與自訂的靜態檔案映射
85
+ * Merge default and custom static file mappings
86
+ *
87
+ * 3. 確保 src 目錄存在
88
+ * Ensure src directory exists
89
+ *
90
+ * @template P - package.json 類型 / package.json type
91
+ * @param config - 設定選項 / Configuration options
92
+ * @returns 包含更新後設定的物件 / Object containing updated configuration
93
+ */
16
94
  export declare function setup<P extends IPackageJson>(config: ISetupTsdxOptions<P>): {
17
95
  pkg: P;
18
96
  file_map: IStaticFilesMapArray<string>;
97
+ /** 目標目錄路徑 / Target directory path */
19
98
  targetDir: string;
99
+ /** 工作區根目錄資訊 / Workspace root directory information */
20
100
  rootData: IFindRootReturnType;
101
+ /** README 檔案名稱 / README file name */
21
102
  mdFile: string;
103
+ /** 是否存在 README 檔案 / Whether README file exists */
22
104
  existsReadme: boolean;
105
+ /** 是否為已存在的專案 / Whether it's an existing project */
23
106
  oldExists: boolean;
24
107
  };
25
108
  export {};
@@ -1,4 +1,14 @@
1
1
  "use strict";
2
+ /**
3
+ * tsdx 專案設定模組
4
+ * tsdx project setup module
5
+ *
6
+ * 此模組提供設定 tsdx 專案的核心功能,包括更新 package.json、
7
+ * 設定靜態檔案映射以及主要設定函式。
8
+ * This module provides core functionality for setting up tsdx projects,
9
+ * including updating package.json, configuring static file mappings,
10
+ * and the main setup function.
11
+ */
2
12
  Object.defineProperty(exports, "__esModule", { value: true });
3
13
  exports.defaultCopyStaticFilesTsdx = void 0;
4
14
  exports.updatePackageJson = updatePackageJson;
@@ -7,58 +17,164 @@ const scripts_1 = require("@yarn-tool/pkg-entry-util/lib/field/scripts");
7
17
  const fix_1 = require("./fix");
8
18
  const fs_extra_1 = require("fs-extra");
9
19
  const path_1 = require("path");
20
+ /**
21
+ * 更新 package.json 以符合 tsdx 專案標準
22
+ * Update package.json to conform to tsdx project standards
23
+ *
24
+ * 此函式會設定以下內容:
25
+ * This function configures the following:
26
+ *
27
+ * - scripts: test, posttest, build, build:dts:bundle, build:tsdx 等
28
+ * scripts: test, posttest, build, build:dts:bundle, build:tsdx, etc.
29
+ *
30
+ * - main/module/types: 設定輸出檔案路徑
31
+ * main/module/types: configure output file paths
32
+ *
33
+ * - exports: 設定模組匯出映射
34
+ * exports: configure module export mappings
35
+ *
36
+ * - keywords: 添加 tsdx 標識關鍵字
37
+ * keywords: add tsdx identifier keyword
38
+ *
39
+ * @param pkg - 要更新的 package.json 物件 / package.json object to update
40
+ * @param config - 設定選項 (可選) / configuration options (optional)
41
+ * @returns 更新後的 package.json 物件 / Updated package.json object
42
+ */
10
43
  function updatePackageJson(pkg, config) {
11
44
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
12
45
  var _q, _r, _s, _t, _u, _v, _w, _x, _y;
46
+ // 確保 scripts 欄位存在
47
+ // Ensure scripts field exists
13
48
  (_a = pkg.scripts) !== null && _a !== void 0 ? _a : (pkg.scripts = {});
49
+ // 如果 test 腳本未指定或為空,清除並設定預設值
50
+ // If test script is not specified or empty, clear and set default
14
51
  if ((0, scripts_1.scriptsEntryIsNoTestSpecified)(pkg.scripts["test"])) {
15
52
  pkg.scripts["test"] = void 0;
16
53
  }
54
+ // 設定預設的 test 腳本為 jest
55
+ // Set default test script to jest
17
56
  (_b = (_q = pkg.scripts)["test"]) !== null && _b !== void 0 ? _b : (_q["test"] = "jest --passWithNoTests" /* EnumScriptsEntry.JEST_TEST */);
57
+ // 設定 posttest 腳本,在測試後執行 build
58
+ // Set posttest script to run build after tests
18
59
  (_c = (_r = pkg.scripts)["posttest"]) !== null && _c !== void 0 ? _c : (_r["posttest"] = "yarn run build");
60
+ // 如果 build 腳本不包含 tsdx build,則設定新的 build 腳本
61
+ // If build script doesn't include tsdx build, set new build script
19
62
  if (!((_d = pkg.scripts["build"]) === null || _d === void 0 ? void 0 : _d.includes('run build:tsdx'))) {
20
63
  pkg.scripts["build"] = "yarn run build:tsdx && yarn run build:dts:bundle";
21
64
  }
65
+ // 設定 TypeScript 宣告檔案打包腳本
66
+ // Set TypeScript declaration file bundling script
22
67
  (_e = (_s = pkg.scripts)["build:dts:bundle"]) !== null && _e !== void 0 ? _e : (_s["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 */);
68
+ // 設定 tsdx build 腳本,目標為 node 環境
69
+ // Set tsdx build script targeting node environment
23
70
  (_f = (_t = pkg.scripts)["build:tsdx"]) !== null && _f !== void 0 ? _f : (_t["build:tsdx"] = "ynpx @bluelovers/tsdx build --target node");
71
+ // 設定複製宣告檔案的腳本 (Windows 語法)
72
+ // Set declaration file copy script (Windows syntax)
24
73
  (_g = (_u = pkg.scripts)["build:dts:copy"]) !== null && _g !== void 0 ? _g : (_u["build:dts:copy"] = "copy .\\src\\index.d.ts .\\dist\\index.d.ts & echo build:dts");
74
+ // 設定 TypeScript 宣告檔案輸出腳本
75
+ // Set TypeScript declaration file emit script
25
76
  (_h = (_v = pkg.scripts)["build:dts:tsc:emit"]) !== null && _h !== void 0 ? _h : (_v["build:dts:tsc:emit"] = "tsc --emitDeclarationOnly --declaration --noEmit false");
77
+ // 組合完整的 dts 建置腳本
78
+ // Compose complete dts build script
26
79
  (_j = (_w = pkg.scripts)["build:dts:tsc"]) !== null && _j !== void 0 ? _j : (_w["build:dts:tsc"] = [
27
80
  'yarn run build:dts:copy',
28
81
  'yarn run build:dts:tsc:emit',
29
82
  'yarn run build:dts:copy',
30
83
  ].join(' && '));
84
+ // 設定模組入口點
85
+ // Set module entry points
31
86
  pkg.main = "dist/index.cjs";
32
87
  pkg.module = "dist/index.esm.mjs";
33
88
  pkg.types = pkg.typings = "dist/index.d.ts";
89
+ // 設定 unpkg CDN 入口點
90
+ // Set unpkg CDN entry point
34
91
  (_k = pkg.unpkg) !== null && _k !== void 0 ? _k : (pkg.unpkg = "dist/index.umd.production.min.cjs");
92
+ // 設定 exports 欄位,定義模組匯出映射
93
+ // Set exports field, defining module export mappings
35
94
  (_l = pkg.exports) !== null && _l !== void 0 ? _l : (pkg.exports = {});
36
95
  (_m = (_x = pkg.exports)['.']) !== null && _m !== void 0 ? _m : (_x['.'] = {});
37
96
  pkg.exports['.'].types = "./dist/index.d.ts";
38
97
  pkg.exports['.'].import = "./dist/index.esm.mjs";
39
98
  pkg.exports['.'].require = "./dist/index.cjs";
99
+ // 允許直接存取 src 目錄下的檔案
100
+ // Allow direct access to files under src directory
40
101
  pkg.exports['./src/*'] = './src/*';
102
+ // 匯出 package.json 本身
103
+ // Export package.json itself
41
104
  (_o = (_y = pkg.exports)['./package.json']) !== null && _o !== void 0 ? _o : (_y['./package.json'] = './package.json');
105
+ // 確保 keywords 欄位存在
106
+ // Ensure keywords field exists
42
107
  (_p = pkg.keywords) !== null && _p !== void 0 ? _p : (pkg.keywords = []);
108
+ // 添加 tsdx 標識關鍵字(如果尚未存在)
109
+ // Add tsdx identifier keyword if not already present
43
110
  if (!pkg.keywords.includes("create-by-tsdx" /* EnumTsdx.keyword */)) {
44
111
  pkg.keywords.push("create-by-tsdx" /* EnumTsdx.keyword */);
45
112
  }
113
+ // 呼叫 fixTsdxPackage 進行額外的修復
114
+ // Call fixTsdxPackage for additional fixes
46
115
  (0, fix_1.fixTsdxPackage)(pkg, config);
47
116
  return pkg;
48
117
  }
118
+ /**
119
+ * 預設的靜態檔案複製映射表
120
+ * Default static file copy mapping table
121
+ *
122
+ * 定義需要複製到目標專案的靜態檔案,每個項目為 [目標路徑, 來源路徑, ?來源檔名] 的格式。
123
+ * Defines static files that need to be copied to the target project,
124
+ * each entry follows [targetPath, sourcePath, ?sourceFileName] format.
125
+ */
49
126
  const _defaultCopyStaticFilesTsdx = [
50
- ['tsconfig.json', 'file/tsconfig.tsdx.json.tpl', 'tsconfig.json'],
51
- ['test/tsconfig.json', 'file/test/tsconfig.json.tpl', 'test/tsconfig.json'],
127
+ // 根目錄的 tsconfig.json 設定檔
128
+ // Root tsconfig.json configuration file
129
+ ['tsconfig.json', 'file/tsconfig.tsdx.json.tpl'],
130
+ // 測試目錄的 tsconfig.json 設定檔
131
+ // Test directory tsconfig.json configuration file
132
+ ['test/tsconfig.json', 'file/test/tsconfig.json.tpl'],
133
+ // src 目錄下的 index.cts 檔案
134
+ // index.cts file under src directory
52
135
  ['src/index.cts', 'file/tsdx/index.cts'],
136
+ // src 目錄的 tsconfig.json 設定檔
137
+ // src directory tsconfig.json configuration file
138
+ ['src/tsconfig.json', 'file/tsdx/tsconfig.json.tpl'],
53
139
  ];
140
+ /**
141
+ * 凍結的預設靜態檔案映射表
142
+ * Frozen default static file mapping table
143
+ */
54
144
  exports.defaultCopyStaticFilesTsdx = Object.freeze(_defaultCopyStaticFilesTsdx);
145
+ /**
146
+ * 設定 tsdx 專案的主要函式
147
+ * Main function for setting up tsdx project
148
+ *
149
+ * 此函式執行以下操作:
150
+ * This function performs the following operations:
151
+ *
152
+ * 1. 更新 package.json 設定
153
+ * Update package.json configuration
154
+ *
155
+ * 2. 合併預設與自訂的靜態檔案映射
156
+ * Merge default and custom static file mappings
157
+ *
158
+ * 3. 確保 src 目錄存在
159
+ * Ensure src directory exists
160
+ *
161
+ * @template P - package.json 類型 / package.json type
162
+ * @param config - 設定選項 / Configuration options
163
+ * @returns 包含更新後設定的物件 / Object containing updated configuration
164
+ */
55
165
  function setup(config) {
56
166
  let { pkg, file_map, targetDir, } = config;
167
+ // 更新 package.json
168
+ // Update package.json
57
169
  pkg = updatePackageJson(pkg, config);
170
+ // 合併預設與自訂的靜態檔案映射
171
+ // Merge default and custom static file mappings
58
172
  file_map = [
59
173
  ...exports.defaultCopyStaticFilesTsdx,
60
174
  ...file_map,
61
175
  ];
176
+ // 確保 src 目錄存在
177
+ // Ensure src directory exists
62
178
  (0, fs_extra_1.ensureDirSync)((0, path_1.resolve)(targetDir, 'src'));
63
179
  return {
64
180
  ...config,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAUA,8CAoDC;AAuBD,sBAsBC;AAxGD,yEAA8G;AAG9G,+BAAuC;AACvC,uCAAyC;AACzC,+BAA+B;AAE/B,SAAgB,iBAAiB,CAAyB,GAAM,EAAE,MAA6B;;;IAE9F,MAAA,GAAG,CAAC,OAAO,oCAAX,GAAG,CAAC,OAAO,GAAK,EAAE,EAAC;IAEnB,IAAI,IAAA,uCAA6B,EAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EACtD,CAAC;QACA,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,YAAA,GAAG,CAAC,OAAO,EAAC,MAAM,wCAAN,MAAM,+DAAiC;IAEnD,YAAA,GAAG,CAAC,OAAO,EAAC,UAAU,wCAAV,UAAU,IAAM,gBAAgB,EAAC;IAE7C,IAAI,CAAC,CAAA,MAAA,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,0CAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAA,EACrD,CAAC;QACA,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,kDAAkD,CAAC;IAC3E,CAAC;IAED,YAAA,GAAG,CAAC,OAAO,EAAC,kBAAkB,wCAAlB,kBAAkB,qLAAwC;IACtE,YAAA,GAAG,CAAC,OAAO,EAAC,YAAY,wCAAZ,YAAY,IAAM,2CAA2C,EAAC;IAE1E,YAAA,GAAG,CAAC,OAAO,EAAC,gBAAgB,wCAAhB,gBAAgB,IAAM,8DAA8D,EAAC;IACjG,YAAA,GAAG,CAAC,OAAO,EAAC,oBAAoB,wCAApB,oBAAoB,IAAM,wDAAwD,EAAC;IAC/F,YAAA,GAAG,CAAC,OAAO,EAAC,eAAe,wCAAf,eAAe,IAAM;QAC9B,yBAAyB;QACzB,6BAA6B;QAC7B,yBAAyB;KAC1B,CAAC,IAAI,CAAC,MAAM,CAAC,EAAC;IAEhB,GAAG,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC5B,GAAG,CAAC,MAAM,GAAG,oBAAoB,CAAC;IAClC,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,OAAO,GAAG,iBAAiB,CAAC;IAC5C,MAAA,GAAG,CAAC,KAAK,oCAAT,GAAG,CAAC,KAAK,GAAK,mCAAmC,EAAC;IAElD,MAAA,GAAG,CAAC,OAAO,oCAAX,GAAG,CAAC,OAAO,GAAK,EAAE,EAAC;IACnB,YAAA,GAAG,CAAC,OAAO,EAAC,GAAG,wCAAH,GAAG,IAAM,EAAE,EAAC;IACxB,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,mBAAmB,CAAC;IAC7C,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,sBAAsB,CAAC;IACjD,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,GAAG,kBAAkB,CAAC;IAE9C,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IACnC,YAAA,GAAG,CAAC,OAAO,EAAC,gBAAgB,wCAAhB,gBAAgB,IAAM,gBAAgB,EAAC;IAEnD,MAAA,GAAG,CAAC,QAAQ,oCAAZ,GAAG,CAAC,QAAQ,GAAK,EAAE,EAAC;IACpB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,yCAAkB,EAC5C,CAAC;QACA,GAAG,CAAC,QAAQ,CAAC,IAAI,yCAAkB,CAAC;IACrC,CAAC;IAED,IAAA,oBAAc,EAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAE5B,OAAO,GAAG,CAAA;AACX,CAAC;AAED,MAAM,2BAA2B,GAAG;IAEnC,CAAC,eAAe,EAAE,6BAA6B,EAAE,eAAe,CAAC;IACjE,CAAC,oBAAoB,EAAE,6BAA6B,EAAE,oBAAoB,CAAC;IAC3E,CAAC,eAAe,EAAE,qBAAqB,CAAC;CAE/B,CAAC;AAEE,QAAA,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC,2BAA2B,CAA0E,CAAC;AAa9J,SAAgB,KAAK,CAAyB,MAA4B;IAEzE,IAAI,EACH,GAAG,EACH,QAAQ,EACR,SAAS,GACT,GAAG,MAAM,CAAC;IAEX,GAAG,GAAG,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAErC,QAAQ,GAAG;QACR,GAAG,kCAA0B;QAC/B,GAAG,QAAQ;KACX,CAAC;IAEF,IAAA,wBAAa,EAAC,IAAA,cAAO,EAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAEzC,OAAO;QACN,GAAG,MAAM;QACT,GAAG;QACH,QAAQ;KACR,CAAA;AACF,CAAC","sourcesContent":["import { IPackageJson } from '@ts-type/package-dts/package-json';\nimport { IFindRootReturnType } from '@yarn-tool/find-root';\nimport { _Key, IStaticFilesMapArray } from '@yarn-tool/static-file/lib/types';\nimport { EnumScriptsEntry, scriptsEntryIsNoTestSpecified } from '@yarn-tool/pkg-entry-util/lib/field/scripts';\nimport { deleteValue } from 'dot-values2';\nimport { EnumTsdx } from './const';\nimport { fixTsdxPackage } from './fix';\nimport { ensureDirSync } from 'fs-extra';\nimport { resolve } from 'path';\n\nexport function updatePackageJson<P extends IPackageJson>(pkg: P, config?: ISetupTsdxOptions<P>)\n{\n\tpkg.scripts ??= {};\n\n\tif (scriptsEntryIsNoTestSpecified(pkg.scripts[\"test\"]))\n\t{\n\t\tpkg.scripts[\"test\"] = void 0;\n\t}\n\n\tpkg.scripts[\"test\"] ??= EnumScriptsEntry.JEST_TEST;\n\n\tpkg.scripts[\"posttest\"] ??= \"yarn run build\";\n\n\tif (!pkg.scripts[\"build\"]?.includes('run build:tsdx'))\n\t{\n\t\tpkg.scripts[\"build\"] = \"yarn run build:tsdx && yarn run build:dts:bundle\";\n\t}\n\n\tpkg.scripts[\"build:dts:bundle\"] ??= EnumScriptsEntry.BUILD_DTS_BUNDLE;\n\tpkg.scripts[\"build:tsdx\"] ??= \"ynpx @bluelovers/tsdx build --target node\";\n\n\tpkg.scripts[\"build:dts:copy\"] ??= \"copy .\\\\src\\\\index.d.ts .\\\\dist\\\\index.d.ts & echo build:dts\";\n\tpkg.scripts[\"build:dts:tsc:emit\"] ??= \"tsc --emitDeclarationOnly --declaration --noEmit false\";\n\tpkg.scripts[\"build:dts:tsc\"] ??= [\n 'yarn run build:dts:copy',\n 'yarn run build:dts:tsc:emit',\n 'yarn run build:dts:copy',\n ].join(' && ');\n\n\tpkg.main = \"dist/index.cjs\";\n\tpkg.module = \"dist/index.esm.mjs\";\n\tpkg.types = pkg.typings = \"dist/index.d.ts\";\n\tpkg.unpkg ??= \"dist/index.umd.production.min.cjs\";\n\n\tpkg.exports ??= {};\n\tpkg.exports['.'] ??= {};\n\tpkg.exports['.'].types = \"./dist/index.d.ts\";\n\tpkg.exports['.'].import = \"./dist/index.esm.mjs\";\n\tpkg.exports['.'].require = \"./dist/index.cjs\";\n\n\tpkg.exports['./src/*'] = './src/*';\n\tpkg.exports['./package.json'] ??= './package.json';\n\n\tpkg.keywords ??= [];\n\tif (!pkg.keywords.includes(EnumTsdx.keyword))\n\t{\n\t\tpkg.keywords.push(EnumTsdx.keyword);\n\t}\n\n\tfixTsdxPackage(pkg, config);\n\n\treturn pkg\n}\n\nconst _defaultCopyStaticFilesTsdx = [\n\n\t['tsconfig.json', 'file/tsconfig.tsdx.json.tpl', 'tsconfig.json'],\n\t['test/tsconfig.json', 'file/test/tsconfig.json.tpl', 'test/tsconfig.json'],\n\t['src/index.cts', 'file/tsdx/index.cts'],\n\n] as const;\n\nexport const defaultCopyStaticFilesTsdx = Object.freeze(_defaultCopyStaticFilesTsdx) as any as IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFilesTsdx>>;\n\nexport interface ISetupTsdxOptions<P extends IPackageJson>\n{\n\ttargetDir: string,\n\tpkg: P,\n\trootData: IFindRootReturnType,\n\tfile_map: IStaticFilesMapArray<string>,\n\tmdFile: string,\n\texistsReadme: boolean,\n\toldExists: boolean,\n}\n\nexport function setup<P extends IPackageJson>(config: ISetupTsdxOptions<P>)\n{\n\tlet {\n\t\tpkg,\n\t\tfile_map,\n\t\ttargetDir,\n\t} = config;\n\n\tpkg = updatePackageJson(pkg, config);\n\n\tfile_map = [\n ...defaultCopyStaticFilesTsdx,\n\t\t...file_map,\n\t];\n\n\tensureDirSync(resolve(targetDir, 'src'));\n\n\treturn {\n\t\t...config,\n\t\tpkg,\n\t\tfile_map,\n\t}\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * tsdx 專案設定模組\n * tsdx project setup module\n *\n * 此模組提供設定 tsdx 專案的核心功能,包括更新 package.json、\n * 設定靜態檔案映射以及主要設定函式。\n * This module provides core functionality for setting up tsdx projects,\n * including updating package.json, configuring static file mappings,\n * and the main setup function.\n */\n\nimport { IPackageJson } from '@ts-type/package-dts/package-json';\nimport { IFindRootReturnType } from '@yarn-tool/find-root';\nimport { _Key, IStaticFilesMapArray } from '@yarn-tool/static-file/lib/types';\nimport { EnumScriptsEntry, scriptsEntryIsNoTestSpecified } from '@yarn-tool/pkg-entry-util/lib/field/scripts';\nimport { deleteValue } from 'dot-values2';\nimport { EnumTsdx } from './const';\nimport { fixTsdxPackage } from './fix';\nimport { ensureDirSync } from 'fs-extra';\nimport { resolve } from 'path';\n\n/**\n * 更新 package.json 以符合 tsdx 專案標準\n * Update package.json to conform to tsdx project standards\n *\n * 此函式會設定以下內容:\n * This function configures the following:\n *\n * - scripts: test, posttest, build, build:dts:bundle, build:tsdx 等\n * scripts: test, posttest, build, build:dts:bundle, build:tsdx, etc.\n *\n * - main/module/types: 設定輸出檔案路徑\n * main/module/types: configure output file paths\n *\n * - exports: 設定模組匯出映射\n * exports: configure module export mappings\n *\n * - keywords: 添加 tsdx 標識關鍵字\n * keywords: add tsdx identifier keyword\n *\n * @param pkg - 要更新的 package.json 物件 / package.json object to update\n * @param config - 設定選項 (可選) / configuration options (optional)\n * @returns 更新後的 package.json 物件 / Updated package.json object\n */\nexport function updatePackageJson<P extends IPackageJson>(pkg: P, config?: ISetupTsdxOptions<P>)\n{\n\t// 確保 scripts 欄位存在\n\t// Ensure scripts field exists\n\tpkg.scripts ??= {};\n\n\t// 如果 test 腳本未指定或為空,清除並設定預設值\n\t// If test script is not specified or empty, clear and set default\n\tif (scriptsEntryIsNoTestSpecified(pkg.scripts[\"test\"]))\n\t{\n\t\tpkg.scripts[\"test\"] = void 0;\n\t}\n\n\t// 設定預設的 test 腳本為 jest\n\t// Set default test script to jest\n\tpkg.scripts[\"test\"] ??= EnumScriptsEntry.JEST_TEST;\n\n\t// 設定 posttest 腳本,在測試後執行 build\n\t// Set posttest script to run build after tests\n\tpkg.scripts[\"posttest\"] ??= \"yarn run build\";\n\n\t// 如果 build 腳本不包含 tsdx build,則設定新的 build 腳本\n\t// If build script doesn't include tsdx build, set new build script\n\tif (!pkg.scripts[\"build\"]?.includes('run build:tsdx'))\n\t{\n\t\tpkg.scripts[\"build\"] = \"yarn run build:tsdx && yarn run build:dts:bundle\";\n\t}\n\n\t// 設定 TypeScript 宣告檔案打包腳本\n\t// Set TypeScript declaration file bundling script\n\tpkg.scripts[\"build:dts:bundle\"] ??= EnumScriptsEntry.BUILD_DTS_BUNDLE;\n\n\t// 設定 tsdx build 腳本,目標為 node 環境\n\t// Set tsdx build script targeting node environment\n\tpkg.scripts[\"build:tsdx\"] ??= \"ynpx @bluelovers/tsdx build --target node\";\n\n\t// 設定複製宣告檔案的腳本 (Windows 語法)\n\t// Set declaration file copy script (Windows syntax)\n\tpkg.scripts[\"build:dts:copy\"] ??= \"copy .\\\\src\\\\index.d.ts .\\\\dist\\\\index.d.ts & echo build:dts\";\n\n\t// 設定 TypeScript 宣告檔案輸出腳本\n\t// Set TypeScript declaration file emit script\n\tpkg.scripts[\"build:dts:tsc:emit\"] ??= \"tsc --emitDeclarationOnly --declaration --noEmit false\";\n\n\t// 組合完整的 dts 建置腳本\n\t// Compose complete dts build script\n\tpkg.scripts[\"build:dts:tsc\"] ??= [\n 'yarn run build:dts:copy',\n 'yarn run build:dts:tsc:emit',\n 'yarn run build:dts:copy',\n ].join(' && ');\n\n\t// 設定模組入口點\n\t// Set module entry points\n\tpkg.main = \"dist/index.cjs\";\n\tpkg.module = \"dist/index.esm.mjs\";\n\tpkg.types = pkg.typings = \"dist/index.d.ts\";\n\n\t// 設定 unpkg CDN 入口點\n\t// Set unpkg CDN entry point\n\tpkg.unpkg ??= \"dist/index.umd.production.min.cjs\";\n\n\t// 設定 exports 欄位,定義模組匯出映射\n\t// Set exports field, defining module export mappings\n\tpkg.exports ??= {};\n\tpkg.exports['.'] ??= {};\n\tpkg.exports['.'].types = \"./dist/index.d.ts\";\n\tpkg.exports['.'].import = \"./dist/index.esm.mjs\";\n\tpkg.exports['.'].require = \"./dist/index.cjs\";\n\n\t// 允許直接存取 src 目錄下的檔案\n\t// Allow direct access to files under src directory\n\tpkg.exports['./src/*'] = './src/*';\n\n\t// 匯出 package.json 本身\n\t// Export package.json itself\n\tpkg.exports['./package.json'] ??= './package.json';\n\n\t// 確保 keywords 欄位存在\n\t// Ensure keywords field exists\n\tpkg.keywords ??= [];\n\n\t// 添加 tsdx 標識關鍵字(如果尚未存在)\n\t// Add tsdx identifier keyword if not already present\n\tif (!pkg.keywords.includes(EnumTsdx.keyword))\n\t{\n\t\tpkg.keywords.push(EnumTsdx.keyword);\n\t}\n\n\t// 呼叫 fixTsdxPackage 進行額外的修復\n\t// Call fixTsdxPackage for additional fixes\n\tfixTsdxPackage(pkg, config);\n\n\treturn pkg\n}\n\n/**\n * 預設的靜態檔案複製映射表\n * Default static file copy mapping table\n *\n * 定義需要複製到目標專案的靜態檔案,每個項目為 [目標路徑, 來源路徑, ?來源檔名] 的格式。\n * Defines static files that need to be copied to the target project,\n * each entry follows [targetPath, sourcePath, ?sourceFileName] format.\n */\nconst _defaultCopyStaticFilesTsdx = [\n\n\t// 根目錄的 tsconfig.json 設定檔\n\t// Root tsconfig.json configuration file\n\t['tsconfig.json', 'file/tsconfig.tsdx.json.tpl'],\n\n\t// 測試目錄的 tsconfig.json 設定檔\n\t// Test directory tsconfig.json configuration file\n\t['test/tsconfig.json', 'file/test/tsconfig.json.tpl'],\n\n\t// src 目錄下的 index.cts 檔案\n\t// index.cts file under src directory\n\t['src/index.cts', 'file/tsdx/index.cts'],\n\n\t// src 目錄的 tsconfig.json 設定檔\n\t// src directory tsconfig.json configuration file\n\t['src/tsconfig.json', 'file/tsdx/tsconfig.json.tpl'],\n\n] as const;\n\n/**\n * 凍結的預設靜態檔案映射表\n * Frozen default static file mapping table\n */\nexport const defaultCopyStaticFilesTsdx = Object.freeze(_defaultCopyStaticFilesTsdx) as any as IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFilesTsdx>>;\n\n/**\n * tsdx 設定選項介面\n * tsdx setup options interface\n *\n * @template P - package.json 類型 / package.json type\n */\nexport interface ISetupTsdxOptions<P extends IPackageJson>\n{\n\t/** 目標目錄路徑 / Target directory path */\n\ttargetDir: string,\n\n\t/** package.json 物件 / package.json object */\n\tpkg: P,\n\n\t/** 工作區根目錄資訊 / Workspace root directory information */\n\trootData: IFindRootReturnType,\n\n\t/** 靜態檔案映射表 / Static file mapping table */\n\tfile_map: IStaticFilesMapArray<string>,\n\n\t/** README 檔案名稱 / README file name */\n\tmdFile: string,\n\n\t/** 是否存在 README 檔案 / Whether README file exists */\n\texistsReadme: boolean,\n\n\t/** 是否為已存在的專案 / Whether it's an existing project */\n\toldExists: boolean,\n}\n\n/**\n * 設定 tsdx 專案的主要函式\n * Main function for setting up tsdx project\n *\n * 此函式執行以下操作:\n * This function performs the following operations:\n *\n * 1. 更新 package.json 設定\n * Update package.json configuration\n *\n * 2. 合併預設與自訂的靜態檔案映射\n * Merge default and custom static file mappings\n *\n * 3. 確保 src 目錄存在\n * Ensure src directory exists\n *\n * @template P - package.json 類型 / package.json type\n * @param config - 設定選項 / Configuration options\n * @returns 包含更新後設定的物件 / Object containing updated configuration\n */\nexport function setup<P extends IPackageJson>(config: ISetupTsdxOptions<P>)\n{\n\tlet {\n\t\tpkg,\n\t\tfile_map,\n\t\ttargetDir,\n\t} = config;\n\n\t// 更新 package.json\n\t// Update package.json\n\tpkg = updatePackageJson(pkg, config);\n\n\t// 合併預設與自訂的靜態檔案映射\n\t// Merge default and custom static file mappings\n\tfile_map = [\n ...defaultCopyStaticFilesTsdx,\n\t\t...file_map,\n\t];\n\n\t// 確保 src 目錄存在\n\t// Ensure src directory exists\n\tensureDirSync(resolve(targetDir, 'src'));\n\n\treturn {\n\t\t...config,\n\t\tpkg,\n\t\tfile_map,\n\t}\n}\n"]}
@@ -1,3 +1,18 @@
1
+ /**
2
+ * tsdx 專案識別工具函式
3
+ * Utility functions for identifying tsdx projects
4
+ */
1
5
  import { IPackageJson } from '@ts-type/package-dts/package-json';
2
6
  import { ISetupTsdxOptions } from './index';
7
+ /**
8
+ * 檢查是否為 tsdx 專案
9
+ * Check if the package is a tsdx project
10
+ *
11
+ * 透過檢查 package.json 中的 keywords 和 exports 欄位來判斷是否為 tsdx 專案。
12
+ * Determines if a package is a tsdx project by checking the keywords and exports fields in package.json.
13
+ *
14
+ * @param pkg - package.json 物件 / package.json object
15
+ * @param config - 設定選項 (可選) / configuration options (optional)
16
+ * @returns 如果是 tsdx 專案則返回 true,否則返回 false / Returns true if it's a tsdx project, false otherwise
17
+ */
3
18
  export declare function isTsdxPackage<P extends IPackageJson>(pkg: P, config?: ISetupTsdxOptions<P>): boolean;
@@ -1,8 +1,25 @@
1
1
  "use strict";
2
+ /**
3
+ * tsdx 專案識別工具函式
4
+ * Utility functions for identifying tsdx projects
5
+ */
2
6
  Object.defineProperty(exports, "__esModule", { value: true });
3
7
  exports.isTsdxPackage = isTsdxPackage;
8
+ /**
9
+ * 檢查是否為 tsdx 專案
10
+ * Check if the package is a tsdx project
11
+ *
12
+ * 透過檢查 package.json 中的 keywords 和 exports 欄位來判斷是否為 tsdx 專案。
13
+ * Determines if a package is a tsdx project by checking the keywords and exports fields in package.json.
14
+ *
15
+ * @param pkg - package.json 物件 / package.json object
16
+ * @param config - 設定選項 (可選) / configuration options (optional)
17
+ * @returns 如果是 tsdx 專案則返回 true,否則返回 false / Returns true if it's a tsdx project, false otherwise
18
+ */
4
19
  function isTsdxPackage(pkg, config) {
5
20
  var _a, _b;
21
+ // 檢查關鍵字是否包含 tsdx 標記,且 exports['.'] 為物件類型
22
+ // Check if keywords include tsdx marker and exports['.'] is an object type
6
23
  return ((_a = pkg.keywords) === null || _a === void 0 ? void 0 : _a.includes("create-by-tsdx" /* EnumTsdx.keyword */)) && typeof ((_b = pkg.exports) === null || _b === void 0 ? void 0 : _b['.']) === 'object';
7
24
  }
8
25
  //# sourceMappingURL=is-tsdx.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-tsdx.js","sourceRoot":"","sources":["is-tsdx.ts"],"names":[],"mappings":";;AAIA,sCAGC;AAHD,SAAgB,aAAa,CAAyB,GAAM,EAAE,MAA6B;;IAE1F,OAAO,CAAA,MAAA,GAAG,CAAC,QAAQ,0CAAE,QAAQ,yCAAkB,KAAI,OAAO,CAAA,MAAA,GAAG,CAAC,OAAO,0CAAG,GAAG,CAAC,CAAA,KAAK,QAAQ,CAAA;AAC1F,CAAC","sourcesContent":["import { IPackageJson } from '@ts-type/package-dts/package-json';\nimport { ISetupTsdxOptions } from './index';\nimport { EnumTsdx } from './const';\n\nexport function isTsdxPackage<P extends IPackageJson>(pkg: P, config?: ISetupTsdxOptions<P>)\n{\n\treturn pkg.keywords?.includes(EnumTsdx.keyword) && typeof pkg.exports?.['.'] === 'object'\n}\n"]}
1
+ {"version":3,"file":"is-tsdx.js","sourceRoot":"","sources":["is-tsdx.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAiBH,sCAKC;AAhBD;;;;;;;;;;GAUG;AACH,SAAgB,aAAa,CAAyB,GAAM,EAAE,MAA6B;;IAE1F,yCAAyC;IACzC,2EAA2E;IAC3E,OAAO,CAAA,MAAA,GAAG,CAAC,QAAQ,0CAAE,QAAQ,yCAAkB,KAAI,OAAO,CAAA,MAAA,GAAG,CAAC,OAAO,0CAAG,GAAG,CAAC,CAAA,KAAK,QAAQ,CAAA;AAC1F,CAAC","sourcesContent":["/**\n * tsdx 專案識別工具函式\n * Utility functions for identifying tsdx projects\n */\n\nimport { IPackageJson } from '@ts-type/package-dts/package-json';\nimport { ISetupTsdxOptions } from './index';\nimport { EnumTsdx } from './const';\n\n/**\n * 檢查是否為 tsdx 專案\n * Check if the package is a tsdx project\n *\n * 透過檢查 package.json 中的 keywords 和 exports 欄位來判斷是否為 tsdx 專案。\n * Determines if a package is a tsdx project by checking the keywords and exports fields in package.json.\n *\n * @param pkg - package.json 物件 / package.json object\n * @param config - 設定選項 (可選) / configuration options (optional)\n * @returns 如果是 tsdx 專案則返回 true,否則返回 false / Returns true if it's a tsdx project, false otherwise\n */\nexport function isTsdxPackage<P extends IPackageJson>(pkg: P, config?: ISetupTsdxOptions<P>)\n{\n\t// 檢查關鍵字是否包含 tsdx 標記,且 exports['.'] 為物件類型\n\t// Check if keywords include tsdx marker and exports['.'] is an object type\n\treturn pkg.keywords?.includes(EnumTsdx.keyword) && typeof pkg.exports?.['.'] === 'object'\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yarn-tool/setup-module-env",
3
- "version": "3.0.3",
4
- "description": "",
3
+ "version": "3.0.5",
4
+ "description": "用於設定 tsdx 專案環境的工具,自動配置 package.json 與靜態檔案 (Tool for setting up tsdx project environment, auto-configuring package.json and static files)",
5
5
  "keywords": [
6
6
  "yarn",
7
7
  "yarn-tool",
@@ -55,13 +55,12 @@
55
55
  "tsc:showConfig": "ynpx get-current-tsconfig -p"
56
56
  },
57
57
  "dependencies": {
58
- "@yarn-tool/pkg-entry-util": "^3.0.3",
58
+ "@yarn-tool/pkg-entry-util": "^3.0.5",
59
59
  "dot-values2": "^2.0.7",
60
60
  "tslib": ">=2"
61
61
  },
62
- "packageManager": "yarn@1.22.19",
63
62
  "publishConfig": {
64
63
  "access": "public"
65
64
  },
66
- "gitHead": "ca7f14bdac1827ed8e8fe5fd0932ee56a44669dc"
65
+ "gitHead": "2125b86f55c2db7b5a914e3ad84729e4021f1b7e"
67
66
  }