@ng-native/nx 0.1.0 → 0.1.2
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/application/index.cjs +5 -1
- package/files/AGENTS.md +4 -2
- package/init/index.cjs +4 -0
- package/native-app.cjs +12 -3
- package/package.json +1 -1
package/application/index.cjs
CHANGED
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
* The app is an Expo project, built by Metro. `@nx/expo`'s plugin, which `init` registers, infers
|
|
5
5
|
* its Expo targets from the files written here; `project.json` adds the two it cannot infer:
|
|
6
6
|
* `typecheck`, since Expo's `tsconfig` sets `noEmit` and `@nx/js` disables its own for that, and
|
|
7
|
-
* `test`, which runs Vitest once rather than watching.
|
|
7
|
+
* `test`, which runs Vitest once rather than watching. It also replaces the inferred `start`,
|
|
8
|
+
* which is `@nx/expo:start`, an executor Nx deprecates and warns about on every run, with the
|
|
9
|
+
* `expo start` that executor runs, as the plugin already infers `run-ios` and `export`. Once the
|
|
10
|
+
* plugin infers `start` as a command too, this one can go.
|
|
8
11
|
*
|
|
9
12
|
* Where the dependencies go depends on the workspace. With package-manager workspaces, the Nx
|
|
10
13
|
* default since 20, the app is a workspace package and lists them itself, which pnpm needs in
|
|
@@ -45,6 +48,7 @@ function targets(directory) {
|
|
|
45
48
|
inputs: ['default', '^production'],
|
|
46
49
|
},
|
|
47
50
|
test: { ...run('vitest run'), cache: true, inputs: ['default', '^production'] },
|
|
51
|
+
start: { ...run('expo start'), continuous: true },
|
|
48
52
|
};
|
|
49
53
|
}
|
|
50
54
|
|
package/files/AGENTS.md
CHANGED
|
@@ -8,7 +8,7 @@ The whole documentation, for reading before a change: https://ng-native.com/llms
|
|
|
8
8
|
outline with a line per page: https://ng-native.com/llms.txt.
|
|
9
9
|
|
|
10
10
|
Angular's own rules apply as well: https://angular.dev/assets/context/best-practices.md. Its
|
|
11
|
-
browser-only parts do not: there is no `NgOptimizedImage` (use `<image>`), and no AXE
|
|
11
|
+
browser-only parts do not: there is no `NgOptimizedImage` (use `<image>`), and no AXE
|
|
12
12
|
(accessibility is the props below). Where the two disagree, this file wins.
|
|
13
13
|
|
|
14
14
|
## Commands
|
|
@@ -41,7 +41,9 @@ change; both are fast.
|
|
|
41
41
|
- **No backticks inside an inline template**, even in an HTML comment: they end the template string
|
|
42
42
|
and the build fails with a misleading parse error.
|
|
43
43
|
- **Accessibility is props:** `accessibilityRole="button"`, `accessibilityLabel`,
|
|
44
|
-
`[accessibilityState]`.
|
|
44
|
+
`[accessibilityState]`. The web spellings work too, as aliases: `role`, and the `aria-*` names
|
|
45
|
+
React Native maps (`aria-label`, `aria-checked`, `aria-hidden` and so on). Screen readers and
|
|
46
|
+
the testing library's `getByRole` both read them.
|
|
45
47
|
|
|
46
48
|
## Styling
|
|
47
49
|
|
package/init/index.cjs
CHANGED
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
* because `@nx/expo` depends on `@nx/react`, whose `react-dom` peer npm otherwise takes at the
|
|
15
15
|
* newest React and then refuses every later install beside React 19.2.3. And `@expo/cli`, which
|
|
16
16
|
* `@nx/expo`'s prebuild executor loads from the root, where npm does not put it on its own.
|
|
17
|
+
*
|
|
18
|
+
* It also adds Babel 7's `@babel/runtime`, the one Expo's Babel preset writes imports of. In an
|
|
19
|
+
* Angular workspace `@angular-devkit/build-angular` hoists Babel 8's to the root, which has no
|
|
20
|
+
* `regenerator`, and every `nx start` warned that Metro fell back to file-based resolution.
|
|
17
21
|
*/
|
|
18
22
|
const {
|
|
19
23
|
addDependenciesToPackageJson,
|
package/native-app.cjs
CHANGED
|
@@ -38,8 +38,9 @@ const dependencies = {
|
|
|
38
38
|
...Object.fromEntries(FRAMEWORK.map((name) => [name, version])),
|
|
39
39
|
'@angular/common': '^22.0.0',
|
|
40
40
|
'@angular/core': '^22.0.0',
|
|
41
|
-
expo: '~57.0.
|
|
41
|
+
expo: '~57.0.26',
|
|
42
42
|
'expo-status-bar': '~57.0.1',
|
|
43
|
+
'expo-system-ui': '~57.0.4',
|
|
43
44
|
react: '19.2.3',
|
|
44
45
|
'react-native': '0.86.3',
|
|
45
46
|
'react-native-safe-area-context': '~5.7.0',
|
|
@@ -47,9 +48,14 @@ const dependencies = {
|
|
|
47
48
|
|
|
48
49
|
/**
|
|
49
50
|
* What `nx add` puts beside `@nx/expo`, in place of the `@nx/expo:init` it does not run: see
|
|
50
|
-
* `init/index.cjs`. `@expo/cli`
|
|
51
|
+
* `init/index.cjs`. `@expo/cli` and `@babel/runtime` are the ranges the template's `expo` depends
|
|
52
|
+
* on.
|
|
51
53
|
*/
|
|
52
|
-
const expoCompanions = {
|
|
54
|
+
const expoCompanions = {
|
|
55
|
+
'react-dom': dependencies.react,
|
|
56
|
+
'@expo/cli': '^57.0.27',
|
|
57
|
+
'@babel/runtime': '^7.20.0',
|
|
58
|
+
};
|
|
53
59
|
|
|
54
60
|
/** @type {Record<string, string>} */
|
|
55
61
|
const devDependencies = {
|
|
@@ -104,6 +110,9 @@ function appJson(name) {
|
|
|
104
110
|
ios: { supportsTablet: true },
|
|
105
111
|
android: { predictiveBackGestureEnabled: false },
|
|
106
112
|
scheme: slug.replace(/[^a-z0-9]/gi, '').toLowerCase(),
|
|
113
|
+
// The template's: Expo otherwise guesses a router root from src/app and says so on every start.
|
|
114
|
+
extra: { router: { root: 'src/app' } },
|
|
115
|
+
plugins: ['@ng-native/metro'],
|
|
107
116
|
};
|
|
108
117
|
return JSON.stringify({ expo }, null, 2) + '\n';
|
|
109
118
|
}
|