@geastack/cli 0.1.82 → 0.1.84
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 +22 -0
- package/package.json +5 -5
- package/src/board-catalog.mjs +16 -0
- package/src/create-geastack.mjs +3 -7
- package/src/gea.mjs +13 -7
- package/src/web/adapter.mjs +15 -25
- package/starters/bundled/counter/package.json +1 -1
package/README.md
CHANGED
|
@@ -192,3 +192,25 @@ built on it. The only GeaStack code under a different license is
|
|
|
192
192
|
the embedded board support (`targets` and `@geastack/chips`, GPL-3.0-only):
|
|
193
193
|
shipping closed-source firmware through those needs a commercial license.
|
|
194
194
|
Contact [contact@geastack.com](mailto:contact@geastack.com) for commercial terms, support and hosted builds.
|
|
195
|
+
|
|
196
|
+
## Browser development and emulation
|
|
197
|
+
|
|
198
|
+
`gea dev` (equivalently `gea dev --target web`) runs the Gea DOM/CSS app with
|
|
199
|
+
Vite HMR. `gea simulate` uses that same pipeline inside a device viewport and
|
|
200
|
+
opens the browser. Use `--no-open` to suppress opening, and `--width`, `--height`,
|
|
201
|
+
`--zoom`, and `--dpr` to configure the preview. DPR is a simulated Display API
|
|
202
|
+
value; it does not override the browser's pixel ratio.
|
|
203
|
+
|
|
204
|
+
The default for `simulate` changed from WASM to DOM. To retain the embedded
|
|
205
|
+
renderer and framebuffer workflow, use `gea simulate --renderer wasm`; this
|
|
206
|
+
explicit mode still requires Emscripten. Unknown renderer values are rejected.
|
|
207
|
+
|
|
208
|
+
`gea build --target web` emits HTML/JS/CSS into `.gea/build/web/site` (override
|
|
209
|
+
with `--out-dir`). The app's `index.html` is honored. Web-only Vite customization
|
|
210
|
+
belongs in `vite.web.config.ts`; new web apps scaffold this file. Existing
|
|
211
|
+
`vite.config.*` files remain dedicated to their previous build pipeline.
|
|
212
|
+
|
|
213
|
+
Compatible component edits and CSS changes update without reloading the page;
|
|
214
|
+
reactive state is preserved for compatible component edits. Incompatible edits
|
|
215
|
+
reload. Browser previews use simulated device APIs and browser layout; use the
|
|
216
|
+
WASM renderer or a physical device to validate embedded rendering.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geastack/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.84",
|
|
4
4
|
"description": "Command-line front door for GeaStack apps, targets, and local toolchains.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@clack/prompts": "^1.8.0",
|
|
40
|
-
"@geastack/simulator": "^0.1.
|
|
41
|
-
"@geastack/targets": "^0.1.
|
|
40
|
+
"@geastack/simulator": "^0.1.9",
|
|
41
|
+
"@geastack/targets": "^0.1.82",
|
|
42
42
|
"picocolors": "^1.1.1",
|
|
43
43
|
"serialport": "^13.0.0"
|
|
44
44
|
},
|
|
45
45
|
"starterDependencies": {
|
|
46
|
-
"@geastack/core": "^0.1.
|
|
47
|
-
"@geastack/targets": "^0.1.
|
|
46
|
+
"@geastack/core": "^0.1.26",
|
|
47
|
+
"@geastack/targets": "^0.1.82",
|
|
48
48
|
"@geastack/apple": "^0.2.9"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
package/src/board-catalog.mjs
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
export const knownBoards = Object.freeze([
|
|
2
|
+
{
|
|
3
|
+
id: 'waveshare-amoled-241',
|
|
4
|
+
label: 'Waveshare ESP32-S3 Touch AMOLED 2.41 (V1)',
|
|
5
|
+
alias: 'amoled-241',
|
|
6
|
+
target: 'esp32-s3-touch-amoled-2.41',
|
|
7
|
+
adapter: 'esp32-idf',
|
|
8
|
+
mcu: 'ESP32-S3',
|
|
9
|
+
capabilities: {
|
|
10
|
+
display: '2.41 inch AMOLED touch panel (RM69080)',
|
|
11
|
+
touch: 'FT6336 capacitive touch',
|
|
12
|
+
wireless: ['WiFi', 'BLE'],
|
|
13
|
+
storage: ['16 MB flash', '8 MB PSRAM'],
|
|
14
|
+
audio: [],
|
|
15
|
+
gps: false
|
|
16
|
+
}
|
|
17
|
+
},
|
|
2
18
|
{
|
|
3
19
|
id: 'waveshare-amoled-206',
|
|
4
20
|
label: 'Waveshare ESP32-S3 Touch AMOLED 2.06',
|
package/src/create-geastack.mjs
CHANGED
|
@@ -97,7 +97,7 @@ export async function runCreateGeastack(argv, io = {}) {
|
|
|
97
97
|
writeJson(path.join(targetDir, '.gea', 'boards.json'), {})
|
|
98
98
|
ensureJson(path.join(targetDir, 'tsconfig.json'), () => tsconfigJson(targets))
|
|
99
99
|
ensureFile(path.join(targetDir, '.gitignore'), gitignore)
|
|
100
|
-
if (targets.web) ensureFile(path.join(targetDir, 'vite.config.ts'), viteConfigTs)
|
|
100
|
+
if (targets.web) ensureFile(path.join(targetDir, 'vite.web.config.ts'), viteConfigTs)
|
|
101
101
|
fs.writeFileSync(path.join(targetDir, 'README.md'), readme({ appId, displayName, starter, targets }))
|
|
102
102
|
|
|
103
103
|
const installDependencies = shouldInstallDependencies(parsed, io)
|
|
@@ -472,7 +472,7 @@ function tsconfigJson(targets) {
|
|
|
472
472
|
types: []
|
|
473
473
|
},
|
|
474
474
|
include: ['**/*.ts', '**/*.tsx', '**/*.d.ts'],
|
|
475
|
-
exclude: ['node_modules', 'dist', '.gea', 'vite.config.ts']
|
|
475
|
+
exclude: ['node_modules', 'dist', '.gea', 'vite.config.ts', 'vite.web.config.ts']
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
478
|
|
|
@@ -488,11 +488,7 @@ function viteConfigTs() {
|
|
|
488
488
|
return `import { defineConfig } from 'vite'
|
|
489
489
|
|
|
490
490
|
export default defineConfig({
|
|
491
|
-
|
|
492
|
-
build: {
|
|
493
|
-
outDir: 'dist',
|
|
494
|
-
emptyOutDir: true
|
|
495
|
-
}
|
|
491
|
+
// Gea adds the DOM runtime and JSX transforms. Add web-only options here.
|
|
496
492
|
})
|
|
497
493
|
`
|
|
498
494
|
}
|
package/src/gea.mjs
CHANGED
|
@@ -113,11 +113,8 @@ export async function runGea(argv, io = {}) {
|
|
|
113
113
|
const { runIos } = await import('./ios/adapter.mjs')
|
|
114
114
|
return runIos({ app, env, dryRun: flag(parsed, 'dry-run'), stdout, mode: option(parsed, 'mode', ''), run: command === 'run' })
|
|
115
115
|
}
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
// simulator; `gea {dev,build} --target web` is a real DOM/CSS web app. A bare
|
|
119
|
-
// `gea dev` means the latter -- it is the only target with a dev server, and
|
|
120
|
-
// it is what `gea create` scaffolds into a new app's package.json.
|
|
116
|
+
// DOM is the default web development and emulator runtime. The embedded
|
|
117
|
+
// framebuffer simulator remains available through simulate --renderer wasm.
|
|
121
118
|
if ((command === 'dev' || command === 'build') && (target === 'web' || (!target && command === 'dev'))) {
|
|
122
119
|
const app = webApp(ctx, parsed, rest, cwd)
|
|
123
120
|
const { runWebBuild, runWebDev } = await import('./web/adapter.mjs')
|
|
@@ -127,15 +124,24 @@ export async function runGea(argv, io = {}) {
|
|
|
127
124
|
}
|
|
128
125
|
if (command === 'simulate') {
|
|
129
126
|
const app = webApp(ctx, parsed, rest, cwd)
|
|
127
|
+
const renderer = option(parsed, 'renderer', 'dom')
|
|
128
|
+
if (!['dom', 'wasm'].includes(renderer)) fail(`Unknown renderer '${renderer}'. Use dom or wasm.`, ExitCode.usage)
|
|
129
|
+
for (const key of ['width', 'height', 'dpr', 'zoom']) {
|
|
130
|
+
const value = option(parsed, key)
|
|
131
|
+
if (value !== undefined && (typeof value === 'boolean' || !Number.isFinite(Number(value)) || Number(value) <= 0)) {
|
|
132
|
+
fail(`--${key} must be a positive number.`, ExitCode.usage)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
130
135
|
const { runSimulate } = await import('./web/adapter.mjs')
|
|
131
136
|
return runSimulate({
|
|
137
|
+
renderer,
|
|
132
138
|
ctx,
|
|
133
139
|
app,
|
|
134
140
|
env,
|
|
135
141
|
dryRun: flag(parsed, 'dry-run'),
|
|
136
142
|
stdout,
|
|
137
143
|
port: option(parsed, 'port', ''),
|
|
138
|
-
open:
|
|
144
|
+
open: option(parsed, 'open', true) !== false,
|
|
139
145
|
view: {
|
|
140
146
|
width: option(parsed, 'width', ''),
|
|
141
147
|
height: option(parsed, 'height', ''),
|
|
@@ -226,7 +232,7 @@ ${heading('Usage:')}
|
|
|
226
232
|
gea doctor [--json] [--strict] check packages and toolchains
|
|
227
233
|
|
|
228
234
|
${heading('Run on this machine (no board needed):')}
|
|
229
|
-
gea simulate [app] [--port N]
|
|
235
|
+
gea simulate [app] [--port N] DOM emulator with HMR [--renderer dom|wasm] [--no-open] [--width W --height H --dpr D --zoom Z]
|
|
230
236
|
gea dev [app] [--port N] real DOM + CSS dev server with HMR (same as --target web)
|
|
231
237
|
gea build --target web [app] [--out-dir d] build the app as a real web app
|
|
232
238
|
|
package/src/web/adapter.mjs
CHANGED
|
@@ -10,29 +10,9 @@ import { appSummary, discoverApps } from '../manifest.mjs'
|
|
|
10
10
|
import { formatCommand } from '../run.mjs'
|
|
11
11
|
import { onPath } from '../toolchain.mjs'
|
|
12
12
|
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
// same geatsc flags an ESP32 firmware uses -- same
|
|
17
|
-
// board profile, same font DPR, same renderer -- and
|
|
18
|
-
// only the final compile differs (emcc/WASM + an
|
|
19
|
-
// RGB565 framebuffer on a canvas, instead of clang +
|
|
20
|
-
// a QSPI panel). Gea's own layout engine does layout,
|
|
21
|
-
// so what you see is what the board will show.
|
|
22
|
-
//
|
|
23
|
-
// gea {dev,build} --target web
|
|
24
|
-
// a REAL WEB APP. The same TSX compiled onto the
|
|
25
|
-
// @geajs/core reactive DOM runtime: real DOM nodes,
|
|
26
|
-
// the browser's own CSSOM, native HMR. Faster to
|
|
27
|
-
// iterate on, and deployable -- but the *browser*
|
|
28
|
-
// does layout, so it drifts from the device exactly
|
|
29
|
-
// where a simulator would need to be trusted.
|
|
30
|
-
//
|
|
31
|
-
// Both live in @geastack/simulator. Unlike the Apple targets -- where the app
|
|
32
|
-
// depends on @geastack/apple and the app's own resolution finds the script --
|
|
33
|
-
// nothing here is declared by the app: a gea app is simulatable because it is
|
|
34
|
-
// buildable, so the CLI owns the dependency and resolves it from its own
|
|
35
|
-
// installation.
|
|
13
|
+
// Web development and the default emulator use Gea's DOM/CSS runtime.
|
|
14
|
+
// `gea simulate --renderer wasm` retains the embedded renderer compiled with
|
|
15
|
+
// Emscripten for framebuffer/device-rendering comparisons.
|
|
36
16
|
|
|
37
17
|
const require = createRequire(import.meta.url)
|
|
38
18
|
|
|
@@ -150,7 +130,8 @@ export function buildSimulatorApp({ app, env, dryRun = false, stdout }) {
|
|
|
150
130
|
return { simulatorDir, paths }
|
|
151
131
|
}
|
|
152
132
|
|
|
153
|
-
export async function runSimulate({ ctx, app, env, dryRun = false, stdout, port, open = true, view = {} }) {
|
|
133
|
+
export async function runSimulate({ ctx, app, env, dryRun = false, stdout, port, open = true, view = {}, renderer = 'dom' }) {
|
|
134
|
+
if (renderer === 'dom') return runWebDev({ app, env, dryRun, stdout, port, emulator: true, open, view })
|
|
154
135
|
const { simulatorDir, paths } = buildSimulatorApp({ app, env, dryRun, stdout })
|
|
155
136
|
const url = await startSimulatorServer({ ctx, app, env, simulatorDir, paths, port, dryRun, stdout, view })
|
|
156
137
|
if (dryRun) return 0
|
|
@@ -235,13 +216,22 @@ function openBrowser(url, env) {
|
|
|
235
216
|
// The DOM target resolves the app from the directory itself rather than from an
|
|
236
217
|
// id looked up under an apps root, so `gea dev --target web` works in any app
|
|
237
218
|
// folder on disk.
|
|
238
|
-
export function runWebDev({ app, env, dryRun = false, stdout, port }) {
|
|
219
|
+
export function runWebDev({ app, env, dryRun = false, stdout, port, emulator = false, open = false, view = {} }) {
|
|
239
220
|
requireWebTarget(app)
|
|
240
221
|
const simulatorDir = resolveSimulatorDir(env)
|
|
241
222
|
const script = path.join(simulatorDir, 'targets', 'web', 'dev-web.mjs')
|
|
242
223
|
if (!existsSync(script)) fail(`Web dev server not found: ${script}`, ExitCode.missingDependency)
|
|
243
224
|
const args = [script, '--app-dir', app.root]
|
|
244
225
|
if (port) args.push('--port', String(port))
|
|
226
|
+
if (emulator) args.push('--emulator')
|
|
227
|
+
if (open) args.push('--open')
|
|
228
|
+
for (const key of ['width', 'height', 'dpr', 'zoom']) {
|
|
229
|
+
if (view[key] !== undefined && view[key] !== '') {
|
|
230
|
+
const value = Number(view[key])
|
|
231
|
+
if (!Number.isFinite(value) || value <= 0) fail(`--${key} must be a positive number.`, ExitCode.usage)
|
|
232
|
+
args.push(`--${key}`, String(value))
|
|
233
|
+
}
|
|
234
|
+
}
|
|
245
235
|
return runScript('node', args, {
|
|
246
236
|
cwd: app.root,
|
|
247
237
|
env,
|