@nx/expo 23.1.0 → 23.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/dist/plugins/metro-resolver.d.ts +4 -1
- package/dist/plugins/metro-resolver.js +29 -26
- package/dist/plugins/plugin.js +2 -4
- package/dist/plugins/with-nx-metro.d.ts +1 -0
- package/dist/plugins/with-nx-metro.js +70 -40
- package/dist/src/executors/install/install.impl.js +2 -3
- package/dist/src/executors/serve/serve.impl.js +29 -4
- package/dist/src/executors/sync-deps/sync-deps.impl.d.ts +1 -1
- package/dist/src/generators/application/lib/add-e2e.js +3 -2
- package/dist/src/generators/application/lib/create-application-files.js +3 -3
- package/dist/src/generators/application/schema.d.ts +4 -0
- package/dist/src/generators/application/schema.json +8 -2
- package/dist/src/generators/library/schema.d.ts +4 -0
- package/dist/src/generators/library/schema.json +8 -2
- package/dist/src/utils/add-linting.d.ts +4 -0
- package/dist/src/utils/add-linting.js +1 -0
- package/dist/src/utils/version-utils.d.ts +1 -1
- package/package.json +17 -9
|
@@ -1 +1,4 @@
|
|
|
1
|
-
export declare function getResolveRequest(extensions: string[], exportsConditionNames?: string[], mainFields?: string[]
|
|
1
|
+
export declare function getResolveRequest(extensions: string[], exportsConditionNames?: string[], mainFields?: string[], anchor?: {
|
|
2
|
+
appRoot?: string;
|
|
3
|
+
usesExpoMetro: boolean;
|
|
4
|
+
}): (_context: any, realModuleName: string, platform: string | null) => any;
|
|
@@ -9,29 +9,28 @@ const enhanced_resolve_1 = require("enhanced-resolve");
|
|
|
9
9
|
const path_1 = require("path");
|
|
10
10
|
const fs = tslib_1.__importStar(require("fs"));
|
|
11
11
|
const devkit_1 = require("@nx/devkit");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* `metro-resolver` package. We prefer `@expo/metro` and fall back to the
|
|
20
|
-
* standalone package to stay compatible with both.
|
|
21
|
-
*/
|
|
22
|
-
function getMetroResolver() {
|
|
12
|
+
const metroResolverCache = new Map();
|
|
13
|
+
// The resolver must come from the same Metro instance Expo uses: `@expo/metro`
|
|
14
|
+
// on SDK 55+, standalone `metro-resolver` on 53/54. Resolve from the app root
|
|
15
|
+
// so each app gets its own SDK's copy.
|
|
16
|
+
function getMetroResolver(appRoot, usesExpoMetro) {
|
|
17
|
+
const cacheKey = `${appRoot ?? ''}|${usesExpoMetro}`;
|
|
18
|
+
let metroResolver = metroResolverCache.get(cacheKey);
|
|
23
19
|
if (!metroResolver) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
const candidates = usesExpoMetro
|
|
21
|
+
? ['@expo/metro/metro-resolver', 'metro-resolver']
|
|
22
|
+
: ['metro-resolver', '@expo/metro/metro-resolver'];
|
|
23
|
+
for (const candidate of candidates) {
|
|
28
24
|
try {
|
|
29
|
-
metroResolver = require(
|
|
30
|
-
|
|
31
|
-
catch (error) {
|
|
32
|
-
throw new Error('Unable to load Metro resolver. Install `@expo/metro` (Expo SDK 55+) or `metro-resolver` (>= 0.82.0).');
|
|
25
|
+
metroResolver = require(require.resolve(candidate, appRoot ? { paths: [appRoot] } : undefined));
|
|
26
|
+
break;
|
|
33
27
|
}
|
|
28
|
+
catch { }
|
|
29
|
+
}
|
|
30
|
+
if (!metroResolver) {
|
|
31
|
+
throw new Error('Unable to load Metro resolver. Install `@expo/metro` (Expo SDK 55+) or `metro-resolver` (>= 0.82.0).');
|
|
34
32
|
}
|
|
33
|
+
metroResolverCache.set(cacheKey, metroResolver);
|
|
35
34
|
}
|
|
36
35
|
return metroResolver;
|
|
37
36
|
}
|
|
@@ -41,13 +40,17 @@ function getMetroResolver() {
|
|
|
41
40
|
* This resolve function requires projectRoot to be set to
|
|
42
41
|
* workspace root in order modules and assets to be registered and watched.
|
|
43
42
|
*/
|
|
44
|
-
function getResolveRequest(extensions, exportsConditionNames = [], mainFields = []
|
|
43
|
+
function getResolveRequest(extensions, exportsConditionNames = [], mainFields = [],
|
|
44
|
+
// which app is being bundled; default keeps the process-wide preference
|
|
45
|
+
anchor = {
|
|
46
|
+
usesExpoMetro: true,
|
|
47
|
+
}) {
|
|
45
48
|
return function (_context, realModuleName, platform) {
|
|
46
49
|
const debug = process.env.NX_REACT_NATIVE_DEBUG === 'true';
|
|
47
50
|
const { resolveRequest, ...context } = _context;
|
|
48
51
|
const resolvedPath = resolveRequestFromContext(resolveRequest, _context, realModuleName, platform, debug) ??
|
|
49
|
-
defaultMetroResolver(context, realModuleName, platform, debug) ??
|
|
50
|
-
tsconfigPathsResolver(context, extensions, realModuleName, platform, debug) ??
|
|
52
|
+
defaultMetroResolver(context, realModuleName, platform, debug, anchor) ??
|
|
53
|
+
tsconfigPathsResolver(context, extensions, realModuleName, platform, debug, anchor) ??
|
|
51
54
|
pnpmResolver(extensions, context, realModuleName, debug, exportsConditionNames, mainFields);
|
|
52
55
|
if (resolvedPath) {
|
|
53
56
|
return resolvedPath;
|
|
@@ -71,9 +74,9 @@ function resolveRequestFromContext(resolveRequest, context, realModuleName, plat
|
|
|
71
74
|
* This function try to resolve path using metro's default resolver
|
|
72
75
|
* @returns path if resolved, else undefined
|
|
73
76
|
*/
|
|
74
|
-
function defaultMetroResolver(context, realModuleName, platform, debug) {
|
|
77
|
+
function defaultMetroResolver(context, realModuleName, platform, debug, anchor) {
|
|
75
78
|
try {
|
|
76
|
-
const resolver = getMetroResolver();
|
|
79
|
+
const resolver = getMetroResolver(anchor.appRoot, anchor.usesExpoMetro);
|
|
77
80
|
return resolver.resolve(context, realModuleName, platform);
|
|
78
81
|
}
|
|
79
82
|
catch {
|
|
@@ -109,11 +112,11 @@ function pnpmResolver(extensions, context, realModuleName, debug, exportsConditi
|
|
|
109
112
|
* This function try to resolve files that are specified in tsconfig's paths
|
|
110
113
|
* @returns path if resolved, else undefined
|
|
111
114
|
*/
|
|
112
|
-
function tsconfigPathsResolver(context, extensions, realModuleName, platform, debug) {
|
|
115
|
+
function tsconfigPathsResolver(context, extensions, realModuleName, platform, debug, anchor) {
|
|
113
116
|
try {
|
|
114
117
|
const tsConfigPathMatcher = getMatcher(debug);
|
|
115
118
|
const match = tsConfigPathMatcher(realModuleName, undefined, undefined, extensions.map((ext) => `.${ext}`));
|
|
116
|
-
const resolver = getMetroResolver();
|
|
119
|
+
const resolver = getMetroResolver(anchor.appRoot, anchor.usesExpoMetro);
|
|
117
120
|
return resolver.resolve(context, match, platform);
|
|
118
121
|
}
|
|
119
122
|
catch {
|
package/dist/plugins/plugin.js
CHANGED
|
@@ -6,14 +6,12 @@ const devkit_1 = require("@nx/devkit");
|
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const js_1 = require("@nx/js");
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
|
-
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
10
|
-
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
11
9
|
const internal_2 = require("@nx/js/internal");
|
|
12
10
|
exports.createNodes = [
|
|
13
11
|
'**/app.{json,config.js,config.ts}',
|
|
14
12
|
async (configFiles, options, context) => {
|
|
15
|
-
const optionsHash = (0,
|
|
16
|
-
const cachePath = (0, path_1.join)(
|
|
13
|
+
const optionsHash = (0, internal_1.hashObject)(options);
|
|
14
|
+
const cachePath = (0, path_1.join)(internal_1.workspaceDataDirectory, `expo-${optionsHash}.hash`);
|
|
17
15
|
const targetsCache = new internal_1.PluginCache(cachePath);
|
|
18
16
|
const packageManager = (0, devkit_1.detectPackageManager)(context.workspaceRoot);
|
|
19
17
|
const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
|
@@ -1,36 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.appUsesExpoMetro = appUsesExpoMetro;
|
|
3
4
|
exports.withNxMetro = withNxMetro;
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const node_fs_1 = require("node:fs");
|
|
6
7
|
const path_1 = require("path");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* `@expo/metro-config`'s `getDefaultConfig` is built against. Older SDKs
|
|
15
|
-
* (53/54) use the standalone `metro-config` package. We prefer `@expo/metro`
|
|
16
|
-
* and fall back to the standalone package to stay compatible with both.
|
|
17
|
-
*/
|
|
18
|
-
function getMetroConfig() {
|
|
8
|
+
const metroConfigCache = new Map();
|
|
9
|
+
// `mergeConfig` must come from the same Metro instance as the app's
|
|
10
|
+
// `getDefaultConfig`: `@expo/metro` on SDK 55+, standalone `metro-config` on
|
|
11
|
+
// 53/54. Resolve from the app root so each app gets its own SDK's copy.
|
|
12
|
+
function getMetroConfig(appRoot, usesExpoMetro) {
|
|
13
|
+
const cacheKey = `${appRoot ?? ''}|${usesExpoMetro}`;
|
|
14
|
+
let metroConfig = metroConfigCache.get(cacheKey);
|
|
19
15
|
if (!metroConfig) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
const candidates = usesExpoMetro
|
|
17
|
+
? ['@expo/metro/metro-config', 'metro-config']
|
|
18
|
+
: ['metro-config', '@expo/metro/metro-config'];
|
|
19
|
+
for (const candidate of candidates) {
|
|
24
20
|
try {
|
|
25
|
-
metroConfig = require(
|
|
26
|
-
|
|
27
|
-
catch (error) {
|
|
28
|
-
throw new Error('Unable to load Metro config. Install `@expo/metro` (Expo SDK 55+) or `metro-config` (>= 0.82.0).');
|
|
21
|
+
metroConfig = require(require.resolve(candidate, appRoot ? { paths: [appRoot] } : undefined));
|
|
22
|
+
break;
|
|
29
23
|
}
|
|
24
|
+
catch { }
|
|
30
25
|
}
|
|
26
|
+
if (!metroConfig) {
|
|
27
|
+
throw new Error('Unable to load Metro config. Install `@expo/metro` (Expo SDK 55+) or `metro-config` (>= 0.82.0).');
|
|
28
|
+
}
|
|
29
|
+
metroConfigCache.set(cacheKey, metroConfig);
|
|
31
30
|
}
|
|
32
31
|
return metroConfig;
|
|
33
32
|
}
|
|
33
|
+
// SDK 55+ ships Metro through `@expo/metro`. Resolve `expo` from the app's
|
|
34
|
+
// own root: probing from this plugin's location reads whichever copy is
|
|
35
|
+
// hoisted, which can belong to a sibling app on a different SDK.
|
|
36
|
+
function appUsesExpoMetro(appRoot) {
|
|
37
|
+
try {
|
|
38
|
+
const expoPkgPath = require.resolve('expo/package.json', appRoot ? { paths: [appRoot] } : undefined);
|
|
39
|
+
return parseInt(require(expoPkgPath).version, 10) >= 55;
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
// expo not resolvable; probe `@expo/metro` process-wide (no root entry
|
|
43
|
+
// point, so resolve a known subpath)
|
|
44
|
+
try {
|
|
45
|
+
require.resolve('@expo/metro/metro-config');
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function appOwnsExpo(appNodeModules) {
|
|
54
|
+
const appExpo = (0, path_1.join)(appNodeModules, 'expo');
|
|
55
|
+
if (!(0, node_fs_1.existsSync)(appExpo))
|
|
56
|
+
return false;
|
|
57
|
+
const hoistedExpo = (0, path_1.join)(devkit_1.workspaceRoot, 'node_modules', 'expo');
|
|
58
|
+
// no hoisted copy: the app-local one is the only expo, and Expo's HMR
|
|
59
|
+
// rewrite resolves strictly from `projectRoot`, so anchor at the app
|
|
60
|
+
if (!(0, node_fs_1.existsSync)(hoistedExpo))
|
|
61
|
+
return true;
|
|
62
|
+
return (0, node_fs_1.realpathSync)(appExpo) !== (0, node_fs_1.realpathSync)(hoistedExpo);
|
|
63
|
+
}
|
|
34
64
|
const metro_resolver_1 = require("./metro-resolver");
|
|
35
65
|
function withNxMetro(userConfig, opts = {}) {
|
|
36
66
|
const extensions = ['', 'ts', 'tsx', 'js', 'jsx', 'json'];
|
|
@@ -46,30 +76,30 @@ function withNxMetro(userConfig, opts = {}) {
|
|
|
46
76
|
watchFolders = watchFolders.concat(opts.watchFolders);
|
|
47
77
|
}
|
|
48
78
|
watchFolders = [...new Set(watchFolders)].filter((folder) => (0, node_fs_1.existsSync)(folder));
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
// `
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
usesExpoMetro = true;
|
|
63
|
-
}
|
|
64
|
-
catch { }
|
|
79
|
+
// `getDefaultConfig(__dirname)` set this to the app directory
|
|
80
|
+
const appRoot = userConfig.projectRoot;
|
|
81
|
+
const usesExpoMetro = appUsesExpoMetro(appRoot);
|
|
82
|
+
const appNodeModules = appRoot ? (0, path_1.join)(appRoot, 'node_modules') : null;
|
|
83
|
+
const hasAppNodeModules = !!appNodeModules && (0, node_fs_1.existsSync)(appNodeModules);
|
|
84
|
+
// an app pinning its own `expo` must stay anchored at the app, or the
|
|
85
|
+
// bundle picks up the hoisted copy alongside its own. Compare real paths:
|
|
86
|
+
// `ensureNodeModulesSymlink` links the whole app node_modules to the
|
|
87
|
+
// workspace's, which is not an app-owned copy.
|
|
88
|
+
const ownsExpo = hasAppNodeModules && appOwnsExpo(appNodeModules);
|
|
89
|
+
// SDK 55+ resolves Babel config and the HMR client relative to
|
|
90
|
+
// `projectRoot`; SDK 53/54 apps relying on hoisted Expo need the workspace
|
|
91
|
+
// root so `originModulePath` stays workspace-relative for the Nx resolver.
|
|
65
92
|
const nxConfig = {
|
|
66
|
-
...(usesExpoMetro ? {} : { projectRoot: devkit_1.workspaceRoot }),
|
|
93
|
+
...(usesExpoMetro || ownsExpo ? {} : { projectRoot: devkit_1.workspaceRoot }),
|
|
67
94
|
resolver: {
|
|
68
|
-
resolveRequest: (0, metro_resolver_1.getResolveRequest)(extensions, opts.exportsConditionNames, opts.mainFields),
|
|
69
|
-
nodeModulesPaths: [
|
|
95
|
+
resolveRequest: (0, metro_resolver_1.getResolveRequest)(extensions, opts.exportsConditionNames, opts.mainFields, { appRoot, usesExpoMetro }),
|
|
96
|
+
nodeModulesPaths: [
|
|
97
|
+
...(hasAppNodeModules ? [appNodeModules] : []),
|
|
98
|
+
(0, path_1.join)(devkit_1.workspaceRoot, 'node_modules'),
|
|
99
|
+
],
|
|
70
100
|
},
|
|
71
101
|
watchFolders,
|
|
72
102
|
};
|
|
73
|
-
const { mergeConfig } = getMetroConfig();
|
|
103
|
+
const { mergeConfig } = getMetroConfig(appRoot, usesExpoMetro);
|
|
74
104
|
return mergeConfig(userConfig, nxConfig);
|
|
75
105
|
}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = installExecutor;
|
|
4
4
|
exports.installAndUpdatePackageJson = installAndUpdatePackageJson;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const fileutils_1 = require("nx/src/utils/fileutils");
|
|
7
6
|
const path_1 = require("path");
|
|
8
7
|
const sync_deps_impl_1 = require("../sync-deps/sync-deps.impl");
|
|
9
8
|
const deprecation_1 = require("../../utils/deprecation");
|
|
@@ -34,8 +33,8 @@ async function installAndUpdatePackageJson(context, options) {
|
|
|
34
33
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
35
34
|
const workspacePackageJsonPath = (0, path_1.join)(context.root, 'package.json');
|
|
36
35
|
const projectPackageJsonPath = (0, path_1.join)(context.root, projectRoot, 'package.json');
|
|
37
|
-
const workspacePackageJson = (0,
|
|
38
|
-
const projectPackageJson = (0,
|
|
36
|
+
const workspacePackageJson = (0, devkit_1.readJsonFile)(workspacePackageJsonPath);
|
|
37
|
+
const projectPackageJson = (0, devkit_1.readJsonFile)(projectPackageJsonPath);
|
|
39
38
|
(0, sync_deps_impl_1.displayNewlyAddedDepsMessage)(context.projectName, await (0, sync_deps_impl_1.syncDeps)(context.projectName, projectPackageJson, projectPackageJsonPath, workspacePackageJson, context.projectGraph, packages));
|
|
40
39
|
}
|
|
41
40
|
// options from https://github.com/expo/expo/blob/main/packages/%40expo/cli/src/install/index.ts
|
|
@@ -60,27 +60,52 @@ function serveAsync(workspaceRoot, projectRoot, options) {
|
|
|
60
60
|
env: process.env,
|
|
61
61
|
stdio: ['inherit', 'pipe', 'pipe', 'ipc'],
|
|
62
62
|
});
|
|
63
|
+
let settled = false;
|
|
64
|
+
const settleResolve = (cp) => {
|
|
65
|
+
if (settled)
|
|
66
|
+
return;
|
|
67
|
+
settled = true;
|
|
68
|
+
resolve(cp);
|
|
69
|
+
};
|
|
70
|
+
const settleReject = (err) => {
|
|
71
|
+
if (settled)
|
|
72
|
+
return;
|
|
73
|
+
settled = true;
|
|
74
|
+
reject(err);
|
|
75
|
+
};
|
|
76
|
+
// Expo bundles on first request, so waiting on a bundle log line deadlocks
|
|
77
|
+
// against a consumer that only requests once we report ready (@nx/cypress).
|
|
78
|
+
// /status answers packager-status:running once Metro's bundler is ready.
|
|
79
|
+
void (async () => {
|
|
80
|
+
while (!settled) {
|
|
81
|
+
if ((await (0, is_packager_running_1.isPackagerRunning)(options.port)) === 'running') {
|
|
82
|
+
settleResolve(childProcess);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
86
|
+
}
|
|
87
|
+
})();
|
|
63
88
|
childProcess.stdout.on('data', (data) => {
|
|
64
89
|
process.stdout.write(data);
|
|
65
90
|
if (data.toString().includes('Bundling complete') ||
|
|
66
91
|
data.toString().includes('Bundled')) {
|
|
67
|
-
|
|
92
|
+
settleResolve(childProcess);
|
|
68
93
|
}
|
|
69
94
|
});
|
|
70
95
|
childProcess.stderr.on('data', (data) => {
|
|
71
96
|
process.stderr.write(data);
|
|
72
97
|
});
|
|
73
98
|
childProcess.on('error', (err) => {
|
|
74
|
-
|
|
99
|
+
settleReject(err);
|
|
75
100
|
});
|
|
76
101
|
childProcess.on('exit', (code, signal) => {
|
|
77
102
|
if (code === null)
|
|
78
103
|
code = (0, internal_1.signalToCode)(signal);
|
|
79
104
|
if (code === 0) {
|
|
80
|
-
|
|
105
|
+
settleResolve(childProcess);
|
|
81
106
|
}
|
|
82
107
|
else {
|
|
83
|
-
|
|
108
|
+
settleReject(code);
|
|
84
109
|
}
|
|
85
110
|
});
|
|
86
111
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExecutorContext, ProjectGraph } from '@nx/devkit';
|
|
2
2
|
import { ExpoSyncDepsOptions } from './schema';
|
|
3
|
-
import { PackageJson } from 'nx/
|
|
3
|
+
import { PackageJson } from '@nx/devkit/internal';
|
|
4
4
|
export interface ReactNativeSyncDepsOutput {
|
|
5
5
|
success: boolean;
|
|
6
6
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addE2e = addE2e;
|
|
4
4
|
const internal_1 = require("@nx/devkit/internal");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const internal_2 = require("@nx/eslint/internal");
|
|
6
7
|
const has_expo_plugin_1 = require("../../../utils/has-expo-plugin");
|
|
7
8
|
const versions_1 = require("../../../utils/versions");
|
|
8
9
|
async function addE2e(tree, options) {
|
|
@@ -93,7 +94,7 @@ async function addE2e(tree, options) {
|
|
|
93
94
|
directory: 'src',
|
|
94
95
|
js: false,
|
|
95
96
|
linter: options.linter,
|
|
96
|
-
|
|
97
|
+
enableTypedLinting: (0, internal_2.isTypedLintingEnabled)(options),
|
|
97
98
|
webServerCommand: e2eWebServerInfo.e2eCiWebServerCommand,
|
|
98
99
|
webServerAddress: e2eWebServerInfo.e2eCiBaseUrl,
|
|
99
100
|
rootProject: options.rootProject,
|
|
@@ -111,7 +112,7 @@ async function addE2e(tree, options) {
|
|
|
111
112
|
appDisplayName: options.displayName,
|
|
112
113
|
appName: options.simpleName,
|
|
113
114
|
framework: 'expo',
|
|
114
|
-
|
|
115
|
+
enableTypedLinting: (0, internal_2.isTypedLintingEnabled)(options),
|
|
115
116
|
skipFormat: true,
|
|
116
117
|
});
|
|
117
118
|
case 'none':
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createApplicationFiles = createApplicationFiles;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
|
|
6
5
|
const path_1 = require("path");
|
|
7
6
|
const version_utils_1 = require("../../../utils/version-utils");
|
|
7
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
8
8
|
async function createApplicationFiles(host, options) {
|
|
9
9
|
const packageManager = (0, devkit_1.detectPackageManager)(host.root);
|
|
10
10
|
// Expo SDK 55+ ships Metro via `@expo/metro` instead of the standalone
|
|
@@ -12,9 +12,9 @@ async function createApplicationFiles(host, options) {
|
|
|
12
12
|
// installed yet), default to the latest behavior (v56).
|
|
13
13
|
const installedExpoMajor = await (0, version_utils_1.getInstalledExpoMajor)(host);
|
|
14
14
|
const usesExpoMetro = installedExpoMajor === null || installedExpoMajor >= 55;
|
|
15
|
-
const onBoardingStatus = await (0,
|
|
15
|
+
const onBoardingStatus = await (0, internal_1.createNxCloudOnboardingURLForWelcomeApp)(host, options.nxCloudToken);
|
|
16
16
|
const connectCloudUrl = onBoardingStatus === 'unclaimed' &&
|
|
17
|
-
(await (0,
|
|
17
|
+
(await (0, internal_1.getNxCloudAppOnBoardingUrl)(options.nxCloudToken));
|
|
18
18
|
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/base'), options.appProjectRoot, {
|
|
19
19
|
...options,
|
|
20
20
|
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.appProjectRoot),
|
|
@@ -11,6 +11,10 @@ export interface Schema {
|
|
|
11
11
|
classComponent?: boolean;
|
|
12
12
|
js: boolean; // default is false
|
|
13
13
|
linter: Linter | LinterType; // default is eslint
|
|
14
|
+
enableTypedLinting?: boolean; // default is false
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
17
|
+
*/
|
|
14
18
|
setParserOptionsProject?: boolean; // default is false
|
|
15
19
|
e2eTestRunner: 'cypress' | 'playwright' | 'detox' | 'none'; // default is none
|
|
16
20
|
skipPackageJson?: boolean; // default is false
|
|
@@ -66,11 +66,17 @@
|
|
|
66
66
|
"description": "Generate JavaScript files rather than TypeScript files",
|
|
67
67
|
"default": false
|
|
68
68
|
},
|
|
69
|
-
"
|
|
69
|
+
"enableTypedLinting": {
|
|
70
70
|
"type": "boolean",
|
|
71
|
-
"description": "Whether
|
|
71
|
+
"description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
|
|
72
72
|
"default": false
|
|
73
73
|
},
|
|
74
|
+
"setParserOptionsProject": {
|
|
75
|
+
"type": "boolean",
|
|
76
|
+
"description": "Deprecated alias for `enableTypedLinting`.",
|
|
77
|
+
"default": false,
|
|
78
|
+
"x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
|
|
79
|
+
},
|
|
74
80
|
"e2eTestRunner": {
|
|
75
81
|
"description": "Adds the specified e2e test runner",
|
|
76
82
|
"type": "string",
|
|
@@ -16,6 +16,10 @@ export interface Schema {
|
|
|
16
16
|
importPath?: string;
|
|
17
17
|
js: boolean; // default is false
|
|
18
18
|
strict: boolean; // default is true
|
|
19
|
+
enableTypedLinting?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
22
|
+
*/
|
|
19
23
|
setParserOptionsProject?: boolean;
|
|
20
24
|
skipPackageJson?: boolean; // default is false
|
|
21
25
|
addPlugin?: boolean;
|
|
@@ -81,11 +81,17 @@
|
|
|
81
81
|
"description": "Whether to enable tsconfig strict mode or not.",
|
|
82
82
|
"default": true
|
|
83
83
|
},
|
|
84
|
-
"
|
|
84
|
+
"enableTypedLinting": {
|
|
85
85
|
"type": "boolean",
|
|
86
|
-
"description": "Whether
|
|
86
|
+
"description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
|
|
87
87
|
"default": false
|
|
88
88
|
},
|
|
89
|
+
"setParserOptionsProject": {
|
|
90
|
+
"type": "boolean",
|
|
91
|
+
"description": "Deprecated alias for `enableTypedLinting`.",
|
|
92
|
+
"default": false,
|
|
93
|
+
"x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
|
|
94
|
+
},
|
|
89
95
|
"skipPackageJson": {
|
|
90
96
|
"type": "boolean",
|
|
91
97
|
"description": "Do not add dependencies to `package.json`.",
|
|
@@ -4,6 +4,10 @@ interface NormalizedSchema {
|
|
|
4
4
|
linter?: Linter | LinterType;
|
|
5
5
|
projectName: string;
|
|
6
6
|
projectRoot: string;
|
|
7
|
+
enableTypedLinting?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
10
|
+
*/
|
|
7
11
|
setParserOptionsProject?: boolean;
|
|
8
12
|
tsConfigPaths: string[];
|
|
9
13
|
skipPackageJson?: boolean;
|
|
@@ -16,6 +16,7 @@ async function addLinting(host, options) {
|
|
|
16
16
|
tsConfigPaths: options.tsConfigPaths,
|
|
17
17
|
skipFormat: true,
|
|
18
18
|
skipPackageJson: options.skipPackageJson,
|
|
19
|
+
enableTypedLinting: (0, internal_1.isTypedLintingEnabled)(options),
|
|
19
20
|
addPlugin: options.addPlugin,
|
|
20
21
|
addPackageJsonDependencyChecks: options.buildable,
|
|
21
22
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/expo",
|
|
3
|
-
"version": "23.1.
|
|
3
|
+
"version": "23.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Expo Plugin for Nx contains executors and generators for managing and developing an expo application within your workspace. For example, you can directly build for different target platforms as well as generate projects and publish your code.",
|
|
6
6
|
"keywords": [
|
|
@@ -61,18 +61,26 @@
|
|
|
61
61
|
"semver": "^7.6.3",
|
|
62
62
|
"tsconfig-paths": "^4.1.2",
|
|
63
63
|
"tslib": "^2.3.0",
|
|
64
|
-
"@nx/devkit": "23.1.
|
|
65
|
-
"@nx/eslint": "23.1.
|
|
66
|
-
"@nx/js": "23.1.
|
|
67
|
-
"@nx/react": "23.1.
|
|
64
|
+
"@nx/devkit": "23.1.2",
|
|
65
|
+
"@nx/eslint": "23.1.2",
|
|
66
|
+
"@nx/js": "23.1.2",
|
|
67
|
+
"@nx/react": "23.1.2"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"expo": ">=53.0.0",
|
|
71
71
|
"@expo/metro": ">= 55.0.0",
|
|
72
72
|
"metro-config": ">= 0.82.0",
|
|
73
|
-
"metro-resolver": ">= 0.82.0"
|
|
73
|
+
"metro-resolver": ">= 0.82.0",
|
|
74
|
+
"@nx/cypress": "23.1.2",
|
|
75
|
+
"@nx/playwright": "23.1.2"
|
|
74
76
|
},
|
|
75
77
|
"peerDependenciesMeta": {
|
|
78
|
+
"@nx/cypress": {
|
|
79
|
+
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"@nx/playwright": {
|
|
82
|
+
"optional": true
|
|
83
|
+
},
|
|
76
84
|
"expo": {
|
|
77
85
|
"optional": true
|
|
78
86
|
},
|
|
@@ -87,11 +95,11 @@
|
|
|
87
95
|
}
|
|
88
96
|
},
|
|
89
97
|
"devDependencies": {
|
|
90
|
-
"nx": "23.1.
|
|
98
|
+
"nx": "23.1.2"
|
|
91
99
|
},
|
|
92
100
|
"optionalDependencies": {
|
|
93
|
-
"@nx/detox": "23.1.
|
|
94
|
-
"@nx/rollup": "23.1.
|
|
101
|
+
"@nx/detox": "23.1.2",
|
|
102
|
+
"@nx/rollup": "23.1.2"
|
|
95
103
|
},
|
|
96
104
|
"executors": "./executors.json",
|
|
97
105
|
"ng-update": {
|