@object-ui/cli 0.3.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ObjectQL
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,195 @@
1
+ # Object UI CLI
2
+
3
+ CLI tool for Object UI - Build applications from JSON schemas.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g @object-ui/cli
9
+ ```
10
+
11
+ Or use with npx:
12
+
13
+ ```bash
14
+ npx @object-ui/cli serve app.json
15
+ ```
16
+
17
+ ## Commands
18
+
19
+ ### `objectui init [name]`
20
+
21
+ Create a new Object UI application with a sample schema.
22
+
23
+ ```bash
24
+ objectui init my-app
25
+ objectui init my-app --template form
26
+ objectui init . --template dashboard
27
+ ```
28
+
29
+ **Options:**
30
+ - `-t, --template <template>` - Template to use: `simple`, `form`, or `dashboard` (default: `dashboard`)
31
+
32
+ **Templates:**
33
+ - **simple**: A minimal getting started template
34
+ - **form**: A contact form with validation
35
+ - **dashboard**: A full dashboard with metrics and charts
36
+
37
+ ### `objectui dev [schema]`
38
+
39
+ Start a development server with hot reload. Opens browser automatically.
40
+
41
+ ```bash
42
+ objectui dev app.json
43
+ objectui dev my-schema.json --port 8080
44
+ objectui dev --no-open
45
+ ```
46
+
47
+ **Arguments:**
48
+ - `[schema]` - Path to JSON/YAML schema file (default: `app.json`)
49
+
50
+ **Options:**
51
+ - `-p, --port <port>` - Port to run the server on (default: `3000`)
52
+ - `-h, --host <host>` - Host to bind the server to (default: `localhost`)
53
+ - `--no-open` - Do not open browser automatically
54
+
55
+ ### `objectui build [schema]`
56
+
57
+ Build your application for production deployment.
58
+
59
+ ```bash
60
+ objectui build app.json
61
+ objectui build --out-dir build
62
+ objectui build --clean
63
+ ```
64
+
65
+ **Arguments:**
66
+ - `[schema]` - Path to JSON/YAML schema file (default: `app.json`)
67
+
68
+ **Options:**
69
+ - `-o, --out-dir <dir>` - Output directory (default: `dist`)
70
+ - `--clean` - Clean output directory before build
71
+
72
+ ### `objectui start`
73
+
74
+ Serve the production build locally.
75
+
76
+ ```bash
77
+ objectui start
78
+ objectui start --port 8080
79
+ objectui start --dir build
80
+ ```
81
+
82
+ **Options:**
83
+ - `-p, --port <port>` - Port to run the server on (default: `3000`)
84
+ - `-h, --host <host>` - Host to bind the server to (default: `0.0.0.0`)
85
+ - `-d, --dir <dir>` - Directory to serve (default: `dist`)
86
+
87
+ ### `objectui serve [schema]`
88
+
89
+ Start a development server (legacy command, use `dev` instead).
90
+
91
+ ```bash
92
+ objectui serve app.json
93
+ objectui serve my-schema.json --port 8080
94
+ ```
95
+
96
+ **Arguments:**
97
+ - `[schema]` - Path to JSON schema file (default: `app.json`)
98
+
99
+ **Options:**
100
+ - `-p, --port <port>` - Port to run the server on (default: `3000`)
101
+ - `-h, --host <host>` - Host to bind the server to (default: `localhost`)
102
+
103
+ ### `objectui lint`
104
+
105
+ Lint the generated application code using ESLint.
106
+
107
+ ```bash
108
+ objectui lint
109
+ objectui lint --fix
110
+ ```
111
+
112
+ **Options:**
113
+ - `--fix` - Automatically fix linting issues
114
+
115
+ **Note:** Run `objectui dev` first to generate the application before linting.
116
+
117
+ ### `objectui test`
118
+
119
+ Run tests for the application using Vitest.
120
+
121
+ ```bash
122
+ objectui test
123
+ objectui test --watch
124
+ objectui test --coverage
125
+ objectui test --ui
126
+ ```
127
+
128
+ **Options:**
129
+ - `-w, --watch` - Run tests in watch mode
130
+ - `-c, --coverage` - Generate test coverage report
131
+ - `--ui` - Run tests with Vitest UI
132
+
133
+ **Note:** Run `objectui dev` first to generate the application before testing.
134
+
135
+ ## Quick Start
136
+
137
+ 1. Create a new application:
138
+ ```bash
139
+ objectui init my-dashboard --template dashboard
140
+ cd my-dashboard
141
+ ```
142
+
143
+ 2. Start the development server:
144
+ ```bash
145
+ objectui dev app.json
146
+ ```
147
+
148
+ 3. Lint your code (optional):
149
+ ```bash
150
+ objectui lint
151
+ ```
152
+
153
+ 4. Run tests (optional):
154
+ ```bash
155
+ objectui test
156
+ ```
157
+
158
+ 5. Build for production:
159
+ ```bash
160
+ objectui build app.json
161
+ ```
162
+
163
+ 6. Serve the production build:
164
+ ```bash
165
+ objectui start
166
+ ```
167
+
168
+ Your app will be running at http://localhost:3000!
169
+
170
+ ## Example Schema
171
+
172
+ ```json
173
+ {
174
+ "type": "div",
175
+ "className": "min-h-screen flex items-center justify-center",
176
+ "body": {
177
+ "type": "card",
178
+ "title": "Hello World",
179
+ "body": {
180
+ "type": "text",
181
+ "content": "Welcome to Object UI!"
182
+ }
183
+ }
184
+ }
185
+ ```
186
+
187
+ ## Learn More
188
+
189
+ - [Object UI Documentation](https://www.objectui.org)
190
+ - [Schema Reference](https://www.objectui.org/docs/protocol/overview)
191
+ - [Component Library](https://www.objectui.org/docs/api/components)
192
+
193
+ ## License
194
+
195
+ MIT