@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.
- package/README.md +332 -0
- package/bin/onex.js +4 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +2507 -0
- package/dist/cli.js.map +1 -0
- package/dist/cli.mjs +2492 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.d.mts +167 -0
- package/dist/index.d.ts +167 -0
- package/dist/index.js +2104 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2063 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +80 -0
- package/templates/default/README.md.ejs +129 -0
- package/templates/default/esbuild.config.js +81 -0
- package/templates/default/package.json.ejs +30 -0
- package/templates/default/src/config.ts.ejs +98 -0
- package/templates/default/src/index.ts.ejs +11 -0
- package/templates/default/src/layout.ts +23 -0
- package/templates/default/src/manifest.ts.ejs +47 -0
- package/templates/default/src/pages/home.ts.ejs +37 -0
- package/templates/default/src/sections/footer/footer-default.tsx +28 -0
- package/templates/default/src/sections/footer/footer.schema.ts +45 -0
- package/templates/default/src/sections/footer/index.ts +2 -0
- package/templates/default/src/sections/header/header-default.tsx +61 -0
- package/templates/default/src/sections/header/header.schema.ts +46 -0
- package/templates/default/src/sections/header/index.ts +2 -0
- package/templates/default/src/sections/hero/hero-default.tsx +52 -0
- package/templates/default/src/sections/hero/hero.schema.ts +52 -0
- package/templates/default/src/sections/hero/index.ts +2 -0
- package/templates/default/tsconfig.json +18 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
interface InitOptions {
|
|
2
|
+
template?: string;
|
|
3
|
+
noInstall?: boolean;
|
|
4
|
+
git?: boolean;
|
|
5
|
+
yes?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare function initCommand(projectName?: string, options?: InitOptions): Promise<void>;
|
|
8
|
+
|
|
9
|
+
interface CreateSectionOptions {
|
|
10
|
+
theme?: string;
|
|
11
|
+
category?: string;
|
|
12
|
+
template?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function createSectionCommand(name: string, options: CreateSectionOptions): Promise<void>;
|
|
15
|
+
|
|
16
|
+
interface CreateBlockOptions {
|
|
17
|
+
theme?: string;
|
|
18
|
+
}
|
|
19
|
+
declare function createBlockCommand(name: string, options: CreateBlockOptions): Promise<void>;
|
|
20
|
+
|
|
21
|
+
interface CreateComponentOptions {
|
|
22
|
+
type?: string;
|
|
23
|
+
}
|
|
24
|
+
declare function createComponentCommand(name: string, options: CreateComponentOptions): Promise<void>;
|
|
25
|
+
|
|
26
|
+
interface ListOptions {
|
|
27
|
+
sections?: boolean;
|
|
28
|
+
blocks?: boolean;
|
|
29
|
+
components?: boolean;
|
|
30
|
+
theme?: string;
|
|
31
|
+
}
|
|
32
|
+
declare function listCommand(options: ListOptions): Promise<void>;
|
|
33
|
+
|
|
34
|
+
interface BuildOptions {
|
|
35
|
+
theme?: string;
|
|
36
|
+
production?: boolean;
|
|
37
|
+
watch?: boolean;
|
|
38
|
+
}
|
|
39
|
+
declare function buildCommand(options: BuildOptions): Promise<void>;
|
|
40
|
+
|
|
41
|
+
interface UploadOptions {
|
|
42
|
+
theme?: string;
|
|
43
|
+
bucket?: string;
|
|
44
|
+
version?: string;
|
|
45
|
+
environment?: "staging" | "production";
|
|
46
|
+
dryRun?: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Upload theme to S3
|
|
50
|
+
*/
|
|
51
|
+
declare function uploadCommand(options: UploadOptions): Promise<void>;
|
|
52
|
+
|
|
53
|
+
interface DownloadOptions {
|
|
54
|
+
themeId?: string;
|
|
55
|
+
version?: string;
|
|
56
|
+
bucket?: string;
|
|
57
|
+
environment?: "staging" | "production";
|
|
58
|
+
output?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Download theme from S3
|
|
62
|
+
*/
|
|
63
|
+
declare function downloadCommand(options: DownloadOptions): Promise<void>;
|
|
64
|
+
|
|
65
|
+
declare class Logger {
|
|
66
|
+
private spinner;
|
|
67
|
+
success(message: string): void;
|
|
68
|
+
error(message: string): void;
|
|
69
|
+
warning(message: string): void;
|
|
70
|
+
info(message: string): void;
|
|
71
|
+
log(message: string): void;
|
|
72
|
+
startSpinner(message: string): void;
|
|
73
|
+
stopSpinner(success?: boolean, message?: string): void;
|
|
74
|
+
updateSpinner(message: string): void;
|
|
75
|
+
newLine(): void;
|
|
76
|
+
header(message: string): void;
|
|
77
|
+
section(message: string): void;
|
|
78
|
+
}
|
|
79
|
+
declare const logger: Logger;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Render a template file with EJS
|
|
83
|
+
*/
|
|
84
|
+
declare function renderTemplate(templatePath: string, data: Record<string, unknown>): Promise<string>;
|
|
85
|
+
/**
|
|
86
|
+
* Write a file with directory creation
|
|
87
|
+
*/
|
|
88
|
+
declare function writeFile(filePath: string, content: string): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Copy template directory
|
|
91
|
+
*/
|
|
92
|
+
declare function copyTemplate(templateName: string, targetDir: string, data: Record<string, unknown>): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Get project root directory
|
|
95
|
+
*/
|
|
96
|
+
declare function getProjectRoot(): string;
|
|
97
|
+
/**
|
|
98
|
+
* Get themes directory
|
|
99
|
+
*/
|
|
100
|
+
declare function getThemesDir(): string;
|
|
101
|
+
/**
|
|
102
|
+
* Get features directory
|
|
103
|
+
*/
|
|
104
|
+
declare function getFeaturesDir(): string;
|
|
105
|
+
/**
|
|
106
|
+
* Check if running in OneX project
|
|
107
|
+
*/
|
|
108
|
+
declare function isOneXProject(): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Ensure running in OneX project
|
|
111
|
+
*/
|
|
112
|
+
declare function ensureOneXProject(): void;
|
|
113
|
+
/**
|
|
114
|
+
* List available themes
|
|
115
|
+
*/
|
|
116
|
+
declare function listThemes(): string[];
|
|
117
|
+
/**
|
|
118
|
+
* Check if theme exists
|
|
119
|
+
*/
|
|
120
|
+
declare function themeExists(themeName: string): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Detect package manager (npm, yarn, pnpm, bun)
|
|
123
|
+
*/
|
|
124
|
+
declare function detectPackageManager(): "npm" | "yarn" | "pnpm" | "bun";
|
|
125
|
+
/**
|
|
126
|
+
* Install dependencies in a directory
|
|
127
|
+
*/
|
|
128
|
+
declare function installDependencies(projectPath: string, packageManager?: "npm" | "yarn" | "pnpm" | "bun"): Promise<void>;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Validation utilities for CLI inputs
|
|
132
|
+
*/
|
|
133
|
+
/**
|
|
134
|
+
* Validate component/section/block name
|
|
135
|
+
* Must be kebab-case and alphanumeric
|
|
136
|
+
*/
|
|
137
|
+
declare function validateName(name: string): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Convert string to kebab-case
|
|
140
|
+
*/
|
|
141
|
+
declare function toKebabCase(str: string): string;
|
|
142
|
+
/**
|
|
143
|
+
* Convert string to PascalCase
|
|
144
|
+
*/
|
|
145
|
+
declare function toPascalCase(str: string): string;
|
|
146
|
+
/**
|
|
147
|
+
* Convert string to camelCase
|
|
148
|
+
*/
|
|
149
|
+
declare function toCamelCase(str: string): string;
|
|
150
|
+
/**
|
|
151
|
+
* Validate theme name
|
|
152
|
+
*/
|
|
153
|
+
declare function validateThemeName(name: string): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Check if path exists
|
|
156
|
+
*/
|
|
157
|
+
declare function pathExists(filePath: string): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Validate section category
|
|
160
|
+
*/
|
|
161
|
+
declare function validateCategory(category: string): boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Get valid categories
|
|
164
|
+
*/
|
|
165
|
+
declare function getValidCategories(): string[];
|
|
166
|
+
|
|
167
|
+
export { Logger, buildCommand, copyTemplate, createBlockCommand, createComponentCommand, createSectionCommand, detectPackageManager, downloadCommand, ensureOneXProject, getFeaturesDir, getProjectRoot, getThemesDir, getValidCategories, initCommand, installDependencies, isOneXProject, listCommand, listThemes, logger, pathExists, renderTemplate, themeExists, toCamelCase, toKebabCase, toPascalCase, uploadCommand, validateCategory, validateName, validateThemeName, writeFile };
|