From 2d4bec26b6cdb07246ce7fe99ca5e4f927c5cd03 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Thu, 12 Nov 2026 14:12:27 -0800 Subject: [PATCH 1/2] feat: publish examples to GitHub-backed StackBlitz branches 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/- Pipeline (.github/workflows/publish-examples.yml, replaces extract-templates.yml): - tools/scripts/extract-example.mjs makes apps// 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 - 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, - - diff --git a/apps/battery/svelte/package.json b/apps/battery/svelte/package.json index d668959..ed28e1d 100644 --- a/apps/battery/svelte/package.json +++ b/apps/battery/svelte/package.json @@ -4,20 +4,19 @@ "version": "1.0.0", "private": true, "dependencies": { - "@nativescript/core": "~8.3.0", - "@stackblitz/nativescript-battery": "file:../../../libs/nativescript-battery/src", - "svelte-native": "~1.0.0" + "@nativescript-community/svelte-native": "~1.0.29", + "@nativescript/core": "~8.9.0" }, "devDependencies": { - "@nativescript/ios": "8.3.3", - "@nativescript/preview-cli": "1.0.0-beta.18", - "@nativescript/stackblitz": "0.0.5", - "@nativescript/types-minimal": "~8.3.0", - "@nativescript/webpack": "~5.0.0", - "svelte": "~3.44.0", - "svelte-loader": "^3.1.2", - "svelte-native-preprocessor": "^1.0.0", - "svelte-preprocess": "^4.7.0", - "typescript": "~4.7.0" + "@nativescript/preview-cli": "^1.0.14", + "@nativescript/stackblitz": "^0.0.8", + "@nativescript/tailwind": "^2.1.0", + "@nativescript/types": "~8.9.0", + "@nativescript/webpack": "~5.0.27", + "svelte": "~4.2.0", + "svelte-loader": "^3.2.0", + "svelte-preprocess": "^5.1.3", + "tailwindcss": "~3.4.0", + "typescript": "~5.7.0" } } diff --git a/apps/battery/svelte/project.json b/apps/battery/svelte/project.json index 8967455..0b2a844 100644 --- a/apps/battery/svelte/project.json +++ b/apps/battery/svelte/project.json @@ -3,42 +3,34 @@ "sourceRoot": "apps/battery/svelte/src", "projectType": "application", "targets": { - "ios": { + "build": { "executor": "@nativescript/nx:build", "options": { - "platform": "ios" + "noHmr": true, + "production": true, + "uglify": true, + "release": true, + "forDevice": true }, - "configurations": { - "build": { - "copyTo": "./dist/build.ipa" - }, - "prod": { - "combineWithConfig": "build:prod" - } - } + "configurations": {} }, - "android": { - "executor": "@nativescript/nx:build", + "debug": { + "executor": "@nativescript/nx:debug", "options": { - "platform": "android" + "noHmr": true, + "uglify": false, + "release": false, + "forDevice": false, + "prepare": false }, - "configurations": { - "build": { - "copyTo": "./dist/build.apk" - }, - "prod": { - "combineWithConfig": "build:prod" - } - } + "configurations": {} }, "clean": { - "executor": "@nativescript/nx:build", - "options": { - "clean": true - } + "executor": "@nativescript/nx:clean", + "options": {} }, "lint": { - "executor": "@nrwl/linter:eslint", + "executor": "@nx/eslint:lint", "options": { "lintFilePatterns": [ "apps/battery/svelte/**/*.ts", @@ -46,5 +38,6 @@ ] } } - } + }, + "name": "svelte" } diff --git a/apps/battery/svelte/svelte.config.js b/apps/battery/svelte/svelte.config.js index f6f3764..2243623 100644 --- a/apps/battery/svelte/svelte.config.js +++ b/apps/battery/svelte/svelte.config.js @@ -1,9 +1,8 @@ -const sveltePreprocess = require('svelte-preprocess') -const svelteNativePreprocessor = require('svelte-native-preprocessor') +const sveltePreprocess = require('svelte-preprocess'); module.exports = { compilerOptions: { - namespace: "foreign" + namespace: 'foreign', }, - preprocess: [ sveltePreprocess(), svelteNativePreprocessor() ] -} \ No newline at end of file + preprocess: [sveltePreprocess()], +}; diff --git a/apps/battery/svelte/tailwind.config.js b/apps/battery/svelte/tailwind.config.js new file mode 100644 index 0000000..0d14b07 --- /dev/null +++ b/apps/battery/svelte/tailwind.config.js @@ -0,0 +1,13 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + content: ['./app/**/*.{css,xml,html,vue,svelte,ts,tsx}'], + // use the .ns-dark class to control dark mode (applied by NativeScript) - since 'media' (default) is not supported. + darkMode: ['class', '.ns-dark'], + theme: { + extend: {}, + }, + plugins: [], + corePlugins: { + preflight: false, // disables browser-specific resets + }, +}; diff --git a/apps/battery/svelte/tsconfig.json b/apps/battery/svelte/tsconfig.json index e9c986e..1a31cbf 100644 --- a/apps/battery/svelte/tsconfig.json +++ b/apps/battery/svelte/tsconfig.json @@ -3,7 +3,7 @@ "strict": true, "target": "es2017", "module": "esnext", - "moduleResolution": "node", + "moduleResolution": "bundler", "lib": ["dom", "es2017"], "sourceMap": true, "noEmitHelpers": true, diff --git a/apps/battery/svelte/types/references.d.ts b/apps/battery/svelte/types/references.d.ts index 724f209..dedd793 100644 --- a/apps/battery/svelte/types/references.d.ts +++ b/apps/battery/svelte/types/references.d.ts @@ -1 +1 @@ -/// +/// diff --git a/apps/battery/svelte/webpack.config.js b/apps/battery/svelte/webpack.config.js index b80dc7f..bcf25f7 100644 --- a/apps/battery/svelte/webpack.config.js +++ b/apps/battery/svelte/webpack.config.js @@ -1,8 +1,16 @@ +const path = require('path'); const webpack = require('@nativescript/webpack'); module.exports = (env) => { webpack.init(env); + webpack.chainWebpack((config) => { + config.resolve.alias.set( + '@stackblitz/nativescript-battery', + path.resolve(__dirname, '../../../libs/nativescript-battery/src'), + ); + }); + // Learn how to customize: // https://docs.nativescript.org/webpack diff --git a/apps/battery/typescript/app/app.css b/apps/battery/typescript/app/app.css index db7374a..9a27e59 100644 --- a/apps/battery/typescript/app/app.css +++ b/apps/battery/typescript/app/app.css @@ -1,5 +1,11 @@ -@import '@nativescript/theme/css/core.css'; -@import '@nativescript/theme/css/default.css'; +@tailwind base; +@tailwind components; +@tailwind utilities; + +ActionBar { + background-color: #65adf1; + color: white; +} Button.action-btn { border-radius: 25; diff --git a/apps/battery/typescript/app/main-page.xml b/apps/battery/typescript/app/main-page.xml index d984cf6..71123d7 100644 --- a/apps/battery/typescript/app/main-page.xml +++ b/apps/battery/typescript/app/main-page.xml @@ -1,11 +1,10 @@ - -