@bunin/sparkling-webify
v1.13.0
Published
Add Lynx for Web preview/build support to Sparkling projects.
Readme
@bunin/sparkling-webify
한국어 | English
Add Lynx for Web preview/build support to Sparkling projects.
@bunin/sparkling-webify is a Bun-first CLI that adds a safe Lynx for Web preview setup to an existing Sparkling/Lynx project. It treats Sparkling as the native iOS/Android layer and does not claim that Sparkling has an official first-class Web target.
Install and run
bunx @bunin/sparkling-webify init
bun run web
bun run build:webFor a monorepo app:
bunx @bunin/sparkling-webify init --cwd apps/mobileCommands
sparkling-webify init [--cwd path] [--force] [--yes] [--overwrite] [--dry-run] [--no-install]
sparkling-webify doctor [--cwd path]
sparkling-webify print [--cwd path]
sparkling-webify clean [--cwd path] [--scripts] [--deps] [--restore] [--all] [--dry-run]init detects a Sparkling/Lynx project, installs the missing Web dependencies, adds safe scripts, patches an existing Lynx config, and creates an owned web/ host project. The host has a real web/src/main.ts entry and serves dist/main.web.bundle through lynx-view. It asks before creating a missing root lynx.config.ts or web/ host; use --yes for non-interactive setup. It backs up modified package.json and existing config files as *.bak.sparkling-webify.
The generated preview uses the current @lynx-js/web-core/client initialization entrypoint. web first produces the Web bundles, then starts the host at /; build:web also produces the production host. See the Rspeedy CLI documentation and Lynx Web integration guide.
print is equivalent to init --dry-run. clean removes the owned generated web/ host by default; scripts, dependencies, and backups require explicit flags.
Scripts added
When no conflict exists, the CLI adds:
{
"web": "rspeedy build --environment web && bun run --cwd web dev",
"web:dev": "bun run web",
"dev:web": "bun run web",
"build:web": "rspeedy build --environment web && bun run --cwd web build",
"doctor:web": "sparkling-webify doctor"
}Existing scripts are preserved. In a conflict, sparkling:web or sparkling:build:web is added where possible; use --overwrite only when replacement is intended.
Limitations
- This is not official Sparkling Web support.
- It is a Lynx for Web preview bridge for Sparkling/Lynx apps.
- Native APIs may not work on Web unless they are polyfilled or mocked.
sparkling-navigationis bridged through Lynx for Web's native-module hook:open,navigate, andcloseswitch thelynx-viewbundle or browser history. Sparkling-native options and non-bundle schemes remain native-only.sparkling-storageandsparkling-mediamay need future Web shims.- Browser preview is not guaranteed to exactly match iOS or Android behavior.
- It does not provide SEO or SSR.
- It does not replace native testing.
Development
bun install
bun run check
bun run build