@onexapis/cli 1.1.19 → 1.1.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/dist/cli.mjs CHANGED
@@ -4581,18 +4581,17 @@ async function publishCommand(options) {
4581
4581
  }
4582
4582
  logger.startSpinner("Building theme...");
4583
4583
  try {
4584
- const { execSync: execSync3 } = await import('child_process');
4585
- execSync3(
4586
- "npx tsup bundle-entry.ts --format esm --target es2020 --outDir dist",
4587
- {
4588
- cwd: themePath,
4589
- stdio: "ignore"
4590
- }
4591
- );
4584
+ const { compileStandaloneTheme: compileStandaloneTheme2 } = await Promise.resolve().then(() => (init_compile_theme(), compile_theme_exports));
4585
+ const buildSuccess = await compileStandaloneTheme2(themePath, themeId);
4586
+ if (!buildSuccess) {
4587
+ logger.stopSpinner(false, "Build failed");
4588
+ logger.error("Run 'onexthm build' to see build errors");
4589
+ process.exit(1);
4590
+ }
4592
4591
  logger.stopSpinner(true, "Theme compiled");
4593
- } catch {
4592
+ } catch (error) {
4594
4593
  logger.stopSpinner(false, "Build failed");
4595
- logger.error("Run 'onexthm build' to see build errors");
4594
+ logger.error(error instanceof Error ? error.message : "Build error");
4596
4595
  process.exit(1);
4597
4596
  }
4598
4597
  logger.startSpinner("Getting upload URL...");
@@ -4632,7 +4631,12 @@ async function publishCommand(options) {
4632
4631
  process.exit(1);
4633
4632
  }
4634
4633
  const bundleZipPath = path8.join(themePath, "dist", "bundle.zip");
4635
- await createZip(distDir, bundleZipPath, ["bundle.zip"]);
4634
+ await createZip(distDir, bundleZipPath, [
4635
+ "bundle.zip",
4636
+ "source.zip",
4637
+ "preview-runtime.js",
4638
+ "preview-runtime.js.map"
4639
+ ]);
4636
4640
  const bundleBuffer = fs.readFileSync(bundleZipPath);
4637
4641
  const bundleRes = await fetch(bundleUploadUrl, {
4638
4642
  method: "PUT",
@@ -4728,7 +4732,7 @@ async function createZip(sourceDir, outputPath, exclude) {
4728
4732
  archive.pipe(output);
4729
4733
  archive.glob("**/*", {
4730
4734
  cwd: sourceDir,
4731
- ignore: exclude.map((e) => `${e}/**`),
4735
+ ignore: exclude.flatMap((e) => [e, `${e}/**`]),
4732
4736
  dot: false
4733
4737
  });
4734
4738
  archive.finalize();