@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/index.mjs CHANGED
@@ -538,10 +538,6 @@ async function generateThemeData(themePath, outputDir, themeId) {
538
538
  async function contentHashEntry(outputDir) {
539
539
  const entryPath = path8.join(outputDir, "bundle-entry.js");
540
540
  const mapPath = path8.join(outputDir, "bundle-entry.js.map");
541
- const oldFiles = await glob("bundle-entry-*.js*", { cwd: outputDir });
542
- for (const f of oldFiles) {
543
- await fs7.unlink(path8.join(outputDir, f));
544
- }
545
541
  let entryContent;
546
542
  try {
547
543
  entryContent = await fs7.readFile(entryPath, "utf-8");
@@ -561,8 +557,17 @@ async function contentHashEntry(outputDir) {
561
557
  /\/\/# sourceMappingURL=index\.js\.map/,
562
558
  `//# sourceMappingURL=${hashedMapName2}`
563
559
  );
560
+ const oldFiles2 = await glob("bundle-entry-*.js*", { cwd: outputDir });
561
+ for (const f of oldFiles2) {
562
+ await fs7.unlink(path8.join(outputDir, f));
563
+ }
564
564
  await fs7.writeFile(path8.join(outputDir, hashedName2), entryContent);
565
565
  await fs7.unlink(indexPath);
566
+ try {
567
+ await fs7.unlink(entryPath);
568
+ } catch {
569
+ }
570
+ await fs7.writeFile(entryPath, entryContent);
566
571
  try {
567
572
  await fs7.access(indexMapPath);
568
573
  await fs7.rename(indexMapPath, path8.join(outputDir, hashedMapName2));
@@ -578,8 +583,16 @@ async function contentHashEntry(outputDir) {
578
583
  /\/\/# sourceMappingURL=bundle-entry\.js\.map/,
579
584
  `//# sourceMappingURL=${hashedMapName}`
580
585
  );
586
+ const oldFiles = await glob("bundle-entry-*.js*", { cwd: outputDir });
587
+ for (const f of oldFiles) {
588
+ await fs7.unlink(path8.join(outputDir, f));
589
+ }
581
590
  await fs7.writeFile(path8.join(outputDir, hashedName), entryContent);
582
- await fs7.unlink(entryPath);
591
+ try {
592
+ await fs7.unlink(entryPath);
593
+ } catch {
594
+ }
595
+ await fs7.writeFile(entryPath, entryContent);
583
596
  try {
584
597
  await fs7.access(mapPath);
585
598
  await fs7.rename(mapPath, path8.join(outputDir, hashedMapName));