@breadstone-infrastructure/nx-tasks 0.0.231 → 0.0.233
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/executors/doppler-config-sync/executor.task.d.ts.map +1 -1
- package/executors/doppler-config-sync/executor.task.js +37 -18
- package/executors/doppler-config-sync/executor.task.js.map +1 -1
- package/executors/doppler-vercel-sync/executor.d.ts +11 -0
- package/executors/doppler-vercel-sync/executor.d.ts.map +1 -0
- package/executors/doppler-vercel-sync/executor.js +71 -0
- package/executors/doppler-vercel-sync/executor.js.map +1 -0
- package/executors/doppler-vercel-sync/executor.options.d.ts +8 -0
- package/executors/doppler-vercel-sync/executor.options.d.ts.map +1 -0
- package/executors/doppler-vercel-sync/executor.options.js +4 -0
- package/executors/doppler-vercel-sync/executor.options.js.map +1 -0
- package/executors/doppler-vercel-sync/executor.task.d.ts +30 -0
- package/executors/doppler-vercel-sync/executor.task.d.ts.map +1 -0
- package/executors/doppler-vercel-sync/executor.task.js +522 -0
- package/executors/doppler-vercel-sync/executor.task.js.map +1 -0
- package/executors/doppler-vercel-sync/schema.json +95 -0
- package/executors/generate-package-docs/executor.d.ts +6 -0
- package/executors/generate-package-docs/executor.d.ts.map +1 -0
- package/executors/generate-package-docs/executor.js +72 -0
- package/executors/generate-package-docs/executor.js.map +1 -0
- package/executors/generate-package-docs/executor.options.d.ts +6 -0
- package/executors/generate-package-docs/executor.options.d.ts.map +1 -0
- package/executors/generate-package-docs/executor.options.js +4 -0
- package/executors/generate-package-docs/executor.options.js.map +1 -0
- package/executors/generate-package-docs/executor.task.d.ts +103 -0
- package/executors/generate-package-docs/executor.task.d.ts.map +1 -0
- package/executors/generate-package-docs/executor.task.js +259 -0
- package/executors/generate-package-docs/executor.task.js.map +1 -0
- package/executors/generate-package-docs/schema.json +258 -0
- package/executors/icon-collection-builder/executor.d.ts.map +1 -1
- package/executors/icon-collection-builder/executor.js +3 -2
- package/executors/icon-collection-builder/executor.js.map +1 -1
- package/executors/icon-collection-builder/executor.task.d.ts +1 -0
- package/executors/icon-collection-builder/executor.task.d.ts.map +1 -1
- package/executors/icon-collection-builder/executor.task.js +73 -11
- package/executors/icon-collection-builder/executor.task.js.map +1 -1
- package/executors/icon-collection-builder/svg.d.ts +19 -0
- package/executors/icon-collection-builder/svg.d.ts.map +1 -1
- package/executors/icon-collection-builder/svg.js +106 -0
- package/executors/icon-collection-builder/svg.js.map +1 -1
- package/executors/icon-collection-downloader/executor.d.ts.map +1 -1
- package/executors/icon-collection-downloader/executor.js +3 -2
- package/executors/icon-collection-downloader/executor.js.map +1 -1
- package/executors/icon-collection-downloader/executor.task.d.ts +2 -0
- package/executors/icon-collection-downloader/executor.task.d.ts.map +1 -1
- package/executors/icon-collection-downloader/executor.task.js +130 -15
- package/executors/icon-collection-downloader/executor.task.js.map +1 -1
- package/executors/lit-docs/ComponentDocFixer.d.ts +176 -0
- package/executors/lit-docs/ComponentDocFixer.d.ts.map +1 -0
- package/executors/lit-docs/ComponentDocFixer.js +424 -0
- package/executors/lit-docs/ComponentDocFixer.js.map +1 -0
- package/executors/lit-docs/JSDocFixer.d.ts +97 -0
- package/executors/lit-docs/JSDocFixer.d.ts.map +1 -0
- package/executors/lit-docs/JSDocFixer.js +200 -0
- package/executors/lit-docs/JSDocFixer.js.map +1 -0
- package/executors/lit-docs/executor.d.ts.map +1 -1
- package/executors/lit-docs/executor.js +2 -1
- package/executors/lit-docs/executor.js.map +1 -1
- package/executors/lit-docs/executor.task.d.ts +1 -0
- package/executors/lit-docs/executor.task.d.ts.map +1 -1
- package/executors/lit-docs/executor.task.js +71 -24
- package/executors/lit-docs/executor.task.js.map +1 -1
- package/executors/lit-style-transform/executor.js +1 -1
- package/executors/lit-style-transform/executor.js.map +1 -1
- package/executors/prisma-seeds/executor.options.d.ts +1 -1
- package/executors/prisma-seeds/executor.task.d.ts +1 -1
- package/executors/secrets-config-sync/executor.d.ts +11 -0
- package/executors/secrets-config-sync/executor.d.ts.map +1 -0
- package/executors/secrets-config-sync/executor.js +64 -0
- package/executors/secrets-config-sync/executor.js.map +1 -0
- package/executors/secrets-config-sync/executor.options.d.ts +6 -0
- package/executors/secrets-config-sync/executor.options.d.ts.map +1 -0
- package/executors/secrets-config-sync/executor.options.js +4 -0
- package/executors/secrets-config-sync/executor.options.js.map +1 -0
- package/executors/secrets-config-sync/executor.task.d.ts +14 -0
- package/executors/secrets-config-sync/executor.task.d.ts.map +1 -0
- package/executors/secrets-config-sync/executor.task.js +157 -0
- package/executors/secrets-config-sync/executor.task.js.map +1 -0
- package/executors/secrets-config-sync/providers/azure-keyvault.provider.d.ts +42 -0
- package/executors/secrets-config-sync/providers/azure-keyvault.provider.d.ts.map +1 -0
- package/executors/secrets-config-sync/providers/azure-keyvault.provider.js +120 -0
- package/executors/secrets-config-sync/providers/azure-keyvault.provider.js.map +1 -0
- package/executors/secrets-config-sync/providers/doppler.provider.d.ts +18 -0
- package/executors/secrets-config-sync/providers/doppler.provider.d.ts.map +1 -0
- package/executors/secrets-config-sync/providers/doppler.provider.js +53 -0
- package/executors/secrets-config-sync/providers/doppler.provider.js.map +1 -0
- package/executors/secrets-config-sync/providers/secrets-provider.factory.d.ts +17 -0
- package/executors/secrets-config-sync/providers/secrets-provider.factory.d.ts.map +1 -0
- package/executors/secrets-config-sync/providers/secrets-provider.factory.js +25 -0
- package/executors/secrets-config-sync/providers/secrets-provider.factory.js.map +1 -0
- package/executors/secrets-config-sync/providers/secrets-provider.interface.d.ts +28 -0
- package/executors/secrets-config-sync/providers/secrets-provider.interface.d.ts.map +1 -0
- package/executors/secrets-config-sync/providers/secrets-provider.interface.js +4 -0
- package/executors/secrets-config-sync/providers/secrets-provider.interface.js.map +1 -0
- package/executors/secrets-config-sync/schema.json +44 -0
- package/executors/secrets-vercel-sync/executor.d.ts +11 -0
- package/executors/secrets-vercel-sync/executor.d.ts.map +1 -0
- package/executors/secrets-vercel-sync/executor.js +74 -0
- package/executors/secrets-vercel-sync/executor.js.map +1 -0
- package/executors/secrets-vercel-sync/executor.options.d.ts +8 -0
- package/executors/secrets-vercel-sync/executor.options.d.ts.map +1 -0
- package/executors/secrets-vercel-sync/executor.options.js +4 -0
- package/executors/secrets-vercel-sync/executor.options.js.map +1 -0
- package/executors/secrets-vercel-sync/executor.task.d.ts +34 -0
- package/executors/secrets-vercel-sync/executor.task.d.ts.map +1 -0
- package/executors/secrets-vercel-sync/executor.task.js +492 -0
- package/executors/secrets-vercel-sync/executor.task.js.map +1 -0
- package/executors/secrets-vercel-sync/providers/azure-keyvault.provider.d.ts +42 -0
- package/executors/secrets-vercel-sync/providers/azure-keyvault.provider.d.ts.map +1 -0
- package/executors/secrets-vercel-sync/providers/azure-keyvault.provider.js +118 -0
- package/executors/secrets-vercel-sync/providers/azure-keyvault.provider.js.map +1 -0
- package/executors/secrets-vercel-sync/providers/doppler.provider.d.ts +18 -0
- package/executors/secrets-vercel-sync/providers/doppler.provider.d.ts.map +1 -0
- package/executors/secrets-vercel-sync/providers/doppler.provider.js +61 -0
- package/executors/secrets-vercel-sync/providers/doppler.provider.js.map +1 -0
- package/executors/secrets-vercel-sync/providers/secrets-provider.factory.d.ts +17 -0
- package/executors/secrets-vercel-sync/providers/secrets-provider.factory.d.ts.map +1 -0
- package/executors/secrets-vercel-sync/providers/secrets-provider.factory.js +25 -0
- package/executors/secrets-vercel-sync/providers/secrets-provider.factory.js.map +1 -0
- package/executors/secrets-vercel-sync/providers/secrets-provider.interface.d.ts +28 -0
- package/executors/secrets-vercel-sync/providers/secrets-provider.interface.d.ts.map +1 -0
- package/executors/secrets-vercel-sync/providers/secrets-provider.interface.js +4 -0
- package/executors/secrets-vercel-sync/providers/secrets-provider.interface.js.map +1 -0
- package/executors/secrets-vercel-sync/schema.json +112 -0
- package/executors/token-linter/executor.options.d.ts +1 -1
- package/executors/token-linter/executor.task.d.ts +1 -1
- package/executors/token-linter/schema.json +1 -1
- package/executors.json +40 -30
- package/index.d.ts +4 -3
- package/index.d.ts.map +1 -1
- package/index.js +41 -39
- package/index.js.map +1 -1
- package/package.json +21 -19
- package/utils/markdown-processing.d.ts +43 -0
- package/utils/markdown-processing.d.ts.map +1 -0
- package/utils/markdown-processing.js +186 -0
- package/utils/markdown-processing.js.map +1 -0
- package/utils/valid-html-tags.d.ts +6 -0
- package/utils/valid-html-tags.d.ts.map +1 -0
- package/utils/valid-html-tags.js +83 -0
- package/utils/valid-html-tags.js.map +1 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"title": "Generate Package Docs",
|
|
4
|
+
"description": "Generates API documentation for a library package using TypeDoc with Markdown output and configurable post-processing.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"entryPoint": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Entry point file relative to the project root.",
|
|
10
|
+
"default": "src/Index.ts"
|
|
11
|
+
},
|
|
12
|
+
"additionalEntryPoints": {
|
|
13
|
+
"type": "array",
|
|
14
|
+
"items": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"description": "Additional entry point paths (absolute or relative to workspace root). Auto-discovered from the build target's `additionalEntryPoints` when omitted."
|
|
18
|
+
},
|
|
19
|
+
"tsConfig": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "TypeScript config file relative to the project root.",
|
|
22
|
+
"default": "tsconfig.json"
|
|
23
|
+
},
|
|
24
|
+
"outputDir": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "Output directory (absolute or relative to workspace root). Defaults to `.docs/packages/{projectName}/api`."
|
|
27
|
+
},
|
|
28
|
+
"packageDisplayName": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "Display name for the package in generated docs. Auto-detected from package.json when omitted."
|
|
31
|
+
},
|
|
32
|
+
"outputFileStrategy": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"enum": [
|
|
35
|
+
"members",
|
|
36
|
+
"modules"
|
|
37
|
+
],
|
|
38
|
+
"description": "TypeDoc output file strategy.",
|
|
39
|
+
"default": "members"
|
|
40
|
+
},
|
|
41
|
+
"flattenOutputFiles": {
|
|
42
|
+
"type": "boolean",
|
|
43
|
+
"description": "Flatten output files into a single directory.",
|
|
44
|
+
"default": true
|
|
45
|
+
},
|
|
46
|
+
"hidePageHeader": {
|
|
47
|
+
"type": "boolean",
|
|
48
|
+
"description": "Hide page headers in generated Markdown.",
|
|
49
|
+
"default": false
|
|
50
|
+
},
|
|
51
|
+
"hidePageTitle": {
|
|
52
|
+
"type": "boolean",
|
|
53
|
+
"description": "Hide page titles in generated Markdown.",
|
|
54
|
+
"default": false
|
|
55
|
+
},
|
|
56
|
+
"hideBreadcrumbs": {
|
|
57
|
+
"type": "boolean",
|
|
58
|
+
"description": "Hide breadcrumb navigation in generated Markdown.",
|
|
59
|
+
"default": true
|
|
60
|
+
},
|
|
61
|
+
"useCodeBlocks": {
|
|
62
|
+
"type": "boolean",
|
|
63
|
+
"description": "Wrap code examples in fenced code blocks.",
|
|
64
|
+
"default": true
|
|
65
|
+
},
|
|
66
|
+
"expandObjects": {
|
|
67
|
+
"type": "boolean",
|
|
68
|
+
"description": "Expand object types inline.",
|
|
69
|
+
"default": true
|
|
70
|
+
},
|
|
71
|
+
"parametersFormat": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"enum": [
|
|
74
|
+
"table",
|
|
75
|
+
"list",
|
|
76
|
+
"htmlTable"
|
|
77
|
+
],
|
|
78
|
+
"description": "Format for function parameters.",
|
|
79
|
+
"default": "table"
|
|
80
|
+
},
|
|
81
|
+
"enumMembersFormat": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"enum": [
|
|
84
|
+
"table",
|
|
85
|
+
"list",
|
|
86
|
+
"htmlTable"
|
|
87
|
+
],
|
|
88
|
+
"description": "Format for enum members.",
|
|
89
|
+
"default": "table"
|
|
90
|
+
},
|
|
91
|
+
"typeDeclarationFormat": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"enum": [
|
|
94
|
+
"table",
|
|
95
|
+
"list",
|
|
96
|
+
"htmlTable"
|
|
97
|
+
],
|
|
98
|
+
"description": "Format for type declarations.",
|
|
99
|
+
"default": "table"
|
|
100
|
+
},
|
|
101
|
+
"indexFormat": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"enum": [
|
|
104
|
+
"table",
|
|
105
|
+
"list",
|
|
106
|
+
"htmlTable"
|
|
107
|
+
],
|
|
108
|
+
"description": "Format for index/listing pages.",
|
|
109
|
+
"default": "table"
|
|
110
|
+
},
|
|
111
|
+
"membersWithOwnFile": {
|
|
112
|
+
"type": "array",
|
|
113
|
+
"items": {
|
|
114
|
+
"type": "string"
|
|
115
|
+
},
|
|
116
|
+
"description": "TypeDoc member kinds that get their own file.",
|
|
117
|
+
"default": [
|
|
118
|
+
"Class",
|
|
119
|
+
"Interface",
|
|
120
|
+
"TypeAlias",
|
|
121
|
+
"Enum",
|
|
122
|
+
"Function",
|
|
123
|
+
"Variable"
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
"excludePrivate": {
|
|
127
|
+
"type": "boolean",
|
|
128
|
+
"description": "Exclude private members from docs.",
|
|
129
|
+
"default": true
|
|
130
|
+
},
|
|
131
|
+
"excludeProtected": {
|
|
132
|
+
"type": "boolean",
|
|
133
|
+
"description": "Exclude protected members from docs.",
|
|
134
|
+
"default": false
|
|
135
|
+
},
|
|
136
|
+
"excludeInternal": {
|
|
137
|
+
"type": "boolean",
|
|
138
|
+
"description": "Exclude @internal members from docs.",
|
|
139
|
+
"default": true
|
|
140
|
+
},
|
|
141
|
+
"excludeExternals": {
|
|
142
|
+
"type": "boolean",
|
|
143
|
+
"description": "Exclude external/third-party symbols from docs.",
|
|
144
|
+
"default": true
|
|
145
|
+
},
|
|
146
|
+
"categoryOrder": {
|
|
147
|
+
"type": "array",
|
|
148
|
+
"items": {
|
|
149
|
+
"type": "string"
|
|
150
|
+
},
|
|
151
|
+
"description": "Category display order in index pages.",
|
|
152
|
+
"default": [
|
|
153
|
+
"Classes",
|
|
154
|
+
"Interfaces",
|
|
155
|
+
"Type Aliases",
|
|
156
|
+
"Functions",
|
|
157
|
+
"Enumerations",
|
|
158
|
+
"Variables"
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
"sort": {
|
|
162
|
+
"type": "array",
|
|
163
|
+
"items": {
|
|
164
|
+
"type": "string"
|
|
165
|
+
},
|
|
166
|
+
"description": "Sort order for members.",
|
|
167
|
+
"default": [
|
|
168
|
+
"alphabetical"
|
|
169
|
+
]
|
|
170
|
+
},
|
|
171
|
+
"kindSortOrder": {
|
|
172
|
+
"type": "array",
|
|
173
|
+
"items": {
|
|
174
|
+
"type": "string"
|
|
175
|
+
},
|
|
176
|
+
"description": "Kind sort order for members.",
|
|
177
|
+
"default": [
|
|
178
|
+
"Class",
|
|
179
|
+
"Interface",
|
|
180
|
+
"TypeAlias",
|
|
181
|
+
"Function",
|
|
182
|
+
"Enum",
|
|
183
|
+
"Variable"
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
"gitRevision": {
|
|
187
|
+
"type": "string",
|
|
188
|
+
"description": "Git revision used for source links.",
|
|
189
|
+
"default": "main"
|
|
190
|
+
},
|
|
191
|
+
"logLevel": {
|
|
192
|
+
"type": "string",
|
|
193
|
+
"enum": [
|
|
194
|
+
"Verbose",
|
|
195
|
+
"Info",
|
|
196
|
+
"Warn",
|
|
197
|
+
"Error",
|
|
198
|
+
"None"
|
|
199
|
+
],
|
|
200
|
+
"description": "TypeDoc log level.",
|
|
201
|
+
"default": "Warn"
|
|
202
|
+
},
|
|
203
|
+
"postProcessing": {
|
|
204
|
+
"type": "object",
|
|
205
|
+
"description": "Post-processing options for generated Markdown files. All default to true.",
|
|
206
|
+
"properties": {
|
|
207
|
+
"removeReadme": {
|
|
208
|
+
"type": "boolean",
|
|
209
|
+
"description": "Remove the auto-generated README.md from output.",
|
|
210
|
+
"default": true
|
|
211
|
+
},
|
|
212
|
+
"renameGlobalsToIndex": {
|
|
213
|
+
"type": "boolean",
|
|
214
|
+
"description": "Rename globals.md to index.md for static site generators.",
|
|
215
|
+
"default": true
|
|
216
|
+
},
|
|
217
|
+
"rewriteLinks": {
|
|
218
|
+
"type": "boolean",
|
|
219
|
+
"description": "Rewrite .md extension links for clean URL compatibility.",
|
|
220
|
+
"default": true
|
|
221
|
+
},
|
|
222
|
+
"escapeAngleBrackets": {
|
|
223
|
+
"type": "boolean",
|
|
224
|
+
"description": "Escape angle brackets in type generics for Vue/VitePress.",
|
|
225
|
+
"default": true
|
|
226
|
+
},
|
|
227
|
+
"normalizeFrontmatter": {
|
|
228
|
+
"type": "boolean",
|
|
229
|
+
"description": "Add or normalize YAML frontmatter with a title.",
|
|
230
|
+
"default": true
|
|
231
|
+
},
|
|
232
|
+
"markAsGenerated": {
|
|
233
|
+
"type": "boolean",
|
|
234
|
+
"description": "Mark generated files with generated: true in frontmatter.",
|
|
235
|
+
"default": true
|
|
236
|
+
},
|
|
237
|
+
"stripPackageBackLink": {
|
|
238
|
+
"type": "boolean",
|
|
239
|
+
"description": "Strip TypeDoc-generated package back-links at the top of pages.",
|
|
240
|
+
"default": true
|
|
241
|
+
},
|
|
242
|
+
"resolveInlineLinks": {
|
|
243
|
+
"type": "boolean",
|
|
244
|
+
"description": "Resolve unresolved {@link} TSDoc references to plain text.",
|
|
245
|
+
"default": true
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
"additionalProperties": false
|
|
249
|
+
},
|
|
250
|
+
"verbose": {
|
|
251
|
+
"type": "boolean",
|
|
252
|
+
"description": "Enable verbose logging.",
|
|
253
|
+
"default": false
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
"required": [],
|
|
257
|
+
"additionalProperties": false
|
|
258
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executors/icon-collection-builder/executor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,oBAAoB,CAAC;AAI/E;;GAEG;AACH,wBAA8B,WAAW,CAAC,OAAO,EAAE,oCAAoC,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executors/icon-collection-builder/executor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,oBAAoB,CAAC;AAI/E;;GAEG;AACH,wBAA8B,WAAW,CAAC,OAAO,EAAE,oCAAoC,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAsDhJ"}
|
|
@@ -50,6 +50,7 @@ async function runExecutor(options, context) {
|
|
|
50
50
|
name: 'fluent',
|
|
51
51
|
inDir: 'static/icons/fluent/',
|
|
52
52
|
outDir: 'static/icons/',
|
|
53
|
+
targetViewBox: 24,
|
|
53
54
|
types: [
|
|
54
55
|
{
|
|
55
56
|
key: 'filled',
|
|
@@ -57,7 +58,7 @@ async function runExecutor(options, context) {
|
|
|
57
58
|
outputFile: 'fluent-filled.json',
|
|
58
59
|
nameTransform: {
|
|
59
60
|
removePrefix: 'ic_fluent_',
|
|
60
|
-
|
|
61
|
+
removePattern: '_\\d+_filled$'
|
|
61
62
|
}
|
|
62
63
|
},
|
|
63
64
|
{
|
|
@@ -66,7 +67,7 @@ async function runExecutor(options, context) {
|
|
|
66
67
|
outputFile: 'fluent-outlined.json',
|
|
67
68
|
nameTransform: {
|
|
68
69
|
removePrefix: 'ic_fluent_',
|
|
69
|
-
|
|
70
|
+
removePattern: '_\\d+_regular$'
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/executors/icon-collection-builder/executor.ts"],"names":[],"mappings":";AACA,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWlB,
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/executors/icon-collection-builder/executor.ts"],"names":[],"mappings":";AACA,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWlB,8BAsDC;AA9DD,+DAA4D;AAG5D,aAAa;AAEb;;GAEG;AACY,KAAK,UAAU,WAAW,CAAC,OAA6C,EAAE,OAAwB;IAC7G,IAAI,CAAC;QACD,MAAM,IAAI,GAAG,CAAC,wDAAa,iBAAiB,GAAC,CAAC,CAAC,yBAAyB,CAAC;QAEzE,MAAM,IAAI,CAAC,GAAG,CAAC;YACX,IAAI,EAAE;gBACF;oBACI,GAAG,EAAE,IAAA,+BAAc,EAAC,OAAO,CAAC;oBAC5B,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE,sBAAsB;oBAC7B,MAAM,EAAE,eAAe;oBACvB,aAAa,EAAE,EAAE;oBACjB,KAAK,EAAE;wBACH;4BACI,GAAG,EAAE,QAAQ;4BACb,OAAO,EAAE,iBAAiB;4BAC1B,UAAU,EAAE,oBAAoB;4BAChC,aAAa,EAAE;gCACX,YAAY,EAAE,YAAY;gCAC1B,aAAa,EAAE,eAAe;6BACjC;yBACJ;wBACD;4BACI,GAAG,EAAE,SAAS;4BACd,OAAO,EAAE,kBAAkB;4BAC3B,UAAU,EAAE,sBAAsB;4BAClC,aAAa,EAAE;gCACX,YAAY,EAAE,YAAY;gCAC1B,aAAa,EAAE,gBAAgB;6BAClC;yBACJ;qBACJ;iBACJ;gBACD;oBACI,GAAG,EAAE,IAAA,+BAAc,EAAC,OAAO,CAAC;oBAC5B,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE,sBAAsB;oBAC7B,MAAM,EAAE,eAAe;oBACvB,KAAK,EAAE;wBACH;4BACI,GAAG,EAAE,SAAS;4BACd,OAAO,EAAE,UAAU;4BACnB,UAAU,EAAE,sBAAsB;yBACrC;qBACJ;iBACJ;gBACD,kBAAkB;aACrB;SACJ,CAAC,CAAC;QACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC7B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC9B,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.task.d.ts","sourceRoot":"","sources":["../../../src/executors/icon-collection-builder/executor.task.ts"],"names":[],"mappings":"AASA,yBAAiB,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"executor.task.d.ts","sourceRoot":"","sources":["../../../src/executors/icon-collection-builder/executor.task.ts"],"names":[],"mappings":"AASA,yBAAiB,yBAAyB,CAAC;IAoBvC,UAAU,UAAU;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,KAAK,EAAE,KAAK,CAAC;YACT,GAAG,EAAE,MAAM,CAAC;YACZ,OAAO,EAAE,MAAM,CAAC;YAChB,UAAU,EAAE,MAAM,CAAC;YACnB,aAAa,CAAC,EAAE;gBACZ,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,aAAa,CAAC,EAAE,MAAM,CAAC;aAC1B,CAAC;SACL,CAAC,CAAC;KACN;IAED,MAAM,WAAW,iCAAiC;QAC9C,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;KAC3B;IAED,gBAAsB,GAAG,CAAC,OAAO,EAAE,iCAAiC,GAAG,OAAO,CAAC,IAAI,CAAC,CA4HnF;;CA4GJ"}
|
|
@@ -6,8 +6,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.IconCollectionBuilderTask = void 0;
|
|
8
8
|
const utilities_1 = require("@breadstone-infrastructure/utilities");
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const svg_1 = require("./svg");
|
|
12
12
|
// #endregion
|
|
13
13
|
var IconCollectionBuilderTask;
|
|
@@ -20,19 +20,29 @@ var IconCollectionBuilderTask;
|
|
|
20
20
|
try {
|
|
21
21
|
const basePath = utilities_1.Path.combine(set.cwd, set.inDir);
|
|
22
22
|
for (const typeConfig of set.types) {
|
|
23
|
-
const svgDataPaths = new Array();
|
|
24
23
|
logger.log(` 🔍 Type [${typeConfig.key}] with pattern [${typeConfig.pattern}]`);
|
|
25
24
|
const globPattern = utilities_1.Path.combine(basePath, typeConfig.pattern);
|
|
26
25
|
const files = utilities_1.File.glob(globPattern);
|
|
27
26
|
logger.log(` 📄 Found [${files.length}] files`);
|
|
27
|
+
let normalizedCount = 0;
|
|
28
|
+
let alreadyTargetCount = 0;
|
|
29
|
+
const svgDataMap = new Map();
|
|
30
|
+
let duplicateCount = 0;
|
|
28
31
|
for (const svgFilePath of files) {
|
|
29
32
|
// eslint-disable-next-line no-await-in-loop
|
|
30
|
-
const
|
|
33
|
+
const result = await extractSVGDataPath(svgFilePath, set.targetViewBox, logger);
|
|
31
34
|
// eslint-disable-next-line max-depth
|
|
32
|
-
if (!
|
|
35
|
+
if (!result) {
|
|
33
36
|
logger.warn(` ⚠️ Skipping [${path_1.default.basename(svgFilePath)}] - no path data found`);
|
|
34
37
|
continue;
|
|
35
38
|
}
|
|
39
|
+
// eslint-disable-next-line max-depth
|
|
40
|
+
if (result.wasNormalized) {
|
|
41
|
+
normalizedCount++;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
alreadyTargetCount++;
|
|
45
|
+
}
|
|
36
46
|
// Get raw filename without extension
|
|
37
47
|
const rawFileName = path_1.default.basename(svgFilePath, '.svg');
|
|
38
48
|
// Apply transformations
|
|
@@ -40,12 +50,45 @@ var IconCollectionBuilderTask;
|
|
|
40
50
|
// Convert to camelCase and PascalCase
|
|
41
51
|
const camelCaseName = toCamelCase(transformedName);
|
|
42
52
|
const pascalCaseName = toPascalCase(transformedName);
|
|
43
|
-
|
|
53
|
+
const originalSize = parseOriginalSize(result.sourceViewBox);
|
|
54
|
+
const entry = {
|
|
44
55
|
name: camelCaseName,
|
|
45
56
|
category: path_1.default.basename(path_1.default.dirname(svgFilePath)),
|
|
46
57
|
componentName: pascalCaseName,
|
|
47
|
-
data:
|
|
48
|
-
|
|
58
|
+
data: result.pathData,
|
|
59
|
+
originalSize
|
|
60
|
+
};
|
|
61
|
+
const existing = svgDataMap.get(camelCaseName);
|
|
62
|
+
// eslint-disable-next-line max-depth
|
|
63
|
+
if (existing) {
|
|
64
|
+
duplicateCount++;
|
|
65
|
+
// eslint-disable-next-line max-depth
|
|
66
|
+
if (typeof set.targetViewBox === 'number') {
|
|
67
|
+
const existingDistance = typeof existing.originalSize === 'number'
|
|
68
|
+
? Math.abs(existing.originalSize - set.targetViewBox)
|
|
69
|
+
: Infinity;
|
|
70
|
+
const newDistance = typeof originalSize === 'number'
|
|
71
|
+
? Math.abs(originalSize - set.targetViewBox)
|
|
72
|
+
: Infinity;
|
|
73
|
+
// eslint-disable-next-line max-depth
|
|
74
|
+
if (newDistance < existingDistance) {
|
|
75
|
+
svgDataMap.set(camelCaseName, entry);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
svgDataMap.set(camelCaseName, entry);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const svgDataPaths = [...svgDataMap.values()];
|
|
84
|
+
if (duplicateCount > 0) {
|
|
85
|
+
logger.log((0, utilities_1.yellow)(` [!] ${duplicateCount} duplicate icons resolved by best-fit variant`));
|
|
86
|
+
}
|
|
87
|
+
if (set.targetViewBox) {
|
|
88
|
+
logger.log(` 📐 Normalization (target: ${set.targetViewBox}x${set.targetViewBox}): ${alreadyTargetCount} already correct, ${normalizedCount} normalized`);
|
|
89
|
+
if (normalizedCount > 0) {
|
|
90
|
+
logger.log((0, utilities_1.yellow)(` [!] ${normalizedCount} icons were rescaled to ${set.targetViewBox}x${set.targetViewBox}`));
|
|
91
|
+
}
|
|
49
92
|
}
|
|
50
93
|
if (svgDataPaths.length === 0) {
|
|
51
94
|
logger.warn(` ⚠️ No valid SVG files found for [${typeConfig.key}]`);
|
|
@@ -59,7 +102,7 @@ var IconCollectionBuilderTask;
|
|
|
59
102
|
// Write JSON file
|
|
60
103
|
const outFilePath = utilities_1.Path.combine(outPath, typeConfig.outputFile);
|
|
61
104
|
utilities_1.File.writeAllText(outFilePath, JSON.stringify(svgDataPaths, null, 4));
|
|
62
|
-
logger.log(` ✅ Processed [${svgDataPaths.length}] icons → [${typeConfig.outputFile}]`);
|
|
105
|
+
logger.log(` ✅ Processed [${svgDataPaths.length}] unique icons → [${typeConfig.outputFile}]`);
|
|
63
106
|
}
|
|
64
107
|
}
|
|
65
108
|
catch (error) {
|
|
@@ -125,17 +168,36 @@ var IconCollectionBuilderTask;
|
|
|
125
168
|
const camel = toCamelCase(str);
|
|
126
169
|
return camel.charAt(0).toUpperCase() + camel.slice(1);
|
|
127
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Parses the original size from a viewBox string
|
|
173
|
+
* @param sourceViewBox - The source viewBox string (e.g. "0 0 20 20")
|
|
174
|
+
* @returns The size as a number or null if not parseable
|
|
175
|
+
*/
|
|
176
|
+
function parseOriginalSize(sourceViewBox) {
|
|
177
|
+
const parts = sourceViewBox.split(/[\s,]+/).map(Number);
|
|
178
|
+
if (parts.length === 4 && !parts.some(isNaN)) {
|
|
179
|
+
return Math.max(parts[2], parts[3]);
|
|
180
|
+
}
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
128
183
|
/**
|
|
129
184
|
* Extract path data from SVG file
|
|
130
185
|
* @param svgFilePath - Path to SVG file
|
|
131
186
|
* @param logger - Logger instance
|
|
132
187
|
* @returns Combined path data or null if none found
|
|
133
188
|
*/
|
|
134
|
-
async function extractSVGDataPath(svgFilePath, logger) {
|
|
189
|
+
async function extractSVGDataPath(svgFilePath, targetViewBox, logger) {
|
|
135
190
|
try {
|
|
136
191
|
const svgContent = utilities_1.File.readAllText(svgFilePath, 'utf-8');
|
|
137
|
-
|
|
138
|
-
|
|
192
|
+
if (typeof targetViewBox === 'number') {
|
|
193
|
+
return await (0, svg_1.svgToNormalizedSinglePath)(svgContent, targetViewBox);
|
|
194
|
+
}
|
|
195
|
+
const pathData = await (0, svg_1.svgToSinglePath)(svgContent);
|
|
196
|
+
return {
|
|
197
|
+
pathData,
|
|
198
|
+
sourceViewBox: 'unknown',
|
|
199
|
+
wasNormalized: false
|
|
200
|
+
};
|
|
139
201
|
}
|
|
140
202
|
catch (error) {
|
|
141
203
|
logger.error(` ❌ Error parsing SVG [${path_1.default.basename(svgFilePath)}]:`, error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.task.js","sourceRoot":"","sources":["../../../src/executors/icon-collection-builder/executor.task.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;;;;AAElB,
|
|
1
|
+
{"version":3,"file":"executor.task.js","sourceRoot":"","sources":["../../../src/executors/icon-collection-builder/executor.task.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;;;;AAElB,oEAAqH;AACrH,4CAAoB;AACpB,gDAAwB;AACxB,+BAA8F;AAE9F,aAAa;AAEb,IAAiB,yBAAyB,CAkRzC;AAlRD,WAAiB,yBAAyB;IA0C/B,KAAK,UAAU,GAAG,CAA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
|
+
/**
|
|
16
|
+
* Result of a normalized SVG conversion
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export interface INormalizedSvgResult {
|
|
20
|
+
pathData: string;
|
|
21
|
+
sourceViewBox: string;
|
|
22
|
+
wasNormalized: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Converts an SVG string to a single normalized path data string.
|
|
26
|
+
* If the SVG viewBox differs from the target size, all path coordinates
|
|
27
|
+
* are scaled and centered to fit the target viewBox.
|
|
28
|
+
* @param svgContent - The SVG content as a string
|
|
29
|
+
* @param targetSize - Target viewBox dimension (e.g. 24 for 0 0 24 24)
|
|
30
|
+
* @returns Normalized result with path data and metadata
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export declare function svgToNormalizedSinglePath(svgContent: string, targetSize: number): Promise<INormalizedSvgResult>;
|
|
15
34
|
//# sourceMappingURL=svg.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg.d.ts","sourceRoot":"","sources":["../../../src/executors/icon-collection-builder/svg.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"svg.d.ts","sourceRoot":"","sources":["../../../src/executors/icon-collection-builder/svg.ts"],"names":[],"mappings":"AAGA,OAAO,EAAS,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AAM3C;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC;AAgO5B;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBzE;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;CAC1B;AAkED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAuDrH"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// #region Imports
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
3
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
7
|
exports.svgToSinglePath = svgToSinglePath;
|
|
8
|
+
exports.svgToNormalizedSinglePath = svgToNormalizedSinglePath;
|
|
9
|
+
const svgpath_1 = __importDefault(require("svgpath"));
|
|
5
10
|
const svgson_1 = require("svgson");
|
|
6
11
|
// #endregion
|
|
7
12
|
// #region Constants
|
|
@@ -221,5 +226,106 @@ async function svgToSinglePath(svgContent) {
|
|
|
221
226
|
traverse(svg);
|
|
222
227
|
return paths.join(' ');
|
|
223
228
|
}
|
|
229
|
+
/**
|
|
230
|
+
* Parses a viewBox attribute string into its components
|
|
231
|
+
* @param viewBox - The viewBox attribute value
|
|
232
|
+
* @returns Parsed viewBox or null if invalid
|
|
233
|
+
* @internal
|
|
234
|
+
*/
|
|
235
|
+
function parseViewBox(viewBox) {
|
|
236
|
+
const parts = viewBox.split(/[\s,]+/).map(Number);
|
|
237
|
+
if (parts.length !== 4 || parts.some(isNaN)) {
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
minX: parts[0],
|
|
242
|
+
minY: parts[1],
|
|
243
|
+
width: parts[2],
|
|
244
|
+
height: parts[3]
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Computes a transform to map source viewBox coordinates to the target size.
|
|
249
|
+
* Scales uniformly and centers the content.
|
|
250
|
+
* @param source - Source viewBox
|
|
251
|
+
* @param targetSize - Target viewBox dimension (e.g. 24 for 0 0 24 24)
|
|
252
|
+
* @returns Scale, translate-x, and translate-y values
|
|
253
|
+
* @internal
|
|
254
|
+
*/
|
|
255
|
+
function computeNormalizationTransform(source, targetSize) {
|
|
256
|
+
const scale = Math.min(targetSize / source.width, targetSize / source.height);
|
|
257
|
+
const tx = (targetSize - source.width * scale) / 2 - source.minX * scale;
|
|
258
|
+
const ty = (targetSize - source.height * scale) / 2 - source.minY * scale;
|
|
259
|
+
return { scale, tx, ty };
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Applies translate + scale transform to SVG path data
|
|
263
|
+
* @param pathData - Raw SVG path data string
|
|
264
|
+
* @param transform - Transform parameters
|
|
265
|
+
* @returns Transformed path data string
|
|
266
|
+
* @internal
|
|
267
|
+
*/
|
|
268
|
+
function transformPathData(pathData, transform) {
|
|
269
|
+
return (0, svgpath_1.default)(pathData)
|
|
270
|
+
.translate(transform.tx, transform.ty)
|
|
271
|
+
.scale(transform.scale)
|
|
272
|
+
.abs()
|
|
273
|
+
.round(3)
|
|
274
|
+
.toString();
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Converts an SVG string to a single normalized path data string.
|
|
278
|
+
* If the SVG viewBox differs from the target size, all path coordinates
|
|
279
|
+
* are scaled and centered to fit the target viewBox.
|
|
280
|
+
* @param svgContent - The SVG content as a string
|
|
281
|
+
* @param targetSize - Target viewBox dimension (e.g. 24 for 0 0 24 24)
|
|
282
|
+
* @returns Normalized result with path data and metadata
|
|
283
|
+
* @public
|
|
284
|
+
*/
|
|
285
|
+
async function svgToNormalizedSinglePath(svgContent, targetSize) {
|
|
286
|
+
const svg = await (0, svgson_1.parse)(svgContent);
|
|
287
|
+
const viewBoxAttr = svg.attributes?.viewBox;
|
|
288
|
+
const sourceViewBox = viewBoxAttr ? parseViewBox(viewBoxAttr) : null;
|
|
289
|
+
const paths = [];
|
|
290
|
+
function traverse(node) {
|
|
291
|
+
const pathData = elementToPath(node);
|
|
292
|
+
if (pathData) {
|
|
293
|
+
paths.push(pathData);
|
|
294
|
+
}
|
|
295
|
+
if (node.children && Array.isArray(node.children)) {
|
|
296
|
+
for (const child of node.children) {
|
|
297
|
+
traverse(child);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
traverse(svg);
|
|
302
|
+
const combinedPath = paths.join(' ');
|
|
303
|
+
const sourceViewBoxStr = viewBoxAttr ?? 'none';
|
|
304
|
+
if (!sourceViewBox) {
|
|
305
|
+
return {
|
|
306
|
+
pathData: combinedPath,
|
|
307
|
+
sourceViewBox: sourceViewBoxStr,
|
|
308
|
+
wasNormalized: false
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
const isAlreadyTarget = sourceViewBox.minX === 0
|
|
312
|
+
&& sourceViewBox.minY === 0
|
|
313
|
+
&& sourceViewBox.width === targetSize
|
|
314
|
+
&& sourceViewBox.height === targetSize;
|
|
315
|
+
if (isAlreadyTarget) {
|
|
316
|
+
return {
|
|
317
|
+
pathData: combinedPath,
|
|
318
|
+
sourceViewBox: sourceViewBoxStr,
|
|
319
|
+
wasNormalized: false
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
const transform = computeNormalizationTransform(sourceViewBox, targetSize);
|
|
323
|
+
const normalizedPath = transformPathData(combinedPath, transform);
|
|
324
|
+
return {
|
|
325
|
+
pathData: normalizedPath,
|
|
326
|
+
sourceViewBox: sourceViewBoxStr,
|
|
327
|
+
wasNormalized: true
|
|
328
|
+
};
|
|
329
|
+
}
|
|
224
330
|
// #endregion
|
|
225
331
|
//# sourceMappingURL=svg.js.map
|