Repository navigation
feat: publish examples to GitHub-backed StackBlitz branches - #3
Merged
Merged
Conversation
Saved StackBlitz projects can lose their files (the Angular and Svelte battery examples did after a StackBlitz storage migration), so examples now publish to per-flavor branches that StackBlitz loads straight from GitHub: https://stackblitz.com/github/NativeScript/stackblitz-examples/tree/<example>-<flavor> Pipeline (.github/workflows/publish-examples.yml, replaces extract-templates.yml): - tools/scripts/extract-example.mjs makes apps/<example>/<flavor> standalone, copying in referenced libs and rewriting ../../../ paths - tools/scripts/verify-example.sh installs and bundles it for iOS and Android - on main, pushes the result to the <example>-<flavor> branch with plain git (git-publish-subdir-action v2.6.0 runs on retired node16) - pull requests verify without publishing Shared lib is resolved through a webpack alias instead of a file: dependency (@nativescript/webpack does not apply tsconfig paths), so the monorepo and the published projects resolve it the same way. Battery flavors: - @nativescript/core ~8.9.0 everywhere; Preview does not support v9 yet - Vue: NativeScript-Vue 3 (createApp, <script setup>, src/ layout) - Angular: v20, standalone components, zoneless with signals; @nativescript/angular ~20.0.0 since 20.1.x needs core 9 (SplitView) - React: battery state in useState/useEffect so the UI updates; drop obsolete @types/react 16 patch - Svelte: @nativescript-community/svelte-native + Svelte 4; drop svelte-native-preprocessor (Svelte 3 peer only) - JavaScript: now the battery example instead of the tap counter - Solid: new flavor, linked from nativescript.org - Tailwind with one shared app.css; logos use Wikimedia standard 500px thumbnails (previous sizes now return 400/404) - lib: globalThis instead of Node's global so it type-checks without @types/node
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
…om published branches
NathanWalker
force-pushed
the
feat/github-backed-examples
branch
from
November 12, 2026 22:21
b34977d to
527a872
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Angular and Svelte battery examples linked from nativescript.org (
stackblitz.com/edit/nativescript-battery-example-{angular,svelte}) open with no files. Both are saved StackBlitz projects, and their storage was moved tobolt-…-migrationstorage that came back empty. The title and stats survived, but the files didn't. The flavors whose storage wasn't moved still load. Saved projects also drift from this repo: the flavor branches the README described were never created, andextract-templates.ymlhad broken paths.Approach
Publish every example to a branch that StackBlitz loads straight from GitHub. Those links always reflect
main, and StackBlitz storage can't lose them.publish-examples.yml(replacesextract-templates.yml) runs a matrix over{example} × {flavor}:tools/scripts/extract-example.mjscopiesapps/{example}/{flavor}into a standalone project. It brings in eachlibs/*the app references, rewrites../../../paths, and fails if any remain.tools/scripts/verify-example.shrunsnpm installand bundles for iOS and Android, the same webpack buildns previewruns. It works on a copy, sonode_modulesnever gets published.mainonly): pushes to{example}-{flavor}with plain git. Branch history is kept, and nothing is pushed when the output is unchanged.git-publish-subdir-action@v2.6.0runs on the retired node16 runtime, so it isn't used.Pull requests run steps 1 and 2 only.
Apps still import the shared lib as
@stackblitz/nativescript-battery. Eachwebpack.config.jsaliases that name to the lib'ssrc, replacing thefile:dependency.@nativescript/webpackdoesn't apply tsconfigpaths, and an alias resolves the same way in the monorepo and in a published branch.Battery flavors
@nativescript/core ~8.9.0, because NativeScript Preview doesn't support v9 yet.nexthad been resolving to9.1.4-next.4.createApp,<script setup>,src/layout to match nativescript-vue's StackBlitz template). Preview runs with HMR.@nativescript/angularis pinned to~20.0.0, because 20.1.x importsSplitView, which only core 9 has (same fix as fix(angular): pin @nativescript/angular to 20.0.x for core 8.9 stackblitz-templates#23).useState/useEffect. It lived in plainletvariables before, so the level never rendered. The obsolete@types/react@16.9.34patch-package step is removed.@nativescript-community/svelte-native+ Svelte 4.svelte-native-preprocessoris dropped: it only supports Svelte 3, and this example doesn't use property-element syntax.@nativescript-community/solid-js's webpack plugin wires up babel and JSX.app.cssin every flavor.@nativescript/themewas still imported but no longer installed. Logo URLs now use Wikimedia's standard 500px thumbnails; the old sizes return 400/404.globalThis.__nativeinstead of Node'sglobal, so it type-checks in flavors without@types/node.Verification
Every flavor was extracted from a clean checkout, installed with
npm install, and bundled for iOS and Android:@nativescript/angular20.0.0index.ios.ts/index.android.tsbattery code and not theindex.tsworkspace stub.../../../path left.The StackBlitz runtime itself (
.stackblitzrcstart and the Preview QR flow) can only be checked once the branches exist after merge.After merge
mainrun creates thebattery-*branches.apps/nativescript.org/components/DropDown.vueand both lists inapps/nativescript.org/pages/index.vue.