@onexapis/cli 1.0.0

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 (33) hide show
  1. package/README.md +332 -0
  2. package/bin/onex.js +4 -0
  3. package/dist/cli.d.mts +1 -0
  4. package/dist/cli.d.ts +1 -0
  5. package/dist/cli.js +2507 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/cli.mjs +2492 -0
  8. package/dist/cli.mjs.map +1 -0
  9. package/dist/index.d.mts +167 -0
  10. package/dist/index.d.ts +167 -0
  11. package/dist/index.js +2104 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/index.mjs +2063 -0
  14. package/dist/index.mjs.map +1 -0
  15. package/package.json +80 -0
  16. package/templates/default/README.md.ejs +129 -0
  17. package/templates/default/esbuild.config.js +81 -0
  18. package/templates/default/package.json.ejs +30 -0
  19. package/templates/default/src/config.ts.ejs +98 -0
  20. package/templates/default/src/index.ts.ejs +11 -0
  21. package/templates/default/src/layout.ts +23 -0
  22. package/templates/default/src/manifest.ts.ejs +47 -0
  23. package/templates/default/src/pages/home.ts.ejs +37 -0
  24. package/templates/default/src/sections/footer/footer-default.tsx +28 -0
  25. package/templates/default/src/sections/footer/footer.schema.ts +45 -0
  26. package/templates/default/src/sections/footer/index.ts +2 -0
  27. package/templates/default/src/sections/header/header-default.tsx +61 -0
  28. package/templates/default/src/sections/header/header.schema.ts +46 -0
  29. package/templates/default/src/sections/header/index.ts +2 -0
  30. package/templates/default/src/sections/hero/hero-default.tsx +52 -0
  31. package/templates/default/src/sections/hero/hero.schema.ts +52 -0
  32. package/templates/default/src/sections/hero/index.ts +2 -0
  33. package/templates/default/tsconfig.json +18 -0
@@ -0,0 +1,30 @@
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": "^0.2.0"
18
+ },
19
+ "devDependencies": {
20
+ "@types/react": "^19",
21
+ "@types/react-dom": "^19",
22
+ "esbuild": "^0.19.0",
23
+ "typescript": "^5.0.0"
24
+ },
25
+ "peerDependencies": {
26
+ "react": "^19.2.1",
27
+ "react-dom": "^19.2.1",
28
+ "next": ">=14.0.0"
29
+ }
30
+ }
@@ -0,0 +1,98 @@
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
+ };
@@ -0,0 +1,11 @@
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";
@@ -0,0 +1,23 @@
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
+ };
@@ -0,0 +1,47 @@
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;
@@ -0,0 +1,37 @@
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
+ };
@@ -0,0 +1,28 @@
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
+ }
@@ -0,0 +1,45 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export { FooterDefault } from "./footer-default";
2
+ export { footerSchema } from "./footer.schema";
@@ -0,0 +1,61 @@
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
+ }
@@ -0,0 +1,46 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export { HeaderDefault } from "./header-default";
2
+ export { headerSchema } from "./header.schema";
@@ -0,0 +1,52 @@
1
+ import React from "react";
2
+ import type { SectionComponentProps } from "@onexapis/core";
3
+
4
+ export function HeroDefault({ section, isEditing }: SectionComponentProps) {
5
+ const { settings } = section;
6
+
7
+ // Get settings with defaults
8
+ const title = (settings.title as string) || "Welcome to OneX";
9
+ const subtitle =
10
+ (settings.subtitle as string) || "Build amazing websites with themes";
11
+ const backgroundColor = (settings.backgroundColor as string) || "#3b82f6";
12
+ const textColor = (settings.textColor as string) || "#ffffff";
13
+
14
+ return (
15
+ <section
16
+ style={{
17
+ backgroundColor,
18
+ color: textColor,
19
+ minHeight: "500px",
20
+ display: "flex",
21
+ alignItems: "center",
22
+ justifyContent: "center",
23
+ padding: "4rem 2rem",
24
+ }}
25
+ data-section-id={section.id}
26
+ data-editable={isEditing}
27
+ >
28
+ <div style={{ maxWidth: "800px", textAlign: "center" }}>
29
+ <h1
30
+ style={{
31
+ fontSize: "3rem",
32
+ fontWeight: "bold",
33
+ marginBottom: "1rem",
34
+ }}
35
+ data-editable-field="title"
36
+ >
37
+ {title}
38
+ </h1>
39
+
40
+ <p
41
+ style={{
42
+ fontSize: "1.25rem",
43
+ opacity: 0.9,
44
+ }}
45
+ data-editable-field="subtitle"
46
+ >
47
+ {subtitle}
48
+ </p>
49
+ </div>
50
+ </section>
51
+ );
52
+ }
@@ -0,0 +1,52 @@
1
+ import type { SectionSchema } from "@onexapis/core";
2
+ import { HeroDefault } from "./hero-default";
3
+
4
+ export const heroSchema: SectionSchema = {
5
+ id: "hero",
6
+ name: "Hero Section",
7
+ description: "A hero section with title and subtitle",
8
+ icon: "layout",
9
+ category: "marketing",
10
+
11
+ // Available templates
12
+ templates: {
13
+ default: {
14
+ name: "Default Hero",
15
+ component: HeroDefault,
16
+ preview: undefined,
17
+ },
18
+ },
19
+
20
+ // Section settings schema
21
+ settingsSchema: {
22
+ title: {
23
+ type: "text",
24
+ label: "Title",
25
+ default: "Welcome to OneX",
26
+ required: true,
27
+ },
28
+ subtitle: {
29
+ type: "textarea",
30
+ label: "Subtitle",
31
+ default: "Build amazing websites with themes",
32
+ },
33
+ backgroundColor: {
34
+ type: "color",
35
+ label: "Background Color",
36
+ default: "#3b82f6",
37
+ },
38
+ textColor: {
39
+ type: "color",
40
+ label: "Text Color",
41
+ default: "#ffffff",
42
+ },
43
+ },
44
+
45
+ // Default settings
46
+ defaultSettings: {
47
+ title: "Welcome to OneX",
48
+ subtitle: "Build amazing websites with themes",
49
+ backgroundColor: "#3b82f6",
50
+ textColor: "#ffffff",
51
+ },
52
+ };
@@ -0,0 +1,2 @@
1
+ export { HeroDefault } from "./hero-default";
2
+ export { heroSchema } from "./hero.schema";
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "jsx": "react-jsx",
7
+ "strict": true,
8
+ "esModuleInterop": true,
9
+ "skipLibCheck": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "resolveJsonModule": true,
12
+ "declaration": false,
13
+ "outDir": "dist",
14
+ "rootDir": "src"
15
+ },
16
+ "include": ["src/**/*"],
17
+ "exclude": ["node_modules", "dist"]
18
+ }