使用 TypeScript 和 CSS 编写的原生应用
Native apps written in TypeScript and CSS

原始链接: https://github.com/geastack/examples

本仓库是官方的 **GeaStack 应用库**,收录了模拟器、GeaOS、嵌入式目标平台以及 IDE 扩展的示例。每个项目都是一个独立的包,通过 `package.json` 中的 `gea` 清单进行定义,并指定了运行时目标(Web、ESP32、GeaOS)及元数据。 **核心工作流亮点:** * **开发:** 使用 `geastack/simulator` 仓库来运行和构建应用,只需将 `GEA_APPS_ROOT` 环境变量指向本目录即可。 * **部署:** 通过 Gea CLI 使用 `npx gea flash` 直接烧录到兼容硬件。 * **最佳实践:** 示例应保持小巧、专注,并优先使用共享框架 API,而非针对特定目标的“黑客”写法。贡献者应为复杂逻辑编写测试,并保持文档更新。 **许可协议:** 本仓库采用 **MIT** 协议,允许开源或闭源使用。请注意,特定的嵌入式板卡支持组件采用 **GPL-3.0** 协议;若需使用这些特定工具发布闭源固件,则需要获得商业授权。如需支持或进行商业咨询,请联系 [email protected]

这篇 Hacker News 讨论介绍了一个名为 **Geastack** 的项目,它允许开发者使用 TypeScript 和 CSS 构建原生应用程序。 讨论的主要要点包括: * **技术基础:** 该项目作为一个将 TypeScript 编译为 C++ 的编译器运行,并带有特定于平台的绑定,从而实现高性能。 * **渲染引擎:** 它将 CSS、JSX 和 HTML Canvas API 等 Web 技术直接映射到原生平台组件和界面上。 * **应用场景:** 用户指出该技术特别适合嵌入式应用程序。 社区讨论澄清了其底层架构,特别提到编译器在消除“承载性”装箱(load-bearing boxing)方面取得了最新进展,此前这一问题曾影响内存效率。
相关文章

原文

Example applications and tools for GeaStack.

This repo is the app gallery used by the simulator, embedded targets, GeaOS, Apple targets, the VS Code/Cursor extension, and marketing demos. Each example is a small package with a gea manifest in package.json.

Path Purpose
apps/* Gea apps. Most are TSX apps targeting web, ESP32, and/or GeaOS.
apps/*/package.json App manifest, target compatibility, scripts, and launcher metadata.
tools/dialer-browser Small browser-side helper tool for dialer workflows.
package.json Workspace marker for the examples collection.
docs Catalog and contribution guidance.

Run checks for an individual example:

cd apps/watch
npm install
npm run check
npm run build

Some examples also carry tests, mostly guarding a layout or a device setup that nothing else would catch -- npm test in the app folder runs them.

The web loop is driven from the simulator, which is a separate repository: geastack/simulator. Its scripts read apps out of an app project root, which they take from GEA_APPS_ROOT -- this repo, or your own. There is no default, so set it or pass --app-dir; nothing assumes the two checkouts sit next to each other.

cd /path/to/simulator
GEA_APPS_ROOT=/path/to/examples ./targets/web/dev-web.mjs watch   # development loop
GEA_APPS_ROOT=/path/to/examples ./targets/web/build-web.sh watch  # build for web

./targets/web/dev-web.mjs --app-dir /path/to/examples/apps/watch   # or name one app

Flash a compatible board through the Gea CLI:

npx gea flash watch --board <alias>
npx gea flash watch --board <alias> --monitor

Every buildable app should have a package.json with a gea field:

{
  "gea": {
    "id": "watch",
    "name": "Watch",
    "entry": "index.tsx",
    "runtime": "gea",
    "targets": {
      "web": true,
      "esp32": true,
      "geaos": true
    }
  }
}

The manifest is consumed by the simulator, embedded board scripts, GeaOS, Apple targets, and the IDE extension. Keep it accurate.

  • Keep examples small and focused. A good example proves one behavior clearly.
  • Prefer shared framework APIs over target-specific hacks inside examples.
  • Add tests for examples with non-trivial logic, physics, or parsing.
  • Update the catalog docs when adding, renaming, hiding, or changing target compatibility for an app.

MIT (see LICENSE). Use it, change it, ship closed-source products on it, no strings attached. The only GeaStack code under a different license is the embedded board support (targets and @geastack/chips, GPL-3.0-only): shipping closed-source firmware through those needs a commercial license. Contact [email protected] for commercial terms, support and hosted builds.

联系我们 contact @ memedata.com