@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.
- package/README.md +117 -51
- package/bin/onexthm.js +4 -0
- package/dist/cli.js +750 -328
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +747 -325
- package/dist/cli.mjs.map +1 -1
- package/dist/index.js +162 -299
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +162 -299
- package/dist/index.mjs.map +1 -1
- package/dist/preview/preview-app.tsx +175 -53
- package/package.json +14 -12
- 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
|
@@ -7,6 +7,7 @@ var path7 = require('path');
|
|
|
7
7
|
var fs6 = require('fs/promises');
|
|
8
8
|
var crypto = require('crypto');
|
|
9
9
|
var glob = require('glob');
|
|
10
|
+
var module$1 = require('module');
|
|
10
11
|
var fs2 = require('fs');
|
|
11
12
|
var child_process = require('child_process');
|
|
12
13
|
var inquirer = require('inquirer');
|
|
@@ -130,7 +131,7 @@ __export(compile_theme_exports, {
|
|
|
130
131
|
compilePreviewRuntime: () => compilePreviewRuntime,
|
|
131
132
|
compileStandaloneTheme: () => compileStandaloneTheme,
|
|
132
133
|
compileStandaloneThemeDev: () => compileStandaloneThemeDev,
|
|
133
|
-
generateManifest: () =>
|
|
134
|
+
generateManifest: () => generateManifest
|
|
134
135
|
});
|
|
135
136
|
async function resolveNodeModulesFile(startDir, relativePath) {
|
|
136
137
|
let dir = startDir;
|
|
@@ -277,6 +278,12 @@ function createThemeDepsStubPlugin(themePath) {
|
|
|
277
278
|
if (!result.errors.length) return result;
|
|
278
279
|
} catch {
|
|
279
280
|
}
|
|
281
|
+
try {
|
|
282
|
+
const req = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)) || __filename);
|
|
283
|
+
const resolved = req.resolve(args.path);
|
|
284
|
+
if (resolved) return { path: resolved, namespace: "file" };
|
|
285
|
+
} catch {
|
|
286
|
+
}
|
|
280
287
|
return { path: args.path, namespace };
|
|
281
288
|
});
|
|
282
289
|
};
|
|
@@ -285,11 +292,19 @@ function createThemeDepsStubPlugin(themePath) {
|
|
|
285
292
|
const stubs = {
|
|
286
293
|
"next/image": `
|
|
287
294
|
import React from 'react';
|
|
288
|
-
const Image = (props) => {
|
|
289
|
-
const { src, alt, width, height, fill, priority, ...rest } = props;
|
|
295
|
+
const Image = React.forwardRef((props, ref) => {
|
|
296
|
+
const { src, alt, width, height, fill, priority, sizes, quality, placeholder, blurDataURL, onLoad, onError, style, className, ...rest } = props;
|
|
290
297
|
const imgSrc = typeof src === 'object' ? src.src : src;
|
|
291
|
-
|
|
292
|
-
};
|
|
298
|
+
const fillStyle = fill ? { position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: style?.objectFit || 'cover', display: 'block' } : {};
|
|
299
|
+
const mergedStyle = { ...fillStyle, ...style };
|
|
300
|
+
return React.createElement('img', {
|
|
301
|
+
ref, src: imgSrc, alt,
|
|
302
|
+
width: fill ? undefined : width, height: fill ? undefined : height,
|
|
303
|
+
loading: priority ? 'eager' : 'lazy',
|
|
304
|
+
style: Object.keys(mergedStyle).length > 0 ? mergedStyle : undefined,
|
|
305
|
+
className, onLoad, onError, ...rest,
|
|
306
|
+
});
|
|
307
|
+
});
|
|
293
308
|
export default Image;
|
|
294
309
|
`,
|
|
295
310
|
"next/link": `
|
|
@@ -323,7 +338,10 @@ export function headers() { return new Headers(); }
|
|
|
323
338
|
if (!lucideThemeScanned) {
|
|
324
339
|
lucideThemeScanned = true;
|
|
325
340
|
try {
|
|
326
|
-
const scanned = await scanImportsFromPackage(
|
|
341
|
+
const scanned = await scanImportsFromPackage(
|
|
342
|
+
themePath,
|
|
343
|
+
"lucide-react"
|
|
344
|
+
);
|
|
327
345
|
for (const names of Object.values(scanned)) {
|
|
328
346
|
for (const name of names) lucideImports.add(name);
|
|
329
347
|
}
|
|
@@ -386,10 +404,13 @@ export function useFormContext() { return useForm(); }
|
|
|
386
404
|
loader: "js"
|
|
387
405
|
}));
|
|
388
406
|
tryResolveOrStub(/^@hookform\/resolvers/, "hookform-resolvers-stub");
|
|
389
|
-
build2.onLoad(
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
407
|
+
build2.onLoad(
|
|
408
|
+
{ filter: /.*/, namespace: "hookform-resolvers-stub" },
|
|
409
|
+
() => ({
|
|
410
|
+
contents: `export function zodResolver() { return () => ({ values: {}, errors: {} }); }`,
|
|
411
|
+
loader: "js"
|
|
412
|
+
})
|
|
413
|
+
);
|
|
393
414
|
tryResolveOrStub(/^next-intl$/, "next-intl-stub");
|
|
394
415
|
build2.onLoad({ filter: /.*/, namespace: "next-intl-stub" }, () => ({
|
|
395
416
|
contents: `
|
|
@@ -554,7 +575,7 @@ async function extractDataRequirements(themePath) {
|
|
|
554
575
|
}
|
|
555
576
|
return requirements;
|
|
556
577
|
}
|
|
557
|
-
async function
|
|
578
|
+
async function generateManifest(themeName, themePath, outputDir) {
|
|
558
579
|
let version = "1.0.0";
|
|
559
580
|
let themeId = themeName;
|
|
560
581
|
try {
|
|
@@ -647,7 +668,11 @@ async function compileStandaloneTheme(themePath, themeName) {
|
|
|
647
668
|
banner: {
|
|
648
669
|
js: '"use client";'
|
|
649
670
|
},
|
|
650
|
-
plugins: [
|
|
671
|
+
plugins: [
|
|
672
|
+
reactGlobalPlugin,
|
|
673
|
+
createCoreGlobalPlugin(themePath),
|
|
674
|
+
createThemeDepsStubPlugin(themePath)
|
|
675
|
+
],
|
|
651
676
|
external: [],
|
|
652
677
|
alias: {
|
|
653
678
|
events: "events/",
|
|
@@ -685,7 +710,7 @@ async function compileStandaloneTheme(themePath, themeName) {
|
|
|
685
710
|
} catch {
|
|
686
711
|
}
|
|
687
712
|
await contentHashEntry(outputDir);
|
|
688
|
-
await
|
|
713
|
+
await generateManifest(themeName, themePath, outputDir);
|
|
689
714
|
await generateThemeData(themePath, outputDir, themeName);
|
|
690
715
|
if (result.metafile) {
|
|
691
716
|
const outputs = result.metafile.outputs;
|
|
@@ -729,7 +754,11 @@ async function compileStandaloneThemeDev(themePath, themeName) {
|
|
|
729
754
|
banner: {
|
|
730
755
|
js: '"use client";'
|
|
731
756
|
},
|
|
732
|
-
plugins: [
|
|
757
|
+
plugins: [
|
|
758
|
+
reactGlobalPlugin,
|
|
759
|
+
createCoreGlobalPlugin(themePath),
|
|
760
|
+
createThemeDepsStubPlugin(themePath)
|
|
761
|
+
],
|
|
733
762
|
external: [],
|
|
734
763
|
alias: {
|
|
735
764
|
events: "events/",
|
|
@@ -762,7 +791,7 @@ async function compileStandaloneThemeDev(themePath, themeName) {
|
|
|
762
791
|
};
|
|
763
792
|
const context2 = await esbuild__namespace.context(buildOptions);
|
|
764
793
|
await context2.rebuild();
|
|
765
|
-
await
|
|
794
|
+
await generateManifest(themeName, themePath, outputDir);
|
|
766
795
|
await generateThemeData(themePath, outputDir, themeName);
|
|
767
796
|
return { context: context2, outputDir };
|
|
768
797
|
}
|
|
@@ -864,7 +893,16 @@ ${locations.join("\n")}`
|
|
|
864
893
|
path7__default.default.join(themePath, "node_modules", "@onexapis", "core", "src"),
|
|
865
894
|
path7__default.default.join(themePath, "..", "..", "packages", "core", "src"),
|
|
866
895
|
// monorepo sibling
|
|
867
|
-
path7__default.default.join(
|
|
896
|
+
path7__default.default.join(
|
|
897
|
+
__dirname,
|
|
898
|
+
"..",
|
|
899
|
+
"..",
|
|
900
|
+
"..",
|
|
901
|
+
"..",
|
|
902
|
+
"packages",
|
|
903
|
+
"core",
|
|
904
|
+
"src"
|
|
905
|
+
)
|
|
868
906
|
// from CLI src
|
|
869
907
|
];
|
|
870
908
|
let coreSourceDir = null;
|
|
@@ -878,7 +916,10 @@ ${locations.join("\n")}`
|
|
|
878
916
|
}
|
|
879
917
|
if (coreSourceDir) {
|
|
880
918
|
try {
|
|
881
|
-
const scanned = await scanImportsFromPackage(
|
|
919
|
+
const scanned = await scanImportsFromPackage(
|
|
920
|
+
coreSourceDir,
|
|
921
|
+
"lucide-react"
|
|
922
|
+
);
|
|
882
923
|
for (const names of Object.values(scanned)) {
|
|
883
924
|
for (const name of names) lucideIconNames.add(name);
|
|
884
925
|
}
|
|
@@ -899,7 +940,10 @@ ${locations.join("\n")}`
|
|
|
899
940
|
const mjsFiles = await glob.glob("*.mjs", { cwd: candidate });
|
|
900
941
|
const importRegex = /import\s*\{([^}]+)\}\s*from\s*["']lucide-react["']/g;
|
|
901
942
|
for (const file of mjsFiles) {
|
|
902
|
-
const content = await fs6__default.default.readFile(
|
|
943
|
+
const content = await fs6__default.default.readFile(
|
|
944
|
+
path7__default.default.join(candidate, file),
|
|
945
|
+
"utf-8"
|
|
946
|
+
);
|
|
903
947
|
for (const match of content.matchAll(importRegex)) {
|
|
904
948
|
for (const name of match[1].split(",")) {
|
|
905
949
|
const original = name.trim().split(/\s+as\s+/)[0].trim();
|
|
@@ -915,7 +959,10 @@ ${locations.join("\n")}`
|
|
|
915
959
|
}
|
|
916
960
|
}
|
|
917
961
|
try {
|
|
918
|
-
const scanned = await scanImportsFromPackage(
|
|
962
|
+
const scanned = await scanImportsFromPackage(
|
|
963
|
+
themePath,
|
|
964
|
+
"lucide-react"
|
|
965
|
+
);
|
|
919
966
|
for (const names of Object.values(scanned)) {
|
|
920
967
|
for (const name of names) lucideIconNames.add(name);
|
|
921
968
|
}
|
|
@@ -945,14 +992,39 @@ export default new Proxy({}, { get: (_, name) => name === '__esModule' ? true :
|
|
|
945
992
|
if (!result.errors.length) return result;
|
|
946
993
|
} catch {
|
|
947
994
|
}
|
|
995
|
+
try {
|
|
996
|
+
const req = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)) || __filename);
|
|
997
|
+
const cjsPath = req.resolve("framer-motion");
|
|
998
|
+
const pkgDir = cjsPath.replace(/[/\\]dist[/\\].*$/, "");
|
|
999
|
+
const esmEntry = path7__default.default.join(pkgDir, "dist", "es", "index.mjs");
|
|
1000
|
+
const { existsSync } = await import('fs');
|
|
1001
|
+
if (existsSync(esmEntry)) {
|
|
1002
|
+
return { path: esmEntry, namespace: "file" };
|
|
1003
|
+
}
|
|
1004
|
+
return { path: cjsPath, namespace: "file" };
|
|
1005
|
+
} catch {
|
|
1006
|
+
}
|
|
948
1007
|
return { path: args.path, namespace: "motion-stub" };
|
|
949
1008
|
});
|
|
950
1009
|
build2.onLoad({ filter: /.*/, namespace: "motion-stub" }, () => ({
|
|
951
1010
|
contents: `
|
|
952
|
-
|
|
953
|
-
const
|
|
1011
|
+
import React from 'react';
|
|
1012
|
+
const MotionComponent = React.forwardRef((props, ref) => {
|
|
1013
|
+
const { initial, animate, exit, variants, transition, whileInView, whileHover, whileTap, viewport, onAnimationComplete, layout, layoutId, style, className, ...rest } = props;
|
|
1014
|
+
return React.createElement(rest.as || 'div', { ref, style, className, ...rest }, rest.children);
|
|
1015
|
+
});
|
|
1016
|
+
const handler = { get: (_, name) => {
|
|
1017
|
+
if (name === '__esModule') return true;
|
|
1018
|
+
if (name === 'create') return () => new Proxy({}, handler);
|
|
1019
|
+
return MotionComponent;
|
|
1020
|
+
}};
|
|
954
1021
|
export const motion = new Proxy({}, handler);
|
|
955
|
-
export const AnimatePresence =
|
|
1022
|
+
export const AnimatePresence = (props) => props.children || null;
|
|
1023
|
+
export const useInView = () => true;
|
|
1024
|
+
export const useAnimation = () => ({ start: () => {}, stop: () => {}, set: () => {} });
|
|
1025
|
+
export const useMotionValue = (v) => ({ get: () => v, set: () => {}, onChange: () => () => {} });
|
|
1026
|
+
export const useTransform = (v) => v;
|
|
1027
|
+
export const useScroll = () => ({ scrollY: { get: () => 0, onChange: () => () => {} }, scrollYProgress: { get: () => 0, onChange: () => () => {} } });
|
|
956
1028
|
export default { motion, AnimatePresence };
|
|
957
1029
|
`.trim(),
|
|
958
1030
|
loader: "jsx"
|
|
@@ -975,12 +1047,26 @@ export default { motion, AnimatePresence };
|
|
|
975
1047
|
build2.onLoad({ filter: /.*/, namespace: "next-stub" }, (args) => {
|
|
976
1048
|
const stubs = {
|
|
977
1049
|
"next/image": `
|
|
978
|
-
const Image = (props) => {
|
|
979
|
-
const { src, alt, width, height, fill, priority, ...rest } = props;
|
|
980
|
-
const imgSrc = typeof src === 'object' ? src.src : src;
|
|
981
|
-
return React.createElement('img', { src: imgSrc, alt, width: fill ? undefined : width, height: fill ? undefined : height, loading: priority ? 'eager' : 'lazy', ...rest });
|
|
982
|
-
};
|
|
983
1050
|
import React from 'react';
|
|
1051
|
+
const Image = React.forwardRef((props, ref) => {
|
|
1052
|
+
const { src, alt, width, height, fill, priority, sizes, quality, placeholder, blurDataURL, onLoad, onError, style, className, ...rest } = props;
|
|
1053
|
+
const imgSrc = typeof src === 'object' ? src.src : src;
|
|
1054
|
+
const fillStyle = fill ? { position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: style?.objectFit || 'cover', display: 'block' } : {};
|
|
1055
|
+
const mergedStyle = { ...fillStyle, ...style };
|
|
1056
|
+
return React.createElement('img', {
|
|
1057
|
+
ref,
|
|
1058
|
+
src: imgSrc,
|
|
1059
|
+
alt,
|
|
1060
|
+
width: fill ? undefined : width,
|
|
1061
|
+
height: fill ? undefined : height,
|
|
1062
|
+
loading: priority ? 'eager' : 'lazy',
|
|
1063
|
+
style: Object.keys(mergedStyle).length > 0 ? mergedStyle : undefined,
|
|
1064
|
+
className,
|
|
1065
|
+
onLoad,
|
|
1066
|
+
onError,
|
|
1067
|
+
...rest,
|
|
1068
|
+
});
|
|
1069
|
+
});
|
|
984
1070
|
export default Image;
|
|
985
1071
|
`,
|
|
986
1072
|
"next/link": `
|
|
@@ -1465,45 +1551,20 @@ async function initCommand(projectName, options = {}) {
|
|
|
1465
1551
|
try {
|
|
1466
1552
|
fs2__default.default.mkdirSync(projectPath, { recursive: true });
|
|
1467
1553
|
await copyTemplate(template, projectPath, data);
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
const layoutContent = generateThemeLayout(data);
|
|
1475
|
-
await writeFile(path7__default.default.join(srcPath, "layout.ts"), layoutContent);
|
|
1476
|
-
const indexContent = generateThemeIndex(data);
|
|
1477
|
-
await writeFile(path7__default.default.join(srcPath, "index.ts"), indexContent);
|
|
1478
|
-
const sectionsPath = path7__default.default.join(srcPath, "sections");
|
|
1479
|
-
fs2__default.default.mkdirSync(sectionsPath, { recursive: true });
|
|
1480
|
-
await writeFile(
|
|
1481
|
-
path7__default.default.join(sectionsPath, "README.md"),
|
|
1482
|
-
`# ${displayName} Sections
|
|
1483
|
-
|
|
1484
|
-
Add your theme-specific sections here.
|
|
1485
|
-
`
|
|
1486
|
-
);
|
|
1487
|
-
const blocksPath = path7__default.default.join(srcPath, "blocks");
|
|
1488
|
-
fs2__default.default.mkdirSync(blocksPath, { recursive: true });
|
|
1489
|
-
await writeFile(
|
|
1490
|
-
path7__default.default.join(blocksPath, "README.md"),
|
|
1491
|
-
`# ${displayName} Blocks
|
|
1492
|
-
|
|
1493
|
-
Add your theme-specific blocks here.
|
|
1494
|
-
`
|
|
1554
|
+
await renameThemeInFiles(
|
|
1555
|
+
projectPath,
|
|
1556
|
+
name,
|
|
1557
|
+
displayName,
|
|
1558
|
+
description,
|
|
1559
|
+
author
|
|
1495
1560
|
);
|
|
1496
|
-
const pagesPath = path7__default.default.join(srcPath, "pages");
|
|
1497
|
-
fs2__default.default.mkdirSync(pagesPath, { recursive: true });
|
|
1498
|
-
const homePageContent = generateHomePage(data);
|
|
1499
|
-
await writeFile(path7__default.default.join(pagesPath, "home.ts"), homePageContent);
|
|
1500
1561
|
exports.logger.stopSpinner(true, "Project structure created!");
|
|
1501
1562
|
if (options.git) {
|
|
1502
1563
|
exports.logger.startSpinner("Initializing git repository...");
|
|
1503
1564
|
try {
|
|
1504
1565
|
child_process.execSync("git init", { cwd: projectPath, stdio: "ignore" });
|
|
1505
1566
|
child_process.execSync("git add .", { cwd: projectPath, stdio: "ignore" });
|
|
1506
|
-
child_process.execSync('git commit -m "Initial commit from
|
|
1567
|
+
child_process.execSync('git commit -m "Initial commit from onexthm init"', {
|
|
1507
1568
|
cwd: projectPath,
|
|
1508
1569
|
stdio: "ignore"
|
|
1509
1570
|
});
|
|
@@ -1540,14 +1601,14 @@ Add your theme-specific blocks here.
|
|
|
1540
1601
|
exports.logger.log(` npm run dev # Start development mode`);
|
|
1541
1602
|
exports.logger.newLine();
|
|
1542
1603
|
exports.logger.section("Theme structure:");
|
|
1543
|
-
exports.logger.log("
|
|
1604
|
+
exports.logger.log(" bundle-entry.ts - Theme manifest and exports");
|
|
1544
1605
|
exports.logger.log(
|
|
1545
|
-
"
|
|
1606
|
+
" theme.config.ts - Design tokens (colors, typography, etc.)"
|
|
1546
1607
|
);
|
|
1547
|
-
exports.logger.log("
|
|
1548
|
-
exports.logger.log("
|
|
1549
|
-
exports.logger.log("
|
|
1550
|
-
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");
|
|
1551
1612
|
exports.logger.newLine();
|
|
1552
1613
|
exports.logger.success(`Happy theming! \u{1F3A8}`);
|
|
1553
1614
|
} catch (error) {
|
|
@@ -1561,231 +1622,33 @@ Add your theme-specific blocks here.
|
|
|
1561
1622
|
process.exit(1);
|
|
1562
1623
|
}
|
|
1563
1624
|
}
|
|
1564
|
-
function
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
// Example: productCard: () => import("./blocks/product-card").then((m) => m.productCardDefinition),
|
|
1592
|
-
},
|
|
1593
|
-
|
|
1594
|
-
// Default pages
|
|
1595
|
-
pages: {
|
|
1596
|
-
home: () => import("./pages/home").then((m) => m.homePageConfig),
|
|
1597
|
-
},
|
|
1598
|
-
|
|
1599
|
-
// Supported page types
|
|
1600
|
-
supportedPageTypes: ["home", "about", "contact", "custom"],
|
|
1601
|
-
|
|
1602
|
-
// Preview image (optional)
|
|
1603
|
-
preview: undefined,
|
|
1604
|
-
|
|
1605
|
-
// Tags for categorization (optional)
|
|
1606
|
-
tags: ["custom"],
|
|
1607
|
-
};
|
|
1608
|
-
|
|
1609
|
-
export default manifest;
|
|
1610
|
-
`;
|
|
1611
|
-
}
|
|
1612
|
-
function generateThemeConfig(data) {
|
|
1613
|
-
return `import type { ThemeConfig } from "@onexapis/core";
|
|
1614
|
-
|
|
1615
|
-
/**
|
|
1616
|
-
* ${data.displayName} Theme Configuration
|
|
1617
|
-
* Design tokens: colors, typography, spacing, etc.
|
|
1618
|
-
*/
|
|
1619
|
-
export const themeConfig: ThemeConfig = {
|
|
1620
|
-
// Color palette
|
|
1621
|
-
colors: {
|
|
1622
|
-
primary: {
|
|
1623
|
-
50: "#eff6ff",
|
|
1624
|
-
100: "#dbeafe",
|
|
1625
|
-
200: "#bfdbfe",
|
|
1626
|
-
300: "#93c5fd",
|
|
1627
|
-
400: "#60a5fa",
|
|
1628
|
-
500: "#3b82f6",
|
|
1629
|
-
600: "#2563eb",
|
|
1630
|
-
700: "#1d4ed8",
|
|
1631
|
-
800: "#1e40af",
|
|
1632
|
-
900: "#1e3a8a",
|
|
1633
|
-
},
|
|
1634
|
-
secondary: {
|
|
1635
|
-
50: "#f8fafc",
|
|
1636
|
-
100: "#f1f5f9",
|
|
1637
|
-
200: "#e2e8f0",
|
|
1638
|
-
300: "#cbd5e1",
|
|
1639
|
-
400: "#94a3b8",
|
|
1640
|
-
500: "#64748b",
|
|
1641
|
-
600: "#475569",
|
|
1642
|
-
700: "#334155",
|
|
1643
|
-
800: "#1e293b",
|
|
1644
|
-
900: "#0f172a",
|
|
1645
|
-
},
|
|
1646
|
-
accent: {
|
|
1647
|
-
50: "#fdf4ff",
|
|
1648
|
-
100: "#fae8ff",
|
|
1649
|
-
200: "#f5d0fe",
|
|
1650
|
-
300: "#f0abfc",
|
|
1651
|
-
400: "#e879f9",
|
|
1652
|
-
500: "#d946ef",
|
|
1653
|
-
600: "#c026d3",
|
|
1654
|
-
700: "#a21caf",
|
|
1655
|
-
800: "#86198f",
|
|
1656
|
-
900: "#701a75",
|
|
1657
|
-
},
|
|
1658
|
-
},
|
|
1659
|
-
|
|
1660
|
-
// Typography
|
|
1661
|
-
typography: {
|
|
1662
|
-
fontFamily: {
|
|
1663
|
-
sans: ["Inter", "system-ui", "sans-serif"],
|
|
1664
|
-
serif: ["Georgia", "serif"],
|
|
1665
|
-
mono: ["Monaco", "monospace"],
|
|
1666
|
-
},
|
|
1667
|
-
fontSize: {
|
|
1668
|
-
xs: "0.75rem",
|
|
1669
|
-
sm: "0.875rem",
|
|
1670
|
-
base: "1rem",
|
|
1671
|
-
lg: "1.125rem",
|
|
1672
|
-
xl: "1.25rem",
|
|
1673
|
-
"2xl": "1.5rem",
|
|
1674
|
-
"3xl": "1.875rem",
|
|
1675
|
-
"4xl": "2.25rem",
|
|
1676
|
-
"5xl": "3rem",
|
|
1677
|
-
},
|
|
1678
|
-
},
|
|
1679
|
-
|
|
1680
|
-
// Spacing
|
|
1681
|
-
spacing: {
|
|
1682
|
-
xs: "0.5rem",
|
|
1683
|
-
sm: "1rem",
|
|
1684
|
-
md: "1.5rem",
|
|
1685
|
-
lg: "2rem",
|
|
1686
|
-
xl: "3rem",
|
|
1687
|
-
"2xl": "4rem",
|
|
1688
|
-
"3xl": "6rem",
|
|
1689
|
-
"4xl": "8rem",
|
|
1690
|
-
},
|
|
1691
|
-
|
|
1692
|
-
// Border radius
|
|
1693
|
-
borderRadius: {
|
|
1694
|
-
none: "0",
|
|
1695
|
-
sm: "0.125rem",
|
|
1696
|
-
md: "0.375rem",
|
|
1697
|
-
lg: "0.5rem",
|
|
1698
|
-
xl: "0.75rem",
|
|
1699
|
-
full: "9999px",
|
|
1700
|
-
},
|
|
1701
|
-
|
|
1702
|
-
// Breakpoints
|
|
1703
|
-
breakpoints: {
|
|
1704
|
-
sm: "640px",
|
|
1705
|
-
md: "768px",
|
|
1706
|
-
lg: "1024px",
|
|
1707
|
-
xl: "1280px",
|
|
1708
|
-
"2xl": "1536px",
|
|
1709
|
-
},
|
|
1710
|
-
};
|
|
1711
|
-
`;
|
|
1712
|
-
}
|
|
1713
|
-
function generateThemeLayout(data) {
|
|
1714
|
-
return `import type { ThemeLayoutConfig } from "@onexapis/core";
|
|
1715
|
-
|
|
1716
|
-
/**
|
|
1717
|
-
* ${data.themeName} Theme Layout
|
|
1718
|
-
* Define header and footer sections
|
|
1719
|
-
*/
|
|
1720
|
-
export const themeLayout: ThemeLayoutConfig = {
|
|
1721
|
-
// Header section configuration
|
|
1722
|
-
header: undefined,
|
|
1723
|
-
// Example:
|
|
1724
|
-
// header: {
|
|
1725
|
-
// type: "header",
|
|
1726
|
-
// template: "default",
|
|
1727
|
-
// enabled: true,
|
|
1728
|
-
// settings: {},
|
|
1729
|
-
// },
|
|
1730
|
-
|
|
1731
|
-
// Footer section configuration
|
|
1732
|
-
footer: undefined,
|
|
1733
|
-
// Example:
|
|
1734
|
-
// footer: {
|
|
1735
|
-
// type: "footer",
|
|
1736
|
-
// template: "default",
|
|
1737
|
-
// enabled: true,
|
|
1738
|
-
// settings: {},
|
|
1739
|
-
// },
|
|
1740
|
-
};
|
|
1741
|
-
`;
|
|
1742
|
-
}
|
|
1743
|
-
function generateThemeIndex(data) {
|
|
1744
|
-
return `/**
|
|
1745
|
-
* ${data.themeNamePascal} Theme
|
|
1746
|
-
*/
|
|
1747
|
-
|
|
1748
|
-
export { manifest as ${data.themeNamePascal}Manifest } from "./manifest";
|
|
1749
|
-
export { themeConfig as ${data.themeNamePascal}Config } from "./config";
|
|
1750
|
-
export { themeLayout as ${data.themeNamePascal}Layout } from "./layout";
|
|
1751
|
-
`;
|
|
1752
|
-
}
|
|
1753
|
-
function generateHomePage(data) {
|
|
1754
|
-
return `import type { PageConfig } from "@onexapis/core";
|
|
1755
|
-
|
|
1756
|
-
/**
|
|
1757
|
-
* Home Page Configuration
|
|
1758
|
-
*/
|
|
1759
|
-
export const homePageConfig: PageConfig = {
|
|
1760
|
-
type: "home",
|
|
1761
|
-
title: "${data.displayName}",
|
|
1762
|
-
description: "Welcome to ${data.displayName}",
|
|
1763
|
-
|
|
1764
|
-
// SEO metadata
|
|
1765
|
-
seo: {
|
|
1766
|
-
title: "${data.displayName} - Home",
|
|
1767
|
-
description: "Welcome to ${data.displayName}",
|
|
1768
|
-
keywords: [],
|
|
1769
|
-
ogImage: undefined,
|
|
1770
|
-
},
|
|
1771
|
-
|
|
1772
|
-
// Page sections
|
|
1773
|
-
sections: [
|
|
1774
|
-
// Add your sections here
|
|
1775
|
-
// Example:
|
|
1776
|
-
// {
|
|
1777
|
-
// id: "hero-1",
|
|
1778
|
-
// type: "hero",
|
|
1779
|
-
// template: "default",
|
|
1780
|
-
// order: 0,
|
|
1781
|
-
// enabled: true,
|
|
1782
|
-
// settings: {},
|
|
1783
|
-
// components: [],
|
|
1784
|
-
// blocks: [],
|
|
1785
|
-
// },
|
|
1786
|
-
],
|
|
1787
|
-
};
|
|
1788
|
-
`;
|
|
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
|
+
}
|
|
1789
1652
|
}
|
|
1790
1653
|
|
|
1791
1654
|
// src/commands/create-section.ts
|
|
@@ -2671,7 +2534,7 @@ async function buildCommand(options) {
|
|
|
2671
2534
|
exports.logger.stopSpinner(true, "Lint passed");
|
|
2672
2535
|
const pkgJson = fs__default.default.readJsonSync(packageJsonPath);
|
|
2673
2536
|
const buildScript = pkgJson.scripts?.build || "";
|
|
2674
|
-
const isRecursive = buildScript.includes("
|
|
2537
|
+
const isRecursive = buildScript.includes("onexthm build") || buildScript.includes("onex-cli build");
|
|
2675
2538
|
exports.logger.startSpinner(
|
|
2676
2539
|
options.watch ? "Building (watch mode)..." : "Building..."
|
|
2677
2540
|
);
|
|
@@ -2762,7 +2625,7 @@ function getBucketName(env) {
|
|
|
2762
2625
|
return process.env.BUCKET_NAME;
|
|
2763
2626
|
}
|
|
2764
2627
|
const environment = env || process.env.ENVIRONMENT || "staging";
|
|
2765
|
-
return environment === "production" ? "
|
|
2628
|
+
return environment === "production" ? "theme-s3-bucket" : "theme-s3-bucket";
|
|
2766
2629
|
}
|
|
2767
2630
|
async function findCompiledThemeDir(themeId, version) {
|
|
2768
2631
|
const searchPaths = [path7__default.default.resolve(process.cwd(), "dist")];
|
|
@@ -2869,7 +2732,7 @@ async function uploadCommand(options) {
|
|
|
2869
2732
|
if (!compiledDir) {
|
|
2870
2733
|
spinner.fail(
|
|
2871
2734
|
chalk4__default.default.red(
|
|
2872
|
-
`Compiled theme not found for ${themeId}@${version}. Run '
|
|
2735
|
+
`Compiled theme not found for ${themeId}@${version}. Run 'onexthm build' first.`
|
|
2873
2736
|
)
|
|
2874
2737
|
);
|
|
2875
2738
|
exports.logger.info(chalk4__default.default.gray(`Expected location:
|
|
@@ -3031,7 +2894,7 @@ function getBucketName2(env) {
|
|
|
3031
2894
|
return process.env.BUCKET_NAME;
|
|
3032
2895
|
}
|
|
3033
2896
|
const environment = env || process.env.ENVIRONMENT || "staging";
|
|
3034
|
-
return environment === "production" ? "
|
|
2897
|
+
return environment === "production" ? "theme-s3-bucket" : "theme-s3-bucket";
|
|
3035
2898
|
}
|
|
3036
2899
|
async function streamToString(stream) {
|
|
3037
2900
|
const chunks = [];
|
|
@@ -3101,7 +2964,7 @@ function showDownloadFailureHelp(themeId, bucket) {
|
|
|
3101
2964
|
console.log(chalk4__default.default.white("1. Compile and upload the theme:"));
|
|
3102
2965
|
console.log(chalk4__default.default.gray(` cd themes/${themeId}`));
|
|
3103
2966
|
console.log(chalk4__default.default.gray(" pnpm build"));
|
|
3104
|
-
console.log(chalk4__default.default.gray("
|
|
2967
|
+
console.log(chalk4__default.default.gray(" onexthm upload"));
|
|
3105
2968
|
console.log();
|
|
3106
2969
|
console.log(chalk4__default.default.white("2. Verify AWS credentials are set:"));
|
|
3107
2970
|
console.log(
|
|
@@ -3232,7 +3095,7 @@ function getBucketName3(env) {
|
|
|
3232
3095
|
return process.env.BUCKET_NAME;
|
|
3233
3096
|
}
|
|
3234
3097
|
const environment = env || process.env.ENVIRONMENT || "staging";
|
|
3235
|
-
return environment === "production" ? "
|
|
3098
|
+
return environment === "production" ? "theme-s3-bucket" : "theme-s3-bucket";
|
|
3236
3099
|
}
|
|
3237
3100
|
async function streamToString2(stream) {
|
|
3238
3101
|
const chunks = [];
|
|
@@ -3403,7 +3266,7 @@ async function cloneCommand(themeName, options) {
|
|
|
3403
3266
|
chalk4__default.default.yellow("The theme source may not have been uploaded yet.")
|
|
3404
3267
|
);
|
|
3405
3268
|
console.log(
|
|
3406
|
-
chalk4__default.default.gray(`Upload source with:
|
|
3269
|
+
chalk4__default.default.gray(`Upload source with: onexthm upload --theme ${themeName}`)
|
|
3407
3270
|
);
|
|
3408
3271
|
console.log();
|
|
3409
3272
|
process.exit(1);
|
|
@@ -3430,7 +3293,7 @@ async function cloneCommand(themeName, options) {
|
|
|
3430
3293
|
[
|
|
3431
3294
|
"# API Configuration (enables real data in preview)",
|
|
3432
3295
|
"# Get your Company ID from the OneX dashboard",
|
|
3433
|
-
"NEXT_PUBLIC_API_URL=https://
|
|
3296
|
+
"NEXT_PUBLIC_API_URL=https://platform-dev.onexeos.com",
|
|
3434
3297
|
"NEXT_PUBLIC_COMPANY_ID=",
|
|
3435
3298
|
""
|
|
3436
3299
|
].join("\n")
|
|
@@ -3472,7 +3335,7 @@ async function cloneCommand(themeName, options) {
|
|
|
3472
3335
|
if (options.install === false) {
|
|
3473
3336
|
console.log(chalk4__default.default.gray(" pnpm install"));
|
|
3474
3337
|
}
|
|
3475
|
-
console.log(chalk4__default.default.gray("
|
|
3338
|
+
console.log(chalk4__default.default.gray(" onexthm build"));
|
|
3476
3339
|
console.log();
|
|
3477
3340
|
} catch (error) {
|
|
3478
3341
|
spinner.fail(chalk4__default.default.red(`Clone failed: ${error.message}`));
|