@onexapis/cli 1.1.17 → 1.1.18
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/README.md +82 -16
- package/dist/cli.js +522 -286
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +519 -283
- package/dist/cli.mjs.map +1 -1
- package/dist/index.js +47 -270
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -270
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/templates/default/.env.example +1 -1
- package/templates/default/.mcp.json +8 -0
- package/templates/default/CLAUDE.md +941 -0
- package/templates/default/bundle-entry.ts +18 -0
- package/templates/default/index.ts +26 -0
- package/templates/default/package.json +37 -0
- package/templates/default/pages/about.ts +66 -0
- package/templates/default/pages/home.ts +93 -0
- package/templates/default/pages/showcase.ts +146 -0
- package/templates/default/sections/about/about-default.tsx +237 -0
- package/templates/default/sections/about/about.schema.ts +259 -0
- package/templates/default/sections/about/index.ts +15 -0
- package/templates/default/sections/cta/cta-default.tsx +180 -0
- package/templates/default/sections/cta/cta.schema.ts +210 -0
- package/templates/default/sections/cta/index.ts +11 -0
- package/templates/default/sections/features/features-default.tsx +154 -0
- package/templates/default/sections/features/features.schema.ts +330 -0
- package/templates/default/sections/features/index.ts +11 -0
- package/templates/default/sections/gallery/gallery-default.tsx +134 -0
- package/templates/default/sections/gallery/gallery.schema.ts +397 -0
- package/templates/default/sections/gallery/index.ts +11 -0
- package/templates/default/sections/hero/hero-default.tsx +212 -0
- package/templates/default/sections/hero/hero.schema.ts +273 -0
- package/templates/default/sections/hero/index.ts +15 -0
- package/templates/default/sections/stats/index.ts +11 -0
- package/templates/default/sections/stats/stats-default.tsx +103 -0
- package/templates/default/sections/stats/stats.schema.ts +266 -0
- package/templates/default/sections/testimonials/index.ts +11 -0
- package/templates/default/sections/testimonials/testimonials-default.tsx +130 -0
- package/templates/default/sections/testimonials/testimonials.schema.ts +371 -0
- package/templates/default/sections-registry.ts +32 -0
- package/templates/default/theme.config.ts +107 -0
- package/templates/default/theme.layout.ts +21 -0
- package/templates/default/tsconfig.json +16 -7
- package/templates/default/README.md.ejs +0 -129
- package/templates/default/esbuild.config.js +0 -81
- package/templates/default/package.json.ejs +0 -31
- package/templates/default/src/config.ts.ejs +0 -98
- package/templates/default/src/index.ts.ejs +0 -11
- package/templates/default/src/layout.ts +0 -23
- package/templates/default/src/manifest.ts.ejs +0 -47
- package/templates/default/src/pages/home.ts.ejs +0 -37
- package/templates/default/src/sections/footer/footer-default.tsx +0 -28
- package/templates/default/src/sections/footer/footer.schema.ts +0 -45
- package/templates/default/src/sections/footer/index.ts +0 -2
- package/templates/default/src/sections/header/header-default.tsx +0 -61
- package/templates/default/src/sections/header/header.schema.ts +0 -46
- package/templates/default/src/sections/header/index.ts +0 -2
- package/templates/default/src/sections/hero/hero-default.tsx +0 -52
- package/templates/default/src/sections/hero/hero.schema.ts +0 -52
- 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: () =>
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
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("
|
|
1604
|
+
exports.logger.log(" bundle-entry.ts - Theme manifest and exports");
|
|
1630
1605
|
exports.logger.log(
|
|
1631
|
-
"
|
|
1606
|
+
" theme.config.ts - Design tokens (colors, typography, etc.)"
|
|
1632
1607
|
);
|
|
1633
|
-
exports.logger.log("
|
|
1634
|
-
exports.logger.log("
|
|
1635
|
-
exports.logger.log("
|
|
1636
|
-
exports.logger.log("
|
|
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
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
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
|
|
@@ -2848,7 +2625,7 @@ function getBucketName(env) {
|
|
|
2848
2625
|
return process.env.BUCKET_NAME;
|
|
2849
2626
|
}
|
|
2850
2627
|
const environment = env || process.env.ENVIRONMENT || "staging";
|
|
2851
|
-
return environment === "production" ? "
|
|
2628
|
+
return environment === "production" ? "theme-s3-bucket" : "theme-s3-bucket";
|
|
2852
2629
|
}
|
|
2853
2630
|
async function findCompiledThemeDir(themeId, version) {
|
|
2854
2631
|
const searchPaths = [path7__default.default.resolve(process.cwd(), "dist")];
|
|
@@ -3117,7 +2894,7 @@ function getBucketName2(env) {
|
|
|
3117
2894
|
return process.env.BUCKET_NAME;
|
|
3118
2895
|
}
|
|
3119
2896
|
const environment = env || process.env.ENVIRONMENT || "staging";
|
|
3120
|
-
return environment === "production" ? "
|
|
2897
|
+
return environment === "production" ? "theme-s3-bucket" : "theme-s3-bucket";
|
|
3121
2898
|
}
|
|
3122
2899
|
async function streamToString(stream) {
|
|
3123
2900
|
const chunks = [];
|
|
@@ -3318,7 +3095,7 @@ function getBucketName3(env) {
|
|
|
3318
3095
|
return process.env.BUCKET_NAME;
|
|
3319
3096
|
}
|
|
3320
3097
|
const environment = env || process.env.ENVIRONMENT || "staging";
|
|
3321
|
-
return environment === "production" ? "
|
|
3098
|
+
return environment === "production" ? "theme-s3-bucket" : "theme-s3-bucket";
|
|
3322
3099
|
}
|
|
3323
3100
|
async function streamToString2(stream) {
|
|
3324
3101
|
const chunks = [];
|
|
@@ -3516,7 +3293,7 @@ async function cloneCommand(themeName, options) {
|
|
|
3516
3293
|
[
|
|
3517
3294
|
"# API Configuration (enables real data in preview)",
|
|
3518
3295
|
"# Get your Company ID from the OneX dashboard",
|
|
3519
|
-
"NEXT_PUBLIC_API_URL=https://
|
|
3296
|
+
"NEXT_PUBLIC_API_URL=https://platform-dev.onexeos.com",
|
|
3520
3297
|
"NEXT_PUBLIC_COMPANY_ID=",
|
|
3521
3298
|
""
|
|
3522
3299
|
].join("\n")
|