@ng-native/nx 0.18.0 → 0.18.1
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 +3 -4
- package/library/index.cjs +2 -3
- package/migrations.json +6 -1
- package/native-app.cjs +16 -4
- package/package.json +2 -2
package/application/index.cjs
CHANGED
|
@@ -29,7 +29,7 @@ const {
|
|
|
29
29
|
addDependenciesToPackageJson,
|
|
30
30
|
} = require('@nx/devkit');
|
|
31
31
|
const native = require('../native-app.cjs');
|
|
32
|
-
const { init
|
|
32
|
+
const { init } = require('../init/index.cjs');
|
|
33
33
|
const { usesWorkspaces, includeInWorkspaces } = require('./workspaces.cjs');
|
|
34
34
|
const { asSaved } = require('../save-exact.cjs');
|
|
35
35
|
const { registerSyncGenerator } = require('../sync/index.cjs');
|
|
@@ -268,12 +268,11 @@ async function application(tree, options) {
|
|
|
268
268
|
true,
|
|
269
269
|
);
|
|
270
270
|
}
|
|
271
|
-
// `
|
|
271
|
+
// `tsconfigPaths()`, which the app's Vitest config uses to reach the workspace's libraries.
|
|
272
272
|
// Added now rather than only when present, because a library generated later is the ordinary
|
|
273
273
|
// case and nothing would come back to add it then.
|
|
274
274
|
if (hasPathAliases(tree, workspaces)) {
|
|
275
|
-
|
|
276
|
-
addDependenciesToPackageJson(tree, {}, vite, 'package.json', true);
|
|
275
|
+
addDependenciesToPackageJson(tree, {}, native.vitestPathsDependencies, 'package.json', true);
|
|
277
276
|
}
|
|
278
277
|
await writeFiles(tree, resolved);
|
|
279
278
|
addProjectConfiguration(tree, projectName, {
|
package/library/index.cjs
CHANGED
|
@@ -328,10 +328,9 @@ async function library(tree, options) {
|
|
|
328
328
|
});
|
|
329
329
|
|
|
330
330
|
await addImports(tree, directory, angular ? {} : typecheckDependencies);
|
|
331
|
-
// `
|
|
331
|
+
// `tsconfigPaths()`, which the Vitest config uses to reach the workspace's other libraries.
|
|
332
332
|
if (aliases) {
|
|
333
|
-
|
|
334
|
-
addDependenciesToPackageJson(tree, {}, vite, 'package.json', true);
|
|
333
|
+
addDependenciesToPackageJson(tree, {}, native.vitestPathsDependencies, 'package.json', true);
|
|
335
334
|
}
|
|
336
335
|
|
|
337
336
|
if (!options.skipFormat) await formatFiles(tree);
|
package/migrations.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"generators": {
|
|
3
3
|
"sync-app-versions": {
|
|
4
|
-
"version": "0.18.
|
|
4
|
+
"version": "0.18.1",
|
|
5
5
|
"description": "Move the @ng-native packages each project's own package.json lists to the new version.",
|
|
6
6
|
"implementation": "./migrations/run.cjs#sync-app-versions"
|
|
7
7
|
},
|
|
@@ -44,6 +44,11 @@
|
|
|
44
44
|
"version": "0.17.2",
|
|
45
45
|
"description": "Keep what watchConditions returns in each app's entry point and stop it as the app is destroyed.",
|
|
46
46
|
"implementation": "./migrations/run.cjs#stop-watching-conditions"
|
|
47
|
+
},
|
|
48
|
+
"vitest-tsconfig-paths": {
|
|
49
|
+
"version": "0.18.1",
|
|
50
|
+
"description": "Resolve the workspace's path aliases in Nx Vitest configs with vite-tsconfig-paths, as nxViteTsPaths does nothing from Nx 24.",
|
|
51
|
+
"implementation": "./migrations/run.cjs#vitest-tsconfig-paths"
|
|
47
52
|
}
|
|
48
53
|
}
|
|
49
54
|
}
|
package/native-app.cjs
CHANGED
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
* import a library at all: Metro reports `Cannot resolve @org/ui`.
|
|
14
14
|
* - `tsconfig.json` also extends the workspace's `tsconfig.base.json` when there is one, which is
|
|
15
15
|
* where those aliases live, and puts back the Expo settings the workspace's base overrides.
|
|
16
|
-
* - `vitest.config.mts` adds `
|
|
17
|
-
* aliases, which Vitest does not read from tsconfig either.
|
|
16
|
+
* - `vitest.config.mts` adds `vite-tsconfig-paths` when the workspace has path aliases, for the
|
|
17
|
+
* same aliases, which Vitest does not read from tsconfig either. It is what Nx 24 writes in its
|
|
18
|
+
* own Vite configs: `nxViteTsPaths` from `@nx/vite` is an inert stub there.
|
|
18
19
|
*
|
|
19
20
|
* What does not depend on Nx, the dependencies, `app.json` and bundle identifier among them, is
|
|
20
21
|
* `@ng-native/migrate/native-app.cjs`, which `@ng-native/schematics` builds its apps from too.
|
|
@@ -153,12 +154,22 @@ function vitestConfig(withPaths) {
|
|
|
153
154
|
return template
|
|
154
155
|
.replace(
|
|
155
156
|
"import { defineConfig } from 'vitest/config';",
|
|
156
|
-
"import
|
|
157
|
+
"import tsconfigPaths from 'vite-tsconfig-paths';\n" +
|
|
157
158
|
"import { defineConfig } from 'vitest/config';",
|
|
158
159
|
)
|
|
159
|
-
.replace('plugins: [ngNative()],', 'plugins: [
|
|
160
|
+
.replace('plugins: [ngNative()],', 'plugins: [tsconfigPaths(), ngNative()],');
|
|
160
161
|
}
|
|
161
162
|
|
|
163
|
+
/**
|
|
164
|
+
* What `vitestConfig(true)` imports, at the range Nx 24 adds for its own Vite configs, and Vite at
|
|
165
|
+
* the range `@ng-native/testing` peers on. Both peer on Vite optionally, so npm installs it for
|
|
166
|
+
* neither, and an integrated workspace from the `angular-monorepo` preset may have none at its root.
|
|
167
|
+
*/
|
|
168
|
+
const vitestPathsDependencies = {
|
|
169
|
+
'vite-tsconfig-paths': '^5.1.4',
|
|
170
|
+
vite: '^6.0.0 || ^7.0.0 || ^8.0.0',
|
|
171
|
+
};
|
|
172
|
+
|
|
162
173
|
/**
|
|
163
174
|
* The ranges a workspace package's `package.json` lists: the root's own where everything it can
|
|
164
175
|
* resolve to is a version Angular Native accepts, so that pnpm does not install a second Vitest
|
|
@@ -195,6 +206,7 @@ module.exports = {
|
|
|
195
206
|
tsconfig,
|
|
196
207
|
typecheckTsconfig,
|
|
197
208
|
vitestConfig,
|
|
209
|
+
vitestPathsDependencies,
|
|
198
210
|
reuseRootRanges,
|
|
199
211
|
expoCompanions,
|
|
200
212
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-native/nx",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "Nx generators for Angular Native: nx add, an Expo app project whose targets run it, and native libraries and components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
]
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@ng-native/migrate": "0.18.
|
|
43
|
+
"@ng-native/migrate": "0.18.1",
|
|
44
44
|
"@nx/devkit": "^23.0.0 || ^24.0.0",
|
|
45
45
|
"minimatch": "^10.0.0",
|
|
46
46
|
"semver": "^7.7.0"
|