@ng-native/template-desktop 0.26.1 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AGENTS.md
2
2
 
3
- This is an Angular app rendering real native macOS views (AppKit) with
3
+ This is an Angular app rendering real native macOS (AppKit) and Linux (GTK) views with
4
4
  [Angular Native](https://ng-native.com): Angular components on React Native's Fabric renderer, in
5
5
  the `@ng-native/desktop` host. Expo is the build tool (CLI, config, autolinking, Metro), not the
6
6
  runtime. It is not a web app, not Electron and not React: there is no DOM, no web view and no JSX.
@@ -16,13 +16,16 @@ browser-only parts do not: there is no `NgOptimizedImage` (use `<image>`), and n
16
16
 
17
17
  ```sh
18
18
  npm start # Metro, the dev server the app loads from
19
- npm run macos # builds the desktop host (the first time) and opens the app from Metro
19
+ npm run macos # on a Mac: builds the desktop host (the first time) and opens the app from Metro
20
+ npm run linux # on Linux: the same, in GTK
20
21
  npm test # Vitest, in Node against a fake native layer: no app window needed
21
22
  npx vitest --project macos # tests in src/**/*.device.ts, inside the running app, which it
22
23
  # starts, with its own Metro
24
+ npx vitest --project linux # the same in GTK: on Linux, or on a Mac in the ngn-el9 container
23
25
  npm run typecheck
24
- npm run package # the .app
26
+ npm run package # the .app on a Mac, an app folder and .tar.gz on Linux
25
27
  npm run package -- --format dmg # a signed, notarised download; --format mas for the Mac App Store
28
+ npm run package -- --os linux --format deb # --format rpm or flatpak too
26
29
  ```
27
30
 
28
31
  `src/main.ts` mounts the root component, `src/app/app.ts`. Run `npm test` and `npm run typecheck` after a
@@ -67,8 +70,8 @@ change; both are fast.
67
70
  `::before`/`::after` are dropped with a build warning naming the file, line and reason - lay out
68
71
  with flexbox, grid or a block. Everything is `display: flex` with `flex-direction: column` by
69
72
  default, as in React Native.
70
- - Tailwind v4 works through `@ng-native/tailwind`, with `ios:`, `android:`, `macos:`, `desktop:`
71
- and `dark:` variants.
73
+ - Tailwind v4 works through `@ng-native/tailwind`, with `ios:`, `android:`, `macos:`, `linux:`,
74
+ `desktop:` and `dark:` variants.
72
75
 
73
76
  ## Lists, navigation, forms
74
77
 
package/README.md CHANGED
@@ -1,28 +1,35 @@
1
- # My Angular Native macOS app
1
+ # My Angular Native desktop app
2
2
 
3
- A native macOS app in Angular, created from `@ng-native/template-desktop`: real AppKit views, a
4
- sidebar and a menu bar, and no web view.
3
+ A native macOS and Linux app in Angular, created from `@ng-native/template-desktop`: real AppKit
4
+ views on a Mac and real GTK views on Linux, a sidebar and a menu bar, and no web view.
5
5
 
6
6
  Expo is your build tool here, not your runtime. Its CLI, config, autolinking and Metro build the
7
7
  app, and none of Expo ships in it: the `@ng-native/desktop` host runs it.
8
8
 
9
9
  ```sh
10
10
  npm start # Metro, the dev server the app loads from; leave it running
11
- npm run macos # builds the desktop host and opens the app, with Fast Refresh
11
+ npm run macos # on a Mac: builds the desktop host and opens the app, with Fast Refresh
12
+ npm run linux # on Linux: the same, in GTK
12
13
  npm test # the example test in src/app/app.test.ts, in Node with no app window
13
14
  npm run typecheck
14
- npm run package # dist/macos/my-app.app
15
+ npm run package # dist/macos/my-app.app, or dist/linux/ on Linux
15
16
  npm run package -- --format dmg # a signed, notarised .dmg; --format mas for the Mac App Store
17
+ npm run package -- --os linux --format deb # a .deb; --format app, rpm or flatpak too
16
18
  ```
17
19
 
18
- To run tests inside the app, on real AppKit views, run the `macos` Vitest project, which starts
19
- Metro and opens the app itself (`src/app/app.device.ts` is the example):
20
+ To run tests inside the app, on real native views, run the `macos` or `linux` Vitest project,
21
+ which starts Metro and opens the app itself (`src/app/app.device.ts` is the example):
20
22
 
21
23
  ```sh
22
- npx vitest --project macos
24
+ npx vitest --project macos # on a Mac, in AppKit
25
+ npx vitest --project linux # in GTK: on Linux, or on a Mac in the ngn-el9 container
23
26
  ```
24
27
 
25
- `npm test` runs the Node project, `node-macos`, alone.
28
+ The `linux` project runs the debug host `npm run linux` uses. On a Mac it runs the prebuilt Linux
29
+ host for the Mac's architecture in the `ngn-el9` image, which you build once with Docker or Colima:
30
+ `docker build -t ngn-el9 node_modules/@ng-native/desktop/native/docker`.
31
+
32
+ `npm test` runs the two Node projects, `node-macos` and `node-linux`, alone.
26
33
 
27
34
  `npm run macos` uses the prebuilt debug desktop host, with React Native's debugger, published for
28
35
  the app's React Native version when the app links no native code of its own and its host libraries
package/app.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "my-app",
4
4
  "slug": "my-app",
5
5
  "version": "1.0.0",
6
- "platforms": ["macos"],
6
+ "platforms": ["macos", "linux"],
7
7
  "experiments": {
8
8
  "outOfTreePlatforms": true
9
9
  },
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@ng-native/template-desktop",
3
- "version": "0.26.1",
4
- "description": "A macOS app in Angular, rendering real AppKit views. Use with create-expo-app --template.",
3
+ "version": "0.27.0",
4
+ "description": "A macOS and Linux app in Angular, rendering real AppKit and GTK views. Use with create-expo-app --template.",
5
5
  "license": "MIT",
6
6
  "main": "src/main.ts",
7
7
  "dependencies": {
8
- "@ng-native/components": "0.26.1",
9
- "@ng-native/desktop": "0.26.1",
10
- "@ng-native/device": "0.26.1",
11
- "@ng-native/expo": "0.26.1",
12
- "@ng-native/fabric": "0.26.1",
13
- "@ng-native/metro": "0.26.1",
14
- "@ng-native/platform": "0.26.1",
8
+ "@ng-native/components": "0.27.0",
9
+ "@ng-native/desktop": "0.27.0",
10
+ "@ng-native/device": "0.27.0",
11
+ "@ng-native/expo": "0.27.0",
12
+ "@ng-native/fabric": "0.27.0",
13
+ "@ng-native/metro": "0.27.0",
14
+ "@ng-native/platform": "0.27.0",
15
15
  "@angular/common": "^22.0.0",
16
16
  "@angular/core": "^22.0.0",
17
17
  "expo": "~58.0.16",
@@ -22,7 +22,7 @@
22
22
  "devDependencies": {
23
23
  "@angular/compiler-cli": "^22.0.0",
24
24
  "@babel/core": "^7.29.7",
25
- "@ng-native/testing": "0.26.1",
25
+ "@ng-native/testing": "0.27.0",
26
26
  "@types/react": "~19.3.0",
27
27
  "typescript": "~6.0.3",
28
28
  "vitest": "^5.0.0"
@@ -35,8 +35,9 @@
35
35
  "scripts": {
36
36
  "start": "expo start",
37
37
  "macos": "ng-native-desktop run",
38
+ "linux": "ng-native-desktop run --os linux",
38
39
  "package": "ng-native-desktop package",
39
40
  "typecheck": "node metro.config.js && ngc -p tsconfig.json --noEmit",
40
- "test": "vitest run --project node-macos"
41
+ "test": "vitest run --project node-macos --project node-linux"
41
42
  }
42
43
  }
@@ -1,9 +1,9 @@
1
1
  import { Platform } from 'react-native';
2
2
  import { expect, it } from 'vitest';
3
3
 
4
- // Runs inside the app, on real native views: `npx vitest --project macos`, and `ios` or `android`
5
- // once the app has those projects. Render a component with `render` and `screen` from
6
- // `@ng-native/testing/device`.
4
+ // Runs inside the app, on real native views: AppKit with `npx vitest --project macos`, GTK with
5
+ // `npx vitest --project linux`, and `ios` or `android` once the app has those projects. Render a
6
+ // component with `render` and `screen` from `@ng-native/testing/device`.
7
7
  it('runs inside the app', () => {
8
- expect(['macos', 'ios', 'android']).toContain(Platform.OS);
8
+ expect(['macos', 'linux', 'ios', 'android']).toContain(Platform.OS);
9
9
  });
package/src/app/app.ts CHANGED
@@ -23,8 +23,13 @@ interface Page {
23
23
  }
24
24
 
25
25
  const PAGES: readonly Page[] = [
26
- { id: 'home', label: 'Home', sfSymbol: 'house', hint: 'A native macOS app, written in Angular.' },
27
- { id: 'notes', label: 'Notes', sfSymbol: 'note.text', hint: 'Real AppKit views, no web view.' },
26
+ {
27
+ id: 'home',
28
+ label: 'Home',
29
+ sfSymbol: 'house',
30
+ hint: 'A native desktop app, written in Angular.',
31
+ },
32
+ { id: 'notes', label: 'Notes', sfSymbol: 'note.text', hint: 'Real native views, no web view.' },
28
33
  { id: 'settings', label: 'Settings', sfSymbol: 'gearshape', hint: 'One runtime: no IPC.' },
29
34
  ];
30
35
 
@@ -32,8 +37,9 @@ const PAGES: readonly Page[] = [
32
37
  * Element names are lowercase, and that is load-bearing rather than style: an uppercase name such
33
38
  * as <View> matches no component's selector, and the Metro transform fails the build on it.
34
39
  *
35
- * Sizes are a phone's by default and a Mac's under :host-context(.platform-macos), so the app is
36
- * Mac-sized now and still fits a phone if iOS or Android is added later.
40
+ * Sizes are a phone's by default and a desktop's under :host-context(.platform-macos) and
41
+ * :host-context(.platform-linux), so the app is desktop-sized now and still fits a phone if iOS or
42
+ * Android is added later.
37
43
  */
38
44
  @Component({
39
45
  imports: [
@@ -108,14 +114,17 @@ const PAGES: readonly Page[] = [
108
114
  color: #5f5f6b;
109
115
  font-size: 15px;
110
116
  }
111
- :host-context(.platform-macos) .content {
117
+ :host-context(.platform-macos) .content,
118
+ :host-context(.platform-linux) .content {
112
119
  gap: 8px;
113
120
  padding: 20px;
114
121
  }
115
- :host-context(.platform-macos) .title {
122
+ :host-context(.platform-macos) .title,
123
+ :host-context(.platform-linux) .title {
116
124
  font-size: 22px;
117
125
  }
118
- :host-context(.platform-macos) .hint {
126
+ :host-context(.platform-macos) .hint,
127
+ :host-context(.platform-linux) .hint {
119
128
  font-size: 13px;
120
129
  }
121
130
  @media (prefers-color-scheme: dark) {
package/vitest.config.mts CHANGED
@@ -2,15 +2,18 @@ import { ngNative } from '@ng-native/testing/vitest';
2
2
  import { deviceTests } from '@ng-native/testing/device/vitest';
3
3
  import { defineConfig } from 'vitest/config';
4
4
 
5
- // Two projects. `node-macos` compiles Angular for the tests the way Metro compiles it for the app
6
- // and runs them in Node against a fake of the native side: no app window. `macos` runs the
7
- // `*.device.ts` files inside the running app on this Mac, starting Metro and the app itself.
8
- // `npm test` runs `node-macos` alone.
5
+ // Four projects. `node-macos` and `node-linux` compile Angular for the tests the way Metro
6
+ // compiles it for the app and run them in Node against a fake of the native side: no app window.
7
+ // `macos` and `linux` run the `*.device.ts` files inside the running app, starting Metro and the
8
+ // app themselves: `macos` on this Mac, `linux` in GTK, on Linux or in the ngn-el9 container on a
9
+ // Mac. `npm test` runs the two Node projects alone.
9
10
  export default defineConfig({
10
11
  test: {
11
12
  projects: [
12
13
  { plugins: [ngNative({ os: 'macos' })], test: { name: 'node-macos' } },
14
+ { plugins: [ngNative({ os: 'linux' })], test: { name: 'node-linux' } },
13
15
  { plugins: [deviceTests({ platform: 'macos' })] },
16
+ { plugins: [deviceTests({ platform: 'linux' })] },
14
17
  ],
15
18
  },
16
19
  });