@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.js CHANGED
@@ -4623,18 +4623,17 @@ async function publishCommand(options) {
4623
4623
  }
4624
4624
  logger.startSpinner("Building theme...");
4625
4625
  try {
4626
- const { execSync: execSync3 } = await import('child_process');
4627
- execSync3(
4628
- "npx tsup bundle-entry.ts --format esm --target es2020 --outDir dist",
4629
- {
4630
- cwd: themePath,
4631
- stdio: "ignore"
4632
- }
4633
- );
4626
+ const { compileStandaloneTheme: compileStandaloneTheme2 } = await Promise.resolve().then(() => (init_compile_theme(), compile_theme_exports));
4627
+ const buildSuccess = await compileStandaloneTheme2(themePath, themeId);
4628
+ if (!buildSuccess) {
4629
+ logger.stopSpinner(false, "Build failed");
4630
+ logger.error("Run 'onexthm build' to see build errors");
4631
+ process.exit(1);
4632
+ }
4634
4633
  logger.stopSpinner(true, "Theme compiled");
4635
- } catch {
4634
+ } catch (error) {
4636
4635
  logger.stopSpinner(false, "Build failed");
4637
- logger.error("Run 'onexthm build' to see build errors");
4636
+ logger.error(error instanceof Error ? error.message : "Build error");
4638
4637
  process.exit(1);
4639
4638
  }
4640
4639
  logger.startSpinner("Getting upload URL...");
@@ -4674,7 +4673,12 @@ async function publishCommand(options) {
4674
4673
  process.exit(1);
4675
4674
  }
4676
4675
  const bundleZipPath = path8__default.default.join(themePath, "dist", "bundle.zip");
4677
- await createZip(distDir, bundleZipPath, ["bundle.zip"]);
4676
+ await createZip(distDir, bundleZipPath, [
4677
+ "bundle.zip",
4678
+ "source.zip",
4679
+ "preview-runtime.js",
4680
+ "preview-runtime.js.map"
4681
+ ]);
4678
4682
  const bundleBuffer = fs__default.default.readFileSync(bundleZipPath);
4679
4683
  const bundleRes = await fetch(bundleUploadUrl, {
4680
4684
  method: "PUT",
@@ -4770,7 +4774,7 @@ async function createZip(sourceDir, outputPath, exclude) {
4770
4774
  archive.pipe(output);
4771
4775
  archive.glob("**/*", {
4772
4776
  cwd: sourceDir,
4773
- ignore: exclude.map((e) => `${e}/**`),
4777
+ ignore: exclude.flatMap((e) => [e, `${e}/**`]),
4774
4778
  dot: false
4775
4779
  });
4776
4780
  archive.finalize();