generate device-specific projects from reusable host templates

Đang mở
#571 4 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
embedded-iot

Hướng nghiên cứu

Start by reading the existing ESP-IDF pocket.host.json flow mentioned in the issue, then trace how host configuration is consumed and validated during builds. The issue proposes a project-generation workflow but does not identify implementation files or settle its design; clarify the scope and expected interfaces with maintainers before starting. Done would mean device projects can reuse a versioned host while owning validated device-specific configuration.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

I understand that PocketJS already separates application projects from the
framework and SDK reasonably well. An application can have its own manifest,
source tree, and build output while depending on PocketJS as a package.

The remaining coupling is on the host side. Hosts still tend to be maintained
as device-specific implementations or profiles. This is especially visible for
embedded devices, where every product may have a different screen resolution,
pixel format, color configuration, framebuffer layout, and input device.

I would like to propose a project-generation workflow that applies the same
kind of separation to hosts: reuse a host implementation from the SDK, but
keep the device-specific host configuration and product integration in a
separate project.

The desired workflow is:

select an existing host
        ↓
generate a new device project
        ├── depend on a released PocketJS SDK
        ├── reuse the selected host implementation
        ├── define device-specific parameters locally
        └── build and maintain the device independently

Motivation and concrete use case

I encountered this issue while considering a new host for an embedded Linux
device using a framebuffer at /dev/fb0 and input events from
/dev/input/eventX. The general host mechanism is reusable, but the actual
products are not identical boards with a standard configuration. Each product
can have its own display and input parameters.

For an embedded Linux product, the project may need to define the framebuffer
resolution, stride, pixel format, channel order, color depth, refresh policy,
input device path, key or touch mapping, coordinate range, and timing. These
values are not properties of Linux fbdev or evdev as a generic host; they are
facts of the particular product.

In a real product, the team usually wants to maintain a project for one
specific device. It does not want to fork, modify, and version the entire
PocketJS SDK because one device has different hardware parameters.

For example, two devices may use the same host implementation but have
different:

  • logical and physical viewport sizes;
  • raster density;
  • refresh rate or tick frequency;
  • pixel format or framebuffer layout;
  • input mapping;
  • touch coordinate limits;
  • memory or storage constraints;
  • device-specific build and packaging settings.

With the current coupling, changing one of these values may require modifying a
host profile or host source inside the PocketJS repository. If several devices
need different values, the product team may end up maintaining multiple
PocketJS SDK copies or forks. This increases upgrade cost and makes it
difficult to keep fixes and security updates synchronized.

There are two different use cases here:

  1. Adapting a popular, already-defined product. If the target is a commonly
    purchased device with a stable hardware profile, maintaining a device-specific
    host in the current repository can be a reasonable workflow.
  2. Developing a new embedded product. If the team owns the hardware or is
    building several product variants, the parameters are part of the product
    project and change independently of the SDK. Requiring those parameters to
    live in the PocketJS repository makes this workflow unnecessarily costly.

The second case is particularly important for embedded Linux development. The
community may more often adapt software to popular existing products, while a
commercial embedded project may face a collection of new products whose
screens and input hardware are all different.

The important boundary should be:

  • PocketJS SDK: reusable runtime, framework APIs, host implementation, build
    contracts, and validation logic.
  • Device project: one device's profile, parameters, native integration,
    packaging, and product-specific code.

Proposed workflow

A command such as the following could create a device project from an existing
host:

pocket create-device my-device --host esp-idf
# or
pocket create-device my-device --host linux-fbdev
# or a generic embedded Linux host using fbdev + evdev
pocket create-device my-device --host linux-fbdev-evdev

The generated project would:

  1. depend on @pocketjs/framework or the corresponding PocketJS SDK package;
  2. select a host implementation or host template;
  3. contain a device-owned profile/configuration file;
  4. validate that profile against the host's supported contract;
  5. pass the resolved device parameters into the host build;
  6. build an application package and/or device firmware from the project;
  7. allow the SDK version to be upgraded through normal dependency management.

For example, the generated project might contain:

my-device/
  package.json
  pocket.json
  pocket.device.json
  src/
  native/
  build/

pocket.device.json would describe the device-specific facts, while the host
would provide the implementation and the supported configuration schema.

The ESP-IDF pocket.host.json flow appears to be a useful direction for this
model. It already demonstrates that a host can consume an external profile
instead of requiring every device profile to live in the SDK repository. The
same model would be useful for an embedded Linux host: the SDK could provide
the fbdev/evdev host implementation, while the generated project would own the
product's display and input profile.

Requirements

  • A host should be reusable by multiple device projects.
  • Device parameters should be owned by the generated project rather than
    hard-coded in the SDK.
  • The generated project should depend on a versioned PocketJS SDK package.
  • The project should not need to copy or fork the complete PocketJS repository.
  • Host and device configuration should have a versioned schema and clear
    validation errors.
  • Parameters that affect compilation, resource baking, package admission, or
    host ABI should be validated during the build.
  • Runtime-only settings may remain in the native host configuration where
    appropriate.
  • SDK upgrades should be possible without replacing or manually merging the
    whole device project.
  • Multiple device projects should be able to use the same host and different
    profiles in parallel.

Expected benefit

This would make PocketJS more suitable for new embedded products and custom
hardware. A product team could maintain a small, device-specific repository
while consuming PocketJS as an SDK dependency. Host fixes and framework
features could be upgraded through SDK versions, while device configuration and
native product integration would remain under the product team's ownership.

This would also avoid creating a separate PocketJS SDK fork for every device
that differs only in host parameters.

Ngôn ngữ chính
TypeScript
Star
1.6k
Fork
88
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của pocket-stack/pocketjs

Tất cả issue của pocket-stack/pocketjs

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.