@yarn-tool/static-file 3.0.32 → 3.0.34
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 +52 -0
- package/file/gitignore +16 -13
- package/file/npmignore +79 -14
- package/lib/const.d.ts +17 -0
- package/lib/const.js +20 -1
- package/lib/const.js.map +1 -1
- package/lib/copyStaticFilesByRootData.d.ts +52 -0
- package/lib/copyStaticFilesByRootData.js +53 -0
- package/lib/copyStaticFilesByRootData.js.map +1 -0
- package/package.json +5 -3
- package/playwright.config.js.map +1 -0
- package/test/copyStaticFiles.test.js.map +1 -1
- package/test/copyStaticFiles.test.ts.snapshot +2 -2
- package/test/copyStaticFilesByRootData.test.js.map +1 -0
- package/test/copyStaticFilesByRootData.test.ts.snapshot +634 -0
- package/test/fixtures/empty-pkg/package.json +4 -0
- package/test/fixtures/out/gitignore +16 -13
- package/test/fixtures/out/npmignore +79 -14
- package/test/fixtures/split/git/00-header.txt +1 -1
- package/test/fixtures/split/git/10-project.txt +1 -1
- package/test/fixtures/split/git/20-test.txt +1 -1
- package/test/fixtures/split/git/40-env.txt +1 -1
- package/test/fixtures/split/git/90-misc.txt +1 -1
- package/test/fixtures/split/git/99-whitelist.txt +1 -1
- package/test/fixtures/split/npm/01-hidden.txt +1 -1
- package/test/fixtures/split/npm/05-source.txt +1 -1
- package/test/fixtures/split/npm/10-project.txt +1 -1
- package/test/fixtures/split/npm/20-test.txt +3 -1
- package/test/fixtures/split/npm/30-ide.txt +1 -1
- package/test/fixtures/split/npm/40-env.txt +1 -1
- package/test/fixtures/split/npm/90-misc.txt +1 -1
- package/test/fixtures/split/other/90-duplicates.txt +2 -2
- package/test/fixtures/split/shared/10-project.txt +1 -1
- package/test/fixtures/split/shared/20-test.txt +4 -1
- package/test/fixtures/split/shared/30-ide.txt +1 -1
- package/test/fixtures/split/shared/40-env.txt +1 -1
- package/test/fixtures/split/shared/90-misc.txt +1 -1
- package/test/scripts/compose-split-ignore-files.js +1 -1
- package/test/scripts/compose-split-ignore-files.js.map +1 -1
- package/test/scripts/lib/ignore-split.d.ts +24 -64
- package/test/scripts/lib/ignore-split.js +41 -75
- package/test/scripts/lib/ignore-split.js.map +1 -1
- package/test/scripts/split-ignore-files.js +19 -19
- package/test/scripts/split-ignore-files.js.map +1 -1
- package/test/scripts/update-npmignore-static-files.js +25 -2
- package/test/scripts/update-npmignore-static-files.js.map +1 -1
- package/file/test/__root.js.map +0 -1
- package/file/test/temp.js.map +0 -1
- package/file/tsdx/index.cjs.map +0 -1
- package/file/tsdx/index.js.map +0 -1
- package/file/ws-root/__root_ws.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,58 @@
|
|
|
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.34](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/static-file@3.0.33...@yarn-tool/static-file@3.0.34) (2026-11-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### ✨ Features
|
|
11
|
+
|
|
12
|
+
* **@yarn-tool/fix-all:** 新增 CLI 入口點並重構執行腳本 ([09b56fe](https://github.com/bluelovers/ws-yarn-workspaces/commit/09b56fe92e8de174a892f20ad3483df0cbe90e54))
|
|
13
|
+
* **static-file:** 實作基於 rootData 的靜態檔案複製參數產生器 ([ed756de](https://github.com/bluelovers/ws-yarn-workspaces/commit/ed756de7fd12e978330e1ccc9492da408c93dd24))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### 📦 Code Refactoring
|
|
17
|
+
|
|
18
|
+
* **static-file:** 整合靜態檔案複製邏輯至 rootData 驅動的工具函數 ([de7a526](https://github.com/bluelovers/ws-yarn-workspaces/commit/de7a526bea2ffa7eded6d67f0f84a124a997cc3d))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### 🚨 Tests
|
|
22
|
+
|
|
23
|
+
* 重構測試路徑引用並提取路徑標準化工具 ([1380fcc](https://github.com/bluelovers/ws-yarn-workspaces/commit/1380fcc8830a48fc68d8ba2853c11b6563124317))
|
|
24
|
+
* **static-file:** 優化忽略規則分割腳本並移除英文註解 ([4ecce6b](https://github.com/bluelovers/ws-yarn-workspaces/commit/4ecce6bc32ca6470de226afced3b207b2b934a51))
|
|
25
|
+
* **test:** 重構測試工具函數並新增測試案例 ([5a572b5](https://github.com/bluelovers/ws-yarn-workspaces/commit/5a572b5e38e18ec39bd7f70f33cab9e55023aa2a))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### 🛠 Build System
|
|
29
|
+
|
|
30
|
+
* **static-file:** 新增 @yarn-tool/find-root 為運行時依賴 ([4e9d0df](https://github.com/bluelovers/ws-yarn-workspaces/commit/4e9d0dfeeb42ab6facfd152ee04765fa6f52a3cf))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### ⚙️ Continuous Integration
|
|
34
|
+
|
|
35
|
+
* **static-file:** 更新忽略檔案清單以包含新增的靜態檔案 ([4f8d801](https://github.com/bluelovers/ws-yarn-workspaces/commit/4f8d801c03d9881b8e01b289a1b0be8ee19a99b6))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### ♻️ Chores
|
|
39
|
+
|
|
40
|
+
* update ignore files ([e87c676](https://github.com/bluelovers/ws-yarn-workspaces/commit/e87c676a10dca83b9004bbf7cda645e505131e93))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## [3.0.33](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/static-file@3.0.32...@yarn-tool/static-file@3.0.33) (2026-11-16)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### ✨ Features
|
|
48
|
+
|
|
49
|
+
* **test:** 新增 Playwright 測試支援 ([cffba94](https://github.com/bluelovers/ws-yarn-workspaces/commit/cffba94d62dd933e5ff70cd8b3830459e56f4944))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### 🛠 Build System
|
|
53
|
+
|
|
54
|
+
* update build ([ef0f46f](https://github.com/bluelovers/ws-yarn-workspaces/commit/ef0f46f1e88ed77365cbf7762f4bfe6d29a510fd))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
6
58
|
## [3.0.32](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/static-file@3.0.31...@yarn-tool/static-file@3.0.32) (2026-11-16)
|
|
7
59
|
|
|
8
60
|
|
package/file/gitignore
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# file header · git only
|
|
2
2
|
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
3
3
|
|
|
4
|
-
#
|
|
4
|
+
# project files · git only
|
|
5
5
|
# next.js
|
|
6
6
|
# production
|
|
7
7
|
/build
|
|
@@ -13,7 +13,7 @@ vue.config.js.map
|
|
|
13
13
|
/.eslintignore
|
|
14
14
|
node_modules/.cache
|
|
15
15
|
.yarn-integrity
|
|
16
|
-
# *.map
|
|
16
|
+
# *.map files (generated by shared helper)
|
|
17
17
|
*.js.map
|
|
18
18
|
*.cjs.map
|
|
19
19
|
*.mjs.map
|
|
@@ -32,7 +32,7 @@ dist/*.umd.*.*s
|
|
|
32
32
|
out/
|
|
33
33
|
node_modules_
|
|
34
34
|
|
|
35
|
-
#
|
|
35
|
+
# project files · shared
|
|
36
36
|
# dependencies
|
|
37
37
|
node_modules
|
|
38
38
|
/.pnp
|
|
@@ -75,8 +75,8 @@ tsc-multi.json.tpl
|
|
|
75
75
|
|
|
76
76
|
/src/index.ts.tpl
|
|
77
77
|
|
|
78
|
-
#
|
|
79
|
-
#
|
|
78
|
+
# test files · git only
|
|
79
|
+
# test build artifacts (generated by shared helper)
|
|
80
80
|
test/temp*
|
|
81
81
|
test/**/*.map
|
|
82
82
|
tests/temp*
|
|
@@ -151,7 +151,7 @@ jest.config.js.map
|
|
|
151
151
|
/test/*.tpl
|
|
152
152
|
test/fixtures/.gitkeep
|
|
153
153
|
|
|
154
|
-
#
|
|
154
|
+
# test files · shared
|
|
155
155
|
# testing
|
|
156
156
|
.nyc_output
|
|
157
157
|
coverage
|
|
@@ -159,9 +159,12 @@ coverage
|
|
|
159
159
|
*.spec.d.ts
|
|
160
160
|
*.spec.js
|
|
161
161
|
|
|
162
|
+
/playwright.config.d.ts
|
|
163
|
+
/playwright.config.js
|
|
164
|
+
|
|
162
165
|
test-results/.last-run.json
|
|
163
166
|
|
|
164
|
-
# IDE
|
|
167
|
+
# IDE & editor settings · shared
|
|
165
168
|
.idea
|
|
166
169
|
.vscode
|
|
167
170
|
*.suo
|
|
@@ -170,7 +173,7 @@ test-results/.last-run.json
|
|
|
170
173
|
*.sln
|
|
171
174
|
*.sw?
|
|
172
175
|
|
|
173
|
-
#
|
|
176
|
+
# environment settings · git only
|
|
174
177
|
*.pem
|
|
175
178
|
.env.development.local
|
|
176
179
|
.env.test.local
|
|
@@ -181,20 +184,20 @@ test-results/.last-run.json
|
|
|
181
184
|
.nowignore
|
|
182
185
|
/certificates
|
|
183
186
|
|
|
184
|
-
#
|
|
187
|
+
# environment settings · shared
|
|
185
188
|
# local env files
|
|
186
189
|
.env.local
|
|
187
190
|
# vercel
|
|
188
191
|
.vercel
|
|
189
192
|
.env.*.local
|
|
190
193
|
|
|
191
|
-
#
|
|
194
|
+
# unclassified · git only
|
|
192
195
|
# misc
|
|
193
196
|
.DS_Store
|
|
194
197
|
.opt-in
|
|
195
198
|
.opt-out
|
|
196
199
|
|
|
197
|
-
#
|
|
200
|
+
# unclassified · shared
|
|
198
201
|
~ci.list.txt
|
|
199
202
|
~ci.log.txt
|
|
200
203
|
~ci.errors.txt
|
|
@@ -206,7 +209,7 @@ test-results/.last-run.json
|
|
|
206
209
|
.logs
|
|
207
210
|
.agentbridge
|
|
208
211
|
|
|
209
|
-
#
|
|
212
|
+
# whitelist exceptions · git only
|
|
210
213
|
!test/tsconfig.json
|
|
211
214
|
!tsconfig.json
|
|
212
215
|
!.eslintrc.json
|
package/file/npmignore
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# root hidden files · npm publish only
|
|
2
2
|
/.*
|
|
3
3
|
|
|
4
|
-
# npm
|
|
4
|
+
# npm source rules · npm publish only
|
|
5
5
|
*.ts
|
|
6
|
-
# npm
|
|
6
|
+
# npm source & declaration rules (generated by shared helper)
|
|
7
7
|
!*.d.ts
|
|
8
8
|
/bin/**/*.d.ts
|
|
9
9
|
/bin/*.d.ts
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
!/src/**/*.mts
|
|
21
21
|
!/src/**/*.tsx
|
|
22
22
|
|
|
23
|
-
#
|
|
23
|
+
# project files · npm publish only
|
|
24
24
|
tsconfig.json
|
|
25
25
|
.github
|
|
26
26
|
/src/**/*.jsx
|
|
@@ -52,7 +52,7 @@ bin/tsconfig.*.json
|
|
|
52
52
|
!/README.md
|
|
53
53
|
!/CHANGELOG.md
|
|
54
54
|
|
|
55
|
-
#
|
|
55
|
+
# project files · shared
|
|
56
56
|
# dependencies
|
|
57
57
|
node_modules
|
|
58
58
|
/.pnp
|
|
@@ -95,7 +95,7 @@ tsc-multi.json.tpl
|
|
|
95
95
|
|
|
96
96
|
/src/index.ts.tpl
|
|
97
97
|
|
|
98
|
-
#
|
|
98
|
+
# test files · npm publish only
|
|
99
99
|
test
|
|
100
100
|
.gitkeep
|
|
101
101
|
tests
|
|
@@ -105,7 +105,7 @@ __tests__
|
|
|
105
105
|
karma.conf.js
|
|
106
106
|
jest.config.*
|
|
107
107
|
/jest-preset.*
|
|
108
|
-
# spec
|
|
108
|
+
# spec & test filename matrix (generated by shared helper)
|
|
109
109
|
*.spec.ts
|
|
110
110
|
|
|
111
111
|
*.spec.d.cts
|
|
@@ -163,6 +163,66 @@ jest.config.*
|
|
|
163
163
|
|
|
164
164
|
*.node-test.d.tsx
|
|
165
165
|
*.node-test.tsx
|
|
166
|
+
|
|
167
|
+
*.playwright-spec.d.ts
|
|
168
|
+
*.playwright-spec.js
|
|
169
|
+
*.playwright-spec.ts
|
|
170
|
+
|
|
171
|
+
*.playwright-spec.d.cts
|
|
172
|
+
*.playwright-spec.cjs
|
|
173
|
+
*.playwright-spec.cts
|
|
174
|
+
|
|
175
|
+
*.playwright-spec.d.mts
|
|
176
|
+
*.playwright-spec.mjs
|
|
177
|
+
*.playwright-spec.mts
|
|
178
|
+
|
|
179
|
+
*.playwright-spec.d.tsx
|
|
180
|
+
*.playwright-spec.tsx
|
|
181
|
+
|
|
182
|
+
*.playwright-test.d.ts
|
|
183
|
+
*.playwright-test.js
|
|
184
|
+
*.playwright-test.ts
|
|
185
|
+
|
|
186
|
+
*.playwright-test.d.cts
|
|
187
|
+
*.playwright-test.cjs
|
|
188
|
+
*.playwright-test.cts
|
|
189
|
+
|
|
190
|
+
*.playwright-test.d.mts
|
|
191
|
+
*.playwright-test.mjs
|
|
192
|
+
*.playwright-test.mts
|
|
193
|
+
|
|
194
|
+
*.playwright-test.d.tsx
|
|
195
|
+
*.playwright-test.tsx
|
|
196
|
+
|
|
197
|
+
*.playwright.spec.d.ts
|
|
198
|
+
*.playwright.spec.js
|
|
199
|
+
*.playwright.spec.ts
|
|
200
|
+
|
|
201
|
+
*.playwright.spec.d.cts
|
|
202
|
+
*.playwright.spec.cjs
|
|
203
|
+
*.playwright.spec.cts
|
|
204
|
+
|
|
205
|
+
*.playwright.spec.d.mts
|
|
206
|
+
*.playwright.spec.mjs
|
|
207
|
+
*.playwright.spec.mts
|
|
208
|
+
|
|
209
|
+
*.playwright.spec.d.tsx
|
|
210
|
+
*.playwright.spec.tsx
|
|
211
|
+
|
|
212
|
+
*.playwright.test.d.ts
|
|
213
|
+
*.playwright.test.js
|
|
214
|
+
*.playwright.test.ts
|
|
215
|
+
|
|
216
|
+
*.playwright.test.d.cts
|
|
217
|
+
*.playwright.test.cjs
|
|
218
|
+
*.playwright.test.cts
|
|
219
|
+
|
|
220
|
+
*.playwright.test.d.mts
|
|
221
|
+
*.playwright.test.mjs
|
|
222
|
+
*.playwright.test.mts
|
|
223
|
+
|
|
224
|
+
*.playwright.test.d.tsx
|
|
225
|
+
*.playwright.test.tsx
|
|
166
226
|
__mocks__
|
|
167
227
|
__snapshots__
|
|
168
228
|
*.snap
|
|
@@ -173,7 +233,9 @@ __fixtures__
|
|
|
173
233
|
*.stories.*
|
|
174
234
|
./stories/
|
|
175
235
|
|
|
176
|
-
|
|
236
|
+
/playwright.config.ts
|
|
237
|
+
|
|
238
|
+
# test files · shared
|
|
177
239
|
# testing
|
|
178
240
|
.nyc_output
|
|
179
241
|
coverage
|
|
@@ -181,12 +243,15 @@ coverage
|
|
|
181
243
|
*.spec.d.ts
|
|
182
244
|
*.spec.js
|
|
183
245
|
|
|
246
|
+
/playwright.config.d.ts
|
|
247
|
+
/playwright.config.js
|
|
248
|
+
|
|
184
249
|
test-results/.last-run.json
|
|
185
250
|
|
|
186
|
-
# IDE
|
|
251
|
+
# IDE & editor settings · npm publish only
|
|
187
252
|
intellij-style-guide.xml
|
|
188
253
|
|
|
189
|
-
# IDE
|
|
254
|
+
# IDE & editor settings · shared
|
|
190
255
|
.idea
|
|
191
256
|
.vscode
|
|
192
257
|
*.suo
|
|
@@ -195,22 +260,22 @@ intellij-style-guide.xml
|
|
|
195
260
|
*.sln
|
|
196
261
|
*.sw?
|
|
197
262
|
|
|
198
|
-
#
|
|
263
|
+
# environment settings · npm publish only
|
|
199
264
|
now.json
|
|
200
265
|
|
|
201
|
-
#
|
|
266
|
+
# environment settings · shared
|
|
202
267
|
# local env files
|
|
203
268
|
.env.local
|
|
204
269
|
# vercel
|
|
205
270
|
.vercel
|
|
206
271
|
.env.*.local
|
|
207
272
|
|
|
208
|
-
#
|
|
273
|
+
# unclassified · npm publish only
|
|
209
274
|
/~*
|
|
210
275
|
cz-adapter
|
|
211
276
|
openspec/
|
|
212
277
|
|
|
213
|
-
#
|
|
278
|
+
# unclassified · shared
|
|
214
279
|
~ci.list.txt
|
|
215
280
|
~ci.log.txt
|
|
216
281
|
~ci.errors.txt
|
package/lib/const.d.ts
CHANGED
|
@@ -21,6 +21,16 @@ import { _Key, IStaticFilesMapArray } from './types';
|
|
|
21
21
|
* - detectFile: Optional file to check for existence before copying / 可選的檢測檔案,複製前檢查是否存在
|
|
22
22
|
*/
|
|
23
23
|
declare const _defaultCopyStaticFiles: [[".npmignore", "file/npmignore"], [".gitignore", "file/gitignore"], [".eslintignore", "file/eslintignore"], ["tsconfig.json", "file/tsconfig.json.tpl"], ["tsconfig.json.tpl", "file/tsconfig.json.tpl"], ["test/tsconfig.json.tpl", "file/test/tsconfig.json.tpl", "test/tsconfig.json"], ["tsconfig.esm.json.tpl", "file/tsconfig.esm.json.tpl", "tsconfig.esm.json"], ["tsconfig.tsdx.json.tpl", "file/tsconfig.tsdx.json.tpl", "tsconfig.tsdx.json"], [".eslintrc.json.tpl", "file/eslintrc.json.tpl", ".eslintrc.json"], ["README.md", "file/README.md"], [".mocharc.yml.tpl", "file/mocharc.yml"], ["jest.config.js", "file/jest.config.auto.js"], [".nowignore", "file/nowignore"], ["now.json.tpl", "file/now.json.tpl", "now.json"], ["tsdx.config.js.tpl", "file/tsdx.config.js", "tsdx.config.js"], ...["test/temp.ts" | "test/__root.ts" | "test/__root-core.cjs" | "test/__root-core.mjs" | "test/__root-core.d.cts" | "test/__root-core.d.mts" | "test/__root-core.d.ts" | "test/fixtures/.gitkeep", "file/test/temp.ts" | "file/test/__root.ts" | "file/test/__root-core.cjs" | "file/test/__root-core.mjs" | "file/test/__root-core.d.cts" | "file/test/__root-core.d.mts" | "file/test/__root-core.d.ts" | "file/test/fixtures/.gitkeep"][]];
|
|
24
|
+
/**
|
|
25
|
+
* Default static files for package-level only copying / 僅套件層級複製的預設靜態檔案
|
|
26
|
+
*
|
|
27
|
+
* Contains configuration files that should only be copied to individual packages. not workspace root.
|
|
28
|
+
* 包含僅應複製到各個套件的配置檔案。不複製到工作區根目錄。
|
|
29
|
+
*
|
|
30
|
+
* These files are typically unique to each package.
|
|
31
|
+
* 這些檔案通常僅屬於單個套件。
|
|
32
|
+
*/
|
|
33
|
+
declare const _defaultCopyStaticFilesPkgOnly: [["playwright.config.ts", "file/playwright.config.ts", "playwright.config.js"]];
|
|
24
34
|
/**
|
|
25
35
|
* Default static files for root-level only copying / 僅根目錄層級複製的預設靜態檔案
|
|
26
36
|
*
|
|
@@ -45,6 +55,13 @@ declare const _defaultCopyStaticFilesWsRootOnly: [["lerna.json.tpl", "file/lerna
|
|
|
45
55
|
* 用於將靜態檔案複製到各個套件。
|
|
46
56
|
*/
|
|
47
57
|
export declare const defaultCopyStaticFiles: IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFiles>>;
|
|
58
|
+
/**
|
|
59
|
+
* Frozen default static files for package-level only / 凍結的僅套件層級預設靜態檔案
|
|
60
|
+
*
|
|
61
|
+
* Use this for copying static files to individual packages only and not workspace root.
|
|
62
|
+
* 用於將靜態檔案僅複製到各個套件,不複製到工作區根目錄。
|
|
63
|
+
*/
|
|
64
|
+
export declare const defaultCopyStaticFilesPkgOnly: IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFilesPkgOnly>>;
|
|
48
65
|
/**
|
|
49
66
|
* Frozen default static files for root-level only / 凍結的僅根目錄層級預設靜態檔案
|
|
50
67
|
*
|
package/lib/const.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultCopyStaticFilesWsRootOnly = exports.defaultCopyStaticFilesRootOnly = exports.defaultCopyStaticFiles = void 0;
|
|
3
|
+
exports.defaultCopyStaticFilesWsRootOnly = exports.defaultCopyStaticFilesRootOnly = exports.defaultCopyStaticFilesPkgOnly = exports.defaultCopyStaticFiles = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Default static files for package-level copying / 套件層級複製的預設靜態檔案
|
|
6
6
|
*
|
|
@@ -84,6 +84,18 @@ const _defaultCopyStaticFiles = [
|
|
|
84
84
|
])),
|
|
85
85
|
//['changelog-option.js.tpl', 'file/changelog-option.js', 'changelog-option.js'],
|
|
86
86
|
];
|
|
87
|
+
/**
|
|
88
|
+
* Default static files for package-level only copying / 僅套件層級複製的預設靜態檔案
|
|
89
|
+
*
|
|
90
|
+
* Contains configuration files that should only be copied to individual packages. not workspace root.
|
|
91
|
+
* 包含僅應複製到各個套件的配置檔案。不複製到工作區根目錄。
|
|
92
|
+
*
|
|
93
|
+
* These files are typically unique to each package.
|
|
94
|
+
* 這些檔案通常僅屬於單個套件。
|
|
95
|
+
*/
|
|
96
|
+
const _defaultCopyStaticFilesPkgOnly = [
|
|
97
|
+
['playwright.config.ts', 'file/playwright.config.ts', 'playwright.config.js'],
|
|
98
|
+
];
|
|
87
99
|
/**
|
|
88
100
|
* Default static files for root-level only copying / 僅根目錄層級複製的預設靜態檔案
|
|
89
101
|
*
|
|
@@ -230,6 +242,13 @@ const _defaultCopyStaticFilesWsRootOnly = [
|
|
|
230
242
|
* 用於將靜態檔案複製到各個套件。
|
|
231
243
|
*/
|
|
232
244
|
exports.defaultCopyStaticFiles = Object.freeze(_defaultCopyStaticFiles);
|
|
245
|
+
/**
|
|
246
|
+
* Frozen default static files for package-level only / 凍結的僅套件層級預設靜態檔案
|
|
247
|
+
*
|
|
248
|
+
* Use this for copying static files to individual packages only and not workspace root.
|
|
249
|
+
* 用於將靜態檔案僅複製到各個套件,不複製到工作區根目錄。
|
|
250
|
+
*/
|
|
251
|
+
exports.defaultCopyStaticFilesPkgOnly = Object.freeze(_defaultCopyStaticFilesPkgOnly);
|
|
233
252
|
/**
|
|
234
253
|
* Frozen default static files for root-level only / 凍結的僅根目錄層級預設靜態檔案
|
|
235
254
|
*
|
package/lib/const.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.js","sourceRoot":"","sources":["const.ts"],"names":[],"mappings":";;;AAUA;;;;;;;;;;;;GAYG;AACH,MAAM,uBAAuB,GAAG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;IAEnD;;;OAGG;IACH,uEAAuE;IAEvE;;;OAGG;IACH,CAAC,cAAc,EAAE,2BAA2B,CAAC;IAE7C;;;;;;OAMG;IACH,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;IACjD,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;IAEjD,CAAC,oBAAoB,EAAE,6BAA6B,CAAC;IAErD;;;OAGG;IACH,CAAC,gCAAgC,EAAE,6CAA6C,CAAC;CAEjC,CAAC;AAElD;;;;;GAKG;AACU,QAAA,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC,uBAAuB,CAAsE,CAAC;AAElJ;;;;;GAKG;AACU,QAAA,8BAA8B,GAAG,MAAM,CAAC,MAAM,CAAC,+BAA+B,CAA8E,CAAC;AAE1K;;;;;GAKG;AACU,QAAA,gCAAgC,GAAG,MAAM,CAAC,MAAM,CAAC,iCAAiC,CAAgF,CAAC","sourcesContent":["/**\n * Static file mapping constants / 靜態檔案映射常量\n *\n * This module defines the default static file mappings for different project scenarios.\n * 此模組定義了不同專案情境的預設靜態檔案映射。\n *\n * @module const\n */\nimport { _Key, IStaticFilesKey, IStaticFilesMapArray, IStaticFilesMapArrayEntry } from './types';\n\n/**\n * Default static files for package-level copying / 套件層級複製的預設靜態檔案\n *\n * Contains common configuration files that should be copied to each package.\n * 包含應複製到每個套件的常用配置檔案。\n *\n * Each entry follows the format: [targetFile, staticFile, detectFile?]\n * 每個條目遵循格式:[目標檔案, 靜態檔案, 檢測檔案?]\n *\n * - targetFile: The destination file path / 目標檔案路徑\n * - staticFile: The source static file path (relative to static root) / 來源靜態檔案路徑(相對於靜態根目錄)\n * - detectFile: Optional file to check for existence before copying / 可選的檢測檔案,複製前檢查是否存在\n */\nconst _defaultCopyStaticFiles = [\n\n\t/**\n\t * 忽略檔案\n\t * Ignore files\n\t */\n\t['.npmignore', 'file/npmignore'],\n\t['.gitignore', 'file/gitignore'],\n\t['.eslintignore', 'file/eslintignore'],\n\n\t/**\n\t * TypeScript 配置\n\t * TypeScript configuration\n\t */\n\t['tsconfig.json', 'file/tsconfig.json.tpl'],\n\t['tsconfig.json.tpl', 'file/tsconfig.json.tpl'],\n\n\t['test/tsconfig.json.tpl', 'file/test/tsconfig.json.tpl', 'test/tsconfig.json'],\n\n\t['tsconfig.esm.json.tpl', 'file/tsconfig.esm.json.tpl', 'tsconfig.esm.json'],\n\t['tsconfig.tsdx.json.tpl', 'file/tsconfig.tsdx.json.tpl', 'tsconfig.tsdx.json'],\n\n\t/**\n\t * ESLint 配置\n\t * ESLint configuration\n\t */\n\t['.eslintrc.json.tpl', 'file/eslintrc.json.tpl', '.eslintrc.json'],\n\n\t/**\n\t * 文件\n\t * Documentation\n\t */\n\t['README.md', 'file/README.md'],\n\n\t/**\n\t * 測試配置\n\t * Test configuration\n\t */\n\t['.mocharc.yml.tpl', 'file/mocharc.yml'],\n\n\t['jest.config.js', 'file/jest.config.auto.js'],\n\n\t/**\n\t * Now/Zeit 部署配置\n\t * Now/Zeit deployment\n\t */\n\t['.nowignore', 'file/nowignore'],\n\t['now.json.tpl', 'file/now.json.tpl', 'now.json'],\n\n\t/**\n\t * TSDX 配置\n\t * TSDX configuration\n\t */\n\t['tsdx.config.js.tpl', 'file/tsdx.config.js', 'tsdx.config.js'],\n\n\t/**\n\t * 測試\n\t * test\n\t *\n\t * 以展開運算式一次產生 test/ 底下的固定樣板條目\n\t * Expands into template entries under test/ in one go\n\t */\n\t...(([\n\t\t'temp.ts',\n\n\t\t'__root.ts',\n\n\t\t'__root-core.cjs',\n\t\t'__root-core.mjs',\n\n\t\t'__root-core.d.cts',\n\t\t'__root-core.d.mts',\n\n\t\t'__root-core.d.ts',\n\n\t\t/**\n\t\t * 測試固定檔案\n\t\t * Test fixtures\n\t\t */\n\t\t'fixtures/.gitkeep',\n\n\t] as const).map(file => [\n\t\t`test/${file}`,\n\t\t`file/test/${file}`\n\t] as const satisfies IStaticFilesMapArrayEntry<string>)),\n\n\t//['changelog-option.js.tpl', 'file/changelog-option.js', 'changelog-option.js'],\n\n] as const satisfies IStaticFilesMapArray<string>;\n\n/**\n * Default static files for root-level only copying / 僅根目錄層級複製的預設靜態檔案\n *\n * Contains configuration files that should only be copied to the workspace root.\n * 包含僅應複製到工作區根目錄的配置檔案。\n *\n * These files are typically shared across all packages in a monorepo.\n * 這些檔案通常在 monorepo 中的所有套件之間共享。\n */\nconst _defaultCopyStaticFilesRootOnly = [\n\n\t/**\n\t * Monorepo 配置\n\t * Monorepo configuration\n\t */\n\t['lerna.json.tpl', 'file/lerna.json.tpl', 'lerna.json'],\n\t['pnpm-workspace.yaml.tpl', 'file/pnpm-workspace.yaml'],\n\n\t/**\n\t * GitHub Actions 工作流程\n\t * GitHub Actions workflows\n\t */\n\t['.github/workflows/build-pnpm.yml', 'file/github/workflows/build-pnpm.yml'],\n\t['.github/workflows/build-yarn.yml', 'file/github/workflows/build-yarn.yml'],\n\n\t/**\n\t * 額外的 GitHub 配置\n\t * Additional GitHub configuration\n\t */\n\t...(([\n\t\t'dependabot.yml',\n\t\t'commit-convention.md',\n\n\t\t// ---\n\n\t\t// 'workflows/codeql-analysis.yml',\n\t\t// 'workflows/cmd-rebase.yml',\n\n\t\t// 'workflows/coverage.yml',\n\t\t// 'workflows/action-yarnlock-dedupe.yml',\n\t\t// 'workflows/yarn-lock-changes.yml',\n\n\t\t// ---\n\n\t] as const).map(file => [`.github/${file}`, `file/github/${file}`] as const satisfies IStaticFilesMapArrayEntry<string>)),\n\n\t/**\n\t * Node 版本檔案\n\t * Node version files\n\t */\n\t['.node-version.tpl', 'file/nvmrc'],\n\t['.nvmrc.tpl', 'file/nvmrc'],\n\n\t/**\n\t * 根目錄 TypeScript 配置\n\t * Root TypeScript configuration\n\t *\n\t * 注意:此處目標為 .eslintrc.json,屬於根目錄專用的 ESLint 設定\n\t * Note: the target here is .eslintrc.json, the ESLint config used only at the root\n\t */\n\t['.eslintrc.json', 'file/eslintrc.json.tpl', '.eslintrc.json'],\n\n\t//['changelog-option.js', 'file/changelog-option.js', 'changelog-option.js.tpl'],\n\n\t/**\n\t * 套件管理器配置\n\t * Package manager configuration\n\t */\n\t['.yarnrc.yml.tpl', 'file/root/yarnrc.yml', '.yarnrc.yml'],\n\t['.npmrc.tpl', 'file/npmrc', '.npmrc'],\n\n\t['.env.tpl', 'file/env'],\n\n\t/**\n\t * Jest 配置\n\t * Jest configuration\n\t *\n\t * 僅放置 .tpl 樣板,正式設定檔交由工作區層級建立\n\t * Only the .tpl template is shipped here; the real config is created by the workspace layer\n\t */\n\t// ['jest.config.js', 'file/jest.config.js'],\n\t// ['jest.config.js.tpl', 'file/jest.config.js'],\n\t['jest.config.auto.js.tpl', 'file/jest.config.auto.js'],\n\n\t/**\n\t * 編輯器配置\n\t * Editor configuration\n\t */\n\t['.editorconfig.tpl', 'file/tpl.editorconfig'],\n\t['.editorconfig', 'file/tpl.editorconfig'],\n\n\t/**\n\t * 全域型別宣告\n\t * Global type declarations\n\t */\n\t['global.tsdx.d.ts', 'file/root/global.tsdx.d.ts'],\n\n\t/**\n\t * Browserslist 配置\n\t * Browserslist configuration\n\t */\n\t['.browserslistrc', 'file/ws-root/browserslistrc'],\n\n\t/**\n\t * TSC 多配置\n\t * TSC multi configuration\n\t */\n\t// ['tsc-multi.json.tpl', 'file/tsc-multi.json.tpl', 'tsc-multi.json'],\n\n\t/**\n\t * NYC 覆蓋率配置\n\t * NYC coverage configuration\n\t */\n\t// ['.nycrc.tpl', 'file/nycrc', '.nycrc'],\n\n] as const satisfies IStaticFilesMapArray<string>;\n\n/**\n * Default static files for workspace root only / 僅工作區根目錄的預設靜態檔案\n *\n * Contains files specific to workspace root management.\n * 包含特定於工作區根目錄管理的檔案。\n */\nconst _defaultCopyStaticFilesWsRootOnly = [\n\n\t/**\n\t * Lerna 配置\n\t * Lerna configuration\n\t */\n\t['lerna.json.tpl', 'file/lerna.json.tpl'],\n\n\t/**\n\t * pnpm 工作區配置\n\t * pnpm workspace configuration\n\t */\n\t['pnpm-workspace.yaml', 'file/pnpm-workspace.yaml'],\n\n\t/**\n\t * TSC 多配置\n\t * TSC multi configuration\n\t */\n\t// ['tsc-multi.json.tpl', 'file/tsc-multi.json.tpl', 'tsc-multi.json'],\n\n\t/**\n\t * 工作區根目錄檔案\n\t * Workspace root file\n\t */\n\t['__root_ws.ts', 'file/ws-root/__root_ws.ts'],\n\n\t/**\n\t * Jest 配置\n\t * Jest configuration\n\t *\n\t * 工作區根目錄同時提供正式設定與樣板兩種形式\n\t * The workspace root ships both the real config and the template form\n\t */\n\t['jest.config.js', 'file/ws-root/jest.config.js'],\n\t['jest-preset.js', 'file/ws-root/jest-preset.js'],\n\n\t['jest.config.js.tpl', 'file/ws-root/jest.config.js'],\n\n\t/**\n\t * 執行配置\n\t * Run configurations\n\t */\n\t['.run/lerna_publish_yes.run.xml', 'file/ws-root/.run/lerna_publish_yes.run.xml'],\n\n] as const satisfies IStaticFilesMapArray<string>;\n\n/**\n * Frozen default static files for package-level / 凍結的套件層級預設靜態檔案\n *\n * Use this for copying static files to individual packages.\n * 用於將靜態檔案複製到各個套件。\n */\nexport const defaultCopyStaticFiles = Object.freeze(_defaultCopyStaticFiles) as any as IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFiles>>;\n\n/**\n * Frozen default static files for root-level only / 凍結的僅根目錄層級預設靜態檔案\n *\n * Use this for copying static files to the workspace root only.\n * 用於將靜態檔案僅複製到工作區根目錄。\n */\nexport const defaultCopyStaticFilesRootOnly = Object.freeze(_defaultCopyStaticFilesRootOnly) as any as IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFilesRootOnly>>;\n\n/**\n * Frozen default static files for workspace root / 凍結的工作區根目錄預設靜態檔案\n *\n * Use this for workspace root specific file management.\n * 用於工作區根目錄特定的檔案管理。\n */\nexport const defaultCopyStaticFilesWsRootOnly = Object.freeze(_defaultCopyStaticFilesWsRootOnly) as any as IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFilesWsRootOnly>>;\n"]}
|
|
1
|
+
{"version":3,"file":"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G;IACH,uEAAuE;IAEvE;;;OAGG;IACH,0CAA0C;CAEM,CAAC;AAElD;;;;;GAKG;AACH,MAAM,iCAAiC,GAAG;IAEzC;;;OAGG;IACH,CAAC,gBAAgB,EAAE,qBAAqB,CAAC;IAEzC;;;OAGG;IACH,CAAC,qBAAqB,EAAE,0BAA0B,CAAC;IAEnD;;;OAGG;IACH,uEAAuE;IAEvE;;;OAGG;IACH,CAAC,cAAc,EAAE,2BAA2B,CAAC;IAE7C;;;;;;OAMG;IACH,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;IACjD,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;IAEjD,CAAC,oBAAoB,EAAE,6BAA6B,CAAC;IAErD;;;OAGG;IACH,CAAC,gCAAgC,EAAE,6CAA6C,CAAC;CAEjC,CAAC;AAElD;;;;;GAKG;AACU,QAAA,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC,uBAAuB,CAAsE,CAAC;AAElJ;;;;;GAKG;AACU,QAAA,6BAA6B,GAAG,MAAM,CAAC,MAAM,CAAC,8BAA8B,CAA6E,CAAC;AAEvK;;;;;GAKG;AACU,QAAA,8BAA8B,GAAG,MAAM,CAAC,MAAM,CAAC,+BAA+B,CAA8E,CAAC;AAE1K;;;;;GAKG;AACU,QAAA,gCAAgC,GAAG,MAAM,CAAC,MAAM,CAAC,iCAAiC,CAAgF,CAAC","sourcesContent":["/**\n * Static file mapping constants / 靜態檔案映射常量\n *\n * This module defines the default static file mappings for different project scenarios.\n * 此模組定義了不同專案情境的預設靜態檔案映射。\n *\n * @module const\n */\nimport { _Key, IStaticFilesKey, IStaticFilesMapArray, IStaticFilesMapArrayEntry } from './types';\n\n/**\n * Default static files for package-level copying / 套件層級複製的預設靜態檔案\n *\n * Contains common configuration files that should be copied to each package.\n * 包含應複製到每個套件的常用配置檔案。\n *\n * Each entry follows the format: [targetFile, staticFile, detectFile?]\n * 每個條目遵循格式:[目標檔案, 靜態檔案, 檢測檔案?]\n *\n * - targetFile: The destination file path / 目標檔案路徑\n * - staticFile: The source static file path (relative to static root) / 來源靜態檔案路徑(相對於靜態根目錄)\n * - detectFile: Optional file to check for existence before copying / 可選的檢測檔案,複製前檢查是否存在\n */\nconst _defaultCopyStaticFiles = [\n\n\t/**\n\t * 忽略檔案\n\t * Ignore files\n\t */\n\t['.npmignore', 'file/npmignore'],\n\t['.gitignore', 'file/gitignore'],\n\t['.eslintignore', 'file/eslintignore'],\n\n\t/**\n\t * TypeScript 配置\n\t * TypeScript configuration\n\t */\n\t['tsconfig.json', 'file/tsconfig.json.tpl'],\n\t['tsconfig.json.tpl', 'file/tsconfig.json.tpl'],\n\n\t['test/tsconfig.json.tpl', 'file/test/tsconfig.json.tpl', 'test/tsconfig.json'],\n\n\t['tsconfig.esm.json.tpl', 'file/tsconfig.esm.json.tpl', 'tsconfig.esm.json'],\n\t['tsconfig.tsdx.json.tpl', 'file/tsconfig.tsdx.json.tpl', 'tsconfig.tsdx.json'],\n\n\t/**\n\t * ESLint 配置\n\t * ESLint configuration\n\t */\n\t['.eslintrc.json.tpl', 'file/eslintrc.json.tpl', '.eslintrc.json'],\n\n\t/**\n\t * 文件\n\t * Documentation\n\t */\n\t['README.md', 'file/README.md'],\n\n\t/**\n\t * 測試配置\n\t * Test configuration\n\t */\n\t['.mocharc.yml.tpl', 'file/mocharc.yml'],\n\n\t['jest.config.js', 'file/jest.config.auto.js'],\n\n\t/**\n\t * Now/Zeit 部署配置\n\t * Now/Zeit deployment\n\t */\n\t['.nowignore', 'file/nowignore'],\n\t['now.json.tpl', 'file/now.json.tpl', 'now.json'],\n\n\t/**\n\t * TSDX 配置\n\t * TSDX configuration\n\t */\n\t['tsdx.config.js.tpl', 'file/tsdx.config.js', 'tsdx.config.js'],\n\n\t/**\n\t * 測試\n\t * test\n\t *\n\t * 以展開運算式一次產生 test/ 底下的固定樣板條目\n\t * Expands into template entries under test/ in one go\n\t */\n\t...(([\n\t\t'temp.ts',\n\n\t\t'__root.ts',\n\n\t\t'__root-core.cjs',\n\t\t'__root-core.mjs',\n\n\t\t'__root-core.d.cts',\n\t\t'__root-core.d.mts',\n\n\t\t'__root-core.d.ts',\n\n\t\t/**\n\t\t * 測試固定檔案\n\t\t * Test fixtures\n\t\t */\n\t\t'fixtures/.gitkeep',\n\n\t] as const).map(file => [\n\t\t`test/${file}`,\n\t\t`file/test/${file}`\n\t] as const satisfies IStaticFilesMapArrayEntry<string>)),\n\n\t//['changelog-option.js.tpl', 'file/changelog-option.js', 'changelog-option.js'],\n\n] as const satisfies IStaticFilesMapArray<string>;\n\n/**\n * Default static files for package-level only copying / 僅套件層級複製的預設靜態檔案\n *\n * Contains configuration files that should only be copied to individual packages. not workspace root.\n * 包含僅應複製到各個套件的配置檔案。不複製到工作區根目錄。\n *\n * These files are typically unique to each package.\n * 這些檔案通常僅屬於單個套件。\n */\nconst _defaultCopyStaticFilesPkgOnly = [\n\n\t['playwright.config.ts', 'file/playwright.config.ts', 'playwright.config.js'],\n\n] as const satisfies IStaticFilesMapArray<string>;\n\n/**\n * Default static files for root-level only copying / 僅根目錄層級複製的預設靜態檔案\n *\n * Contains configuration files that should only be copied to the workspace root.\n * 包含僅應複製到工作區根目錄的配置檔案。\n *\n * These files are typically shared across all packages in a monorepo.\n * 這些檔案通常在 monorepo 中的所有套件之間共享。\n */\nconst _defaultCopyStaticFilesRootOnly = [\n\n\t/**\n\t * Monorepo 配置\n\t * Monorepo configuration\n\t */\n\t['lerna.json.tpl', 'file/lerna.json.tpl', 'lerna.json'],\n\t['pnpm-workspace.yaml.tpl', 'file/pnpm-workspace.yaml'],\n\n\t/**\n\t * GitHub Actions 工作流程\n\t * GitHub Actions workflows\n\t */\n\t['.github/workflows/build-pnpm.yml', 'file/github/workflows/build-pnpm.yml'],\n\t['.github/workflows/build-yarn.yml', 'file/github/workflows/build-yarn.yml'],\n\n\t/**\n\t * 額外的 GitHub 配置\n\t * Additional GitHub configuration\n\t */\n\t...(([\n\t\t'dependabot.yml',\n\t\t'commit-convention.md',\n\n\t\t// ---\n\n\t\t// 'workflows/codeql-analysis.yml',\n\t\t// 'workflows/cmd-rebase.yml',\n\n\t\t// 'workflows/coverage.yml',\n\t\t// 'workflows/action-yarnlock-dedupe.yml',\n\t\t// 'workflows/yarn-lock-changes.yml',\n\n\t\t// ---\n\n\t] as const).map(file => [`.github/${file}`, `file/github/${file}`] as const satisfies IStaticFilesMapArrayEntry<string>)),\n\n\t/**\n\t * Node 版本檔案\n\t * Node version files\n\t */\n\t['.node-version.tpl', 'file/nvmrc'],\n\t['.nvmrc.tpl', 'file/nvmrc'],\n\n\t/**\n\t * 根目錄 TypeScript 配置\n\t * Root TypeScript configuration\n\t *\n\t * 注意:此處目標為 .eslintrc.json,屬於根目錄專用的 ESLint 設定\n\t * Note: the target here is .eslintrc.json, the ESLint config used only at the root\n\t */\n\t['.eslintrc.json', 'file/eslintrc.json.tpl', '.eslintrc.json'],\n\n\t//['changelog-option.js', 'file/changelog-option.js', 'changelog-option.js.tpl'],\n\n\t/**\n\t * 套件管理器配置\n\t * Package manager configuration\n\t */\n\t['.yarnrc.yml.tpl', 'file/root/yarnrc.yml', '.yarnrc.yml'],\n\t['.npmrc.tpl', 'file/npmrc', '.npmrc'],\n\n\t['.env.tpl', 'file/env'],\n\n\t/**\n\t * Jest 配置\n\t * Jest configuration\n\t *\n\t * 僅放置 .tpl 樣板,正式設定檔交由工作區層級建立\n\t * Only the .tpl template is shipped here; the real config is created by the workspace layer\n\t */\n\t// ['jest.config.js', 'file/jest.config.js'],\n\t// ['jest.config.js.tpl', 'file/jest.config.js'],\n\t['jest.config.auto.js.tpl', 'file/jest.config.auto.js'],\n\n\t/**\n\t * 編輯器配置\n\t * Editor configuration\n\t */\n\t['.editorconfig.tpl', 'file/tpl.editorconfig'],\n\t['.editorconfig', 'file/tpl.editorconfig'],\n\n\t/**\n\t * 全域型別宣告\n\t * Global type declarations\n\t */\n\t['global.tsdx.d.ts', 'file/root/global.tsdx.d.ts'],\n\n\t/**\n\t * Browserslist 配置\n\t * Browserslist configuration\n\t */\n\t['.browserslistrc', 'file/ws-root/browserslistrc'],\n\n\t/**\n\t * TSC 多配置\n\t * TSC multi configuration\n\t */\n\t// ['tsc-multi.json.tpl', 'file/tsc-multi.json.tpl', 'tsc-multi.json'],\n\n\t/**\n\t * NYC 覆蓋率配置\n\t * NYC coverage configuration\n\t */\n\t// ['.nycrc.tpl', 'file/nycrc', '.nycrc'],\n\n] as const satisfies IStaticFilesMapArray<string>;\n\n/**\n * Default static files for workspace root only / 僅工作區根目錄的預設靜態檔案\n *\n * Contains files specific to workspace root management.\n * 包含特定於工作區根目錄管理的檔案。\n */\nconst _defaultCopyStaticFilesWsRootOnly = [\n\n\t/**\n\t * Lerna 配置\n\t * Lerna configuration\n\t */\n\t['lerna.json.tpl', 'file/lerna.json.tpl'],\n\n\t/**\n\t * pnpm 工作區配置\n\t * pnpm workspace configuration\n\t */\n\t['pnpm-workspace.yaml', 'file/pnpm-workspace.yaml'],\n\n\t/**\n\t * TSC 多配置\n\t * TSC multi configuration\n\t */\n\t// ['tsc-multi.json.tpl', 'file/tsc-multi.json.tpl', 'tsc-multi.json'],\n\n\t/**\n\t * 工作區根目錄檔案\n\t * Workspace root file\n\t */\n\t['__root_ws.ts', 'file/ws-root/__root_ws.ts'],\n\n\t/**\n\t * Jest 配置\n\t * Jest configuration\n\t *\n\t * 工作區根目錄同時提供正式設定與樣板兩種形式\n\t * The workspace root ships both the real config and the template form\n\t */\n\t['jest.config.js', 'file/ws-root/jest.config.js'],\n\t['jest-preset.js', 'file/ws-root/jest-preset.js'],\n\n\t['jest.config.js.tpl', 'file/ws-root/jest.config.js'],\n\n\t/**\n\t * 執行配置\n\t * Run configurations\n\t */\n\t['.run/lerna_publish_yes.run.xml', 'file/ws-root/.run/lerna_publish_yes.run.xml'],\n\n] as const satisfies IStaticFilesMapArray<string>;\n\n/**\n * Frozen default static files for package-level / 凍結的套件層級預設靜態檔案\n *\n * Use this for copying static files to individual packages.\n * 用於將靜態檔案複製到各個套件。\n */\nexport const defaultCopyStaticFiles = Object.freeze(_defaultCopyStaticFiles) as any as IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFiles>>;\n\n/**\n * Frozen default static files for package-level only / 凍結的僅套件層級預設靜態檔案\n *\n * Use this for copying static files to individual packages only and not workspace root.\n * 用於將靜態檔案僅複製到各個套件,不複製到工作區根目錄。\n */\nexport const defaultCopyStaticFilesPkgOnly = Object.freeze(_defaultCopyStaticFilesPkgOnly) as any as IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFilesPkgOnly>>;\n\n/**\n * Frozen default static files for root-level only / 凍結的僅根目錄層級預設靜態檔案\n *\n * Use this for copying static files to the workspace root only.\n * 用於將靜態檔案僅複製到工作區根目錄。\n */\nexport const defaultCopyStaticFilesRootOnly = Object.freeze(_defaultCopyStaticFilesRootOnly) as any as IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFilesRootOnly>>;\n\n/**\n * Frozen default static files for workspace root / 凍結的工作區根目錄預設靜態檔案\n *\n * Use this for workspace root specific file management.\n * 用於工作區根目錄特定的檔案管理。\n */\nexport const defaultCopyStaticFilesWsRootOnly = Object.freeze(_defaultCopyStaticFilesWsRootOnly) as any as IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFilesWsRootOnly>>;\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* copyStaticFiles 參數產生器
|
|
3
|
+
*
|
|
4
|
+
* 抽離 fix-all 與 npm-init2 中重複的判定邏輯:
|
|
5
|
+
* 依 rootData 決定複製目標目錄與 file_map,
|
|
6
|
+
* 回傳可直接傳給 copyStaticFiles 的參數物件。
|
|
7
|
+
*
|
|
8
|
+
* @module copyStaticFilesByRootData
|
|
9
|
+
*/
|
|
10
|
+
import type { IFindRootReturnType } from '@yarn-tool/find-root';
|
|
11
|
+
import type { ICopyStaticFilesOptions } from './types';
|
|
12
|
+
import { ITSPartialPick } from 'ts-type';
|
|
13
|
+
/**
|
|
14
|
+
* getCopyStaticFilesOptionsByRootData 的選項
|
|
15
|
+
*
|
|
16
|
+
* 以 copyStaticFiles 的實際參數 ICopyStaticFilesOptions 為基礎,
|
|
17
|
+
* 僅將必填的 cwd 改為可選(預設由 rootData 決定),
|
|
18
|
+
* 其餘欄位(staticRoot、overwrite、file_map、ignoreFilesSnapshot)
|
|
19
|
+
* 與回傳型別同源,保持與 ICopyStaticFilesOptions 的追蹤鏈。
|
|
20
|
+
*
|
|
21
|
+
* @template K - 目標檔案路徑類型
|
|
22
|
+
*/
|
|
23
|
+
export interface ICopyStaticFilesByRootDataOptions<K extends string = string> extends Partial<ICopyStaticFilesOptions<K>>, ITSPartialPick<IFindRootReturnType, 'hasWorkspace' | 'isRoot'> {
|
|
24
|
+
/**
|
|
25
|
+
* 覆寫複製目標目錄;未提供時 workspace 專案取 ws、其餘取 root
|
|
26
|
+
*
|
|
27
|
+
* 提供此欄位時 file_map 一律改以套件模式判定(npm-init2 以 targetDir 複製的情境)。
|
|
28
|
+
*/
|
|
29
|
+
cwd?: ICopyStaticFilesOptions<K>['cwd'];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 依 rootData 產生 copyStaticFiles 的參數
|
|
33
|
+
*
|
|
34
|
+
* 判定規則(對應 fix-all 與 npm-init2 的既有用法):
|
|
35
|
+
*
|
|
36
|
+
* 1. 目標目錄:未覆寫 cwd 時,有 workspace 取 ws、否則取 root
|
|
37
|
+
* 2. file_map:未覆寫 cwd 且有 workspace 時使用 workspace 清單 (getWsCopyStaticFiles),
|
|
38
|
+
* 其餘使用套件清單 (getRootCopyStaticFilesAuto),旗標 hasWorkspace / isRoot 可覆寫
|
|
39
|
+
* 3. ignoreFilesSnapshot 僅在提供時帶入,未提供不產生該鍵
|
|
40
|
+
*
|
|
41
|
+
* 本函式只產生參數,不寫入任何檔案;是否啟用複製
|
|
42
|
+
* (addStaticFiles / noStaticFiles / resetStaticFiles)仍由呼叫端以 _isAddStaticFilesOrReset 決定。
|
|
43
|
+
*
|
|
44
|
+
* @param {ICopyStaticFilesRootData} rootData - 專案根目錄資訊
|
|
45
|
+
* @param {ICopyStaticFilesByRootDataOptions} [opts] - 覆寫選項
|
|
46
|
+
* @returns {ICopyStaticFilesOptions} 可直接傳給 copyStaticFiles 的參數物件
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* const options = getCopyStaticFilesOptionsByRootData(rootData, { ignoreFilesSnapshot });
|
|
50
|
+
* copyStaticFiles(options);
|
|
51
|
+
*/
|
|
52
|
+
export declare function getCopyStaticFilesOptionsByRootData(rootData: IFindRootReturnType, opts?: ICopyStaticFilesByRootDataOptions): ICopyStaticFilesOptions;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCopyStaticFilesOptionsByRootData = getCopyStaticFilesOptionsByRootData;
|
|
4
|
+
const wsCopyStaticFiles_1 = require("./ws/wsCopyStaticFiles");
|
|
5
|
+
const getRootCopyStaticFiles_1 = require("./root/getRootCopyStaticFiles");
|
|
6
|
+
/**
|
|
7
|
+
* 依 rootData 產生 copyStaticFiles 的參數
|
|
8
|
+
*
|
|
9
|
+
* 判定規則(對應 fix-all 與 npm-init2 的既有用法):
|
|
10
|
+
*
|
|
11
|
+
* 1. 目標目錄:未覆寫 cwd 時,有 workspace 取 ws、否則取 root
|
|
12
|
+
* 2. file_map:未覆寫 cwd 且有 workspace 時使用 workspace 清單 (getWsCopyStaticFiles),
|
|
13
|
+
* 其餘使用套件清單 (getRootCopyStaticFilesAuto),旗標 hasWorkspace / isRoot 可覆寫
|
|
14
|
+
* 3. ignoreFilesSnapshot 僅在提供時帶入,未提供不產生該鍵
|
|
15
|
+
*
|
|
16
|
+
* 本函式只產生參數,不寫入任何檔案;是否啟用複製
|
|
17
|
+
* (addStaticFiles / noStaticFiles / resetStaticFiles)仍由呼叫端以 _isAddStaticFilesOrReset 決定。
|
|
18
|
+
*
|
|
19
|
+
* @param {ICopyStaticFilesRootData} rootData - 專案根目錄資訊
|
|
20
|
+
* @param {ICopyStaticFilesByRootDataOptions} [opts] - 覆寫選項
|
|
21
|
+
* @returns {ICopyStaticFilesOptions} 可直接傳給 copyStaticFiles 的參數物件
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const options = getCopyStaticFilesOptionsByRootData(rootData, { ignoreFilesSnapshot });
|
|
25
|
+
* copyStaticFiles(options);
|
|
26
|
+
*/
|
|
27
|
+
function getCopyStaticFilesOptionsByRootData(rootData, opts) {
|
|
28
|
+
const { cwd, file_map, ignoreFilesSnapshot, hasWorkspace = rootData.hasWorkspace, isRoot = rootData.isRoot, ...rest } = opts !== null && opts !== void 0 ? opts : {};
|
|
29
|
+
/**
|
|
30
|
+
* 是否由呼叫端指定目標目錄;
|
|
31
|
+
* true 代表複製目標是呼叫端自己的目錄(npm-init2 的 targetDir),
|
|
32
|
+
* 此時不適用「複製到 workspace 根目錄」的分支
|
|
33
|
+
*/
|
|
34
|
+
const cwdOverridden = cwd !== undefined;
|
|
35
|
+
/**
|
|
36
|
+
* 有 workspace 時 fix-all 已先 refind,故目標即為 ws 根目錄
|
|
37
|
+
*/
|
|
38
|
+
const target = cwdOverridden ? cwd : (rootData.hasWorkspace ? rootData.ws : rootData.root);
|
|
39
|
+
/**
|
|
40
|
+
* 目標為 workspace 根目錄時才使用 workspace 清單,否則用套件清單
|
|
41
|
+
*/
|
|
42
|
+
const map = file_map !== null && file_map !== void 0 ? file_map : (!cwdOverridden && rootData.hasWorkspace
|
|
43
|
+
? (0, wsCopyStaticFiles_1.getWsCopyStaticFiles)()
|
|
44
|
+
: (0, getRootCopyStaticFiles_1.getRootCopyStaticFilesAuto)({ hasWorkspace, isRoot }));
|
|
45
|
+
const options = {
|
|
46
|
+
...rest,
|
|
47
|
+
cwd: target,
|
|
48
|
+
file_map: map,
|
|
49
|
+
...(ignoreFilesSnapshot ? { ignoreFilesSnapshot } : {}),
|
|
50
|
+
};
|
|
51
|
+
return options;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=copyStaticFilesByRootData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copyStaticFilesByRootData.js","sourceRoot":"","sources":["copyStaticFilesByRootData.ts"],"names":[],"mappings":";;AAyDA,kFAsCC;AApFD,8DAA8D;AAC9D,0EAA2E;AAwB3E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,mCAAmC,CAAC,QAA6B,EAAE,IAAwC;IAE1H,MAAM,EACL,GAAG,EACH,QAAQ,EACR,mBAAmB,EACnB,YAAY,GAAG,QAAQ,CAAC,YAAY,EACpC,MAAM,GAAG,QAAQ,CAAC,MAAM,EACxB,GAAG,IAAI,EACP,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC;IAEf;;;;OAIG;IACH,MAAM,aAAa,GAAG,GAAG,KAAK,SAAS,CAAC;IAExC;;OAEG;IACH,MAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE3F;;OAEG;IACH,MAAM,GAAG,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,CAAC,CAAC,aAAa,IAAI,QAAQ,CAAC,YAAY;QAC/D,CAAC,CAAC,IAAA,wCAAoB,GAAE;QACxB,CAAC,CAAC,IAAA,mDAA0B,EAAC,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IAEzD,MAAM,OAAO,GAAG;QACf,GAAG,IAAI;QACP,GAAG,EAAE,MAAM;QACX,QAAQ,EAAE,GAAG;QACb,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACrB,CAAC;IAEpC,OAAO,OAAO,CAAC;AAChB,CAAC","sourcesContent":["/**\n * copyStaticFiles 參數產生器\n *\n * 抽離 fix-all 與 npm-init2 中重複的判定邏輯:\n * 依 rootData 決定複製目標目錄與 file_map,\n * 回傳可直接傳給 copyStaticFiles 的參數物件。\n *\n * @module copyStaticFilesByRootData\n */\nimport type { IFindRootReturnType } from '@yarn-tool/find-root';\nimport type { ICopyStaticFilesOptions, IStaticFiles } from './types';\nimport { getWsCopyStaticFiles } from './ws/wsCopyStaticFiles';\nimport { getRootCopyStaticFilesAuto } from './root/getRootCopyStaticFiles';\nimport { ITSPartialPick } from 'ts-type';\n\n/**\n * getCopyStaticFilesOptionsByRootData 的選項\n *\n * 以 copyStaticFiles 的實際參數 ICopyStaticFilesOptions 為基礎,\n * 僅將必填的 cwd 改為可選(預設由 rootData 決定),\n * 其餘欄位(staticRoot、overwrite、file_map、ignoreFilesSnapshot)\n * 與回傳型別同源,保持與 ICopyStaticFilesOptions 的追蹤鏈。\n *\n * @template K - 目標檔案路徑類型\n */\nexport interface ICopyStaticFilesByRootDataOptions<K extends string = string>\n\textends Partial<ICopyStaticFilesOptions<K>>, ITSPartialPick<IFindRootReturnType, 'hasWorkspace' | 'isRoot'>\n{\n\t/**\n\t * 覆寫複製目標目錄;未提供時 workspace 專案取 ws、其餘取 root\n\t *\n\t * 提供此欄位時 file_map 一律改以套件模式判定(npm-init2 以 targetDir 複製的情境)。\n\t */\n\tcwd?: ICopyStaticFilesOptions<K>['cwd'];\n}\n\n/**\n * 依 rootData 產生 copyStaticFiles 的參數\n *\n * 判定規則(對應 fix-all 與 npm-init2 的既有用法):\n *\n * 1. 目標目錄:未覆寫 cwd 時,有 workspace 取 ws、否則取 root\n * 2. file_map:未覆寫 cwd 且有 workspace 時使用 workspace 清單 (getWsCopyStaticFiles),\n * 其餘使用套件清單 (getRootCopyStaticFilesAuto),旗標 hasWorkspace / isRoot 可覆寫\n * 3. ignoreFilesSnapshot 僅在提供時帶入,未提供不產生該鍵\n *\n * 本函式只產生參數,不寫入任何檔案;是否啟用複製\n * (addStaticFiles / noStaticFiles / resetStaticFiles)仍由呼叫端以 _isAddStaticFilesOrReset 決定。\n *\n * @param {ICopyStaticFilesRootData} rootData - 專案根目錄資訊\n * @param {ICopyStaticFilesByRootDataOptions} [opts] - 覆寫選項\n * @returns {ICopyStaticFilesOptions} 可直接傳給 copyStaticFiles 的參數物件\n *\n * @example\n * const options = getCopyStaticFilesOptionsByRootData(rootData, { ignoreFilesSnapshot });\n * copyStaticFiles(options);\n */\nexport function getCopyStaticFilesOptionsByRootData(rootData: IFindRootReturnType, opts?: ICopyStaticFilesByRootDataOptions): ICopyStaticFilesOptions\n{\n\tconst {\n\t\tcwd,\n\t\tfile_map,\n\t\tignoreFilesSnapshot,\n\t\thasWorkspace = rootData.hasWorkspace,\n\t\tisRoot = rootData.isRoot,\n\t\t...rest\n\t} = opts ?? {};\n\n\t/**\n\t * 是否由呼叫端指定目標目錄;\n\t * true 代表複製目標是呼叫端自己的目錄(npm-init2 的 targetDir),\n\t * 此時不適用「複製到 workspace 根目錄」的分支\n\t */\n\tconst cwdOverridden = cwd !== undefined;\n\n\t/**\n\t * 有 workspace 時 fix-all 已先 refind,故目標即為 ws 根目錄\n\t */\n\tconst target = cwdOverridden ? cwd : (rootData.hasWorkspace ? rootData.ws : rootData.root);\n\n\t/**\n\t * 目標為 workspace 根目錄時才使用 workspace 清單,否則用套件清單\n\t */\n\tconst map = file_map ?? (!cwdOverridden && rootData.hasWorkspace\n\t\t? getWsCopyStaticFiles()\n\t\t: getRootCopyStaticFilesAuto({ hasWorkspace, isRoot }));\n\n\tconst options = {\n\t\t...rest,\n\t\tcwd: target,\n\t\tfile_map: map,\n\t\t...(ignoreFilesSnapshot ? { ignoreFilesSnapshot } : {}),\n\t} satisfies ICopyStaticFilesOptions;\n\n\treturn options;\n}\n\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarn-tool/static-file",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.34",
|
|
4
4
|
"description": "用於將靜態設定檔案 (static configuration files) 複製到 yarn 工作區專案的工具 / A utility for copying static configuration files to yarn workspace projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"static-file",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"npm:publish": "npm publish",
|
|
46
46
|
"preversion": "pnpm run test",
|
|
47
47
|
"prepublishOnly": "node --run fix:ignore && node --run fix:ignore:commit",
|
|
48
|
+
"bin:self": "node --run prepublishOnly",
|
|
48
49
|
"fix:ignore": "node --run fix:ignore:build && node --run fix:ignore:copy && node --run fix:ignore:merge",
|
|
49
50
|
"fix:ignore:build": "tsx test/scripts/compose-split-ignore-files.ts",
|
|
50
51
|
"fix:ignore:commit": "git commit -m \"chore: update ignore files\" ./test/fixtures/split ./test/fixtures/out ./file/gitignore ./file/npmignore & echo fix:ignore:commit done",
|
|
@@ -55,7 +56,8 @@
|
|
|
55
56
|
"tsc:showConfig": "ynpx get-current-tsconfig -p"
|
|
56
57
|
},
|
|
57
58
|
"dependencies": {
|
|
58
|
-
"@yarn-tool/
|
|
59
|
+
"@yarn-tool/find-root": "^2.0.31",
|
|
60
|
+
"@yarn-tool/ignore": "^1.0.10",
|
|
59
61
|
"array-hyper-unique": "^2.1.10",
|
|
60
62
|
"fs-extra": "^11.4.1",
|
|
61
63
|
"tslib": ">=2.8.1"
|
|
@@ -63,5 +65,5 @@
|
|
|
63
65
|
"publishConfig": {
|
|
64
66
|
"access": "public"
|
|
65
67
|
},
|
|
66
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "314b389c12023220506f368dadea7b7624cbb740"
|
|
67
69
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playwright.config.js","sourceRoot":"","sources":["playwright.config.ts"],"names":[],"mappings":";;AAAA,aAAa;AACb,2CAAgD;AAEhD,kBAAe,IAAA,mBAAY,EAAC;IAC3B,SAAS,EAAE,6CAA6C;CACxD,CAAC,CAAC","sourcesContent":["// @ts-ignore\nimport { defineConfig } from '@playwright/test';\n\nexport default defineConfig({\n\ttestMatch: /.*\\.playwright(?:-|\\.)(?:spec|test)\\.(?:ts)/,\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyStaticFiles.test.js","sourceRoot":"","sources":["copyStaticFiles.test.ts"],"names":[],"mappings":";;AAAA;;;;;;;;GAQG;AACH,yCAA2C;AAE3C,4DAA0G;AAC1G,
|
|
1
|
+
{"version":3,"file":"copyStaticFiles.test.js","sourceRoot":"","sources":["copyStaticFiles.test.ts"],"names":[],"mappings":";;AAAA;;;;;;;;GAQG;AACH,yCAA2C;AAE3C,4DAA0G;AAC1G,4FAA8G;AAE9G;;;;;;;;GAQG;AACH,MAAM,GAAG,GAAG,SAAS,CAAC;AAEtB,IAAA,oBAAQ,EAAC,+BAA+B,EAAE,GAAG,EAAE;IAE9C,IAAA,gBAAI,EAAC,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE;QAExB,MAAM,MAAM,GAAG,IAAA,+CAA6B,EAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAEtD,MAAM,QAAQ,GAAG;YAChB,GAAG,MAAM;YACT,GAAG,EAAE,IAAA,oDAAyB,EAAC,MAAM,CAAC,GAAG,CAAC;YAC1C,UAAU,EAAE,IAAA,oDAAyB,EAAC,MAAM,CAAC,UAAU,CAAC;SACxD,CAAC;QAEF,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAA,oBAAQ,EAAC,mCAAmC,EAAE,GAAG,EAAE;IAElD,IAAA,gBAAI,EAAC,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE;QAExB;;;;;;;WAOG;QACH,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAA,mDAAiC,EAAC,EAAE,GAAG,EAAE,CAAC,CAAC;aAC9D,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACf,GAAG,IAAI;YACP,OAAO,EAAE;gBACR,GAAG,IAAI,CAAC,OAAO;gBACf,cAAc,EAAE,IAAA,oDAAyB,EAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;gBACtE,cAAc,EAAE,IAAA,oDAAyB,EAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;aACtE;YACD,IAAI,EAAE,OAAO,IAAI,CAAC,IAAI;SACtB,CAAC,CAAC,CAAC;QAEL,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/**\n * @yarn-tool/static-file 快照測試\n * Snapshot tests for @yarn-tool/static-file\n *\n * 只涵蓋不會寫入檔案的內部函式:選項補齊與清單產出皆為唯讀操作,\n * 因此測試過程不建立、也不覆蓋任何靜態檔案。\n * Only covers internals that never write files: option resolution and list generation are read-only,\n * so the run creates and overwrites nothing.\n */\nimport { describe, test } from 'node:test';\n\nimport { _copyStaticFilesCoreListGenerator, _handleCopyStaticFilesOptions } from '../lib/copyStaticFiles';\nimport { _isPathForSnapshot, _normalizePathForSnapshot } from '../../../../test/lib/normalizePathForSnapshot';\n\n/**\n * 以測試檔所在目錄作為唯一必填的 cwd\n * Use the test file's own directory as the sole required cwd\n *\n * 該目錄必然存在,且不含預設清單中任何 detectFile 指向的檔案,\n * 使快照內容不因執行環境而變動。\n * The directory always exists and holds none of the detectFile targets from the default list,\n * keeping the snapshot independent of the execution environment.\n */\nconst cwd = __dirname;\n\ndescribe('_handleCopyStaticFilesOptions', () =>\n{\n\ttest('預設值 + 必填參數', (t) =>\n\t{\n\t\tconst actual = _handleCopyStaticFilesOptions({ cwd });\n\n\t\tconst snapshot = {\n\t\t\t...actual,\n\t\t\tcwd: _normalizePathForSnapshot(actual.cwd),\n\t\t\tstaticRoot: _normalizePathForSnapshot(actual.staticRoot),\n\t\t};\n\n\t\tt.assert.snapshot(snapshot);\n\t});\n});\n\ndescribe('_copyStaticFilesCoreListGenerator', () =>\n{\n\ttest('預設值 + 必填參數', (t) =>\n\t{\n\t\t/**\n\t\t * 保留實際產出的結構(entry / runtime / copy),只標準化 runtime 內的絕對路徑;\n\t\t * copy 是函式、序列化時會被略過,故以 typeof 取代其值讓鍵的存在仍可見;\n\t\t * 刻意不呼叫 copy(),因此測試不會寫入任何檔案。\n\t\t * Keep the yielded shape (entry / runtime / copy) as-is and only normalize the absolute paths inside runtime;\n\t\t * copy is a function and would be dropped by the serializer, so its value is replaced by typeof to keep the key visible;\n\t\t * copy() is deliberately never called, so nothing is written.\n\t\t */\n\t\tconst snapshot = [..._copyStaticFilesCoreListGenerator({ cwd })]\n\t\t\t.map((item) => ({\n\t\t\t\t...item,\n\t\t\t\truntime: {\n\t\t\t\t\t...item.runtime,\n\t\t\t\t\ttargetFileFull: _normalizePathForSnapshot(item.runtime.targetFileFull),\n\t\t\t\t\tstaticFileFull: _normalizePathForSnapshot(item.runtime.staticFileFull),\n\t\t\t\t},\n\t\t\t\tcopy: typeof item.copy,\n\t\t\t}));\n\n\t\tt.assert.snapshot(snapshot);\n\t});\n});\n"]}
|