@lotics/cli 0.19.0 → 0.20.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.
|
@@ -10,11 +10,15 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Conventions (locked decisions):
|
|
12
12
|
* - Vite + React + TypeScript (strict mode).
|
|
13
|
-
* - Entry: src/App.tsx with `export default`. main.tsx wires `mount(<App/>)
|
|
13
|
+
* - Entry: src/App.tsx with `export default`. main.tsx wires `mount(<App/>)`
|
|
14
|
+
* and imports @lotics/ui/index.css for the base style reset.
|
|
14
15
|
* - Vite default `base: "/"` so emitted asset URLs are absolute; the render
|
|
15
16
|
* endpoint rewrites root-relative paths to `/v1/apps/{id}/asset/...`.
|
|
16
17
|
* Don't switch to `base: "./"` without updating `rewriteAssetPaths`.
|
|
17
|
-
* -
|
|
18
|
+
* - react-native aliased to react-native-web so @lotics/ui's RN primitives
|
|
19
|
+
* render in a pure-web environment. `.web.tsx` is prioritized in the
|
|
20
|
+
* resolve.extensions list.
|
|
21
|
+
* - @lotics/app-sdk + @lotics/ui peer-supplied; user installs both via npm.
|
|
18
22
|
* - oxlint + vitest + tsc out of the box, plus a GitHub Actions CI
|
|
19
23
|
* workflow that runs all three on every PR.
|
|
20
24
|
*/
|
|
@@ -10,11 +10,15 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Conventions (locked decisions):
|
|
12
12
|
* - Vite + React + TypeScript (strict mode).
|
|
13
|
-
* - Entry: src/App.tsx with `export default`. main.tsx wires `mount(<App/>)
|
|
13
|
+
* - Entry: src/App.tsx with `export default`. main.tsx wires `mount(<App/>)`
|
|
14
|
+
* and imports @lotics/ui/index.css for the base style reset.
|
|
14
15
|
* - Vite default `base: "/"` so emitted asset URLs are absolute; the render
|
|
15
16
|
* endpoint rewrites root-relative paths to `/v1/apps/{id}/asset/...`.
|
|
16
17
|
* Don't switch to `base: "./"` without updating `rewriteAssetPaths`.
|
|
17
|
-
* -
|
|
18
|
+
* - react-native aliased to react-native-web so @lotics/ui's RN primitives
|
|
19
|
+
* render in a pure-web environment. `.web.tsx` is prioritized in the
|
|
20
|
+
* resolve.extensions list.
|
|
21
|
+
* - @lotics/app-sdk + @lotics/ui peer-supplied; user installs both via npm.
|
|
18
22
|
* - oxlint + vitest + tsc out of the box, plus a GitHub Actions CI
|
|
19
23
|
* workflow that runs all three on every PR.
|
|
20
24
|
*/
|
|
@@ -43,9 +47,17 @@ export function buildStarterTemplate(args) {
|
|
|
43
47
|
test: "vitest run",
|
|
44
48
|
},
|
|
45
49
|
dependencies: {
|
|
46
|
-
"@lotics/app-sdk": "^0.
|
|
50
|
+
"@lotics/app-sdk": "^0.2.0",
|
|
51
|
+
"@lotics/ui": "^0.2.0",
|
|
52
|
+
"@react-native-picker/picker": "^2.7.0",
|
|
53
|
+
"expo-image": "~3.0.9",
|
|
54
|
+
"lucide-react": "^0.562.0",
|
|
55
|
+
"lucide-react-native": "^0.562.0",
|
|
47
56
|
react: "^19.0.0",
|
|
48
57
|
"react-dom": "^19.0.0",
|
|
58
|
+
"react-native": "0.81.0",
|
|
59
|
+
"react-native-svg": "^15.0.0",
|
|
60
|
+
"react-native-web": "^0.21.0",
|
|
49
61
|
},
|
|
50
62
|
devDependencies: {
|
|
51
63
|
"@testing-library/react": "^16.1.0",
|
|
@@ -99,8 +111,19 @@ import react from "@vitejs/plugin-react";
|
|
|
99
111
|
// render endpoint rewrites those to /v1/apps/{id}/asset/... so the bundle
|
|
100
112
|
// loads via the platform's asset proxy. Don't change \`base\` unless you
|
|
101
113
|
// also adjust the rewrite logic in backend/api/apps.ts:rewriteAssetPaths.
|
|
114
|
+
//
|
|
115
|
+
// react-native → react-native-web alias lets @lotics/ui's RN primitives
|
|
116
|
+
// (View, Text, Pressable, StyleSheet, etc.) render in a pure-web environment.
|
|
117
|
+
// .web.tsx is prioritized in resolve.extensions so per-target variants
|
|
118
|
+
// (avatar.web.tsx, wave_avatar.web.tsx) win over the native .tsx file.
|
|
102
119
|
export default defineConfig({
|
|
103
120
|
plugins: [react()],
|
|
121
|
+
resolve: {
|
|
122
|
+
alias: {
|
|
123
|
+
"react-native": "react-native-web",
|
|
124
|
+
},
|
|
125
|
+
extensions: [".web.tsx", ".web.ts", ".tsx", ".ts", ".jsx", ".js"],
|
|
126
|
+
},
|
|
104
127
|
build: {
|
|
105
128
|
outDir: "dist",
|
|
106
129
|
sourcemap: true,
|
|
@@ -129,7 +152,8 @@ export default defineConfig({
|
|
|
129
152
|
},
|
|
130
153
|
{
|
|
131
154
|
path: "src/main.tsx",
|
|
132
|
-
content: `import
|
|
155
|
+
content: `import "@lotics/ui/index.css";
|
|
156
|
+
import { mount } from "@lotics/app-sdk";
|
|
133
157
|
import App from "./App";
|
|
134
158
|
|
|
135
159
|
mount(<App />);
|
|
@@ -137,22 +161,35 @@ mount(<App />);
|
|
|
137
161
|
},
|
|
138
162
|
{
|
|
139
163
|
path: "src/App.tsx",
|
|
140
|
-
// Static welcome screen — no useTable call
|
|
141
|
-
// renders cleanly without needing a real
|
|
142
|
-
// edit is to replace this with their
|
|
143
|
-
content: `
|
|
164
|
+
// Static welcome screen using @lotics/ui primitives — no useTable call
|
|
165
|
+
// so the freshly-deployed v1 renders cleanly without needing a real
|
|
166
|
+
// table id. The user's first edit is to replace this with their app.
|
|
167
|
+
content: `import { View } from "react-native";
|
|
168
|
+
import { Stack } from "@lotics/ui/stack";
|
|
169
|
+
import { Card } from "@lotics/ui/card";
|
|
170
|
+
import { Text } from "@lotics/ui/text";
|
|
171
|
+
import { Button } from "@lotics/ui/button";
|
|
172
|
+
|
|
173
|
+
export default function App() {
|
|
144
174
|
return (
|
|
145
|
-
<
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
175
|
+
<View style={{ padding: 24, maxWidth: 640, marginHorizontal: "auto" }}>
|
|
176
|
+
<Stack gap={16}>
|
|
177
|
+
<Text size="xl" weight="semibold">${escapeHtml(args.app_name)}</Text>
|
|
178
|
+
<Card>
|
|
179
|
+
<Stack gap={8} style={{ padding: 16 }}>
|
|
180
|
+
<Text>This is your new Lotics app.</Text>
|
|
181
|
+
<Text color="muted">
|
|
182
|
+
Edit <Text weight="medium">src/App.tsx</Text> and run{" "}
|
|
183
|
+
<Text weight="medium">lotics app deploy</Text> to publish.
|
|
184
|
+
</Text>
|
|
185
|
+
</Stack>
|
|
186
|
+
</Card>
|
|
187
|
+
<Text color="muted" size="sm">
|
|
188
|
+
Hooks from @lotics/app-sdk: useTable, useMutate, useAction, useQuery, useWorkflow.
|
|
189
|
+
</Text>
|
|
190
|
+
<Button title="Get started" onPress={() => {}} color="primary" />
|
|
191
|
+
</Stack>
|
|
192
|
+
</View>
|
|
156
193
|
);
|
|
157
194
|
}
|
|
158
195
|
`,
|
|
@@ -164,9 +201,9 @@ import { render } from "@testing-library/react";
|
|
|
164
201
|
import App from "./App";
|
|
165
202
|
|
|
166
203
|
describe("App", () => {
|
|
167
|
-
test("renders
|
|
168
|
-
const {
|
|
169
|
-
expect(
|
|
204
|
+
test("renders without crashing", () => {
|
|
205
|
+
const { container } = render(<App />);
|
|
206
|
+
expect(container).not.toBeNull();
|
|
170
207
|
});
|
|
171
208
|
});
|
|
172
209
|
`,
|
|
@@ -235,13 +272,22 @@ lotics app deploy # build + upload as a new version
|
|
|
235
272
|
lotics app deploy -m "what" # with a commit-message-style note
|
|
236
273
|
\`\`\`
|
|
237
274
|
|
|
238
|
-
## SDK
|
|
275
|
+
## SDK + UI components
|
|
239
276
|
|
|
240
277
|
\`\`\`tsx
|
|
241
|
-
import { mount, useTable, useMutate, useAction, useQuery } from "@lotics/app-sdk";
|
|
278
|
+
import { mount, useTable, useMutate, useAction, useQuery, useWorkflow } from "@lotics/app-sdk";
|
|
279
|
+
import { Stack } from "@lotics/ui/stack";
|
|
280
|
+
import { Card } from "@lotics/ui/card";
|
|
281
|
+
import { Button } from "@lotics/ui/button";
|
|
282
|
+
import { Text } from "@lotics/ui/text";
|
|
283
|
+
// ... and Grid, Dialog, DatePicker, FormPicker, BarChart, LineChart, PieChart, Metric, ProgressBar, etc.
|
|
242
284
|
\`\`\`
|
|
243
285
|
|
|
244
|
-
|
|
286
|
+
@lotics/ui ships React Native primitives that render via react-native-web
|
|
287
|
+
in this Vite app (the alias is preconfigured in \`vite.config.ts\`). See
|
|
288
|
+
the full export list at https://www.npmjs.com/package/@lotics/ui.
|
|
289
|
+
|
|
290
|
+
See https://lotics.ai/docs/app-sdk for the SDK reference.
|
|
245
291
|
`,
|
|
246
292
|
},
|
|
247
293
|
];
|