@onexapis/cli 1.1.59 → 1.1.62
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 +44 -13
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +44 -13
- package/dist/cli.mjs.map +1 -1
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -542,10 +542,6 @@ async function generateThemeData(themePath, outputDir, themeId) {
|
|
|
542
542
|
async function contentHashEntry(outputDir) {
|
|
543
543
|
const entryPath = path9.join(outputDir, "bundle-entry.js");
|
|
544
544
|
const mapPath = path9.join(outputDir, "bundle-entry.js.map");
|
|
545
|
-
const oldFiles = await glob("bundle-entry-*.js*", { cwd: outputDir });
|
|
546
|
-
for (const f of oldFiles) {
|
|
547
|
-
await fs8.unlink(path9.join(outputDir, f));
|
|
548
|
-
}
|
|
549
545
|
let entryContent;
|
|
550
546
|
try {
|
|
551
547
|
entryContent = await fs8.readFile(entryPath, "utf-8");
|
|
@@ -565,8 +561,17 @@ async function contentHashEntry(outputDir) {
|
|
|
565
561
|
/\/\/# sourceMappingURL=index\.js\.map/,
|
|
566
562
|
`//# sourceMappingURL=${hashedMapName2}`
|
|
567
563
|
);
|
|
564
|
+
const oldFiles2 = await glob("bundle-entry-*.js*", { cwd: outputDir });
|
|
565
|
+
for (const f of oldFiles2) {
|
|
566
|
+
await fs8.unlink(path9.join(outputDir, f));
|
|
567
|
+
}
|
|
568
568
|
await fs8.writeFile(path9.join(outputDir, hashedName2), entryContent);
|
|
569
569
|
await fs8.unlink(indexPath);
|
|
570
|
+
try {
|
|
571
|
+
await fs8.unlink(entryPath);
|
|
572
|
+
} catch {
|
|
573
|
+
}
|
|
574
|
+
await fs8.writeFile(entryPath, entryContent);
|
|
570
575
|
try {
|
|
571
576
|
await fs8.access(indexMapPath);
|
|
572
577
|
await fs8.rename(indexMapPath, path9.join(outputDir, hashedMapName2));
|
|
@@ -582,8 +587,16 @@ async function contentHashEntry(outputDir) {
|
|
|
582
587
|
/\/\/# sourceMappingURL=bundle-entry\.js\.map/,
|
|
583
588
|
`//# sourceMappingURL=${hashedMapName}`
|
|
584
589
|
);
|
|
590
|
+
const oldFiles = await glob("bundle-entry-*.js*", { cwd: outputDir });
|
|
591
|
+
for (const f of oldFiles) {
|
|
592
|
+
await fs8.unlink(path9.join(outputDir, f));
|
|
593
|
+
}
|
|
585
594
|
await fs8.writeFile(path9.join(outputDir, hashedName), entryContent);
|
|
586
|
-
|
|
595
|
+
try {
|
|
596
|
+
await fs8.unlink(entryPath);
|
|
597
|
+
} catch {
|
|
598
|
+
}
|
|
599
|
+
await fs8.writeFile(entryPath, entryContent);
|
|
587
600
|
try {
|
|
588
601
|
await fs8.access(mapPath);
|
|
589
602
|
await fs8.rename(mapPath, path9.join(outputDir, hashedMapName));
|
|
@@ -5126,14 +5139,17 @@ async function uploadThumbnail(apiUrl, themeId, themePath, distDir) {
|
|
|
5126
5139
|
}
|
|
5127
5140
|
logger.startSpinner("Uploading thumbnail...");
|
|
5128
5141
|
try {
|
|
5129
|
-
const uploadRes = await authenticatedFetch(
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5142
|
+
const uploadRes = await authenticatedFetch(
|
|
5143
|
+
`${apiUrl}/media/images/upload`,
|
|
5144
|
+
{
|
|
5145
|
+
method: "POST",
|
|
5146
|
+
body: JSON.stringify({
|
|
5147
|
+
prefix: `themes/${themeId}`,
|
|
5148
|
+
image: imageBase64,
|
|
5149
|
+
name: "thumbnail.png"
|
|
5150
|
+
})
|
|
5151
|
+
}
|
|
5152
|
+
);
|
|
5137
5153
|
const uploadData = await uploadRes.json();
|
|
5138
5154
|
const uploadBody = uploadData.statusCode ? uploadData.body : uploadData;
|
|
5139
5155
|
if (!uploadRes.ok || !uploadBody.url) {
|
|
@@ -5186,6 +5202,21 @@ async function screenshotHomePage(themePath, distDir) {
|
|
|
5186
5202
|
timeout: 3e4
|
|
5187
5203
|
});
|
|
5188
5204
|
await page.waitForSelector("#onex-preview-root > *", { timeout: 15e3 });
|
|
5205
|
+
await page.evaluate(async () => {
|
|
5206
|
+
await new Promise((resolve) => {
|
|
5207
|
+
const distance = 400;
|
|
5208
|
+
const delay = 120;
|
|
5209
|
+
const timer = setInterval(() => {
|
|
5210
|
+
window.scrollBy(0, distance);
|
|
5211
|
+
if (window.scrollY + window.innerHeight >= document.body.scrollHeight) {
|
|
5212
|
+
clearInterval(timer);
|
|
5213
|
+
window.scrollTo(0, 0);
|
|
5214
|
+
resolve();
|
|
5215
|
+
}
|
|
5216
|
+
}, delay);
|
|
5217
|
+
});
|
|
5218
|
+
});
|
|
5219
|
+
await new Promise((resolve) => setTimeout(resolve, 5e3));
|
|
5189
5220
|
const screenshot = await page.screenshot({ fullPage: true, type: "png" });
|
|
5190
5221
|
return Buffer.from(screenshot);
|
|
5191
5222
|
} finally {
|