@onexapis/cli 1.1.17 → 1.1.19

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.
Files changed (61) hide show
  1. package/README.md +82 -16
  2. package/dist/cli.js +621 -294
  3. package/dist/cli.js.map +1 -1
  4. package/dist/cli.mjs +618 -291
  5. package/dist/cli.mjs.map +1 -1
  6. package/dist/index.js +73 -278
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +73 -278
  9. package/dist/index.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/templates/default/.env.example +1 -1
  12. package/templates/default/.mcp.json +8 -0
  13. package/templates/default/CLAUDE.md +941 -0
  14. package/templates/default/bundle-entry.ts +18 -0
  15. package/templates/default/index.ts +26 -0
  16. package/templates/default/package.json +34 -0
  17. package/templates/default/pages/about.ts +66 -0
  18. package/templates/default/pages/home.ts +93 -0
  19. package/templates/default/pages/showcase.ts +146 -0
  20. package/templates/default/sections/about/about-default.tsx +237 -0
  21. package/templates/default/sections/about/about.schema.ts +259 -0
  22. package/templates/default/sections/about/index.ts +15 -0
  23. package/templates/default/sections/cta/cta-default.tsx +180 -0
  24. package/templates/default/sections/cta/cta.schema.ts +210 -0
  25. package/templates/default/sections/cta/index.ts +11 -0
  26. package/templates/default/sections/features/features-default.tsx +154 -0
  27. package/templates/default/sections/features/features.schema.ts +330 -0
  28. package/templates/default/sections/features/index.ts +11 -0
  29. package/templates/default/sections/gallery/gallery-default.tsx +134 -0
  30. package/templates/default/sections/gallery/gallery.schema.ts +397 -0
  31. package/templates/default/sections/gallery/index.ts +11 -0
  32. package/templates/default/sections/hero/hero-default.tsx +212 -0
  33. package/templates/default/sections/hero/hero.schema.ts +273 -0
  34. package/templates/default/sections/hero/index.ts +15 -0
  35. package/templates/default/sections/stats/index.ts +11 -0
  36. package/templates/default/sections/stats/stats-default.tsx +103 -0
  37. package/templates/default/sections/stats/stats.schema.ts +266 -0
  38. package/templates/default/sections/testimonials/index.ts +11 -0
  39. package/templates/default/sections/testimonials/testimonials-default.tsx +130 -0
  40. package/templates/default/sections/testimonials/testimonials.schema.ts +371 -0
  41. package/templates/default/sections-registry.ts +32 -0
  42. package/templates/default/theme.config.ts +107 -0
  43. package/templates/default/theme.layout.ts +21 -0
  44. package/templates/default/tsconfig.json +16 -7
  45. package/templates/default/README.md.ejs +0 -129
  46. package/templates/default/esbuild.config.js +0 -81
  47. package/templates/default/package.json.ejs +0 -31
  48. package/templates/default/src/config.ts.ejs +0 -98
  49. package/templates/default/src/index.ts.ejs +0 -11
  50. package/templates/default/src/layout.ts +0 -23
  51. package/templates/default/src/manifest.ts.ejs +0 -47
  52. package/templates/default/src/pages/home.ts.ejs +0 -37
  53. package/templates/default/src/sections/footer/footer-default.tsx +0 -28
  54. package/templates/default/src/sections/footer/footer.schema.ts +0 -45
  55. package/templates/default/src/sections/footer/index.ts +0 -2
  56. package/templates/default/src/sections/header/header-default.tsx +0 -61
  57. package/templates/default/src/sections/header/header.schema.ts +0 -46
  58. package/templates/default/src/sections/header/index.ts +0 -2
  59. package/templates/default/src/sections/hero/hero-default.tsx +0 -52
  60. package/templates/default/src/sections/hero/hero.schema.ts +0 -52
  61. package/templates/default/src/sections/hero/index.ts +0 -2
package/dist/index.mjs CHANGED
@@ -94,7 +94,7 @@ __export(compile_theme_exports, {
94
94
  compilePreviewRuntime: () => compilePreviewRuntime,
95
95
  compileStandaloneTheme: () => compileStandaloneTheme,
96
96
  compileStandaloneThemeDev: () => compileStandaloneThemeDev,
97
- generateManifest: () => generateManifest2
97
+ generateManifest: () => generateManifest
98
98
  });
99
99
  async function resolveNodeModulesFile(startDir, relativePath) {
100
100
  let dir = startDir;
@@ -538,7 +538,7 @@ async function extractDataRequirements(themePath) {
538
538
  }
539
539
  return requirements;
540
540
  }
541
- async function generateManifest2(themeName, themePath, outputDir) {
541
+ async function generateManifest(themeName, themePath, outputDir) {
542
542
  let version = "1.0.0";
543
543
  let themeId = themeName;
544
544
  try {
@@ -673,7 +673,7 @@ async function compileStandaloneTheme(themePath, themeName) {
673
673
  } catch {
674
674
  }
675
675
  await contentHashEntry(outputDir);
676
- await generateManifest2(themeName, themePath, outputDir);
676
+ await generateManifest(themeName, themePath, outputDir);
677
677
  await generateThemeData(themePath, outputDir, themeName);
678
678
  if (result.metafile) {
679
679
  const outputs = result.metafile.outputs;
@@ -754,7 +754,7 @@ async function compileStandaloneThemeDev(themePath, themeName) {
754
754
  };
755
755
  const context2 = await esbuild.context(buildOptions);
756
756
  await context2.rebuild();
757
- await generateManifest2(themeName, themePath, outputDir);
757
+ await generateManifest(themeName, themePath, outputDir);
758
758
  await generateThemeData(themePath, outputDir, themeName);
759
759
  return { context: context2, outputDir };
760
760
  }
@@ -1514,38 +1514,13 @@ async function initCommand(projectName, options = {}) {
1514
1514
  try {
1515
1515
  fs2.mkdirSync(projectPath, { recursive: true });
1516
1516
  await copyTemplate(template, projectPath, data);
1517
- const srcPath = path7.join(projectPath, "src");
1518
- fs2.mkdirSync(srcPath, { recursive: true });
1519
- const manifestContent = generateManifest(data);
1520
- await writeFile(path7.join(srcPath, "manifest.ts"), manifestContent);
1521
- const configContent = generateThemeConfig(data);
1522
- await writeFile(path7.join(srcPath, "config.ts"), configContent);
1523
- const layoutContent = generateThemeLayout(data);
1524
- await writeFile(path7.join(srcPath, "layout.ts"), layoutContent);
1525
- const indexContent = generateThemeIndex(data);
1526
- await writeFile(path7.join(srcPath, "index.ts"), indexContent);
1527
- const sectionsPath = path7.join(srcPath, "sections");
1528
- fs2.mkdirSync(sectionsPath, { recursive: true });
1529
- await writeFile(
1530
- path7.join(sectionsPath, "README.md"),
1531
- `# ${displayName} Sections
1532
-
1533
- Add your theme-specific sections here.
1534
- `
1535
- );
1536
- const blocksPath = path7.join(srcPath, "blocks");
1537
- fs2.mkdirSync(blocksPath, { recursive: true });
1538
- await writeFile(
1539
- path7.join(blocksPath, "README.md"),
1540
- `# ${displayName} Blocks
1541
-
1542
- Add your theme-specific blocks here.
1543
- `
1517
+ await renameThemeInFiles(
1518
+ projectPath,
1519
+ name,
1520
+ displayName,
1521
+ description,
1522
+ author
1544
1523
  );
1545
- const pagesPath = path7.join(srcPath, "pages");
1546
- fs2.mkdirSync(pagesPath, { recursive: true });
1547
- const homePageContent = generateHomePage(data);
1548
- await writeFile(path7.join(pagesPath, "home.ts"), homePageContent);
1549
1524
  logger.stopSpinner(true, "Project structure created!");
1550
1525
  if (options.git) {
1551
1526
  logger.startSpinner("Initializing git repository...");
@@ -1589,14 +1564,14 @@ Add your theme-specific blocks here.
1589
1564
  logger.log(` npm run dev # Start development mode`);
1590
1565
  logger.newLine();
1591
1566
  logger.section("Theme structure:");
1592
- logger.log(" src/manifest.ts - Theme manifest and exports");
1567
+ logger.log(" bundle-entry.ts - Theme manifest and exports");
1593
1568
  logger.log(
1594
- " src/config.ts - Design tokens (colors, typography, etc.)"
1569
+ " theme.config.ts - Design tokens (colors, typography, etc.)"
1595
1570
  );
1596
- logger.log(" src/layout.ts - Header and footer configuration");
1597
- logger.log(" src/sections/ - Custom sections for your theme");
1598
- logger.log(" src/blocks/ - Reusable blocks");
1599
- logger.log(" src/pages/ - Page configurations");
1571
+ logger.log(" theme.layout.ts - Header and footer configuration");
1572
+ logger.log(" sections/ - Custom sections for your theme");
1573
+ logger.log(" pages/ - Page configurations");
1574
+ logger.log(" CLAUDE.md - AI assistant context");
1600
1575
  logger.newLine();
1601
1576
  logger.success(`Happy theming! \u{1F3A8}`);
1602
1577
  } catch (error) {
@@ -1610,231 +1585,33 @@ Add your theme-specific blocks here.
1610
1585
  process.exit(1);
1611
1586
  }
1612
1587
  }
1613
- function generateManifest(data) {
1614
- return `import type { ThemeExport } from "@onexapis/core";
1615
-
1616
- /**
1617
- * ${data.displayName} Theme Manifest
1618
- * ${data.description}
1619
- */
1620
- export const manifest: ThemeExport = {
1621
- id: "${data.themeName}",
1622
- name: "${data.displayName}",
1623
- description: "${data.description}",
1624
- version: "1.0.0",
1625
- author: "${data.author}",
1626
-
1627
- // Theme configuration
1628
- config: () => import("./config").then((m) => m.themeConfig),
1629
-
1630
- // Theme layout (header/footer sections)
1631
- layout: () => import("./layout").then((m) => m.themeLayout),
1632
-
1633
- // Available sections in this theme
1634
- sections: {
1635
- // Example: hero: () => import("./sections/hero").then((m) => m.heroSchema),
1636
- },
1637
-
1638
- // Available blocks in this theme
1639
- blocks: {
1640
- // Example: productCard: () => import("./blocks/product-card").then((m) => m.productCardDefinition),
1641
- },
1642
-
1643
- // Default pages
1644
- pages: {
1645
- home: () => import("./pages/home").then((m) => m.homePageConfig),
1646
- },
1647
-
1648
- // Supported page types
1649
- supportedPageTypes: ["home", "about", "contact", "custom"],
1650
-
1651
- // Preview image (optional)
1652
- preview: undefined,
1653
-
1654
- // Tags for categorization (optional)
1655
- tags: ["custom"],
1656
- };
1657
-
1658
- export default manifest;
1659
- `;
1660
- }
1661
- function generateThemeConfig(data) {
1662
- return `import type { ThemeConfig } from "@onexapis/core";
1663
-
1664
- /**
1665
- * ${data.displayName} Theme Configuration
1666
- * Design tokens: colors, typography, spacing, etc.
1667
- */
1668
- export const themeConfig: ThemeConfig = {
1669
- // Color palette
1670
- colors: {
1671
- primary: {
1672
- 50: "#eff6ff",
1673
- 100: "#dbeafe",
1674
- 200: "#bfdbfe",
1675
- 300: "#93c5fd",
1676
- 400: "#60a5fa",
1677
- 500: "#3b82f6",
1678
- 600: "#2563eb",
1679
- 700: "#1d4ed8",
1680
- 800: "#1e40af",
1681
- 900: "#1e3a8a",
1682
- },
1683
- secondary: {
1684
- 50: "#f8fafc",
1685
- 100: "#f1f5f9",
1686
- 200: "#e2e8f0",
1687
- 300: "#cbd5e1",
1688
- 400: "#94a3b8",
1689
- 500: "#64748b",
1690
- 600: "#475569",
1691
- 700: "#334155",
1692
- 800: "#1e293b",
1693
- 900: "#0f172a",
1694
- },
1695
- accent: {
1696
- 50: "#fdf4ff",
1697
- 100: "#fae8ff",
1698
- 200: "#f5d0fe",
1699
- 300: "#f0abfc",
1700
- 400: "#e879f9",
1701
- 500: "#d946ef",
1702
- 600: "#c026d3",
1703
- 700: "#a21caf",
1704
- 800: "#86198f",
1705
- 900: "#701a75",
1706
- },
1707
- },
1708
-
1709
- // Typography
1710
- typography: {
1711
- fontFamily: {
1712
- sans: ["Inter", "system-ui", "sans-serif"],
1713
- serif: ["Georgia", "serif"],
1714
- mono: ["Monaco", "monospace"],
1715
- },
1716
- fontSize: {
1717
- xs: "0.75rem",
1718
- sm: "0.875rem",
1719
- base: "1rem",
1720
- lg: "1.125rem",
1721
- xl: "1.25rem",
1722
- "2xl": "1.5rem",
1723
- "3xl": "1.875rem",
1724
- "4xl": "2.25rem",
1725
- "5xl": "3rem",
1726
- },
1727
- },
1728
-
1729
- // Spacing
1730
- spacing: {
1731
- xs: "0.5rem",
1732
- sm: "1rem",
1733
- md: "1.5rem",
1734
- lg: "2rem",
1735
- xl: "3rem",
1736
- "2xl": "4rem",
1737
- "3xl": "6rem",
1738
- "4xl": "8rem",
1739
- },
1740
-
1741
- // Border radius
1742
- borderRadius: {
1743
- none: "0",
1744
- sm: "0.125rem",
1745
- md: "0.375rem",
1746
- lg: "0.5rem",
1747
- xl: "0.75rem",
1748
- full: "9999px",
1749
- },
1750
-
1751
- // Breakpoints
1752
- breakpoints: {
1753
- sm: "640px",
1754
- md: "768px",
1755
- lg: "1024px",
1756
- xl: "1280px",
1757
- "2xl": "1536px",
1758
- },
1759
- };
1760
- `;
1761
- }
1762
- function generateThemeLayout(data) {
1763
- return `import type { ThemeLayoutConfig } from "@onexapis/core";
1764
-
1765
- /**
1766
- * ${data.themeName} Theme Layout
1767
- * Define header and footer sections
1768
- */
1769
- export const themeLayout: ThemeLayoutConfig = {
1770
- // Header section configuration
1771
- header: undefined,
1772
- // Example:
1773
- // header: {
1774
- // type: "header",
1775
- // template: "default",
1776
- // enabled: true,
1777
- // settings: {},
1778
- // },
1779
-
1780
- // Footer section configuration
1781
- footer: undefined,
1782
- // Example:
1783
- // footer: {
1784
- // type: "footer",
1785
- // template: "default",
1786
- // enabled: true,
1787
- // settings: {},
1788
- // },
1789
- };
1790
- `;
1791
- }
1792
- function generateThemeIndex(data) {
1793
- return `/**
1794
- * ${data.themeNamePascal} Theme
1795
- */
1796
-
1797
- export { manifest as ${data.themeNamePascal}Manifest } from "./manifest";
1798
- export { themeConfig as ${data.themeNamePascal}Config } from "./config";
1799
- export { themeLayout as ${data.themeNamePascal}Layout } from "./layout";
1800
- `;
1801
- }
1802
- function generateHomePage(data) {
1803
- return `import type { PageConfig } from "@onexapis/core";
1804
-
1805
- /**
1806
- * Home Page Configuration
1807
- */
1808
- export const homePageConfig: PageConfig = {
1809
- type: "home",
1810
- title: "${data.displayName}",
1811
- description: "Welcome to ${data.displayName}",
1812
-
1813
- // SEO metadata
1814
- seo: {
1815
- title: "${data.displayName} - Home",
1816
- description: "Welcome to ${data.displayName}",
1817
- keywords: [],
1818
- ogImage: undefined,
1819
- },
1820
-
1821
- // Page sections
1822
- sections: [
1823
- // Add your sections here
1824
- // Example:
1825
- // {
1826
- // id: "hero-1",
1827
- // type: "hero",
1828
- // template: "default",
1829
- // order: 0,
1830
- // enabled: true,
1831
- // settings: {},
1832
- // components: [],
1833
- // blocks: [],
1834
- // },
1835
- ],
1836
- };
1837
- `;
1588
+ async function renameThemeInFiles(projectPath, themeName, displayName, description, author) {
1589
+ const configPath = path7.join(projectPath, "theme.config.ts");
1590
+ if (fs2.existsSync(configPath)) {
1591
+ let content = fs2.readFileSync(configPath, "utf-8");
1592
+ content = content.replace(
1593
+ /name: "My Simple Theme"/,
1594
+ `name: "${displayName}"`
1595
+ );
1596
+ content = content.replace(
1597
+ /description: ".*?"/,
1598
+ `description: "${description}"`
1599
+ );
1600
+ fs2.writeFileSync(configPath, content, "utf-8");
1601
+ }
1602
+ const pkgPath = path7.join(projectPath, "package.json");
1603
+ if (fs2.existsSync(pkgPath)) {
1604
+ let content = fs2.readFileSync(pkgPath, "utf-8");
1605
+ content = content.replace(
1606
+ /@onex-themes\/my-simple/g,
1607
+ `@onex-themes/${themeName}`
1608
+ );
1609
+ content = content.replace(
1610
+ /"description": ".*?"/,
1611
+ `"description": "${description}"`
1612
+ );
1613
+ fs2.writeFileSync(pkgPath, content, "utf-8");
1614
+ }
1838
1615
  }
1839
1616
 
1840
1617
  // src/commands/create-section.ts
@@ -2720,7 +2497,7 @@ async function buildCommand(options) {
2720
2497
  logger.stopSpinner(true, "Lint passed");
2721
2498
  const pkgJson = fs.readJsonSync(packageJsonPath);
2722
2499
  const buildScript = pkgJson.scripts?.build || "";
2723
- const isRecursive = buildScript.includes("onexthm build") || buildScript.includes("onex-cli build");
2500
+ const isRecursive = buildScript.includes("onexthm build") || buildScript.includes("onex build") || buildScript.includes("onex-cli build");
2724
2501
  logger.startSpinner(
2725
2502
  options.watch ? "Building (watch mode)..." : "Building..."
2726
2503
  );
@@ -2754,18 +2531,36 @@ function runCommand(command, args, cwd) {
2754
2531
  return new Promise((resolve) => {
2755
2532
  const proc = spawn(command, args, {
2756
2533
  cwd,
2757
- stdio: "pipe",
2534
+ stdio: ["pipe", "pipe", "pipe"],
2758
2535
  shell: true
2759
2536
  });
2760
- let hasError = false;
2537
+ let stdout = "";
2538
+ let stderr = "";
2539
+ proc.stdout.on("data", (data) => {
2540
+ stdout += data.toString();
2541
+ });
2761
2542
  proc.stderr.on("data", (data) => {
2762
- const message = data.toString();
2763
- if (message.includes("error") || message.includes("Error") || message.includes("ERROR")) {
2764
- hasError = true;
2765
- }
2543
+ stderr += data.toString();
2766
2544
  });
2767
2545
  proc.on("close", (code) => {
2768
- resolve(code === 0 && !hasError);
2546
+ if (code !== 0) {
2547
+ const output = (stderr + stdout).trim();
2548
+ if (output) {
2549
+ logger.newLine();
2550
+ for (const line of output.split("\n")) {
2551
+ const t = line.trim();
2552
+ if (!t) continue;
2553
+ if (t.includes("error") || t.includes("Error") || t.includes("TS")) {
2554
+ logger.log(` \u274C ${t}`);
2555
+ } else if (t.includes("warning") || t.includes("Warning")) {
2556
+ logger.log(` \u26A0\uFE0F ${t}`);
2557
+ } else {
2558
+ logger.log(` ${t}`);
2559
+ }
2560
+ }
2561
+ }
2562
+ }
2563
+ resolve(code === 0);
2769
2564
  });
2770
2565
  proc.on("error", () => {
2771
2566
  resolve(false);
@@ -2811,7 +2606,7 @@ function getBucketName(env) {
2811
2606
  return process.env.BUCKET_NAME;
2812
2607
  }
2813
2608
  const environment = env || process.env.ENVIRONMENT || "staging";
2814
- return environment === "production" ? "onex-themes-prod" : "onex-themes-staging";
2609
+ return environment === "production" ? "theme-s3-bucket" : "theme-s3-bucket";
2815
2610
  }
2816
2611
  async function findCompiledThemeDir(themeId, version) {
2817
2612
  const searchPaths = [path7.resolve(process.cwd(), "dist")];
@@ -3080,7 +2875,7 @@ function getBucketName2(env) {
3080
2875
  return process.env.BUCKET_NAME;
3081
2876
  }
3082
2877
  const environment = env || process.env.ENVIRONMENT || "staging";
3083
- return environment === "production" ? "onex-themes-prod" : "onex-themes-staging";
2878
+ return environment === "production" ? "theme-s3-bucket" : "theme-s3-bucket";
3084
2879
  }
3085
2880
  async function streamToString(stream) {
3086
2881
  const chunks = [];
@@ -3281,7 +3076,7 @@ function getBucketName3(env) {
3281
3076
  return process.env.BUCKET_NAME;
3282
3077
  }
3283
3078
  const environment = env || process.env.ENVIRONMENT || "staging";
3284
- return environment === "production" ? "onex-themes-prod" : "onex-themes-staging";
3079
+ return environment === "production" ? "theme-s3-bucket" : "theme-s3-bucket";
3285
3080
  }
3286
3081
  async function streamToString2(stream) {
3287
3082
  const chunks = [];
@@ -3479,7 +3274,7 @@ async function cloneCommand(themeName, options) {
3479
3274
  [
3480
3275
  "# API Configuration (enables real data in preview)",
3481
3276
  "# Get your Company ID from the OneX dashboard",
3482
- "NEXT_PUBLIC_API_URL=https://api-dev.onexeos.com",
3277
+ "NEXT_PUBLIC_API_URL=https://platform-dev.onexeos.com",
3483
3278
  "NEXT_PUBLIC_COMPANY_ID=",
3484
3279
  ""
3485
3280
  ].join("\n")