@onexapis/cli 1.1.16 → 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.
Files changed (63) hide show
  1. package/README.md +117 -51
  2. package/bin/onexthm.js +4 -0
  3. package/dist/cli.js +750 -328
  4. package/dist/cli.js.map +1 -1
  5. package/dist/cli.mjs +747 -325
  6. package/dist/cli.mjs.map +1 -1
  7. package/dist/index.js +162 -299
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +162 -299
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/preview/preview-app.tsx +175 -53
  12. package/package.json +14 -12
  13. package/templates/default/.env.example +1 -1
  14. package/templates/default/.mcp.json +8 -0
  15. package/templates/default/CLAUDE.md +941 -0
  16. package/templates/default/bundle-entry.ts +18 -0
  17. package/templates/default/index.ts +26 -0
  18. package/templates/default/package.json +37 -0
  19. package/templates/default/pages/about.ts +66 -0
  20. package/templates/default/pages/home.ts +93 -0
  21. package/templates/default/pages/showcase.ts +146 -0
  22. package/templates/default/sections/about/about-default.tsx +237 -0
  23. package/templates/default/sections/about/about.schema.ts +259 -0
  24. package/templates/default/sections/about/index.ts +15 -0
  25. package/templates/default/sections/cta/cta-default.tsx +180 -0
  26. package/templates/default/sections/cta/cta.schema.ts +210 -0
  27. package/templates/default/sections/cta/index.ts +11 -0
  28. package/templates/default/sections/features/features-default.tsx +154 -0
  29. package/templates/default/sections/features/features.schema.ts +330 -0
  30. package/templates/default/sections/features/index.ts +11 -0
  31. package/templates/default/sections/gallery/gallery-default.tsx +134 -0
  32. package/templates/default/sections/gallery/gallery.schema.ts +397 -0
  33. package/templates/default/sections/gallery/index.ts +11 -0
  34. package/templates/default/sections/hero/hero-default.tsx +212 -0
  35. package/templates/default/sections/hero/hero.schema.ts +273 -0
  36. package/templates/default/sections/hero/index.ts +15 -0
  37. package/templates/default/sections/stats/index.ts +11 -0
  38. package/templates/default/sections/stats/stats-default.tsx +103 -0
  39. package/templates/default/sections/stats/stats.schema.ts +266 -0
  40. package/templates/default/sections/testimonials/index.ts +11 -0
  41. package/templates/default/sections/testimonials/testimonials-default.tsx +130 -0
  42. package/templates/default/sections/testimonials/testimonials.schema.ts +371 -0
  43. package/templates/default/sections-registry.ts +32 -0
  44. package/templates/default/theme.config.ts +107 -0
  45. package/templates/default/theme.layout.ts +21 -0
  46. package/templates/default/tsconfig.json +16 -7
  47. package/templates/default/README.md.ejs +0 -129
  48. package/templates/default/esbuild.config.js +0 -81
  49. package/templates/default/package.json.ejs +0 -31
  50. package/templates/default/src/config.ts.ejs +0 -98
  51. package/templates/default/src/index.ts.ejs +0 -11
  52. package/templates/default/src/layout.ts +0 -23
  53. package/templates/default/src/manifest.ts.ejs +0 -47
  54. package/templates/default/src/pages/home.ts.ejs +0 -37
  55. package/templates/default/src/sections/footer/footer-default.tsx +0 -28
  56. package/templates/default/src/sections/footer/footer.schema.ts +0 -45
  57. package/templates/default/src/sections/footer/index.ts +0 -2
  58. package/templates/default/src/sections/header/header-default.tsx +0 -61
  59. package/templates/default/src/sections/header/header.schema.ts +0 -46
  60. package/templates/default/src/sections/header/index.ts +0 -2
  61. package/templates/default/src/sections/hero/hero-default.tsx +0 -52
  62. package/templates/default/src/sections/hero/hero.schema.ts +0 -52
  63. package/templates/default/src/sections/hero/index.ts +0 -2
@@ -1,129 +0,0 @@
1
- # <%= displayName %>
2
-
3
- <%= description %>
4
-
5
- ## Getting Started
6
-
7
- This is a OneX theme project created with `@onex/cli`.
8
-
9
- ### Development
10
-
11
- ```bash
12
- # Start development mode (watch for changes)
13
- npm run dev
14
-
15
- # Build the theme
16
- npm run build
17
- ```
18
-
19
- ### Project Structure
20
-
21
- ```
22
- <%= projectName %>/
23
- ├── src/
24
- │ ├── manifest.ts # Theme manifest and exports
25
- │ ├── config.ts # Design tokens (colors, typography, etc.)
26
- │ ├── layout.ts # Header and footer configuration
27
- │ ├── sections/ # Custom sections for your theme
28
- │ │ ├── hero/
29
- │ │ ├── header/
30
- │ │ └── footer/
31
- │ ├── blocks/ # Reusable blocks
32
- │ └── pages/ # Page configurations
33
- │ └── home.ts
34
- ├── dist/ # Built theme bundle (auto-generated)
35
- ├── package.json
36
- ├── tsconfig.json
37
- └── esbuild.config.js # Build configuration
38
- ```
39
-
40
- ### Creating Sections
41
-
42
- Sections are the building blocks of your theme. Each section has:
43
-
44
- 1. **Component file** (`{name}-default.tsx`): The React component
45
- 2. **Schema file** (`{name}.schema.ts`): Configuration and settings
46
- 3. **Index file** (`index.ts`): Re-exports
47
-
48
- Example section structure:
49
-
50
- ```
51
- src/sections/hero/
52
- ├── hero-default.tsx # Component
53
- ├── hero.schema.ts # Schema
54
- └── index.ts # Exports
55
- ```
56
-
57
- ### Creating Blocks
58
-
59
- Blocks are reusable components that can be used within sections:
60
-
61
- ```
62
- src/blocks/product-card/
63
- ├── product-card.tsx
64
- ├── product-card.schema.ts
65
- └── index.ts
66
- ```
67
-
68
- ### Theme Configuration
69
-
70
- Edit `src/config.ts` to customize your theme's design tokens:
71
-
72
- - Colors
73
- - Typography
74
- - Spacing
75
- - Border radius
76
- - Breakpoints
77
-
78
- ### Layout Configuration
79
-
80
- Edit `src/layout.ts` to configure header and footer:
81
-
82
- ```typescript
83
- export const themeLayout: ThemeLayoutConfig = {
84
- header: {
85
- type: "header",
86
- template: "default",
87
- enabled: true,
88
- settings: {},
89
- },
90
- footer: {
91
- type: "footer",
92
- template: "default",
93
- enabled: true,
94
- settings: {},
95
- },
96
- };
97
- ```
98
-
99
- ### Building Your Theme
100
-
101
- 1. Create sections in `src/sections/`
102
- 2. Add sections to `src/manifest.ts`:
103
-
104
- ```typescript
105
- sections: {
106
- hero: () => import("./sections/hero").then((m) => m.heroSchema),
107
- features: () => import("./sections/features").then((m) => m.featuresSchema),
108
- }
109
- ```
110
-
111
- 3. Build the theme: `npm run build`
112
- 4. The built bundle will be in `dist/bundle.mjs`
113
-
114
- ### Using Your Theme
115
-
116
- To use your theme in a OneX application:
117
-
118
- 1. Build your theme: `npm run build`
119
- 2. Upload the theme to S3 or your hosting platform
120
- 3. Configure your OneX app to use the theme
121
-
122
- ## Learn More
123
-
124
- - [OneX Documentation](https://github.com/onexapis/onex-website)
125
- - [@onexapis/core](https://www.npmjs.com/package/@onexapis/core)
126
-
127
- ## License
128
-
129
- MIT<% if (author) { %> © <%= author %><% } %>
@@ -1,81 +0,0 @@
1
- const esbuild = require("esbuild");
2
-
3
- const isWatch = process.argv.includes("--watch");
4
-
5
- const config = {
6
- entryPoints: ["src/index.ts"],
7
- bundle: true,
8
- format: "esm",
9
- target: "es2020",
10
- outfile: "dist/bundle.mjs",
11
-
12
- // CRITICAL: Externalize @onexapis/core and peer deps
13
- external: [
14
- "@onexapis/core",
15
- "@onexapis/core/client",
16
- "react",
17
- "react-dom",
18
- "react/jsx-runtime",
19
- "next",
20
- "lucide-react",
21
- ],
22
-
23
- // Source maps for debugging
24
- sourcemap: true,
25
-
26
- // Minify for production
27
- minify: process.env.NODE_ENV === "production",
28
-
29
- // Bundle analysis
30
- metafile: true,
31
-
32
- // Plugin to check bundle size
33
- plugins: [
34
- {
35
- name: "bundle-size-check",
36
- setup(build) {
37
- build.onEnd(async (result) => {
38
- if (result.metafile) {
39
- const { outputs } = result.metafile;
40
- const bundleFile = Object.keys(outputs).find((f) =>
41
- f.endsWith("bundle.mjs")
42
- );
43
- if (bundleFile) {
44
- const size = outputs[bundleFile].bytes;
45
- const sizeKB = (size / 1024).toFixed(2);
46
- const sizeMB = (size / 1024 / 1024).toFixed(2);
47
-
48
- console.log(`\n✅ Bundle size: ${sizeKB} KB (${sizeMB} MB)`);
49
-
50
- // Warn if bundle is too large
51
- const MAX_SIZE_MB = 1;
52
- if (size > MAX_SIZE_MB * 1024 * 1024) {
53
- console.warn(
54
- `⚠️ Warning: Bundle exceeds ${MAX_SIZE_MB}MB limit`
55
- );
56
- }
57
- }
58
- }
59
- });
60
- },
61
- },
62
- ],
63
- };
64
-
65
- async function build() {
66
- try {
67
- if (isWatch) {
68
- const context = await esbuild.context(config);
69
- await context.watch();
70
- console.log("👀 Watching for changes...");
71
- } else {
72
- await esbuild.build(config);
73
- console.log("✅ Build complete!");
74
- }
75
- } catch (error) {
76
- console.error("❌ Build failed:", error);
77
- process.exit(1);
78
- }
79
- }
80
-
81
- build();
@@ -1,31 +0,0 @@
1
- {
2
- "name": "<%= projectName %>",
3
- "version": "1.0.0",
4
- "description": "<%= description %>",
5
- "main": "dist/bundle.mjs",
6
- "scripts": {
7
- "build": "node esbuild.config.js",
8
- "dev": "node esbuild.config.js --watch"
9
- },
10
- "keywords": [
11
- "onex",
12
- "theme"
13
- ],
14
- "author": "<%= author %>",
15
- "license": "MIT",
16
- "dependencies": {
17
- "@onexapis/core": "^1.0.2",
18
- "@tanstack/react-query": "^5.90.16"
19
- },
20
- "devDependencies": {
21
- "@types/react": "^19",
22
- "@types/react-dom": "^19",
23
- "esbuild": "^0.19.0",
24
- "typescript": "^5.0.0"
25
- },
26
- "peerDependencies": {
27
- "react": "^19.2.1",
28
- "react-dom": "^19.2.1",
29
- "next": ">=14.0.0"
30
- }
31
- }
@@ -1,98 +0,0 @@
1
- import type { ThemeConfig } from "@onexapis/core";
2
-
3
- /**
4
- * <%= displayName %> Theme Configuration
5
- * Design tokens: colors, typography, spacing, etc.
6
- */
7
- export const themeConfig: ThemeConfig = {
8
- // Color palette
9
- colors: {
10
- primary: {
11
- 50: "#eff6ff",
12
- 100: "#dbeafe",
13
- 200: "#bfdbfe",
14
- 300: "#93c5fd",
15
- 400: "#60a5fa",
16
- 500: "#3b82f6",
17
- 600: "#2563eb",
18
- 700: "#1d4ed8",
19
- 800: "#1e40af",
20
- 900: "#1e3a8a",
21
- },
22
- secondary: {
23
- 50: "#f8fafc",
24
- 100: "#f1f5f9",
25
- 200: "#e2e8f0",
26
- 300: "#cbd5e1",
27
- 400: "#94a3b8",
28
- 500: "#64748b",
29
- 600: "#475569",
30
- 700: "#334155",
31
- 800: "#1e293b",
32
- 900: "#0f172a",
33
- },
34
- accent: {
35
- 50: "#fdf4ff",
36
- 100: "#fae8ff",
37
- 200: "#f5d0fe",
38
- 300: "#f0abfc",
39
- 400: "#e879f9",
40
- 500: "#d946ef",
41
- 600: "#c026d3",
42
- 700: "#a21caf",
43
- 800: "#86198f",
44
- 900: "#701a75",
45
- },
46
- },
47
-
48
- // Typography
49
- typography: {
50
- fontFamily: {
51
- sans: ["Inter", "system-ui", "sans-serif"],
52
- serif: ["Georgia", "serif"],
53
- mono: ["Monaco", "monospace"],
54
- },
55
- fontSize: {
56
- xs: "0.75rem",
57
- sm: "0.875rem",
58
- base: "1rem",
59
- lg: "1.125rem",
60
- xl: "1.25rem",
61
- "2xl": "1.5rem",
62
- "3xl": "1.875rem",
63
- "4xl": "2.25rem",
64
- "5xl": "3rem",
65
- },
66
- },
67
-
68
- // Spacing
69
- spacing: {
70
- xs: "0.5rem",
71
- sm: "1rem",
72
- md: "1.5rem",
73
- lg: "2rem",
74
- xl: "3rem",
75
- "2xl": "4rem",
76
- "3xl": "6rem",
77
- "4xl": "8rem",
78
- },
79
-
80
- // Border radius
81
- borderRadius: {
82
- none: "0",
83
- sm: "0.125rem",
84
- md: "0.375rem",
85
- lg: "0.5rem",
86
- xl: "0.75rem",
87
- full: "9999px",
88
- },
89
-
90
- // Breakpoints
91
- breakpoints: {
92
- sm: "640px",
93
- md: "768px",
94
- lg: "1024px",
95
- xl: "1280px",
96
- "2xl": "1536px",
97
- },
98
- };
@@ -1,11 +0,0 @@
1
- /**
2
- * <%= themeNamePascal %> Theme
3
- * Entry point for the theme module
4
- */
5
-
6
- export { manifest as <%= themeName %>Manifest } from "./manifest";
7
- export { themeConfig as <%= themeName %>Config } from "./config";
8
- export { themeLayout as <%= themeName %>Layout } from "./layout";
9
-
10
- // Re-export default
11
- export { default } from "./manifest";
@@ -1,23 +0,0 @@
1
- import type { ThemeLayoutConfig } from "@onexapis/core";
2
-
3
- /**
4
- * Theme Layout
5
- * Define header and footer sections
6
- */
7
- export const themeLayout: ThemeLayoutConfig = {
8
- // Header section configuration
9
- header: {
10
- type: "header",
11
- template: "default",
12
- enabled: true,
13
- settings: {},
14
- },
15
-
16
- // Footer section configuration
17
- footer: {
18
- type: "footer",
19
- template: "default",
20
- enabled: true,
21
- settings: {},
22
- },
23
- };
@@ -1,47 +0,0 @@
1
- import type { ThemeExport } from "@onexapis/core";
2
-
3
- /**
4
- * <%= displayName %> Theme Manifest
5
- * <%= description %>
6
- */
7
- export const manifest: ThemeExport = {
8
- id: "<%= themeName %>",
9
- name: "<%= displayName %>",
10
- description: "<%= description %>",
11
- version: "1.0.0",
12
- author: "<%= author %>",
13
-
14
- // Theme configuration
15
- config: () => import("./config").then((m) => m.themeConfig),
16
-
17
- // Theme layout (header/footer sections)
18
- layout: () => import("./layout").then((m) => m.themeLayout),
19
-
20
- // Available sections in this theme
21
- sections: {
22
- hero: () => import("./sections/hero").then((m) => m.heroSchema),
23
- header: () => import("./sections/header").then((m) => m.headerSchema),
24
- footer: () => import("./sections/footer").then((m) => m.footerSchema),
25
- },
26
-
27
- // Available blocks in this theme
28
- blocks: {
29
- // Example: productCard: () => import("./blocks/product-card").then((m) => m.productCardDefinition),
30
- },
31
-
32
- // Default pages
33
- pages: {
34
- home: () => import("./pages/home").then((m) => m.homePageConfig),
35
- },
36
-
37
- // Supported page types
38
- supportedPageTypes: ["home", "about", "contact", "custom"],
39
-
40
- // Preview image (optional)
41
- preview: undefined,
42
-
43
- // Tags for categorization (optional)
44
- tags: ["starter", "custom"],
45
- };
46
-
47
- export default manifest;
@@ -1,37 +0,0 @@
1
- import type { PageConfig } from "@onexapis/core";
2
-
3
- /**
4
- * Home Page Configuration
5
- */
6
- export const homePageConfig: PageConfig = {
7
- type: "home",
8
- title: "<%= displayName %>",
9
- description: "Welcome to <%= displayName %>",
10
-
11
- // SEO metadata
12
- seo: {
13
- title: "<%= displayName %> - Home",
14
- description: "<%= description %>",
15
- keywords: [],
16
- ogImage: undefined,
17
- },
18
-
19
- // Page sections
20
- sections: [
21
- {
22
- id: "hero-1",
23
- type: "hero",
24
- template: "default",
25
- order: 0,
26
- enabled: true,
27
- settings: {
28
- title: "Welcome to <%= displayName %>",
29
- subtitle: "<%= description %>",
30
- backgroundColor: "#3b82f6",
31
- textColor: "#ffffff",
32
- },
33
- components: [],
34
- blocks: [],
35
- },
36
- ],
37
- };
@@ -1,28 +0,0 @@
1
- import React from "react";
2
- import type { SectionComponentProps } from "@onexapis/core";
3
-
4
- export function FooterDefault({ section, isEditing }: SectionComponentProps) {
5
- const { settings } = section;
6
-
7
- const copyright =
8
- (settings.copyright as string) || "© 2024 OneX. All rights reserved.";
9
- const backgroundColor = (settings.backgroundColor as string) || "#1f2937";
10
- const textColor = (settings.textColor as string) || "#ffffff";
11
-
12
- return (
13
- <footer
14
- style={{
15
- backgroundColor,
16
- color: textColor,
17
- padding: "2rem",
18
- textAlign: "center",
19
- }}
20
- data-section-id={section.id}
21
- data-editable={isEditing}
22
- >
23
- <div style={{ maxWidth: "1280px", margin: "0 auto" }}>
24
- <p data-editable-field="copyright">{copyright}</p>
25
- </div>
26
- </footer>
27
- );
28
- }
@@ -1,45 +0,0 @@
1
- import type { SectionSchema } from "@onexapis/core";
2
- import { FooterDefault } from "./footer-default";
3
-
4
- export const footerSchema: SectionSchema = {
5
- id: "footer",
6
- name: "Footer",
7
- description: "Site footer with copyright notice",
8
- icon: "layout",
9
- category: "layout",
10
-
11
- // Available templates
12
- templates: {
13
- default: {
14
- name: "Default Footer",
15
- component: FooterDefault,
16
- preview: undefined,
17
- },
18
- },
19
-
20
- // Section settings schema
21
- settingsSchema: {
22
- copyright: {
23
- type: "text",
24
- label: "Copyright Text",
25
- default: "© 2024 OneX. All rights reserved.",
26
- },
27
- backgroundColor: {
28
- type: "color",
29
- label: "Background Color",
30
- default: "#1f2937",
31
- },
32
- textColor: {
33
- type: "color",
34
- label: "Text Color",
35
- default: "#ffffff",
36
- },
37
- },
38
-
39
- // Default settings
40
- defaultSettings: {
41
- copyright: "© 2024 OneX. All rights reserved.",
42
- backgroundColor: "#1f2937",
43
- textColor: "#ffffff",
44
- },
45
- };
@@ -1,2 +0,0 @@
1
- export { FooterDefault } from "./footer-default";
2
- export { footerSchema } from "./footer.schema";
@@ -1,61 +0,0 @@
1
- import React from "react";
2
- import type { SectionComponentProps } from "@onexapis/core";
3
-
4
- export function HeaderDefault({ section, isEditing }: SectionComponentProps) {
5
- const { settings } = section;
6
-
7
- const logo = (settings.logo as string) || "OneX";
8
- const backgroundColor = (settings.backgroundColor as string) || "#ffffff";
9
- const textColor = (settings.textColor as string) || "#1f2937";
10
-
11
- return (
12
- <header
13
- style={{
14
- backgroundColor,
15
- color: textColor,
16
- padding: "1rem 2rem",
17
- borderBottom: "1px solid #e5e7eb",
18
- position: "sticky",
19
- top: 0,
20
- zIndex: 1000,
21
- }}
22
- data-section-id={section.id}
23
- data-editable={isEditing}
24
- >
25
- <div
26
- style={{
27
- maxWidth: "1280px",
28
- margin: "0 auto",
29
- display: "flex",
30
- justifyContent: "space-between",
31
- alignItems: "center",
32
- }}
33
- >
34
- <div
35
- style={{
36
- fontSize: "1.5rem",
37
- fontWeight: "bold",
38
- }}
39
- data-editable-field="logo"
40
- >
41
- {logo}
42
- </div>
43
-
44
- <nav style={{ display: "flex", gap: "2rem" }}>
45
- <a href="/" style={{ textDecoration: "none", color: "inherit" }}>
46
- Home
47
- </a>
48
- <a href="/about" style={{ textDecoration: "none", color: "inherit" }}>
49
- About
50
- </a>
51
- <a
52
- href="/contact"
53
- style={{ textDecoration: "none", color: "inherit" }}
54
- >
55
- Contact
56
- </a>
57
- </nav>
58
- </div>
59
- </header>
60
- );
61
- }
@@ -1,46 +0,0 @@
1
- import type { SectionSchema } from "@onexapis/core";
2
- import { HeaderDefault } from "./header-default";
3
-
4
- export const headerSchema: SectionSchema = {
5
- id: "header",
6
- name: "Header",
7
- description: "Site header with logo and navigation",
8
- icon: "layout",
9
- category: "layout",
10
-
11
- // Available templates
12
- templates: {
13
- default: {
14
- name: "Default Header",
15
- component: HeaderDefault,
16
- preview: undefined,
17
- },
18
- },
19
-
20
- // Section settings schema
21
- settingsSchema: {
22
- logo: {
23
- type: "text",
24
- label: "Logo Text",
25
- default: "OneX",
26
- required: true,
27
- },
28
- backgroundColor: {
29
- type: "color",
30
- label: "Background Color",
31
- default: "#ffffff",
32
- },
33
- textColor: {
34
- type: "color",
35
- label: "Text Color",
36
- default: "#1f2937",
37
- },
38
- },
39
-
40
- // Default settings
41
- defaultSettings: {
42
- logo: "OneX",
43
- backgroundColor: "#ffffff",
44
- textColor: "#1f2937",
45
- },
46
- };
@@ -1,2 +0,0 @@
1
- export { HeaderDefault } from "./header-default";
2
- export { headerSchema } from "./header.schema";