@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.js CHANGED
@@ -131,7 +131,7 @@ __export(compile_theme_exports, {
131
131
  compilePreviewRuntime: () => compilePreviewRuntime,
132
132
  compileStandaloneTheme: () => compileStandaloneTheme,
133
133
  compileStandaloneThemeDev: () => compileStandaloneThemeDev,
134
- generateManifest: () => generateManifest2
134
+ generateManifest: () => generateManifest
135
135
  });
136
136
  async function resolveNodeModulesFile(startDir, relativePath) {
137
137
  let dir = startDir;
@@ -575,7 +575,7 @@ async function extractDataRequirements(themePath) {
575
575
  }
576
576
  return requirements;
577
577
  }
578
- async function generateManifest2(themeName, themePath, outputDir) {
578
+ async function generateManifest(themeName, themePath, outputDir) {
579
579
  let version = "1.0.0";
580
580
  let themeId = themeName;
581
581
  try {
@@ -710,7 +710,7 @@ async function compileStandaloneTheme(themePath, themeName) {
710
710
  } catch {
711
711
  }
712
712
  await contentHashEntry(outputDir);
713
- await generateManifest2(themeName, themePath, outputDir);
713
+ await generateManifest(themeName, themePath, outputDir);
714
714
  await generateThemeData(themePath, outputDir, themeName);
715
715
  if (result.metafile) {
716
716
  const outputs = result.metafile.outputs;
@@ -791,7 +791,7 @@ async function compileStandaloneThemeDev(themePath, themeName) {
791
791
  };
792
792
  const context2 = await esbuild__namespace.context(buildOptions);
793
793
  await context2.rebuild();
794
- await generateManifest2(themeName, themePath, outputDir);
794
+ await generateManifest(themeName, themePath, outputDir);
795
795
  await generateThemeData(themePath, outputDir, themeName);
796
796
  return { context: context2, outputDir };
797
797
  }
@@ -1551,38 +1551,13 @@ async function initCommand(projectName, options = {}) {
1551
1551
  try {
1552
1552
  fs2__default.default.mkdirSync(projectPath, { recursive: true });
1553
1553
  await copyTemplate(template, projectPath, data);
1554
- const srcPath = path7__default.default.join(projectPath, "src");
1555
- fs2__default.default.mkdirSync(srcPath, { recursive: true });
1556
- const manifestContent = generateManifest(data);
1557
- await writeFile(path7__default.default.join(srcPath, "manifest.ts"), manifestContent);
1558
- const configContent = generateThemeConfig(data);
1559
- await writeFile(path7__default.default.join(srcPath, "config.ts"), configContent);
1560
- const layoutContent = generateThemeLayout(data);
1561
- await writeFile(path7__default.default.join(srcPath, "layout.ts"), layoutContent);
1562
- const indexContent = generateThemeIndex(data);
1563
- await writeFile(path7__default.default.join(srcPath, "index.ts"), indexContent);
1564
- const sectionsPath = path7__default.default.join(srcPath, "sections");
1565
- fs2__default.default.mkdirSync(sectionsPath, { recursive: true });
1566
- await writeFile(
1567
- path7__default.default.join(sectionsPath, "README.md"),
1568
- `# ${displayName} Sections
1569
-
1570
- Add your theme-specific sections here.
1571
- `
1572
- );
1573
- const blocksPath = path7__default.default.join(srcPath, "blocks");
1574
- fs2__default.default.mkdirSync(blocksPath, { recursive: true });
1575
- await writeFile(
1576
- path7__default.default.join(blocksPath, "README.md"),
1577
- `# ${displayName} Blocks
1578
-
1579
- Add your theme-specific blocks here.
1580
- `
1554
+ await renameThemeInFiles(
1555
+ projectPath,
1556
+ name,
1557
+ displayName,
1558
+ description,
1559
+ author
1581
1560
  );
1582
- const pagesPath = path7__default.default.join(srcPath, "pages");
1583
- fs2__default.default.mkdirSync(pagesPath, { recursive: true });
1584
- const homePageContent = generateHomePage(data);
1585
- await writeFile(path7__default.default.join(pagesPath, "home.ts"), homePageContent);
1586
1561
  exports.logger.stopSpinner(true, "Project structure created!");
1587
1562
  if (options.git) {
1588
1563
  exports.logger.startSpinner("Initializing git repository...");
@@ -1626,14 +1601,14 @@ Add your theme-specific blocks here.
1626
1601
  exports.logger.log(` npm run dev # Start development mode`);
1627
1602
  exports.logger.newLine();
1628
1603
  exports.logger.section("Theme structure:");
1629
- exports.logger.log(" src/manifest.ts - Theme manifest and exports");
1604
+ exports.logger.log(" bundle-entry.ts - Theme manifest and exports");
1630
1605
  exports.logger.log(
1631
- " src/config.ts - Design tokens (colors, typography, etc.)"
1606
+ " theme.config.ts - Design tokens (colors, typography, etc.)"
1632
1607
  );
1633
- exports.logger.log(" src/layout.ts - Header and footer configuration");
1634
- exports.logger.log(" src/sections/ - Custom sections for your theme");
1635
- exports.logger.log(" src/blocks/ - Reusable blocks");
1636
- exports.logger.log(" src/pages/ - Page configurations");
1608
+ exports.logger.log(" theme.layout.ts - Header and footer configuration");
1609
+ exports.logger.log(" sections/ - Custom sections for your theme");
1610
+ exports.logger.log(" pages/ - Page configurations");
1611
+ exports.logger.log(" CLAUDE.md - AI assistant context");
1637
1612
  exports.logger.newLine();
1638
1613
  exports.logger.success(`Happy theming! \u{1F3A8}`);
1639
1614
  } catch (error) {
@@ -1647,231 +1622,33 @@ Add your theme-specific blocks here.
1647
1622
  process.exit(1);
1648
1623
  }
1649
1624
  }
1650
- function generateManifest(data) {
1651
- return `import type { ThemeExport } from "@onexapis/core";
1652
-
1653
- /**
1654
- * ${data.displayName} Theme Manifest
1655
- * ${data.description}
1656
- */
1657
- export const manifest: ThemeExport = {
1658
- id: "${data.themeName}",
1659
- name: "${data.displayName}",
1660
- description: "${data.description}",
1661
- version: "1.0.0",
1662
- author: "${data.author}",
1663
-
1664
- // Theme configuration
1665
- config: () => import("./config").then((m) => m.themeConfig),
1666
-
1667
- // Theme layout (header/footer sections)
1668
- layout: () => import("./layout").then((m) => m.themeLayout),
1669
-
1670
- // Available sections in this theme
1671
- sections: {
1672
- // Example: hero: () => import("./sections/hero").then((m) => m.heroSchema),
1673
- },
1674
-
1675
- // Available blocks in this theme
1676
- blocks: {
1677
- // Example: productCard: () => import("./blocks/product-card").then((m) => m.productCardDefinition),
1678
- },
1679
-
1680
- // Default pages
1681
- pages: {
1682
- home: () => import("./pages/home").then((m) => m.homePageConfig),
1683
- },
1684
-
1685
- // Supported page types
1686
- supportedPageTypes: ["home", "about", "contact", "custom"],
1687
-
1688
- // Preview image (optional)
1689
- preview: undefined,
1690
-
1691
- // Tags for categorization (optional)
1692
- tags: ["custom"],
1693
- };
1694
-
1695
- export default manifest;
1696
- `;
1697
- }
1698
- function generateThemeConfig(data) {
1699
- return `import type { ThemeConfig } from "@onexapis/core";
1700
-
1701
- /**
1702
- * ${data.displayName} Theme Configuration
1703
- * Design tokens: colors, typography, spacing, etc.
1704
- */
1705
- export const themeConfig: ThemeConfig = {
1706
- // Color palette
1707
- colors: {
1708
- primary: {
1709
- 50: "#eff6ff",
1710
- 100: "#dbeafe",
1711
- 200: "#bfdbfe",
1712
- 300: "#93c5fd",
1713
- 400: "#60a5fa",
1714
- 500: "#3b82f6",
1715
- 600: "#2563eb",
1716
- 700: "#1d4ed8",
1717
- 800: "#1e40af",
1718
- 900: "#1e3a8a",
1719
- },
1720
- secondary: {
1721
- 50: "#f8fafc",
1722
- 100: "#f1f5f9",
1723
- 200: "#e2e8f0",
1724
- 300: "#cbd5e1",
1725
- 400: "#94a3b8",
1726
- 500: "#64748b",
1727
- 600: "#475569",
1728
- 700: "#334155",
1729
- 800: "#1e293b",
1730
- 900: "#0f172a",
1731
- },
1732
- accent: {
1733
- 50: "#fdf4ff",
1734
- 100: "#fae8ff",
1735
- 200: "#f5d0fe",
1736
- 300: "#f0abfc",
1737
- 400: "#e879f9",
1738
- 500: "#d946ef",
1739
- 600: "#c026d3",
1740
- 700: "#a21caf",
1741
- 800: "#86198f",
1742
- 900: "#701a75",
1743
- },
1744
- },
1745
-
1746
- // Typography
1747
- typography: {
1748
- fontFamily: {
1749
- sans: ["Inter", "system-ui", "sans-serif"],
1750
- serif: ["Georgia", "serif"],
1751
- mono: ["Monaco", "monospace"],
1752
- },
1753
- fontSize: {
1754
- xs: "0.75rem",
1755
- sm: "0.875rem",
1756
- base: "1rem",
1757
- lg: "1.125rem",
1758
- xl: "1.25rem",
1759
- "2xl": "1.5rem",
1760
- "3xl": "1.875rem",
1761
- "4xl": "2.25rem",
1762
- "5xl": "3rem",
1763
- },
1764
- },
1765
-
1766
- // Spacing
1767
- spacing: {
1768
- xs: "0.5rem",
1769
- sm: "1rem",
1770
- md: "1.5rem",
1771
- lg: "2rem",
1772
- xl: "3rem",
1773
- "2xl": "4rem",
1774
- "3xl": "6rem",
1775
- "4xl": "8rem",
1776
- },
1777
-
1778
- // Border radius
1779
- borderRadius: {
1780
- none: "0",
1781
- sm: "0.125rem",
1782
- md: "0.375rem",
1783
- lg: "0.5rem",
1784
- xl: "0.75rem",
1785
- full: "9999px",
1786
- },
1787
-
1788
- // Breakpoints
1789
- breakpoints: {
1790
- sm: "640px",
1791
- md: "768px",
1792
- lg: "1024px",
1793
- xl: "1280px",
1794
- "2xl": "1536px",
1795
- },
1796
- };
1797
- `;
1798
- }
1799
- function generateThemeLayout(data) {
1800
- return `import type { ThemeLayoutConfig } from "@onexapis/core";
1801
-
1802
- /**
1803
- * ${data.themeName} Theme Layout
1804
- * Define header and footer sections
1805
- */
1806
- export const themeLayout: ThemeLayoutConfig = {
1807
- // Header section configuration
1808
- header: undefined,
1809
- // Example:
1810
- // header: {
1811
- // type: "header",
1812
- // template: "default",
1813
- // enabled: true,
1814
- // settings: {},
1815
- // },
1816
-
1817
- // Footer section configuration
1818
- footer: undefined,
1819
- // Example:
1820
- // footer: {
1821
- // type: "footer",
1822
- // template: "default",
1823
- // enabled: true,
1824
- // settings: {},
1825
- // },
1826
- };
1827
- `;
1828
- }
1829
- function generateThemeIndex(data) {
1830
- return `/**
1831
- * ${data.themeNamePascal} Theme
1832
- */
1833
-
1834
- export { manifest as ${data.themeNamePascal}Manifest } from "./manifest";
1835
- export { themeConfig as ${data.themeNamePascal}Config } from "./config";
1836
- export { themeLayout as ${data.themeNamePascal}Layout } from "./layout";
1837
- `;
1838
- }
1839
- function generateHomePage(data) {
1840
- return `import type { PageConfig } from "@onexapis/core";
1841
-
1842
- /**
1843
- * Home Page Configuration
1844
- */
1845
- export const homePageConfig: PageConfig = {
1846
- type: "home",
1847
- title: "${data.displayName}",
1848
- description: "Welcome to ${data.displayName}",
1849
-
1850
- // SEO metadata
1851
- seo: {
1852
- title: "${data.displayName} - Home",
1853
- description: "Welcome to ${data.displayName}",
1854
- keywords: [],
1855
- ogImage: undefined,
1856
- },
1857
-
1858
- // Page sections
1859
- sections: [
1860
- // Add your sections here
1861
- // Example:
1862
- // {
1863
- // id: "hero-1",
1864
- // type: "hero",
1865
- // template: "default",
1866
- // order: 0,
1867
- // enabled: true,
1868
- // settings: {},
1869
- // components: [],
1870
- // blocks: [],
1871
- // },
1872
- ],
1873
- };
1874
- `;
1625
+ async function renameThemeInFiles(projectPath, themeName, displayName, description, author) {
1626
+ const configPath = path7__default.default.join(projectPath, "theme.config.ts");
1627
+ if (fs2__default.default.existsSync(configPath)) {
1628
+ let content = fs2__default.default.readFileSync(configPath, "utf-8");
1629
+ content = content.replace(
1630
+ /name: "My Simple Theme"/,
1631
+ `name: "${displayName}"`
1632
+ );
1633
+ content = content.replace(
1634
+ /description: ".*?"/,
1635
+ `description: "${description}"`
1636
+ );
1637
+ fs2__default.default.writeFileSync(configPath, content, "utf-8");
1638
+ }
1639
+ const pkgPath = path7__default.default.join(projectPath, "package.json");
1640
+ if (fs2__default.default.existsSync(pkgPath)) {
1641
+ let content = fs2__default.default.readFileSync(pkgPath, "utf-8");
1642
+ content = content.replace(
1643
+ /@onex-themes\/my-simple/g,
1644
+ `@onex-themes/${themeName}`
1645
+ );
1646
+ content = content.replace(
1647
+ /"description": ".*?"/,
1648
+ `"description": "${description}"`
1649
+ );
1650
+ fs2__default.default.writeFileSync(pkgPath, content, "utf-8");
1651
+ }
1875
1652
  }
1876
1653
 
1877
1654
  // src/commands/create-section.ts
@@ -2757,7 +2534,7 @@ async function buildCommand(options) {
2757
2534
  exports.logger.stopSpinner(true, "Lint passed");
2758
2535
  const pkgJson = fs__default.default.readJsonSync(packageJsonPath);
2759
2536
  const buildScript = pkgJson.scripts?.build || "";
2760
- const isRecursive = buildScript.includes("onexthm build") || buildScript.includes("onex-cli build");
2537
+ const isRecursive = buildScript.includes("onexthm build") || buildScript.includes("onex build") || buildScript.includes("onex-cli build");
2761
2538
  exports.logger.startSpinner(
2762
2539
  options.watch ? "Building (watch mode)..." : "Building..."
2763
2540
  );
@@ -2791,18 +2568,36 @@ function runCommand(command, args, cwd) {
2791
2568
  return new Promise((resolve) => {
2792
2569
  const proc = child_process.spawn(command, args, {
2793
2570
  cwd,
2794
- stdio: "pipe",
2571
+ stdio: ["pipe", "pipe", "pipe"],
2795
2572
  shell: true
2796
2573
  });
2797
- let hasError = false;
2574
+ let stdout = "";
2575
+ let stderr = "";
2576
+ proc.stdout.on("data", (data) => {
2577
+ stdout += data.toString();
2578
+ });
2798
2579
  proc.stderr.on("data", (data) => {
2799
- const message = data.toString();
2800
- if (message.includes("error") || message.includes("Error") || message.includes("ERROR")) {
2801
- hasError = true;
2802
- }
2580
+ stderr += data.toString();
2803
2581
  });
2804
2582
  proc.on("close", (code) => {
2805
- resolve(code === 0 && !hasError);
2583
+ if (code !== 0) {
2584
+ const output = (stderr + stdout).trim();
2585
+ if (output) {
2586
+ exports.logger.newLine();
2587
+ for (const line of output.split("\n")) {
2588
+ const t = line.trim();
2589
+ if (!t) continue;
2590
+ if (t.includes("error") || t.includes("Error") || t.includes("TS")) {
2591
+ exports.logger.log(` \u274C ${t}`);
2592
+ } else if (t.includes("warning") || t.includes("Warning")) {
2593
+ exports.logger.log(` \u26A0\uFE0F ${t}`);
2594
+ } else {
2595
+ exports.logger.log(` ${t}`);
2596
+ }
2597
+ }
2598
+ }
2599
+ }
2600
+ resolve(code === 0);
2806
2601
  });
2807
2602
  proc.on("error", () => {
2808
2603
  resolve(false);
@@ -2848,7 +2643,7 @@ function getBucketName(env) {
2848
2643
  return process.env.BUCKET_NAME;
2849
2644
  }
2850
2645
  const environment = env || process.env.ENVIRONMENT || "staging";
2851
- return environment === "production" ? "onex-themes-prod" : "onex-themes-staging";
2646
+ return environment === "production" ? "theme-s3-bucket" : "theme-s3-bucket";
2852
2647
  }
2853
2648
  async function findCompiledThemeDir(themeId, version) {
2854
2649
  const searchPaths = [path7__default.default.resolve(process.cwd(), "dist")];
@@ -3117,7 +2912,7 @@ function getBucketName2(env) {
3117
2912
  return process.env.BUCKET_NAME;
3118
2913
  }
3119
2914
  const environment = env || process.env.ENVIRONMENT || "staging";
3120
- return environment === "production" ? "onex-themes-prod" : "onex-themes-staging";
2915
+ return environment === "production" ? "theme-s3-bucket" : "theme-s3-bucket";
3121
2916
  }
3122
2917
  async function streamToString(stream) {
3123
2918
  const chunks = [];
@@ -3318,7 +3113,7 @@ function getBucketName3(env) {
3318
3113
  return process.env.BUCKET_NAME;
3319
3114
  }
3320
3115
  const environment = env || process.env.ENVIRONMENT || "staging";
3321
- return environment === "production" ? "onex-themes-prod" : "onex-themes-staging";
3116
+ return environment === "production" ? "theme-s3-bucket" : "theme-s3-bucket";
3322
3117
  }
3323
3118
  async function streamToString2(stream) {
3324
3119
  const chunks = [];
@@ -3516,7 +3311,7 @@ async function cloneCommand(themeName, options) {
3516
3311
  [
3517
3312
  "# API Configuration (enables real data in preview)",
3518
3313
  "# Get your Company ID from the OneX dashboard",
3519
- "NEXT_PUBLIC_API_URL=https://api-dev.onexeos.com",
3314
+ "NEXT_PUBLIC_API_URL=https://platform-dev.onexeos.com",
3520
3315
  "NEXT_PUBLIC_COMPANY_ID=",
3521
3316
  ""
3522
3317
  ].join("\n")