@yarn-tool/static-file 3.0.4 → 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.
Files changed (63) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +9 -4
  3. package/__root.d.ts +28 -0
  4. package/__root.js +28 -0
  5. package/__root.js.map +1 -1
  6. package/file/.gitignore +10 -0
  7. package/file/README.md +11 -1
  8. package/file/gitignore +15 -0
  9. package/file/jest.config.auto.js +81 -15
  10. package/file/jest.config.js +3 -1
  11. package/file/npmrc +2 -1
  12. package/file/nvmrc +1 -1
  13. package/file/pnpm-workspace.yaml +19 -0
  14. package/file/test/__root.ts +3 -0
  15. package/file/tsconfig.json +5 -0
  16. package/file/tsdx/tsconfig.json.tpl +7 -0
  17. package/file/ws-root/jest-preset.js +32 -3
  18. package/file/ws-root/jest.config.js +3 -2
  19. package/index.d.ts +25 -0
  20. package/index.js +25 -0
  21. package/index.js.map +1 -1
  22. package/lib/const.d.ts +57 -3
  23. package/lib/const.js +81 -8
  24. package/lib/const.js.map +1 -1
  25. package/lib/copyStaticFiles.d.ts +50 -0
  26. package/lib/copyStaticFiles.js +48 -0
  27. package/lib/copyStaticFiles.js.map +1 -1
  28. package/lib/copyStaticFilesEntry.d.ts +50 -0
  29. package/lib/copyStaticFilesEntry.js +48 -0
  30. package/lib/copyStaticFilesEntry.js.map +1 -1
  31. package/lib/getRowOfStaticFilesMapArray.d.ts +40 -0
  32. package/lib/getRowOfStaticFilesMapArray.js +32 -0
  33. package/lib/getRowOfStaticFilesMapArray.js.map +1 -1
  34. package/lib/getStaticFile.d.ts +42 -0
  35. package/lib/getStaticFile.js +34 -0
  36. package/lib/getStaticFile.js.map +1 -1
  37. package/lib/parseStaticMap.d.ts +39 -0
  38. package/lib/parseStaticMap.js +7 -0
  39. package/lib/parseStaticMap.js.map +1 -1
  40. package/lib/reMapStaticFilesMapArray.d.ts +39 -0
  41. package/lib/reMapStaticFilesMapArray.js +36 -0
  42. package/lib/reMapStaticFilesMapArray.js.map +1 -1
  43. package/lib/replaceTargetOfStaticFilesMapArrayEntry.d.ts +33 -0
  44. package/lib/replaceTargetOfStaticFilesMapArrayEntry.js +25 -0
  45. package/lib/replaceTargetOfStaticFilesMapArrayEntry.js.map +1 -1
  46. package/lib/root/getRootCopyStaticFiles.d.ts +54 -0
  47. package/lib/root/getRootCopyStaticFiles.js +47 -0
  48. package/lib/root/getRootCopyStaticFiles.js.map +1 -1
  49. package/lib/types.d.ts +73 -0
  50. package/lib/types.js.map +1 -1
  51. package/lib/ws/wsCopyStaticFiles.d.ts +50 -0
  52. package/lib/ws/wsCopyStaticFiles.js +50 -0
  53. package/lib/ws/wsCopyStaticFiles.js.map +1 -1
  54. package/package.json +3 -3
  55. package/file/github/workflows/linter.yml +0 -57
  56. package/file/node-version +0 -1
  57. package/file/tsdx/index.cjs +0 -5
  58. package/file/tsdx/index.cjs.map +0 -1
  59. package/file/tsdx/index.d.cts +0 -2
  60. package/file/ws-root/__root_ws.d.ts +0 -2
  61. package/file/ws-root/__root_ws.js +0 -7
  62. package/file/ws-root/__root_ws.js.map +0 -1
  63. /package/file/{browserslistrc → ws-root/browserslistrc} +0 -0
package/lib/types.d.ts CHANGED
@@ -1,26 +1,99 @@
1
+ /**
2
+ * Static file ID type / 靜態檔案 ID 類型
3
+ *
4
+ * Extracts the union type of all possible file IDs from the static files map array.
5
+ * 從靜態檔案映射陣列中提取所有可能的檔案 ID 聯合類型。
6
+ */
1
7
  import { defaultCopyStaticFiles, defaultCopyStaticFilesRootOnly } from './const';
2
8
  export type IStaticFilesID<T = typeof defaultCopyStaticFiles & typeof defaultCopyStaticFilesRootOnly> = T extends ({
3
9
  [n: number]: IStaticFilesMapArrayEntry<infer U>;
4
10
  } | {
5
11
  readonly [n: number]: IStaticFilesMapArrayEntry<infer U>;
6
12
  }) ? U : never;
13
+ /**
14
+ * Static files map array entry type / 靜態檔案映射陣列條目類型
15
+ *
16
+ * Represents a single entry in the static files map array.
17
+ * 表示靜態檔案映射陣列中的單個條目。
18
+ *
19
+ * @template K - The target file path type / 目標檔案路徑類型
20
+ *
21
+ * @param targetFile - Target file path to copy to / 要複製到的目標檔案路徑
22
+ * @param staticFile - Source static file path / 來源靜態檔案路徑
23
+ * @param detectFile - Optional file path to detect if target already exists / 可選的檢測檔案路徑,用於判斷目標是否已存在
24
+ */
7
25
  export type IStaticFilesMapArrayEntry<K extends string> = [
8
26
  targetFile: K,
9
27
  staticFile: string,
10
28
  detectFile?: string
11
29
  ];
30
+ /**
31
+ * Static files map record type / 靜態檔案映射記錄類型
32
+ *
33
+ * A record mapping target file paths to source file paths.
34
+ * 將目標檔案路徑映射到來源檔案路徑的記錄類型。
35
+ *
36
+ * @template K - The target file path type / 目標檔案路徑類型
37
+ */
12
38
  export type IStaticFilesMapRecord<K extends string> = {
13
39
  [P in K]: string;
14
40
  };
41
+ /**
42
+ * Static files map array type / 靜態檔案映射陣列類型
43
+ *
44
+ * An array of static file mapping entries.
45
+ * 靜態檔案映射條目的陣列。
46
+ *
47
+ * @template K - The target file path type / 目標檔案路徑類型
48
+ */
15
49
  export type IStaticFilesMapArray<K extends string> = IStaticFilesMapArrayEntry<K>[];
50
+ /**
51
+ * Static files map type / 靜態檔案映射類型
52
+ *
53
+ * Can be either an array of entries or a record mapping.
54
+ * 可以是條目陣列或記錄映射。
55
+ *
56
+ * @template K - The target file path type / 目標檔案路徑類型
57
+ */
16
58
  export type IStaticFiles<K extends string> = IStaticFilesMapArray<K> | IStaticFilesMapRecord<K>;
59
+ /**
60
+ * Base options for copying static files / 複製靜態檔案的基本選項
61
+ *
62
+ * @template K - The target file path type / 目標檔案路徑類型
63
+ *
64
+ * @property cwd - Current working directory / 當前工作目錄
65
+ * @property staticRoot - Root directory of static files / 靜態檔案的根目錄
66
+ * @property overwrite - Whether to overwrite existing files / 是否覆蓋已存在的檔案
67
+ */
17
68
  export interface ICopyStaticFilesOptionsBase<K extends string = string> {
18
69
  cwd: string;
19
70
  staticRoot?: string;
20
71
  overwrite?: boolean;
21
72
  }
73
+ /**
74
+ * Options for copying static files / 複製靜態檔案的選項
75
+ *
76
+ * Extends the base options with file map configuration.
77
+ * 擴展基本選項,加入檔案映射配置。
78
+ *
79
+ * @template K - The target file path type / 目標檔案路徑類型
80
+ *
81
+ * @property file_map - Custom file mapping configuration / 自訂檔案映射配置
82
+ */
22
83
  export interface ICopyStaticFilesOptions<K extends string = string> extends ICopyStaticFilesOptionsBase<K> {
23
84
  file_map?: IStaticFiles<K>;
24
85
  }
86
+ /**
87
+ * Extracts the key type from static files map / 從靜態檔案映射中提取鍵類型
88
+ *
89
+ * Utility type to extract the union type of target file paths from various static file map formats.
90
+ * 工具類型,用於從各種靜態檔案映射格式中提取目標檔案路徑的聯合類型。
91
+ *
92
+ * @template T - The static files map type / 靜態檔案映射類型
93
+ */
25
94
  export type IStaticFilesKey<T extends IStaticFiles<string> | readonly any[]> = T extends IStaticFilesMapArray<infer K> ? K : T extends readonly IStaticFilesMapArrayEntry<infer K>[] ? K : T extends IStaticFilesMapRecord<infer K> ? K : _Key<T>;
95
+ /**
96
+ * Internal key extraction type / 內部鍵提取類型
97
+ * @internal
98
+ */
26
99
  export type _Key<T> = T extends readonly (infer U)[] | (infer U)[] ? (U extends [infer K, string, string] | readonly [infer K, string, string] ? K : never) : never;
package/lib/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["import { defaultCopyStaticFiles, defaultCopyStaticFilesRootOnly } from './const';\n\nexport type IStaticFilesID<T = typeof defaultCopyStaticFiles & typeof defaultCopyStaticFilesRootOnly> =\n\tT extends ({\n\t\t\t[n: number]: IStaticFilesMapArrayEntry<infer U>\n\t\t} | {\n\t\t\treadonly [n: number]: IStaticFilesMapArrayEntry<infer U>;\n\t\t})\n\t\t? U\n\t\t: never\n\t;\n\nexport type IStaticFilesMapArrayEntry<K extends string> =\n\t[targetFile: K, staticFile: string, detectFile?: string]\n\ntype IStaticFilesMap01<K extends string> = {\n\t[P in K]: IStaticFilesMapArrayEntry<P>\n}\n\nexport type IStaticFilesMapRecord<K extends string> = {\n\t[P in K]: string\n}\n\nexport type IStaticFilesMapArray<K extends string> =\n\tIStaticFilesMapArrayEntry<K>[]\n\nexport type IStaticFiles<K extends string> = IStaticFilesMapArray<K> | IStaticFilesMapRecord<K>\n\nexport interface ICopyStaticFilesOptionsBase<K extends string = string>\n{\n\tcwd: string,\n\tstaticRoot?: string,\n\toverwrite?: boolean,\n}\n\nexport interface ICopyStaticFilesOptions<K extends string = string> extends ICopyStaticFilesOptionsBase<K>\n{\n\tfile_map?: IStaticFiles<K>,\n}\n\nexport type IStaticFilesKey<T extends IStaticFiles<string> | readonly any[]> = T extends IStaticFilesMapArray<infer K>\n\t? K\n\t: T extends readonly IStaticFilesMapArrayEntry<infer K>[]\n\t\t? K\n\t\t: T extends IStaticFilesMapRecord<infer K> ? K\n\t\t\t: _Key<T>\n\t;\n\nexport type _Key<T> = T extends readonly (infer U)[] | (infer U)[]\n\t? (U extends [infer K, string, string] | readonly [infer K, string, string] ? K : never)\n\t: never\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Static file ID type / 靜態檔案 ID 類型\n *\n * Extracts the union type of all possible file IDs from the static files map array.\n * 從靜態檔案映射陣列中提取所有可能的檔案 ID 聯合類型。\n */\nimport { defaultCopyStaticFiles, defaultCopyStaticFilesRootOnly } from './const';\n\nexport type IStaticFilesID<T = typeof defaultCopyStaticFiles & typeof defaultCopyStaticFilesRootOnly> =\n\tT extends ({\n\t\t\t[n: number]: IStaticFilesMapArrayEntry<infer U>\n\t\t} | {\n\t\t\treadonly [n: number]: IStaticFilesMapArrayEntry<infer U>;\n\t\t})\n\t\t? U\n\t\t: never\n\t;\n\n/**\n * Static files map array entry type / 靜態檔案映射陣列條目類型\n *\n * Represents a single entry in the static files map array.\n * 表示靜態檔案映射陣列中的單個條目。\n *\n * @template K - The target file path type / 目標檔案路徑類型\n *\n * @param targetFile - Target file path to copy to / 要複製到的目標檔案路徑\n * @param staticFile - Source static file path / 來源靜態檔案路徑\n * @param detectFile - Optional file path to detect if target already exists / 可選的檢測檔案路徑,用於判斷目標是否已存在\n */\nexport type IStaticFilesMapArrayEntry<K extends string> =\n\t[targetFile: K, staticFile: string, detectFile?: string]\n\n/**\n * Static files map object type (internal) / 靜態檔案映射物件類型(內部使用)\n * @internal\n */\ntype IStaticFilesMap01<K extends string> = {\n\t[P in K]: IStaticFilesMapArrayEntry<P>\n}\n\n/**\n * Static files map record type / 靜態檔案映射記錄類型\n *\n * A record mapping target file paths to source file paths.\n * 將目標檔案路徑映射到來源檔案路徑的記錄類型。\n *\n * @template K - The target file path type / 目標檔案路徑類型\n */\nexport type IStaticFilesMapRecord<K extends string> = {\n\t[P in K]: string\n}\n\n/**\n * Static files map array type / 靜態檔案映射陣列類型\n *\n * An array of static file mapping entries.\n * 靜態檔案映射條目的陣列。\n *\n * @template K - The target file path type / 目標檔案路徑類型\n */\nexport type IStaticFilesMapArray<K extends string> =\n\tIStaticFilesMapArrayEntry<K>[]\n\n/**\n * Static files map type / 靜態檔案映射類型\n *\n * Can be either an array of entries or a record mapping.\n * 可以是條目陣列或記錄映射。\n *\n * @template K - The target file path type / 目標檔案路徑類型\n */\nexport type IStaticFiles<K extends string> = IStaticFilesMapArray<K> | IStaticFilesMapRecord<K>\n\n/**\n * Base options for copying static files / 複製靜態檔案的基本選項\n *\n * @template K - The target file path type / 目標檔案路徑類型\n *\n * @property cwd - Current working directory / 當前工作目錄\n * @property staticRoot - Root directory of static files / 靜態檔案的根目錄\n * @property overwrite - Whether to overwrite existing files / 是否覆蓋已存在的檔案\n */\nexport interface ICopyStaticFilesOptionsBase<K extends string = string>\n{\n\tcwd: string,\n\tstaticRoot?: string,\n\toverwrite?: boolean,\n}\n\n/**\n * Options for copying static files / 複製靜態檔案的選項\n *\n * Extends the base options with file map configuration.\n * 擴展基本選項,加入檔案映射配置。\n *\n * @template K - The target file path type / 目標檔案路徑類型\n *\n * @property file_map - Custom file mapping configuration / 自訂檔案映射配置\n */\nexport interface ICopyStaticFilesOptions<K extends string = string> extends ICopyStaticFilesOptionsBase<K>\n{\n\tfile_map?: IStaticFiles<K>,\n}\n\n/**\n * Extracts the key type from static files map / 從靜態檔案映射中提取鍵類型\n *\n * Utility type to extract the union type of target file paths from various static file map formats.\n * 工具類型,用於從各種靜態檔案映射格式中提取目標檔案路徑的聯合類型。\n *\n * @template T - The static files map type / 靜態檔案映射類型\n */\nexport type IStaticFilesKey<T extends IStaticFiles<string> | readonly any[]> = T extends IStaticFilesMapArray<infer K>\n\t? K\n\t: T extends readonly IStaticFilesMapArrayEntry<infer K>[]\n\t\t? K\n\t\t: T extends IStaticFilesMapRecord<infer K> ? K\n\t\t\t: _Key<T>\n\t;\n\n/**\n * Internal key extraction type / 內部鍵提取類型\n * @internal\n */\nexport type _Key<T> = T extends readonly (infer U)[] | (infer U)[]\n\t? (U extends [infer K, string, string] | readonly [infer K, string, string] ? K : never)\n\t: never\n"]}
@@ -1,9 +1,59 @@
1
+ /**
2
+ * Get workspace copy static files configuration / 獲取工作區複製靜態檔案配置
3
+ *
4
+ * This module provides a function to get the combined static files map
5
+ * for workspace-level operations.
6
+ * 此模組提供獲取工作區層級操作的合併靜態檔案映射的函數。
7
+ *
8
+ * @module wsCopyStaticFiles
9
+ */
1
10
  import { defaultCopyStaticFiles, defaultCopyStaticFilesRootOnly } from '../const';
2
11
  import { IStaticFiles, IStaticFilesKey } from '../types';
12
+ /**
13
+ * Remapping configuration for workspace files / 工作區檔案的重新映射配置
14
+ *
15
+ * Maps target file names to their template counterparts.
16
+ * 將目標檔案名稱映射到其模板對應項。
17
+ *
18
+ * This allows copying template files directly to their final names.
19
+ * 這允許將模板檔案直接複製到其最終名稱。
20
+ */
3
21
  declare const remap: {
4
22
  readonly 'tsconfig.json': "tsconfig.json.tpl";
5
23
  readonly 'lerna.json': "lerna.json.tpl";
6
24
  readonly 'pnpm-workspace.yaml': "pnpm-workspace.yaml.tpl";
7
25
  };
26
+ /**
27
+ * Get the combined static files map for workspace operations / 獲取工作區操作的合併靜態檔案映射
28
+ *
29
+ * Combines all static file maps (default, root-only, and workspace-root-only)
30
+ * and applies remapping for template files.
31
+ * 合併所有靜態檔案映射(預設、僅根目錄和僅工作區根目錄)並應用模板檔案的重新映射。
32
+ *
33
+ * This function is useful for setting up a complete workspace with all
34
+ * necessary configuration files.
35
+ * 此函數對於設置包含所有必要配置檔案的完整工作區非常有用。
36
+ *
37
+ * @returns A combined static files map with remapped entries / 具有重新映射條目的合併靜態檔案映射
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * import { getWsCopyStaticFiles } from '@yarn-tool/static-file';
42
+ *
43
+ * // Get all static files for workspace setup
44
+ * // 獲取工作區設置的所有靜態檔案
45
+ * const files = getWsCopyStaticFiles();
46
+ *
47
+ * // The returned map includes:
48
+ * // - Package-level files (.gitignore, .npmignore, etc.)
49
+ * // - Root-level files (lerna.json, pnpm-workspace.yaml, etc.)
50
+ * // - Workspace-root files (__root_ws.ts, jest-preset.js, etc.)
51
+ * //
52
+ * // 返回的映射包括:
53
+ * // - 套件層級檔案(.gitignore、.npmignore 等)
54
+ * // - 根目錄層級檔案(lerna.json、pnpm-workspace.yaml 等)
55
+ * // - 工作區根目錄檔案(__root_ws.ts、jest-preset.js 等)
56
+ * ```
57
+ */
8
58
  export declare function getWsCopyStaticFiles(): IStaticFiles<IStaticFilesKey<typeof defaultCopyStaticFiles | typeof defaultCopyStaticFilesRootOnly> | keyof typeof remap>;
9
59
  export default getWsCopyStaticFiles;
@@ -1,13 +1,63 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getWsCopyStaticFiles = getWsCopyStaticFiles;
4
+ /**
5
+ * Get workspace copy static files configuration / 獲取工作區複製靜態檔案配置
6
+ *
7
+ * This module provides a function to get the combined static files map
8
+ * for workspace-level operations.
9
+ * 此模組提供獲取工作區層級操作的合併靜態檔案映射的函數。
10
+ *
11
+ * @module wsCopyStaticFiles
12
+ */
4
13
  const const_1 = require("../const");
5
14
  const reMapStaticFilesMapArray_1 = require("../reMapStaticFilesMapArray");
15
+ /**
16
+ * Remapping configuration for workspace files / 工作區檔案的重新映射配置
17
+ *
18
+ * Maps target file names to their template counterparts.
19
+ * 將目標檔案名稱映射到其模板對應項。
20
+ *
21
+ * This allows copying template files directly to their final names.
22
+ * 這允許將模板檔案直接複製到其最終名稱。
23
+ */
6
24
  const remap = {
7
25
  'tsconfig.json': 'tsconfig.json.tpl',
8
26
  'lerna.json': 'lerna.json.tpl',
9
27
  'pnpm-workspace.yaml': 'pnpm-workspace.yaml.tpl',
10
28
  };
29
+ /**
30
+ * Get the combined static files map for workspace operations / 獲取工作區操作的合併靜態檔案映射
31
+ *
32
+ * Combines all static file maps (default, root-only, and workspace-root-only)
33
+ * and applies remapping for template files.
34
+ * 合併所有靜態檔案映射(預設、僅根目錄和僅工作區根目錄)並應用模板檔案的重新映射。
35
+ *
36
+ * This function is useful for setting up a complete workspace with all
37
+ * necessary configuration files.
38
+ * 此函數對於設置包含所有必要配置檔案的完整工作區非常有用。
39
+ *
40
+ * @returns A combined static files map with remapped entries / 具有重新映射條目的合併靜態檔案映射
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * import { getWsCopyStaticFiles } from '@yarn-tool/static-file';
45
+ *
46
+ * // Get all static files for workspace setup
47
+ * // 獲取工作區設置的所有靜態檔案
48
+ * const files = getWsCopyStaticFiles();
49
+ *
50
+ * // The returned map includes:
51
+ * // - Package-level files (.gitignore, .npmignore, etc.)
52
+ * // - Root-level files (lerna.json, pnpm-workspace.yaml, etc.)
53
+ * // - Workspace-root files (__root_ws.ts, jest-preset.js, etc.)
54
+ * //
55
+ * // 返回的映射包括:
56
+ * // - 套件層級檔案(.gitignore、.npmignore 等)
57
+ * // - 根目錄層級檔案(lerna.json、pnpm-workspace.yaml 等)
58
+ * // - 工作區根目錄檔案(__root_ws.ts、jest-preset.js 等)
59
+ * ```
60
+ */
11
61
  function getWsCopyStaticFiles() {
12
62
  return (0, reMapStaticFilesMapArray_1.reMapStaticFilesMapArray)([
13
63
  ...const_1.defaultCopyStaticFiles,
@@ -1 +1 @@
1
- {"version":3,"file":"wsCopyStaticFiles.js","sourceRoot":"","sources":["wsCopyStaticFiles.ts"],"names":[],"mappings":";;AAcA,oDAOC;AArBD,oCAIkB;AAElB,0EAAuE;AAEvE,MAAM,KAAK,GAAG;IACb,eAAe,EAAE,mBAAmB;IACpC,YAAY,EAAE,gBAAgB;IAC9B,qBAAqB,EAAE,yBAAyB;CACvC,CAAA;AAEV,SAAgB,oBAAoB;IAEnC,OAAO,IAAA,mDAAwB,EAAC;QAC/B,GAAG,8BAAsB;QACzB,GAAG,sCAA8B;QACjC,GAAG,wCAAgC;KACnC,EAAE,KAAK,CAAC,CAAC;AACX,CAAC;AAED,kBAAe,oBAAoB,CAAC","sourcesContent":["import {\n\tdefaultCopyStaticFiles,\n\tdefaultCopyStaticFilesRootOnly,\n\tdefaultCopyStaticFilesWsRootOnly,\n} from '../const';\nimport { IStaticFiles, IStaticFilesKey, IStaticFilesMapArray } from '../types';\nimport { reMapStaticFilesMapArray } from '../reMapStaticFilesMapArray';\n\nconst remap = {\n\t'tsconfig.json': 'tsconfig.json.tpl',\n\t'lerna.json': 'lerna.json.tpl',\n\t'pnpm-workspace.yaml': 'pnpm-workspace.yaml.tpl',\n} as const\n\nexport function getWsCopyStaticFiles(): IStaticFiles<IStaticFilesKey<typeof defaultCopyStaticFiles | typeof defaultCopyStaticFilesRootOnly> | keyof typeof remap>\n{\n\treturn reMapStaticFilesMapArray([\n\t\t...defaultCopyStaticFiles,\n\t\t...defaultCopyStaticFilesRootOnly,\n\t\t...defaultCopyStaticFilesWsRootOnly,\n\t], remap);\n}\n\nexport default getWsCopyStaticFiles;\n"]}
1
+ {"version":3,"file":"wsCopyStaticFiles.js","sourceRoot":"","sources":["wsCopyStaticFiles.ts"],"names":[],"mappings":";;AAgEA,oDAOC;AAvED;;;;;;;;GAQG;AACH,oCAIkB;AAElB,0EAAuE;AAEvE;;;;;;;;GAQG;AACH,MAAM,KAAK,GAAG;IACb,eAAe,EAAE,mBAAmB;IACpC,YAAY,EAAE,gBAAgB;IAC9B,qBAAqB,EAAE,yBAAyB;CACvC,CAAA;AAEV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,SAAgB,oBAAoB;IAEnC,OAAO,IAAA,mDAAwB,EAAC;QAC/B,GAAG,8BAAsB;QACzB,GAAG,sCAA8B;QACjC,GAAG,wCAAgC;KACnC,EAAE,KAAK,CAAC,CAAC;AACX,CAAC;AAED,kBAAe,oBAAoB,CAAC","sourcesContent":["/**\n * Get workspace copy static files configuration / 獲取工作區複製靜態檔案配置\n *\n * This module provides a function to get the combined static files map\n * for workspace-level operations.\n * 此模組提供獲取工作區層級操作的合併靜態檔案映射的函數。\n *\n * @module wsCopyStaticFiles\n */\nimport {\n\tdefaultCopyStaticFiles,\n\tdefaultCopyStaticFilesRootOnly,\n\tdefaultCopyStaticFilesWsRootOnly,\n} from '../const';\nimport { IStaticFiles, IStaticFilesKey, IStaticFilesMapArray } from '../types';\nimport { reMapStaticFilesMapArray } from '../reMapStaticFilesMapArray';\n\n/**\n * Remapping configuration for workspace files / 工作區檔案的重新映射配置\n *\n * Maps target file names to their template counterparts.\n * 將目標檔案名稱映射到其模板對應項。\n *\n * This allows copying template files directly to their final names.\n * 這允許將模板檔案直接複製到其最終名稱。\n */\nconst remap = {\n\t'tsconfig.json': 'tsconfig.json.tpl',\n\t'lerna.json': 'lerna.json.tpl',\n\t'pnpm-workspace.yaml': 'pnpm-workspace.yaml.tpl',\n} as const\n\n/**\n * Get the combined static files map for workspace operations / 獲取工作區操作的合併靜態檔案映射\n *\n * Combines all static file maps (default, root-only, and workspace-root-only)\n * and applies remapping for template files.\n * 合併所有靜態檔案映射(預設、僅根目錄和僅工作區根目錄)並應用模板檔案的重新映射。\n *\n * This function is useful for setting up a complete workspace with all\n * necessary configuration files.\n * 此函數對於設置包含所有必要配置檔案的完整工作區非常有用。\n *\n * @returns A combined static files map with remapped entries / 具有重新映射條目的合併靜態檔案映射\n *\n * @example\n * ```typescript\n * import { getWsCopyStaticFiles } from '@yarn-tool/static-file';\n *\n * // Get all static files for workspace setup\n * // 獲取工作區設置的所有靜態檔案\n * const files = getWsCopyStaticFiles();\n *\n * // The returned map includes:\n * // - Package-level files (.gitignore, .npmignore, etc.)\n * // - Root-level files (lerna.json, pnpm-workspace.yaml, etc.)\n * // - Workspace-root files (__root_ws.ts, jest-preset.js, etc.)\n * //\n * // 返回的映射包括:\n * // - 套件層級檔案(.gitignore、.npmignore 等)\n * // - 根目錄層級檔案(lerna.json、pnpm-workspace.yaml 等)\n * // - 工作區根目錄檔案(__root_ws.ts、jest-preset.js 等)\n * ```\n */\nexport function getWsCopyStaticFiles(): IStaticFiles<IStaticFilesKey<typeof defaultCopyStaticFiles | typeof defaultCopyStaticFilesRootOnly> | keyof typeof remap>\n{\n\treturn reMapStaticFilesMapArray([\n\t\t...defaultCopyStaticFiles,\n\t\t...defaultCopyStaticFilesRootOnly,\n\t\t...defaultCopyStaticFilesWsRootOnly,\n\t], remap);\n}\n\nexport default getWsCopyStaticFiles;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yarn-tool/static-file",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/bluelovers/ws-yarn-workspaces/tree/master/packages/@yarn-tool/static-file#readme",
6
6
  "bugs": {
@@ -32,11 +32,11 @@
32
32
  "tsc:showConfig": "ynpx get-current-tsconfig -p"
33
33
  },
34
34
  "dependencies": {
35
- "fs-extra": "^11.2.0",
35
+ "fs-extra": "^11.3.3",
36
36
  "tslib": ">=2"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "ca7f14bdac1827ed8e8fe5fd0932ee56a44669dc"
41
+ "gitHead": "ae9b0817b25b1019ba68c88e541bbffc7d84047c"
42
42
  }
@@ -1,57 +0,0 @@
1
- name: Lint Codebase
2
-
3
- on:
4
- workflow_dispatch:
5
- pull_request:
6
- branches:
7
- - master
8
- - main
9
- push:
10
- branches:
11
- - master
12
- - main
13
-
14
- permissions:
15
- contents: read
16
- packages: read
17
- statuses: write
18
-
19
- jobs:
20
- lint:
21
- name: Lint Codebase
22
- runs-on: ubuntu-latest
23
- if: "0"
24
-
25
- steps:
26
- - name: Checkout
27
- id: checkout
28
- uses: actions/checkout@v4
29
- with:
30
- fetch-depth: 2
31
- token: ${{ secrets.GITHUB_TOKEN }}
32
-
33
- - name: Setup Node.js
34
- id: setup-node
35
- uses: actions/setup-node@v4
36
- with:
37
- node-version-file: .node-version
38
- cache: npm
39
-
40
- -
41
- name: install deps
42
- run: |
43
- yarn install --frozen-lockfile
44
- # yarn run ci:install
45
- # yarn add -W typescript@next jest ts-jest ts-node ynpx lerna
46
-
47
- - name: Lint Codebase
48
- id: super-linter
49
- uses: super-linter/super-linter/slim@v6
50
- env:
51
- DEFAULT_BRANCH: main
52
- FILTER_REGEX_EXCLUDE: dist/**/*
53
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54
- TYPESCRIPT_DEFAULT_STYLE: prettier
55
- VALIDATE_ALL_CODEBASE: true
56
- VALIDATE_JAVASCRIPT_STANDARD: false
57
- VALIDATE_JSCPD: false
package/file/node-version DELETED
@@ -1 +0,0 @@
1
- node
@@ -1,5 +0,0 @@
1
- "use strict";
2
- const tslib_1 = require("tslib");
3
- const index_1 = tslib_1.__importDefault(require("./index"));
4
- module.exports = index_1.default;
5
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["index.cts"],"names":[],"mappings":";;AAAA,4DAAwB;AAGxB,iBAAS,eAAC,CAAA","sourcesContent":["import _ from './index';\n\n// @ts-ignore\nexport = _\n"]}
@@ -1,2 +0,0 @@
1
- import _ from './index';
2
- export = _;
@@ -1,2 +0,0 @@
1
- export declare const __ROOT_WS: string;
2
- export declare const isWin: boolean;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isWin = exports.__ROOT_WS = void 0;
4
- const path_1 = require("path");
5
- exports.__ROOT_WS = (0, path_1.join)(__dirname);
6
- exports.isWin = process.platform === "win32";
7
- //# sourceMappingURL=__root_ws.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"__root_ws.js","sourceRoot":"","sources":["__root_ws.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAEf,QAAA,SAAS,GAAG,IAAA,WAAI,EAAC,SAAS,CAAC,CAAC;AAE5B,QAAA,KAAK,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC","sourcesContent":["import { join } from \"path\";\n\nexport const __ROOT_WS = join(__dirname);\n\nexport const isWin = process.platform === \"win32\";\n"]}
File without changes