@woodsportal/hubspot-kit 1.0.41-dev.3 → 1.0.41-dev.4
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/dist/cli.js +20 -4
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
- package/scripts/publish-cdn-github.mjs +31 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@woodsportal/hubspot-kit",
|
|
3
|
-
"version": "1.0.41-dev.
|
|
3
|
+
"version": "1.0.41-dev.4",
|
|
4
4
|
"description": "WoodsCLI — HubSpot CMS dev kit by WoodsPortal. wp CLI, Vite presets, module-config overlay, and theme/module build pipelines.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -180,15 +180,43 @@ async function headJsDelivrFile(base, file, { required = false } = {}) {
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
async function headJsDelivrFiles(base, files, { required = false, concurrency = 5 } = {}) {
|
|
184
|
+
if (files.length === 0) {
|
|
185
|
+
return { ok: true, failed: [] }
|
|
186
|
+
}
|
|
187
|
+
log(`Checking ${files.length} lazy chunk(s) on jsDelivr`)
|
|
188
|
+
const failed = []
|
|
189
|
+
for (let i = 0; i < files.length; i += concurrency) {
|
|
190
|
+
const batch = files.slice(i, i + concurrency)
|
|
191
|
+
const results = await Promise.all(
|
|
192
|
+
batch.map(async (file) => {
|
|
193
|
+
const ok = await headJsDelivrFile(base, file, { required: false })
|
|
194
|
+
return { file, ok }
|
|
195
|
+
}),
|
|
196
|
+
)
|
|
197
|
+
for (const result of results) {
|
|
198
|
+
if (!result.ok) {
|
|
199
|
+
failed.push(result.file)
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (failed.length > 0) {
|
|
204
|
+
const msg = `jsDelivr lazy chunk(s) not reachable: ${failed.join(', ')}`
|
|
205
|
+
if (required) {
|
|
206
|
+
fail(msg)
|
|
207
|
+
}
|
|
208
|
+
log(` ${msg}`)
|
|
209
|
+
}
|
|
210
|
+
return { ok: failed.length === 0, failed }
|
|
211
|
+
}
|
|
212
|
+
|
|
183
213
|
async function checkJsDelivr(config, vendorFile, appFile, appCssFile, lazyChunkFiles = []) {
|
|
184
214
|
const base = jsDelivrBaseUrl(config.github, config.cdnPathInRepo, config.defaultBranch)
|
|
185
215
|
for (const file of [appCssFile, vendorFile, appFile]) {
|
|
186
216
|
await headJsDelivrFile(base, file)
|
|
187
217
|
}
|
|
188
218
|
if (lazyChunkFiles.length > 0) {
|
|
189
|
-
|
|
190
|
-
log(`Checking lazy chunk sample (${lazyChunkFiles.length} in manifest): ${sample}`)
|
|
191
|
-
await headJsDelivrFile(base, sample, { required: true })
|
|
219
|
+
await headJsDelivrFiles(base, lazyChunkFiles, { required: true })
|
|
192
220
|
} else {
|
|
193
221
|
log(' No lazy chunks/ in manifest — skipping lazy chunk HEAD check')
|
|
194
222
|
}
|