@yarn-tool/static-file 3.0.18 → 3.0.20
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 +66 -0
- package/README.md +110 -3
- package/file/gitignore +3 -0
- package/file/npmignore +31 -0
- package/file/test/__root-core.cjs +1 -1
- package/file/test/__root-core.mjs +1 -1
- package/file/test/__root.js.map +1 -0
- package/file/test/__root.ts +9 -2
- package/file/test/temp.js.map +1 -0
- package/file/test/tsconfig.json.tpl +7 -0
- package/file/tsconfig.esm.json.tpl +9 -1
- package/file/tsconfig.json.tpl +9 -1
- package/file/tsconfig.tsdx.json.tpl +4 -0
- package/file/tsdx/index.cjs.map +1 -0
- package/file/ws-root/__root_ws.js.map +1 -0
- package/lib/const.js +120 -27
- package/lib/const.js.map +1 -1
- package/lib/copyStaticFiles.d.ts +62 -2
- package/lib/copyStaticFiles.js +156 -9
- package/lib/copyStaticFiles.js.map +1 -1
- package/lib/copyStaticFilesEntry.d.ts +72 -25
- package/lib/copyStaticFilesEntry.js +133 -34
- package/lib/copyStaticFilesEntry.js.map +1 -1
- package/lib/mergeIgnoreFiles.d.ts +52 -0
- package/lib/mergeIgnoreFiles.js +146 -0
- package/lib/mergeIgnoreFiles.js.map +1 -0
- package/lib/parseStaticMap.js +16 -3
- package/lib/parseStaticMap.js.map +1 -1
- package/lib/reMapStaticFilesMapArray.js +26 -5
- package/lib/reMapStaticFilesMapArray.js.map +1 -1
- package/lib/root/getRootCopyStaticFiles.js +17 -2
- package/lib/root/getRootCopyStaticFiles.js.map +1 -1
- package/lib/types.d.ts +71 -0
- package/lib/types.js.map +1 -1
- package/package.json +24 -6
- package/test/__root-core.cjs +1 -0
- package/test/__root-core.d.cts +1 -0
- package/test/__root-core.d.mts +1 -0
- package/test/__root-core.d.ts +1 -0
- package/test/__root-core.mjs +8 -0
- package/test/__root.d.ts +32 -0
- package/test/__root.js +54 -0
- package/test/__root.js.map +1 -0
- package/test/copyStaticFiles.test.js.map +1 -0
- package/test/copyStaticFiles.test.ts.snapshot +439 -0
- package/test/fixtures/out/gitignore +242 -0
- package/test/fixtures/out/npmignore +216 -0
- package/test/fixtures/split/git/00-header.txt +2 -0
- package/test/fixtures/split/git/10-project.txt +24 -0
- package/test/fixtures/split/git/20-test.txt +9 -0
- package/test/fixtures/split/git/40-env.txt +10 -0
- package/test/fixtures/split/git/90-misc.txt +6 -0
- package/test/fixtures/split/git/99-whitelist.txt +40 -0
- package/test/fixtures/split/npm/01-hidden.txt +2 -0
- package/test/fixtures/split/npm/05-source.txt +7 -0
- package/test/fixtures/split/npm/10-project.txt +31 -0
- package/test/fixtures/split/npm/20-test.txt +20 -0
- package/test/fixtures/split/npm/30-ide.txt +2 -0
- package/test/fixtures/split/npm/40-env.txt +2 -0
- package/test/fixtures/split/npm/90-misc.txt +4 -0
- package/test/fixtures/split/other/90-duplicates.txt +33 -0
- package/test/fixtures/split/shared/10-project.txt +38 -0
- package/test/fixtures/split/shared/20-test.txt +7 -0
- package/test/fixtures/split/shared/30-ide.txt +8 -0
- package/test/fixtures/split/shared/40-env.txt +6 -0
- package/test/fixtures/split/shared/90-misc.txt +10 -0
- package/test/scripts/compose-split-ignore-files.d.ts +1 -0
- package/test/scripts/compose-split-ignore-files.js +80 -0
- package/test/scripts/compose-split-ignore-files.js.map +1 -0
- package/test/scripts/lib/ignore-split.d.ts +205 -0
- package/test/scripts/lib/ignore-split.js +286 -0
- package/test/scripts/lib/ignore-split.js.map +1 -0
- package/test/scripts/split-ignore-files.d.ts +1 -0
- package/test/scripts/split-ignore-files.js +454 -0
- package/test/scripts/split-ignore-files.js.map +1 -0
- package/test/scripts/update-npmignore-static-files.d.ts +1 -0
- package/test/scripts/update-npmignore-static-files.js +121 -0
- package/test/scripts/update-npmignore-static-files.js.map +1 -0
- package/test/temp.d.ts +3 -0
- package/test/temp.js +5 -0
- package/test/temp.js.map +1 -0
- package/test/tsconfig.json.tpl +13 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# 根目錄隱藏檔 / root hidden files · npm 發布專用 / npm publish only
|
|
2
|
+
/.*
|
|
3
|
+
|
|
4
|
+
# npm 來源檔規則 / npm source rules · npm 發布專用 / npm publish only
|
|
5
|
+
*.ts
|
|
6
|
+
# npm 來源與聲明檔規則(共用輔助產生)/ npm source & declaration rules (generated by shared helper)
|
|
7
|
+
!*.d.ts
|
|
8
|
+
/bin/**/*.d.ts
|
|
9
|
+
/bin/*.d.ts
|
|
10
|
+
|
|
11
|
+
!*.d.mts
|
|
12
|
+
/bin/**/*.d.mts
|
|
13
|
+
/bin/*.d.mts
|
|
14
|
+
|
|
15
|
+
!*.d.cts
|
|
16
|
+
/bin/**/*.d.cts
|
|
17
|
+
/bin/*.d.cts
|
|
18
|
+
!/src/**/*.ts
|
|
19
|
+
!/src/**/*.cts
|
|
20
|
+
!/src/**/*.mts
|
|
21
|
+
!/src/**/*.tsx
|
|
22
|
+
|
|
23
|
+
# 專案檔 / project files · npm 發布專用 / npm publish only
|
|
24
|
+
tsconfig.json
|
|
25
|
+
.github
|
|
26
|
+
/src/**/*.jsx
|
|
27
|
+
webpack.config.js
|
|
28
|
+
vue.config.js
|
|
29
|
+
/tslint.json
|
|
30
|
+
webpack.*.config.js
|
|
31
|
+
webpack.*.config.d.ts
|
|
32
|
+
webpack.*.config.js.map
|
|
33
|
+
webpack.*.config.ts
|
|
34
|
+
/_config.yml
|
|
35
|
+
tsconfig.*.json
|
|
36
|
+
/Makefile
|
|
37
|
+
npm-shrinkwrap.json
|
|
38
|
+
/example/
|
|
39
|
+
tsdx.config.js
|
|
40
|
+
/snowpack.config.js
|
|
41
|
+
tsc-multi.json
|
|
42
|
+
changelog-option.js
|
|
43
|
+
bin/tsconfig.json
|
|
44
|
+
bin/tsconfig.*.json
|
|
45
|
+
.yarnrc.yml
|
|
46
|
+
/global.tsdx.d.ts
|
|
47
|
+
/next-env.d.ts
|
|
48
|
+
./global.tsdx.d.ts
|
|
49
|
+
./global.d.ts
|
|
50
|
+
/api-extractor*.json
|
|
51
|
+
/*.md
|
|
52
|
+
!/README.md
|
|
53
|
+
!/CHANGELOG.md
|
|
54
|
+
|
|
55
|
+
# 專案檔 / project files · 兩類共用 / shared
|
|
56
|
+
# dependencies
|
|
57
|
+
node_modules
|
|
58
|
+
/.pnp
|
|
59
|
+
.pnp.js
|
|
60
|
+
# debug
|
|
61
|
+
npm-debug.log*
|
|
62
|
+
yarn-debug.log*
|
|
63
|
+
yarn-error.log*
|
|
64
|
+
/.*/
|
|
65
|
+
package-lock.json
|
|
66
|
+
/src/**/*.d.ts
|
|
67
|
+
/src/**/*.js
|
|
68
|
+
/src/**/*.d.cts
|
|
69
|
+
/src/**/*.d.mts
|
|
70
|
+
/src/**/*.cjs
|
|
71
|
+
/src/**/*.mjs
|
|
72
|
+
*.tgz
|
|
73
|
+
/tsconfig.json.tpl
|
|
74
|
+
yarn-error.log
|
|
75
|
+
*.log
|
|
76
|
+
.git
|
|
77
|
+
yarn.lock
|
|
78
|
+
*.vue.js
|
|
79
|
+
*.vue.d.ts
|
|
80
|
+
*.vue.js.map
|
|
81
|
+
/*.tpl
|
|
82
|
+
*.tsbuildinfo
|
|
83
|
+
tsconfig.esm.json.tpl
|
|
84
|
+
/package.d.ts
|
|
85
|
+
/report.*.json
|
|
86
|
+
/report.json
|
|
87
|
+
/_*/
|
|
88
|
+
_snowpack
|
|
89
|
+
web_modules
|
|
90
|
+
tsc-multi.json.tpl
|
|
91
|
+
.turbo
|
|
92
|
+
.next
|
|
93
|
+
|
|
94
|
+
# 測試檔 / test files · npm 發布專用 / npm publish only
|
|
95
|
+
test
|
|
96
|
+
.gitkeep
|
|
97
|
+
tests
|
|
98
|
+
__test__
|
|
99
|
+
__tests__
|
|
100
|
+
/jestconfig.json
|
|
101
|
+
karma.conf.js
|
|
102
|
+
jest.config.*
|
|
103
|
+
/jest-preset.*
|
|
104
|
+
# spec / test 副檔名矩陣(共用輔助產生)/ spec & test filename matrix (generated by shared helper)
|
|
105
|
+
*.spec.ts
|
|
106
|
+
|
|
107
|
+
*.spec.d.cts
|
|
108
|
+
*.spec.cjs
|
|
109
|
+
*.spec.cts
|
|
110
|
+
|
|
111
|
+
*.spec.d.mts
|
|
112
|
+
*.spec.mjs
|
|
113
|
+
*.spec.mts
|
|
114
|
+
|
|
115
|
+
*.spec.d.tsx
|
|
116
|
+
*.spec.tsx
|
|
117
|
+
|
|
118
|
+
*.test.d.ts
|
|
119
|
+
*.test.js
|
|
120
|
+
*.test.ts
|
|
121
|
+
|
|
122
|
+
*.test.d.cts
|
|
123
|
+
*.test.cjs
|
|
124
|
+
*.test.cts
|
|
125
|
+
|
|
126
|
+
*.test.d.mts
|
|
127
|
+
*.test.mjs
|
|
128
|
+
*.test.mts
|
|
129
|
+
|
|
130
|
+
*.test.d.tsx
|
|
131
|
+
*.test.tsx
|
|
132
|
+
|
|
133
|
+
*.node-spec.d.ts
|
|
134
|
+
*.node-spec.js
|
|
135
|
+
*.node-spec.ts
|
|
136
|
+
|
|
137
|
+
*.node-spec.d.cts
|
|
138
|
+
*.node-spec.cjs
|
|
139
|
+
*.node-spec.cts
|
|
140
|
+
|
|
141
|
+
*.node-spec.d.mts
|
|
142
|
+
*.node-spec.mjs
|
|
143
|
+
*.node-spec.mts
|
|
144
|
+
|
|
145
|
+
*.node-spec.d.tsx
|
|
146
|
+
*.node-spec.tsx
|
|
147
|
+
|
|
148
|
+
*.node-test.d.ts
|
|
149
|
+
*.node-test.js
|
|
150
|
+
*.node-test.ts
|
|
151
|
+
|
|
152
|
+
*.node-test.d.cts
|
|
153
|
+
*.node-test.cjs
|
|
154
|
+
*.node-test.cts
|
|
155
|
+
|
|
156
|
+
*.node-test.d.mts
|
|
157
|
+
*.node-test.mjs
|
|
158
|
+
*.node-test.mts
|
|
159
|
+
|
|
160
|
+
*.node-test.d.tsx
|
|
161
|
+
*.node-test.tsx
|
|
162
|
+
__mocks__
|
|
163
|
+
__snapshots__
|
|
164
|
+
*.snap
|
|
165
|
+
*.snapshot
|
|
166
|
+
__file_snapshots__
|
|
167
|
+
__fixtures__
|
|
168
|
+
/fixture/
|
|
169
|
+
*.stories.*
|
|
170
|
+
./stories/
|
|
171
|
+
|
|
172
|
+
# 測試檔 / test files · 兩類共用 / shared
|
|
173
|
+
# testing
|
|
174
|
+
.nyc_output
|
|
175
|
+
coverage
|
|
176
|
+
.mocharc.yml
|
|
177
|
+
*.spec.d.ts
|
|
178
|
+
*.spec.js
|
|
179
|
+
|
|
180
|
+
# IDE 與編輯器設定 / IDE & editor settings · npm 發布專用 / npm publish only
|
|
181
|
+
intellij-style-guide.xml
|
|
182
|
+
|
|
183
|
+
# IDE 與編輯器設定 / IDE & editor settings · 兩類共用 / shared
|
|
184
|
+
.idea
|
|
185
|
+
.vscode
|
|
186
|
+
*.suo
|
|
187
|
+
*.ntvs*
|
|
188
|
+
*.njsproj
|
|
189
|
+
*.sln
|
|
190
|
+
*.sw?
|
|
191
|
+
|
|
192
|
+
# 環境設定 / environment settings · npm 發布專用 / npm publish only
|
|
193
|
+
now.json
|
|
194
|
+
|
|
195
|
+
# 環境設定 / environment settings · 兩類共用 / shared
|
|
196
|
+
# local env files
|
|
197
|
+
.env.local
|
|
198
|
+
# vercel
|
|
199
|
+
.vercel
|
|
200
|
+
.env.*.local
|
|
201
|
+
|
|
202
|
+
# 未分類 / unclassified · npm 發布專用 / npm publish only
|
|
203
|
+
/~*
|
|
204
|
+
cz-adapter
|
|
205
|
+
openspec/
|
|
206
|
+
|
|
207
|
+
# 未分類 / unclassified · 兩類共用 / shared
|
|
208
|
+
~ci.list.txt
|
|
209
|
+
~ci.log.txt
|
|
210
|
+
~ci.errors.txt
|
|
211
|
+
*.stackdump
|
|
212
|
+
*.bak
|
|
213
|
+
*.old
|
|
214
|
+
*.stat
|
|
215
|
+
.codenomad
|
|
216
|
+
.logs
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# 專案檔 / project files · git 專用 / git only
|
|
2
|
+
# next.js
|
|
3
|
+
# production
|
|
4
|
+
/build
|
|
5
|
+
/.eslintrc.json.tpl
|
|
6
|
+
vue.config.d.ts
|
|
7
|
+
vue.config.js.map
|
|
8
|
+
!.github
|
|
9
|
+
.browserslistrc
|
|
10
|
+
/.eslintignore
|
|
11
|
+
node_modules/.cache
|
|
12
|
+
.yarn-integrity
|
|
13
|
+
# %gen:source-maps%
|
|
14
|
+
.reify-cache
|
|
15
|
+
*/**/.github
|
|
16
|
+
/gradle
|
|
17
|
+
.gradle
|
|
18
|
+
/out
|
|
19
|
+
dist/*.umd.*.*s
|
|
20
|
+
/__root_ws.d.ts
|
|
21
|
+
/__root_ws.js
|
|
22
|
+
.nx
|
|
23
|
+
out/
|
|
24
|
+
node_modules_
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# 白名單例外 / whitelist exceptions · git 專用 / git only
|
|
2
|
+
!test/tsconfig.json
|
|
3
|
+
!tsconfig.json
|
|
4
|
+
!.eslintrc.json
|
|
5
|
+
!.forestry
|
|
6
|
+
!.vuepress
|
|
7
|
+
!.gitee
|
|
8
|
+
!.gitlab
|
|
9
|
+
!/.nvmrc
|
|
10
|
+
!/.node-version
|
|
11
|
+
!/.github
|
|
12
|
+
!npm-shrinkwrap.json
|
|
13
|
+
!/.yarnrc.yml
|
|
14
|
+
!/.run/
|
|
15
|
+
!/.storybook/
|
|
16
|
+
!.clinerules
|
|
17
|
+
!.kilocode
|
|
18
|
+
!.cline
|
|
19
|
+
!.junie
|
|
20
|
+
!.gemini
|
|
21
|
+
!.copilot
|
|
22
|
+
!.claude
|
|
23
|
+
!.agents
|
|
24
|
+
!.aiassistant
|
|
25
|
+
!/api-extractor*.json
|
|
26
|
+
!__mocks__
|
|
27
|
+
!__mocks__/
|
|
28
|
+
!__mocks__/*
|
|
29
|
+
!test/__root-core.cjs
|
|
30
|
+
!test/__root-core.d.ts
|
|
31
|
+
!test/__root-core.mts
|
|
32
|
+
!test/__root-core.d.cts
|
|
33
|
+
!test/__root-core.d.mts
|
|
34
|
+
!test/__root-core.mjs
|
|
35
|
+
!__root-core.cjs
|
|
36
|
+
!__root-core.mjs
|
|
37
|
+
!__root-core.d.cts
|
|
38
|
+
!__root-core.d.mts
|
|
39
|
+
!__root-core.d.ts
|
|
40
|
+
!__root-core.ts
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# 專案檔 / project files · npm 發布專用 / npm publish only
|
|
2
|
+
tsconfig.json
|
|
3
|
+
.github
|
|
4
|
+
/src/**/*.jsx
|
|
5
|
+
webpack.config.js
|
|
6
|
+
vue.config.js
|
|
7
|
+
/tslint.json
|
|
8
|
+
webpack.*.config.js
|
|
9
|
+
webpack.*.config.d.ts
|
|
10
|
+
webpack.*.config.js.map
|
|
11
|
+
webpack.*.config.ts
|
|
12
|
+
/_config.yml
|
|
13
|
+
tsconfig.*.json
|
|
14
|
+
/Makefile
|
|
15
|
+
npm-shrinkwrap.json
|
|
16
|
+
/example/
|
|
17
|
+
tsdx.config.js
|
|
18
|
+
/snowpack.config.js
|
|
19
|
+
tsc-multi.json
|
|
20
|
+
changelog-option.js
|
|
21
|
+
bin/tsconfig.json
|
|
22
|
+
bin/tsconfig.*.json
|
|
23
|
+
.yarnrc.yml
|
|
24
|
+
/global.tsdx.d.ts
|
|
25
|
+
/next-env.d.ts
|
|
26
|
+
./global.tsdx.d.ts
|
|
27
|
+
./global.d.ts
|
|
28
|
+
/api-extractor*.json
|
|
29
|
+
/*.md
|
|
30
|
+
!/README.md
|
|
31
|
+
!/CHANGELOG.md
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# 測試檔 / test files · npm 發布專用 / npm publish only
|
|
2
|
+
test
|
|
3
|
+
.gitkeep
|
|
4
|
+
tests
|
|
5
|
+
__test__
|
|
6
|
+
__tests__
|
|
7
|
+
/jestconfig.json
|
|
8
|
+
karma.conf.js
|
|
9
|
+
jest.config.*
|
|
10
|
+
/jest-preset.*
|
|
11
|
+
# %gen:spec-files%
|
|
12
|
+
__mocks__
|
|
13
|
+
__snapshots__
|
|
14
|
+
*.snap
|
|
15
|
+
*.snapshot
|
|
16
|
+
__file_snapshots__
|
|
17
|
+
__fixtures__
|
|
18
|
+
/fixture/
|
|
19
|
+
*.stories.*
|
|
20
|
+
./stories/
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# 其他:不輸出的重複與冗餘規則 / other: duplicated & redundant rules (never emitted)
|
|
2
|
+
# 本目錄規則不會進入 out/gitignore 或 out/npmignore;僅留存供稽核 / these rules are never emitted into out/gitignore or out/npmignore; kept for auditing only
|
|
3
|
+
# 重複語法(測試矩陣、*.map…)改由共用輔助產生,見 test/scripts/lib/ignore-split.ts / repetitive matrices are generated by the shared helper, see test/scripts/lib/ignore-split.ts
|
|
4
|
+
|
|
5
|
+
# git 專用檔:已被更廣泛的規則涵蓋 / gitignore source: covered by a broader rule
|
|
6
|
+
/coverage
|
|
7
|
+
/.next/
|
|
8
|
+
/out/
|
|
9
|
+
**/node_modules
|
|
10
|
+
test/temp*/
|
|
11
|
+
|
|
12
|
+
# npm 發布專用檔:已被更廣泛的規則涵蓋 / npmignore source: covered by a broader rule
|
|
13
|
+
/node_modules/
|
|
14
|
+
**/node_modules/
|
|
15
|
+
jest.config.js
|
|
16
|
+
|
|
17
|
+
# git 專用檔中重複出現 / duplicated in the gitignore source
|
|
18
|
+
node_modules
|
|
19
|
+
.env.local
|
|
20
|
+
npm-debug.log*
|
|
21
|
+
yarn-debug.log*
|
|
22
|
+
yarn-error.log*
|
|
23
|
+
.git
|
|
24
|
+
.nyc_output
|
|
25
|
+
.vercel
|
|
26
|
+
/*.tpl
|
|
27
|
+
/build
|
|
28
|
+
|
|
29
|
+
# npm 發布專用檔中重複出現 / duplicated in the npmignore source
|
|
30
|
+
.git
|
|
31
|
+
jest.config.js
|
|
32
|
+
__tests__
|
|
33
|
+
__mocks__
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# 專案檔 / project files · 兩類共用 / shared
|
|
2
|
+
# dependencies
|
|
3
|
+
node_modules
|
|
4
|
+
/.pnp
|
|
5
|
+
.pnp.js
|
|
6
|
+
# debug
|
|
7
|
+
npm-debug.log*
|
|
8
|
+
yarn-debug.log*
|
|
9
|
+
yarn-error.log*
|
|
10
|
+
/.*/
|
|
11
|
+
package-lock.json
|
|
12
|
+
/src/**/*.d.ts
|
|
13
|
+
/src/**/*.js
|
|
14
|
+
/src/**/*.d.cts
|
|
15
|
+
/src/**/*.d.mts
|
|
16
|
+
/src/**/*.cjs
|
|
17
|
+
/src/**/*.mjs
|
|
18
|
+
*.tgz
|
|
19
|
+
/tsconfig.json.tpl
|
|
20
|
+
yarn-error.log
|
|
21
|
+
*.log
|
|
22
|
+
.git
|
|
23
|
+
yarn.lock
|
|
24
|
+
*.vue.js
|
|
25
|
+
*.vue.d.ts
|
|
26
|
+
*.vue.js.map
|
|
27
|
+
/*.tpl
|
|
28
|
+
*.tsbuildinfo
|
|
29
|
+
tsconfig.esm.json.tpl
|
|
30
|
+
/package.d.ts
|
|
31
|
+
/report.*.json
|
|
32
|
+
/report.json
|
|
33
|
+
/_*/
|
|
34
|
+
_snowpack
|
|
35
|
+
web_modules
|
|
36
|
+
tsc-multi.json.tpl
|
|
37
|
+
.turbo
|
|
38
|
+
.next
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* 將 test/fixtures/split/ 的分類片段組合成新的 gitignore 與 npmignore
|
|
5
|
+
* Compose the classified fragments under test/fixtures/split/ into new gitignore and npmignore files
|
|
6
|
+
*
|
|
7
|
+
* 組合規則:
|
|
8
|
+
* 1. 逐主題({@link TOPICS} 順序)先放目標分類片段(git 或 npm),再放共用片段,
|
|
9
|
+
* 片段之間以單一空行分隔。
|
|
10
|
+
* 2. `# %gen:NAME%` 佔位行由 lib/ignore-split 的共用產生器展開。
|
|
11
|
+
* 3. other/ 分類(重複與冗餘規則)永不輸出。
|
|
12
|
+
* 4. 行陣列直接作為內容交給 IgnoreFile 保存(支援陣列內容與自動 EOF 結尾換行),
|
|
13
|
+
* 預設優化會去重(保留最後一筆)。
|
|
14
|
+
*
|
|
15
|
+
* Composition rules:
|
|
16
|
+
* 1. Per topic (in {@link TOPICS} order), the target-bucket fragment comes first
|
|
17
|
+
* and the shared fragment follows, with a single blank line between fragments.
|
|
18
|
+
* 2. `# %gen:NAME%` placeholders are expanded by the shared generators in
|
|
19
|
+
* lib/ignore-split.
|
|
20
|
+
* 3. The other/ bucket (duplicated and redundant rules) is never emitted.
|
|
21
|
+
* 4. The line array goes to IgnoreFile as content directly (array content and
|
|
22
|
+
* automatic EOF newline); the default optimization dedupes rules (keeping
|
|
23
|
+
* the last occurrence).
|
|
24
|
+
*
|
|
25
|
+
* 待組合的分類與輸出檔名請見 lib 的 {@link IGNORE_SPLIT_TARGETS}(單一事實來源)。
|
|
26
|
+
* The targets and their output file names come from {@link IGNORE_SPLIT_TARGETS}
|
|
27
|
+
* in the lib (the single source of truth).
|
|
28
|
+
*
|
|
29
|
+
* 執行 / run: tsx packages/@yarn-tool/static-file/test/scripts/compose-split-ignore-files.ts
|
|
30
|
+
* 輸出 / output: test/fixtures/out/gitignore、test/fixtures/out/npmignore
|
|
31
|
+
*/
|
|
32
|
+
const path_1 = require("path");
|
|
33
|
+
const IgnoreFile_1 = require("@yarn-tool/ignore/lib/IgnoreFile");
|
|
34
|
+
const __root_1 = require("../__root");
|
|
35
|
+
const ignore_split_1 = require("./lib/ignore-split");
|
|
36
|
+
/**
|
|
37
|
+
* 組合結果的輸出目錄 / Output directory of the composed files
|
|
38
|
+
*/
|
|
39
|
+
const OUT_ROOT = (0, path_1.join)(__root_1.__ROOT, 'test', 'fixtures', 'out');
|
|
40
|
+
/**
|
|
41
|
+
* 組合單一目標分類的行陣列
|
|
42
|
+
* Assemble the line array for a single target bucket
|
|
43
|
+
*
|
|
44
|
+
* @param target - 目標分類:git 或 npm / Target bucket: git or npm
|
|
45
|
+
* @returns 展開佔位後的完整行陣列 / The full line array after expanding placeholders
|
|
46
|
+
*/
|
|
47
|
+
function compose(target) {
|
|
48
|
+
const lines = [];
|
|
49
|
+
for (const topic of ignore_split_1.TOPICS) {
|
|
50
|
+
for (const bucket of [target, 'shared']) {
|
|
51
|
+
const fragment = (0, ignore_split_1.readSplitFragment)(bucket, topic.id);
|
|
52
|
+
if (fragment.length === 0) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
lines.push(...fragment, '');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return (0, ignore_split_1.expandGenPlaceholders)(lines);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* 腳本進入點:組合兩份 ignore 檔並輸出到 test/fixtures/out
|
|
62
|
+
* Script entry: compose both ignore files and write them to test/fixtures/out
|
|
63
|
+
*/
|
|
64
|
+
function main() {
|
|
65
|
+
for (const { bucket, fileName } of ignore_split_1.IGNORE_SPLIT_TARGETS) {
|
|
66
|
+
const path = (0, path_1.join)(OUT_ROOT, fileName);
|
|
67
|
+
/**
|
|
68
|
+
* 行陣列直接交給 IgnoreFile:建構子接受陣列內容,
|
|
69
|
+
* 結尾空行(EOF 換行)自動記錄並於輸出時還原,無需自行展開或補空行
|
|
70
|
+
* The line array goes straight into IgnoreFile: the constructor accepts
|
|
71
|
+
* array content, and the trailing blank (the EOF newline) is recorded
|
|
72
|
+
* automatically and restored on output — no manual spread or blank needed
|
|
73
|
+
*/
|
|
74
|
+
const ignoreFile = new IgnoreFile_1.IgnoreFile(path, compose(bucket));
|
|
75
|
+
ignoreFile.save();
|
|
76
|
+
console.log(`composed ${path} (${ignoreFile.lines.length} lines)`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
main();
|
|
80
|
+
//# sourceMappingURL=compose-split-ignore-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-split-ignore-files.js","sourceRoot":"","sources":["compose-split-ignore-files.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,+BAA4B;AAC5B,iEAA8D;AAC9D,sCAAmC;AAEnC,qDAK4B;AAE5B;;GAEG;AACH,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,eAAM,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;AAEzD;;;;;;GAMG;AACH,SAAS,OAAO,CAAC,MAAgC;IAEhD,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,MAAM,KAAK,IAAI,qBAAM,EAC1B,CAAC;QACA,KAAK,MAAM,MAAM,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAU,EAChD,CAAC;YACA,MAAM,QAAQ,GAAG,IAAA,gCAAiB,EAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;YAErD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EACzB,CAAC;gBACA,SAAS;YACV,CAAC;YAED,KAAK,CAAC,IAAI,CAAC,GAAG,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC7B,CAAC;IACF,CAAC;IAED,OAAO,IAAA,oCAAqB,EAAC,KAAK,CAAC,CAAC;AACrC,CAAC;AAED;;;GAGG;AACH,SAAS,IAAI;IAEZ,KAAK,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,mCAAoB,EACvD,CAAC;QACA,MAAM,IAAI,GAAG,IAAA,WAAI,EAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAEtC;;;;;;WAMG;QACH,MAAM,UAAU,GAAG,IAAI,uBAAU,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QAEzD,UAAU,CAAC,IAAI,EAAE,CAAC;QAElB,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,KAAK,UAAU,CAAC,KAAK,CAAC,MAAM,SAAS,CAAC,CAAC;IACpE,CAAC;AACF,CAAC;AAED,IAAI,EAAE,CAAC","sourcesContent":["/**\n * 將 test/fixtures/split/ 的分類片段組合成新的 gitignore 與 npmignore\n * Compose the classified fragments under test/fixtures/split/ into new gitignore and npmignore files\n *\n * 組合規則:\n * 1. 逐主題({@link TOPICS} 順序)先放目標分類片段(git 或 npm),再放共用片段,\n * 片段之間以單一空行分隔。\n * 2. `# %gen:NAME%` 佔位行由 lib/ignore-split 的共用產生器展開。\n * 3. other/ 分類(重複與冗餘規則)永不輸出。\n * 4. 行陣列直接作為內容交給 IgnoreFile 保存(支援陣列內容與自動 EOF 結尾換行),\n * 預設優化會去重(保留最後一筆)。\n *\n * Composition rules:\n * 1. Per topic (in {@link TOPICS} order), the target-bucket fragment comes first\n * and the shared fragment follows, with a single blank line between fragments.\n * 2. `# %gen:NAME%` placeholders are expanded by the shared generators in\n * lib/ignore-split.\n * 3. The other/ bucket (duplicated and redundant rules) is never emitted.\n * 4. The line array goes to IgnoreFile as content directly (array content and\n * automatic EOF newline); the default optimization dedupes rules (keeping\n * the last occurrence).\n *\n * 待組合的分類與輸出檔名請見 lib 的 {@link IGNORE_SPLIT_TARGETS}(單一事實來源)。\n * The targets and their output file names come from {@link IGNORE_SPLIT_TARGETS}\n * in the lib (the single source of truth).\n *\n * 執行 / run: tsx packages/@yarn-tool/static-file/test/scripts/compose-split-ignore-files.ts\n * 輸出 / output: test/fixtures/out/gitignore、test/fixtures/out/npmignore\n */\nimport { join } from 'path';\nimport { IgnoreFile } from '@yarn-tool/ignore/lib/IgnoreFile';\nimport { __ROOT } from '../__root';\nimport type { IIgnoreSplitTargetBucket } from './lib/ignore-split';\nimport {\n\tIGNORE_SPLIT_TARGETS,\n\tTOPICS,\n\texpandGenPlaceholders,\n\treadSplitFragment,\n} from './lib/ignore-split';\n\n/**\n * 組合結果的輸出目錄 / Output directory of the composed files\n */\nconst OUT_ROOT = join(__ROOT, 'test', 'fixtures', 'out');\n\n/**\n * 組合單一目標分類的行陣列\n * Assemble the line array for a single target bucket\n *\n * @param target - 目標分類:git 或 npm / Target bucket: git or npm\n * @returns 展開佔位後的完整行陣列 / The full line array after expanding placeholders\n */\nfunction compose(target: IIgnoreSplitTargetBucket): string[]\n{\n\tconst lines: string[] = [];\n\n\tfor (const topic of TOPICS)\n\t{\n\t\tfor (const bucket of [target, 'shared'] as const)\n\t\t{\n\t\t\tconst fragment = readSplitFragment(bucket, topic.id);\n\n\t\t\tif (fragment.length === 0)\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tlines.push(...fragment, '');\n\t\t}\n\t}\n\n\treturn expandGenPlaceholders(lines);\n}\n\n/**\n * 腳本進入點:組合兩份 ignore 檔並輸出到 test/fixtures/out\n * Script entry: compose both ignore files and write them to test/fixtures/out\n */\nfunction main(): void\n{\n\tfor (const { bucket, fileName } of IGNORE_SPLIT_TARGETS)\n\t{\n\t\tconst path = join(OUT_ROOT, fileName);\n\n\t\t/**\n\t\t * 行陣列直接交給 IgnoreFile:建構子接受陣列內容,\n\t\t * 結尾空行(EOF 換行)自動記錄並於輸出時還原,無需自行展開或補空行\n\t\t * The line array goes straight into IgnoreFile: the constructor accepts\n\t\t * array content, and the trailing blank (the EOF newline) is recorded\n\t\t * automatically and restored on output — no manual spread or blank needed\n\t\t */\n\t\tconst ignoreFile = new IgnoreFile(path, compose(bucket));\n\n\t\tignoreFile.save();\n\n\t\tconsole.log(`composed ${path} (${ignoreFile.lines.length} lines)`);\n\t}\n}\n\nmain();\n"]}
|