@nx/expo 19.6.3 → 19.6.5
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/migrations.json +6 -0
- package/package.json +9 -9
- package/plugins/plugin.js +3 -4
- package/src/executors/build/build.impl.js +44 -0
- package/src/executors/build/schema.d.ts +4 -0
- package/src/executors/build/schema.json +16 -0
- package/src/executors/serve/serve.impl.js +2 -3
- package/src/generators/application/files/base/metro.config.js.template +1 -0
- package/src/generators/application/files/base/package.json.template +0 -1
- package/src/generators/application/lib/add-e2e.d.ts +1 -1
- package/src/generators/application/lib/add-e2e.js +38 -14
- package/src/generators/application/lib/add-eas-scripts.js +0 -39
- package/src/generators/application/lib/normalize-options.d.ts +0 -3
- package/src/generators/application/lib/normalize-options.js +1 -23
- package/src/generators/application/schema.d.ts +1 -1
- package/src/generators/application/schema.json +1 -1
- package/src/migrations/update-16-1-4/update-eas-scripts.d.ts +1 -1
- package/src/migrations/update-16-1-4/update-eas-scripts.js +1 -10
- package/src/migrations/update-19-7-0/remove-eas-pre-install.d.ts +6 -0
- package/src/migrations/update-19-7-0/remove-eas-pre-install.js +24 -0
package/migrations.json
CHANGED
|
@@ -77,6 +77,12 @@
|
|
|
77
77
|
"cli": "nx",
|
|
78
78
|
"description": "Remove deprecated webpack.config.js",
|
|
79
79
|
"factory": "./src/migrations/update-19-2-0/remove-deprecated-webpack-config"
|
|
80
|
+
},
|
|
81
|
+
"update-19-7-0-remove-eas-pre-install": {
|
|
82
|
+
"version": "19.7.0-beta.4",
|
|
83
|
+
"cli": "nx",
|
|
84
|
+
"description": "Remove eas-build-pre-install script from app's package.json",
|
|
85
|
+
"factory": "./src/migrations/update-19-7-0/remove-eas-pre-install"
|
|
80
86
|
}
|
|
81
87
|
},
|
|
82
88
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/expo",
|
|
3
|
-
"version": "19.6.
|
|
3
|
+
"version": "19.6.5",
|
|
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": [
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"main": "./index",
|
|
29
29
|
"types": "index.d.ts",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@nx/devkit": "19.6.
|
|
31
|
+
"@nx/devkit": "19.6.5",
|
|
32
32
|
"chalk": "^4.1.0",
|
|
33
33
|
"enhanced-resolve": "^5.8.3",
|
|
34
34
|
"fs-extra": "^11.1.0",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"node-fetch": "^2.6.7",
|
|
38
38
|
"tslib": "^2.3.0",
|
|
39
39
|
"tsconfig-paths": "^4.1.2",
|
|
40
|
-
"@nx/jest": "19.6.
|
|
41
|
-
"@nx/js": "19.6.
|
|
42
|
-
"@nx/eslint": "19.6.
|
|
43
|
-
"@nx/react": "19.6.
|
|
44
|
-
"@nx/web": "19.6.
|
|
45
|
-
"@nx/webpack": "19.6.
|
|
46
|
-
"@nrwl/expo": "19.6.
|
|
40
|
+
"@nx/jest": "19.6.5",
|
|
41
|
+
"@nx/js": "19.6.5",
|
|
42
|
+
"@nx/eslint": "19.6.5",
|
|
43
|
+
"@nx/react": "19.6.5",
|
|
44
|
+
"@nx/web": "19.6.5",
|
|
45
|
+
"@nx/webpack": "19.6.5",
|
|
46
|
+
"@nrwl/expo": "19.6.5"
|
|
47
47
|
},
|
|
48
48
|
"executors": "./executors.json",
|
|
49
49
|
"ng-update": {
|
package/plugins/plugin.js
CHANGED
|
@@ -61,7 +61,7 @@ function buildExpoTargets(projectRoot, options, context) {
|
|
|
61
61
|
},
|
|
62
62
|
[options.serveTargetName]: {
|
|
63
63
|
command: `expo start --web`,
|
|
64
|
-
options: { cwd: projectRoot },
|
|
64
|
+
options: { cwd: projectRoot, args: ['--clear'] },
|
|
65
65
|
},
|
|
66
66
|
[options.runIosTargetName]: {
|
|
67
67
|
command: `expo run:ios`,
|
|
@@ -73,7 +73,7 @@ function buildExpoTargets(projectRoot, options, context) {
|
|
|
73
73
|
},
|
|
74
74
|
[options.exportTargetName]: {
|
|
75
75
|
command: `expo export`,
|
|
76
|
-
options: { cwd: projectRoot },
|
|
76
|
+
options: { cwd: projectRoot, args: ['--clear'] },
|
|
77
77
|
cache: true,
|
|
78
78
|
dependsOn: [`^${options.exportTargetName}`],
|
|
79
79
|
inputs: getInputs(namedInputs),
|
|
@@ -86,8 +86,7 @@ function buildExpoTargets(projectRoot, options, context) {
|
|
|
86
86
|
executor: `@nx/expo:prebuild`,
|
|
87
87
|
},
|
|
88
88
|
[options.buildTargetName]: {
|
|
89
|
-
|
|
90
|
-
options: { cwd: projectRoot },
|
|
89
|
+
executor: `@nx/expo:build`,
|
|
91
90
|
},
|
|
92
91
|
[options.submitTargetName]: {
|
|
93
92
|
command: `eas submit`,
|
|
@@ -2,17 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = buildExecutor;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const js_1 = require("@nx/js");
|
|
6
|
+
const fs_extra_1 = require("fs-extra");
|
|
5
7
|
const path_1 = require("path");
|
|
6
8
|
const child_process_1 = require("child_process");
|
|
7
9
|
const resolve_eas_1 = require("../../utils/resolve-eas");
|
|
8
10
|
let childProcess;
|
|
9
11
|
async function* buildExecutor(options, context) {
|
|
10
12
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
13
|
+
let resetLocalFunction;
|
|
11
14
|
try {
|
|
15
|
+
resetLocalFunction = copyPackageJsonAndLock((0, devkit_1.detectPackageManager)(context.root), context.root, projectRoot);
|
|
12
16
|
await runCliBuild(context.root, projectRoot, options);
|
|
13
17
|
yield { success: true };
|
|
14
18
|
}
|
|
15
19
|
finally {
|
|
20
|
+
resetLocalFunction();
|
|
16
21
|
if (childProcess) {
|
|
17
22
|
childProcess.kill();
|
|
18
23
|
}
|
|
@@ -68,3 +73,42 @@ function createBuildOptions(options) {
|
|
|
68
73
|
return acc;
|
|
69
74
|
}, []);
|
|
70
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* This function:
|
|
78
|
+
* - copies the root package.json and lock file to the project directory
|
|
79
|
+
* - returns a function that resets the project package.json and removes the lock file
|
|
80
|
+
*/
|
|
81
|
+
function copyPackageJsonAndLock(packageManager, workspaceRoot, projectRoot) {
|
|
82
|
+
const packageJson = (0, path_1.resolve)(workspaceRoot, 'package.json');
|
|
83
|
+
const rootPackageJson = (0, devkit_1.readJsonFile)(packageJson);
|
|
84
|
+
// do not copy package.json and lock file if workspaces are enabled
|
|
85
|
+
if ((packageManager === 'pnpm' &&
|
|
86
|
+
(0, fs_extra_1.existsSync)((0, path_1.resolve)(workspaceRoot, 'pnpm-workspace.yaml'))) ||
|
|
87
|
+
rootPackageJson.workspaces) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const packageJsonProject = (0, path_1.resolve)(projectRoot, 'package.json');
|
|
91
|
+
const projectPackageJson = (0, devkit_1.readJsonFile)(packageJsonProject);
|
|
92
|
+
const lockFile = (0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(workspaceRoot));
|
|
93
|
+
const lockFileProject = (0, path_1.resolve)(projectRoot, lockFile);
|
|
94
|
+
const rootPackageJsonDependencies = rootPackageJson.dependencies;
|
|
95
|
+
const projectPackageJsonDependencies = { ...projectPackageJson.dependencies };
|
|
96
|
+
const rootPackageJsonDevDependencies = rootPackageJson.devDependencies;
|
|
97
|
+
const projectPackageJsonDevDependencies = {
|
|
98
|
+
...projectPackageJson.devDependencies,
|
|
99
|
+
};
|
|
100
|
+
projectPackageJson.dependencies = rootPackageJsonDependencies;
|
|
101
|
+
projectPackageJson.devDependencies = rootPackageJsonDevDependencies;
|
|
102
|
+
// Copy dependencies from root package.json to project package.json
|
|
103
|
+
(0, fs_extra_1.writeFileSync)(packageJsonProject, JSON.stringify(projectPackageJson, null, 2));
|
|
104
|
+
// Copy lock file from root to project
|
|
105
|
+
(0, fs_extra_1.copyFileSync)(lockFile, lockFileProject);
|
|
106
|
+
return () => {
|
|
107
|
+
// Reset project package.json to original state
|
|
108
|
+
projectPackageJson.dependencies = projectPackageJsonDependencies;
|
|
109
|
+
projectPackageJson.devDependencies = projectPackageJsonDevDependencies;
|
|
110
|
+
(0, fs_extra_1.writeFileSync)(packageJsonProject, JSON.stringify(projectPackageJson, null, 2));
|
|
111
|
+
// Remove lock file from project
|
|
112
|
+
(0, fs_extra_1.removeSync)(lockFileProject);
|
|
113
|
+
};
|
|
114
|
+
}
|
|
@@ -11,4 +11,8 @@ export interface ExpoEasBuildOptions {
|
|
|
11
11
|
json: boolean; // default is false
|
|
12
12
|
autoSubmit: boolean; // default is false
|
|
13
13
|
autoSubmitWithProfile?: string;
|
|
14
|
+
message?: string;
|
|
15
|
+
// values from https://github.com/expo/eas-build/blob/main/packages/logger/src/level.ts
|
|
16
|
+
buildLoggerLevel: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal'; // default is info
|
|
17
|
+
freezeCredentials: boolean; // default is false
|
|
14
18
|
}
|
|
@@ -77,6 +77,22 @@
|
|
|
77
77
|
"type": "string",
|
|
78
78
|
"description": "Submit on build complete using the submit profile with provided name",
|
|
79
79
|
"examples": ["production", "development", "preview"]
|
|
80
|
+
},
|
|
81
|
+
"message": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"description": "A short message describing the build",
|
|
84
|
+
"examples": ["My message"]
|
|
85
|
+
},
|
|
86
|
+
"buildLoggerLevel": {
|
|
87
|
+
"type": "string",
|
|
88
|
+
"description": "The level of logs to output during the build process.",
|
|
89
|
+
"enum": ["trace", "debug", "info", "warn", "error", "fatal"],
|
|
90
|
+
"default": "info"
|
|
91
|
+
},
|
|
92
|
+
"freezeCredentials": {
|
|
93
|
+
"type": "boolean",
|
|
94
|
+
"description": "Prevent the build from updating credentials in non-interactive mode",
|
|
95
|
+
"default": false
|
|
80
96
|
}
|
|
81
97
|
},
|
|
82
98
|
"required": []
|
|
@@ -58,9 +58,8 @@ function serveAsync(workspaceRoot, projectRoot, options) {
|
|
|
58
58
|
});
|
|
59
59
|
childProcess.stdout.on('data', (data) => {
|
|
60
60
|
process.stdout.write(data);
|
|
61
|
-
if (data
|
|
62
|
-
.toString()
|
|
63
|
-
.includes('Bundling complete' || data.toString().includes('Bundled'))) {
|
|
61
|
+
if (data.toString().includes('Bundling complete') ||
|
|
62
|
+
data.toString().includes('Bundled')) {
|
|
64
63
|
resolve(childProcess);
|
|
65
64
|
}
|
|
66
65
|
});
|
|
@@ -12,6 +12,7 @@ const { assetExts, sourceExts } = defaultConfig.resolver;
|
|
|
12
12
|
* @type {import('metro-config').MetroConfig}
|
|
13
13
|
*/
|
|
14
14
|
const customConfig = {
|
|
15
|
+
cacheVersion: "<%= projectName %>",
|
|
15
16
|
transformer: {
|
|
16
17
|
babelTransformerPath: require.resolve('react-native-svg-transformer'),
|
|
17
18
|
},
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"react-native-web": "*"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
-
"eas-build-pre-install": "cd <%= offsetFromRoot %> && node tools/scripts/eas-build-pre-install.mjs . <%= appProjectRoot %> && cp <%= packageLockFile %> <%= appProjectRoot %>",
|
|
16
15
|
"eas-build-post-install": "cd <%= offsetFromRoot %> && node tools/scripts/eas-build-post-install.mjs . <%= appProjectRoot %>"
|
|
17
16
|
}
|
|
18
17
|
}
|
|
@@ -7,16 +7,18 @@ const versions_1 = require("../../../utils/versions");
|
|
|
7
7
|
const has_expo_plugin_1 = require("../../../utils/has-expo-plugin");
|
|
8
8
|
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
9
9
|
const find_plugin_for_config_file_1 = require("@nx/devkit/src/utils/find-plugin-for-config-file");
|
|
10
|
+
const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
|
|
10
11
|
async function addE2e(tree, options) {
|
|
11
12
|
const hasPlugin = (0, has_expo_plugin_1.hasExpoPlugin)(tree);
|
|
13
|
+
if (!hasPlugin) {
|
|
14
|
+
await (0, web_1.webStaticServeGenerator)(tree, {
|
|
15
|
+
buildTarget: `${options.projectName}:export`,
|
|
16
|
+
targetName: 'serve-static',
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const e2eWebServerInfo = await getExpoE2EWebServerInfo(tree, options.projectName, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'app.json'), options.addPlugin);
|
|
12
20
|
switch (options.e2eTestRunner) {
|
|
13
21
|
case 'cypress': {
|
|
14
|
-
if (!hasPlugin) {
|
|
15
|
-
await (0, web_1.webStaticServeGenerator)(tree, {
|
|
16
|
-
buildTarget: `${options.projectName}:export`,
|
|
17
|
-
targetName: 'serve-static',
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
22
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
21
23
|
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
22
24
|
projectType: 'application',
|
|
@@ -33,12 +35,14 @@ async function addE2e(tree, options) {
|
|
|
33
35
|
// the name and root are already normalized, instruct the generator to use them as is
|
|
34
36
|
bundler: 'none',
|
|
35
37
|
skipFormat: true,
|
|
36
|
-
devServerTarget:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
:
|
|
38
|
+
devServerTarget: e2eWebServerInfo.e2eDevServerTarget,
|
|
39
|
+
baseUrl: e2eWebServerInfo.e2eWebServerAddress,
|
|
40
|
+
ciWebServerCommand: e2eWebServerInfo.e2eCiWebServerCommand,
|
|
41
|
+
webServerCommands: {
|
|
42
|
+
default: e2eWebServerInfo.e2eWebServerCommand,
|
|
43
|
+
production: e2eWebServerInfo.e2eCiWebServerCommand,
|
|
44
|
+
},
|
|
45
|
+
ciBaseUrl: e2eWebServerInfo.e2eCiBaseUrl,
|
|
42
46
|
jsx: true,
|
|
43
47
|
rootProject: options.rootProject,
|
|
44
48
|
});
|
|
@@ -74,8 +78,8 @@ async function addE2e(tree, options) {
|
|
|
74
78
|
js: false,
|
|
75
79
|
linter: options.linter,
|
|
76
80
|
setParserOptionsProject: options.setParserOptionsProject,
|
|
77
|
-
webServerCommand:
|
|
78
|
-
webServerAddress:
|
|
81
|
+
webServerCommand: e2eWebServerInfo.e2eCiWebServerCommand,
|
|
82
|
+
webServerAddress: e2eWebServerInfo.e2eCiBaseUrl,
|
|
79
83
|
rootProject: options.rootProject,
|
|
80
84
|
addPlugin: options.addPlugin,
|
|
81
85
|
});
|
|
@@ -113,3 +117,23 @@ async function addE2e(tree, options) {
|
|
|
113
117
|
return () => { };
|
|
114
118
|
}
|
|
115
119
|
}
|
|
120
|
+
async function getExpoE2EWebServerInfo(tree, projectName, configFilePath, isPluginBeingAdded) {
|
|
121
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
122
|
+
let e2ePort = isPluginBeingAdded ? 8081 : 4200;
|
|
123
|
+
if (nxJson.targetDefaults?.['serve'] &&
|
|
124
|
+
nxJson.targetDefaults?.['serve'].options?.port) {
|
|
125
|
+
e2ePort = nxJson.targetDefaults?.['serve'].options?.port;
|
|
126
|
+
}
|
|
127
|
+
return (0, e2e_web_server_info_utils_1.getE2EWebServerInfo)(tree, projectName, {
|
|
128
|
+
plugin: '@nx/expo/plugin',
|
|
129
|
+
serveTargetName: 'serveTargetName',
|
|
130
|
+
serveStaticTargetName: 'serveTargetName',
|
|
131
|
+
configFilePath,
|
|
132
|
+
}, {
|
|
133
|
+
defaultServeTargetName: 'serve',
|
|
134
|
+
defaultServeStaticTargetName: 'serve-static',
|
|
135
|
+
defaultE2EWebServerAddress: `http://localhost:${e2ePort}`,
|
|
136
|
+
defaultE2ECiBaseUrl: 'http://localhost:4200',
|
|
137
|
+
defaultE2EPort: e2ePort,
|
|
138
|
+
}, isPluginBeingAdded);
|
|
139
|
+
}
|
|
@@ -1,41 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addEasScripts = addEasScripts;
|
|
4
|
-
const preInstallScript = `
|
|
5
|
-
/*
|
|
6
|
-
* This script is used to patch the '@nx/expo' package to work with EAS Build.
|
|
7
|
-
* It is run as the eas-build-pre-install script in the 'package.json' of expo app.
|
|
8
|
-
* It is executed as 'node tools/scripts/eas-build-pre-install.mjs <workspace root> <project root>'
|
|
9
|
-
* It will copy the dependencies and devDependencies from the workspace package.json to project's package.json.
|
|
10
|
-
* This is needed because EAS Build does the install in project's directory and not workspace's directory.
|
|
11
|
-
*/
|
|
12
|
-
import { readFileSync, writeFileSync } from 'fs';
|
|
13
|
-
import { join } from 'path';
|
|
14
|
-
|
|
15
|
-
const [workspaceRoot, projectRoot] = process.argv.slice(2);
|
|
16
|
-
if (!workspaceRoot) {
|
|
17
|
-
throw new Error('Missing workspace root');
|
|
18
|
-
}
|
|
19
|
-
if (!projectRoot) {
|
|
20
|
-
throw new Error('Missing project root');
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
const workspacePackage = JSON.parse(
|
|
24
|
-
readFileSync(join(workspaceRoot, 'package.json')).toString()
|
|
25
|
-
);
|
|
26
|
-
const projectPackage = JSON.parse(
|
|
27
|
-
readFileSync(join(projectRoot, 'package.json')).toString()
|
|
28
|
-
);
|
|
29
|
-
projectPackage.dependencies = workspacePackage.dependencies;
|
|
30
|
-
projectPackage.devDependencies = workspacePackage.devDependencies;
|
|
31
|
-
writeFileSync(
|
|
32
|
-
join(projectRoot, 'package.json'),
|
|
33
|
-
JSON.stringify(projectPackage, null, 2)
|
|
34
|
-
);
|
|
35
|
-
} catch (e) {
|
|
36
|
-
console.error('Error reading package.json file', e);
|
|
37
|
-
}
|
|
38
|
-
`;
|
|
39
4
|
const postInstallScript = `
|
|
40
5
|
/**
|
|
41
6
|
* This script is used to patch the '@nx/expo' package to work with EAS Build.
|
|
@@ -62,11 +27,7 @@ symlink(join(projectRoot, 'node_modules'), join(workspaceRoot, 'node_modules'),
|
|
|
62
27
|
});
|
|
63
28
|
`;
|
|
64
29
|
function addEasScripts(tree) {
|
|
65
|
-
const preInstallScriptPath = 'tools/scripts/eas-build-pre-install.mjs';
|
|
66
30
|
const postInstallScriptPath = 'tools/scripts/eas-build-post-install.mjs';
|
|
67
|
-
if (!tree.exists(preInstallScriptPath)) {
|
|
68
|
-
tree.write(preInstallScriptPath, preInstallScript);
|
|
69
|
-
}
|
|
70
31
|
if (!tree.exists(postInstallScriptPath)) {
|
|
71
32
|
tree.write(postInstallScriptPath, postInstallScript);
|
|
72
33
|
}
|
|
@@ -9,8 +9,5 @@ export interface NormalizedSchema extends Schema {
|
|
|
9
9
|
rootProject: boolean;
|
|
10
10
|
e2eProjectName: string;
|
|
11
11
|
e2eProjectRoot: string;
|
|
12
|
-
e2eWebServerAddress: string;
|
|
13
|
-
e2eWebServerTarget: string;
|
|
14
|
-
e2ePort: number;
|
|
15
12
|
}
|
|
16
13
|
export declare function normalizeOptions(host: Tree, options: Schema): Promise<NormalizedSchema>;
|
|
@@ -21,31 +21,12 @@ async function normalizeOptions(host, options) {
|
|
|
21
21
|
? options.tags.split(',').map((s) => s.trim())
|
|
22
22
|
: [];
|
|
23
23
|
const rootProject = appProjectRoot === '.';
|
|
24
|
-
let e2eWebServerTarget = 'serve';
|
|
25
|
-
if (options.addPlugin) {
|
|
26
|
-
if (nxJson.plugins) {
|
|
27
|
-
for (const plugin of nxJson.plugins) {
|
|
28
|
-
if (typeof plugin === 'object' &&
|
|
29
|
-
plugin.plugin === '@nx/expo/plugin' &&
|
|
30
|
-
plugin.options.serveTargetName) {
|
|
31
|
-
e2eWebServerTarget = plugin.options
|
|
32
|
-
.serveTargetName;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
let e2ePort = options.addPlugin ? 8081 : 4200;
|
|
38
|
-
if (nxJson.targetDefaults?.[e2eWebServerTarget] &&
|
|
39
|
-
nxJson.targetDefaults?.[e2eWebServerTarget].options?.port) {
|
|
40
|
-
e2ePort = nxJson.targetDefaults?.[e2eWebServerTarget].options.port;
|
|
41
|
-
}
|
|
42
24
|
const e2eProjectName = rootProject ? 'e2e' : `${appProjectName}-e2e`;
|
|
43
25
|
const e2eProjectRoot = rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
|
|
44
|
-
const e2eWebServerAddress = `http://localhost:${e2ePort}`;
|
|
45
26
|
return {
|
|
46
27
|
...options,
|
|
47
28
|
unitTestRunner: options.unitTestRunner || 'jest',
|
|
48
|
-
e2eTestRunner: options.e2eTestRunner,
|
|
29
|
+
e2eTestRunner: options.e2eTestRunner || 'none',
|
|
49
30
|
name: projectNames.projectSimpleName,
|
|
50
31
|
className,
|
|
51
32
|
lowerCaseName: className.toLowerCase(),
|
|
@@ -56,8 +37,5 @@ async function normalizeOptions(host, options) {
|
|
|
56
37
|
rootProject,
|
|
57
38
|
e2eProjectName,
|
|
58
39
|
e2eProjectRoot,
|
|
59
|
-
e2eWebServerAddress,
|
|
60
|
-
e2eWebServerTarget,
|
|
61
|
-
e2ePort,
|
|
62
40
|
};
|
|
63
41
|
}
|
|
@@ -15,7 +15,7 @@ export interface Schema {
|
|
|
15
15
|
js: boolean; // default is false
|
|
16
16
|
linter: Linter | LinterType; // default is eslint
|
|
17
17
|
setParserOptionsProject?: boolean; // default is false
|
|
18
|
-
e2eTestRunner: 'cypress' | 'playwright' | 'detox' | 'none'; // default is
|
|
18
|
+
e2eTestRunner: 'cypress' | 'playwright' | 'detox' | 'none'; // default is none
|
|
19
19
|
standaloneConfig?: boolean;
|
|
20
20
|
skipPackageJson?: boolean; // default is false
|
|
21
21
|
addPlugin?: boolean;
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"description": "Adds the specified e2e test runner",
|
|
77
77
|
"type": "string",
|
|
78
78
|
"enum": ["playwright", "cypress", "detox", "none"],
|
|
79
|
-
"default": "
|
|
79
|
+
"default": "none"
|
|
80
80
|
},
|
|
81
81
|
"standaloneConfig": {
|
|
82
82
|
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
|
|
@@ -5,16 +5,10 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const add_eas_scripts_1 = require("../../generators/application/lib/add-eas-scripts");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
/**
|
|
8
|
-
* Update app's package.json to use eas-build-
|
|
8
|
+
* Update app's package.json to use eas-build-post-install scripts.
|
|
9
9
|
*/
|
|
10
10
|
function update(tree) {
|
|
11
11
|
const projects = (0, devkit_1.getProjects)(tree);
|
|
12
|
-
const packageManagerLockFile = {
|
|
13
|
-
npm: 'package-lock.json',
|
|
14
|
-
yarn: 'yarn.lock',
|
|
15
|
-
pnpm: 'pnpm-lock.yaml',
|
|
16
|
-
bun: 'bun.lockb',
|
|
17
|
-
};
|
|
18
12
|
for (const [name, config] of projects.entries()) {
|
|
19
13
|
if (config.targets?.['start']?.executor === '@nrwl/expo:start' ||
|
|
20
14
|
config.targets?.['start']?.executor === '@nx/expo:start') {
|
|
@@ -24,12 +18,9 @@ function update(tree) {
|
|
|
24
18
|
if (packageJson.scripts?.['postinstall']) {
|
|
25
19
|
delete packageJson.scripts['postinstall'];
|
|
26
20
|
}
|
|
27
|
-
const packageManager = (0, devkit_1.detectPackageManager)(tree.root);
|
|
28
|
-
const packageLockFile = packageManagerLockFile[packageManager];
|
|
29
21
|
const offset = (0, devkit_1.offsetFromRoot)(config.root);
|
|
30
22
|
packageJson.scripts = {
|
|
31
23
|
...packageJson.scripts,
|
|
32
|
-
'eas-build-pre-install': `cd ${offset} && node tools/scripts/eas-build-pre-install.mjs . ${config.root} && cp ${packageLockFile} ${config.root}`,
|
|
33
24
|
'eas-build-post-install': `cd ${offset} && node tools/scripts/eas-build-post-install.mjs . ${config.root}`,
|
|
34
25
|
};
|
|
35
26
|
return packageJson;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = update;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
/**
|
|
7
|
+
* Remove eas-build-pre-install script from app's package.json.
|
|
8
|
+
* This script causes an issue with Yarn 4.
|
|
9
|
+
*/
|
|
10
|
+
function update(tree) {
|
|
11
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
12
|
+
for (const [_, config] of projects.entries()) {
|
|
13
|
+
const packageJsonPath = (0, path_1.join)(config.root, 'package.json');
|
|
14
|
+
if (!tree.exists(packageJsonPath)) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
(0, devkit_1.updateJson)(tree, (0, path_1.join)(config.root, 'package.json'), (packageJson) => {
|
|
18
|
+
if (packageJson.scripts?.['eas-build-pre-install']) {
|
|
19
|
+
delete packageJson.scripts['eas-build-pre-install'];
|
|
20
|
+
}
|
|
21
|
+
return packageJson;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|