@nx/expo 24.0.0-beta.2 → 24.0.0-beta.3

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.
Files changed (72) hide show
  1. package/dist/plugins/plugin.js +8 -4
  2. package/dist/src/executors/install/{install.impl.d.ts → install-packages.d.ts} +0 -4
  3. package/dist/src/executors/install/{install.impl.js → install-packages.js} +0 -17
  4. package/dist/src/executors/update/update.impl.js +2 -2
  5. package/dist/src/generators/application/application.js +2 -3
  6. package/dist/src/generators/application/files/base/package.json.template +1 -0
  7. package/dist/src/generators/application/lib/add-e2e.js +4 -5
  8. package/dist/src/generators/application/lib/add-eas-scripts.d.ts +3 -0
  9. package/dist/src/generators/application/lib/add-eas-scripts.js +103 -3
  10. package/dist/src/generators/application/lib/add-project.js +1 -82
  11. package/dist/src/generators/application/lib/normalize-options.js +0 -4
  12. package/dist/src/generators/application/schema.d.ts +0 -1
  13. package/dist/src/generators/init/init.js +18 -32
  14. package/dist/src/generators/init/schema.d.ts +0 -1
  15. package/dist/src/generators/library/lib/normalize-options.js +0 -5
  16. package/dist/src/generators/library/library.js +2 -3
  17. package/dist/src/generators/library/schema.d.ts +0 -1
  18. package/dist/src/migrations/update-24-0-0/add-eas-build-pre-install.d.ts +2 -0
  19. package/dist/src/migrations/update-24-0-0/add-eas-build-pre-install.js +42 -0
  20. package/dist/src/migrations/update-24-0-0/add-eas-build-pre-install.md +32 -0
  21. package/dist/src/migrations/update-24-0-0/finish-inferred-conversion.md +12 -0
  22. package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.d.ts +6 -0
  23. package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.js +30 -0
  24. package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.md +72 -0
  25. package/dist/src/utils/add-linting.d.ts +0 -1
  26. package/dist/src/utils/add-linting.js +0 -1
  27. package/dist/src/utils/jest/add-jest.d.ts +1 -1
  28. package/dist/src/utils/jest/add-jest.js +1 -2
  29. package/executors.json +0 -40
  30. package/migrations.json +13 -0
  31. package/package.json +10 -10
  32. package/dist/docs/export-examples.md +0 -107
  33. package/dist/docs/prebuild-examples.md +0 -65
  34. package/dist/docs/run-examples.md +0 -86
  35. package/dist/docs/start-examples.md +0 -100
  36. package/dist/src/executors/build/build.impl.d.ts +0 -6
  37. package/dist/src/executors/build/build.impl.js +0 -142
  38. package/dist/src/executors/build/schema.d.ts +0 -18
  39. package/dist/src/executors/build/schema.json +0 -100
  40. package/dist/src/executors/export/export.impl.d.ts +0 -7
  41. package/dist/src/executors/export/export.impl.js +0 -81
  42. package/dist/src/executors/export/schema.d.ts +0 -13
  43. package/dist/src/executors/export/schema.json +0 -50
  44. package/dist/src/executors/install/schema.json +0 -40
  45. package/dist/src/executors/prebuild/prebuild.impl.d.ts +0 -7
  46. package/dist/src/executors/prebuild/prebuild.impl.js +0 -77
  47. package/dist/src/executors/prebuild/schema.d.ts +0 -7
  48. package/dist/src/executors/prebuild/schema.json +0 -37
  49. package/dist/src/executors/run/run.impl.d.ts +0 -6
  50. package/dist/src/executors/run/run.impl.js +0 -102
  51. package/dist/src/executors/run/schema.d.ts +0 -24
  52. package/dist/src/executors/run/schema.json +0 -67
  53. package/dist/src/executors/serve/lib/is-packager-running.d.ts +0 -1
  54. package/dist/src/executors/serve/lib/is-packager-running.js +0 -13
  55. package/dist/src/executors/serve/schema.d.ts +0 -7
  56. package/dist/src/executors/serve/schema.json +0 -37
  57. package/dist/src/executors/serve/serve.impl.d.ts +0 -10
  58. package/dist/src/executors/serve/serve.impl.js +0 -134
  59. package/dist/src/executors/start/schema.d.ts +0 -22
  60. package/dist/src/executors/start/schema.json +0 -95
  61. package/dist/src/executors/start/start.impl.d.ts +0 -7
  62. package/dist/src/executors/start/start.impl.js +0 -84
  63. package/dist/src/executors/submit/schema.d.ts +0 -12
  64. package/dist/src/executors/submit/schema.json +0 -58
  65. package/dist/src/executors/submit/submit.impl.d.ts +0 -6
  66. package/dist/src/executors/submit/submit.impl.js +0 -75
  67. package/dist/src/utils/deprecation.d.ts +0 -3
  68. package/dist/src/utils/deprecation.js +0 -23
  69. package/dist/src/utils/pod-install-task.d.ts +0 -17
  70. package/dist/src/utils/pod-install-task.js +0 -69
  71. package/dist/src/utils/resolve-expo-cli.d.ts +0 -11
  72. package/dist/src/utils/resolve-expo-cli.js +0 -21
@@ -1,142 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = buildExecutor;
4
- const devkit_1 = require("@nx/devkit");
5
- const internal_1 = require("@nx/devkit/internal");
6
- const js_1 = require("@nx/js");
7
- const child_process_1 = require("child_process");
8
- const node_fs_1 = require("node:fs");
9
- const path_1 = require("path");
10
- const resolve_eas_1 = require("../../utils/resolve-eas");
11
- const deprecation_1 = require("../../utils/deprecation");
12
- let childProcess;
13
- async function* buildExecutor(options, context) {
14
- (0, deprecation_1.warnExpoExecutorDeprecation)('build');
15
- const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
16
- let resetLocalFunction;
17
- try {
18
- resetLocalFunction = copyPackageJsonAndLock((0, devkit_1.detectPackageManager)(context.root), context.root, projectRoot);
19
- await runCliBuild(context.root, projectRoot, options);
20
- yield { success: true };
21
- }
22
- finally {
23
- resetLocalFunction();
24
- if (childProcess) {
25
- childProcess.kill();
26
- }
27
- }
28
- }
29
- function runCliBuild(workspaceRoot, projectRoot, options) {
30
- return new Promise((resolve, reject) => {
31
- childProcess = (0, child_process_1.fork)((0, resolve_eas_1.resolveEas)(workspaceRoot), ['build', ...createBuildOptions(options)], {
32
- cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
33
- env: {
34
- ...(options.local ? { YARN_ENABLE_IMMUTABLE_INSTALLS: 'false' } : {}),
35
- ...process.env,
36
- },
37
- });
38
- // Ensure the child process is killed when the parent exits
39
- process.on('exit', () => childProcess.kill());
40
- process.on('SIGTERM', () => childProcess.kill());
41
- childProcess.on('error', (err) => {
42
- reject(err);
43
- });
44
- childProcess.on('exit', (code, signal) => {
45
- if (code === null)
46
- code = (0, internal_1.signalToCode)(signal);
47
- if (code === 0) {
48
- resolve(code);
49
- }
50
- else {
51
- reject(code);
52
- }
53
- });
54
- });
55
- }
56
- function createBuildOptions(options) {
57
- return Object.keys(options).reduce((acc, k) => {
58
- const v = options[k];
59
- if (typeof v === 'boolean') {
60
- if (k === 'interactive') {
61
- if (v === false) {
62
- acc.push('--non-interactive'); // when is false, the flag is --non-interactive
63
- }
64
- }
65
- else if (k === 'wait') {
66
- if (v === false) {
67
- acc.push('--no-wait'); // when is false, the flag is --no-wait
68
- }
69
- else {
70
- acc.push('--wait');
71
- }
72
- }
73
- else if (v === true) {
74
- // when true, does not need to pass the value true, just need to pass the flag in kebob case
75
- acc.push(`--${(0, devkit_1.names)(k).fileName}`);
76
- }
77
- }
78
- else {
79
- acc.push(`--${(0, devkit_1.names)(k).fileName}`, v);
80
- }
81
- return acc;
82
- }, []);
83
- }
84
- /**
85
- * This function:
86
- * - copies the root package.json and lock file to the project directory
87
- * - returns a function that resets the project package.json and removes the lock file
88
- */
89
- function copyPackageJsonAndLock(packageManager, workspaceRoot, projectRoot) {
90
- const packageJson = (0, path_1.resolve)(workspaceRoot, 'package.json');
91
- const rootPackageJson = (0, devkit_1.readJsonFile)(packageJson);
92
- // do not copy package.json and lock file if workspaces are enabled
93
- if ((0, devkit_1.isWorkspacesEnabled)(packageManager, workspaceRoot)) {
94
- // no resource taken, no resource cleaned up
95
- return () => { };
96
- }
97
- const packageJsonProject = (0, path_1.resolve)(projectRoot, 'package.json');
98
- const projectPackageJson = (0, devkit_1.readJsonFile)(packageJsonProject);
99
- const lockFile = (0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(workspaceRoot));
100
- const lockFileProject = (0, path_1.resolve)(projectRoot, lockFile);
101
- const rootPackageJsonDependencies = rootPackageJson.dependencies;
102
- const projectPackageJsonDependencies = { ...projectPackageJson.dependencies };
103
- const rootPackageJsonDevDependencies = rootPackageJson.devDependencies;
104
- const projectPackageJsonDevDependencies = {
105
- ...projectPackageJson.devDependencies,
106
- };
107
- projectPackageJson.dependencies = rootPackageJsonDependencies;
108
- projectPackageJson.devDependencies = rootPackageJsonDevDependencies;
109
- const projectOverrides = projectPackageJson.overrides;
110
- const projectResolutions = projectPackageJson.resolutions;
111
- if (rootPackageJson.overrides) {
112
- projectPackageJson.overrides = rootPackageJson.overrides;
113
- }
114
- // if overrides exists, give precedence to it over resolutions
115
- if (!rootPackageJson.overrides && rootPackageJson.resolutions) {
116
- projectPackageJson.resolutions = rootPackageJson.resolutions;
117
- }
118
- // Copy dependencies from root package.json to project package.json
119
- (0, devkit_1.writeJsonFile)(packageJsonProject, projectPackageJson);
120
- // Copy lock file from root to project
121
- (0, node_fs_1.copyFileSync)(lockFile, lockFileProject);
122
- return () => {
123
- // Reset project package.json to original state
124
- projectPackageJson.dependencies = projectPackageJsonDependencies;
125
- projectPackageJson.devDependencies = projectPackageJsonDevDependencies;
126
- if (projectOverrides) {
127
- projectPackageJson.overrides = projectOverrides;
128
- }
129
- else {
130
- delete projectPackageJson.overrides;
131
- }
132
- if (projectResolutions) {
133
- projectPackageJson.resolutions = projectResolutions;
134
- }
135
- else {
136
- delete projectPackageJson.resolutions;
137
- }
138
- (0, node_fs_1.writeFileSync)(packageJsonProject, JSON.stringify(projectPackageJson, null, 2));
139
- // Remove lock file from project
140
- (0, node_fs_1.rmSync)(lockFileProject, { recursive: true, force: true });
141
- };
142
- }
@@ -1,18 +0,0 @@
1
- // command to run https://github.com/expo/eas-cli/tree/main#eas-build
2
- // options from github.com/expo/eas-cli/blob/main/packages/eas-cli/src/commands/build/index.ts
3
- export interface ExpoEasBuildOptions {
4
- platform: 'ios' | 'android' | 'all';
5
- profile?: string;
6
- interactive: boolean; // default is true
7
- local: boolean; // default is false
8
- output?: string;
9
- wait: boolean; // default is true
10
- clearCache: boolean; // default is false
11
- json: boolean; // default is false
12
- autoSubmit: boolean; // default is false
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
18
- }
@@ -1,100 +0,0 @@
1
- {
2
- "version": 2,
3
- "outputCapture": "direct-nodejs",
4
- "$schema": "https://json-schema.org/schema",
5
- "$id": "NxExpoEasBuild",
6
- "cli": "nx",
7
- "title": "Expo EAS Build executor",
8
- "description": "Start an EAS build for your expo project.",
9
- "type": "object",
10
- "x-deprecated": "The `@nx/expo:build` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/expo:convert-to-inferred` to migrate to the `@nx/expo/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
11
- "presets": [
12
- {
13
- "name": "Build for a specific platform",
14
- "keys": ["platform"]
15
- },
16
- {
17
- "name": "Build using a specific profile",
18
- "keys": ["profile"]
19
- },
20
- {
21
- "name": "Run build locally",
22
- "keys": ["local"]
23
- },
24
- {
25
- "name": "Clear cache before the build",
26
- "keys": ["clearCache"]
27
- }
28
- ],
29
- "properties": {
30
- "platform": {
31
- "enum": ["ios", "android", "all"],
32
- "alias": "p",
33
- "description": "The platform to build the app, exaple values: ios, android, all.",
34
- "x-priority": "important"
35
- },
36
- "json": {
37
- "type": "boolean",
38
- "description": "Enable JSON output, non-JSON messages will be printed to stderr",
39
- "default": false
40
- },
41
- "profile": {
42
- "type": "string",
43
- "description": "Name of the build profile from eas.json. Defaults to \"production\" if defined in eas.json.",
44
- "examples": ["production", "development", "preview"],
45
- "x-priority": "important"
46
- },
47
- "interactive": {
48
- "type": "boolean",
49
- "description": "Run command in interactive mode",
50
- "default": true
51
- },
52
- "local": {
53
- "type": "boolean",
54
- "description": "Run build locally [experimental]",
55
- "default": false
56
- },
57
- "output": {
58
- "type": "string",
59
- "description": "Output path for local build",
60
- "examples": ["../../dist/MyApp.tar.gz", "../../dist"]
61
- },
62
- "wait": {
63
- "type": "boolean",
64
- "description": "Wait for build(s) to complete",
65
- "default": true
66
- },
67
- "clearCache": {
68
- "type": "boolean",
69
- "description": "Clear cache before the build",
70
- "default": false
71
- },
72
- "autoSubmit": {
73
- "type": "boolean",
74
- "description": "Submit on build complete using the submit profile with the same name as the build profile",
75
- "default": false
76
- },
77
- "autoSubmitWithProfile": {
78
- "type": "string",
79
- "description": "Submit on build complete using the submit profile with provided name",
80
- "examples": ["production", "development", "preview"]
81
- },
82
- "message": {
83
- "type": "string",
84
- "description": "A short message describing the build",
85
- "examples": ["My message"]
86
- },
87
- "buildLoggerLevel": {
88
- "type": "string",
89
- "description": "The level of logs to output during the build process.",
90
- "enum": ["trace", "debug", "info", "warn", "error", "fatal"],
91
- "default": "info"
92
- },
93
- "freezeCredentials": {
94
- "type": "boolean",
95
- "description": "Prevent the build from updating credentials in non-interactive mode",
96
- "default": false
97
- }
98
- },
99
- "required": []
100
- }
@@ -1,7 +0,0 @@
1
- import { ExecutorContext } from '@nx/devkit';
2
- import { ExportExecutorSchema } from './schema';
3
- export interface ExpoExportOutput {
4
- success: boolean;
5
- }
6
- export default function exportExecutor(options: ExportExecutorSchema, context: ExecutorContext): AsyncGenerator<ExpoExportOutput>;
7
- export declare function createExportOptions(options: ExportExecutorSchema, projectRoot: string): any[];
@@ -1,81 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = exportExecutor;
4
- exports.createExportOptions = createExportOptions;
5
- const devkit_1 = require("@nx/devkit");
6
- const internal_1 = require("@nx/devkit/internal");
7
- const child_process_1 = require("child_process");
8
- const path_1 = require("path");
9
- const deprecation_1 = require("../../utils/deprecation");
10
- const resolve_expo_cli_1 = require("../../utils/resolve-expo-cli");
11
- let childProcess;
12
- async function* exportExecutor(options, context) {
13
- (0, deprecation_1.warnExpoExecutorDeprecation)('export');
14
- const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
15
- try {
16
- await exportAsync(context.root, projectRoot, options);
17
- yield {
18
- success: true,
19
- };
20
- }
21
- finally {
22
- if (childProcess) {
23
- childProcess.kill();
24
- }
25
- }
26
- }
27
- function exportAsync(workspaceRoot, projectRoot, options) {
28
- return new Promise((resolve, reject) => {
29
- childProcess = (0, child_process_1.fork)((0, resolve_expo_cli_1.resolveExpoCliPath)(), [`export`, ...createExportOptions(options, projectRoot)], {
30
- cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
31
- env: process.env,
32
- });
33
- // Ensure the child process is killed when the parent exits
34
- process.on('exit', () => childProcess.kill());
35
- process.on('SIGTERM', () => childProcess.kill());
36
- childProcess.on('error', (err) => {
37
- reject(err);
38
- });
39
- childProcess.on('exit', (code, signal) => {
40
- if (code === null)
41
- code = (0, internal_1.signalToCode)(signal);
42
- if (code === 0) {
43
- resolve(code);
44
- }
45
- else {
46
- reject(code);
47
- }
48
- });
49
- });
50
- }
51
- const nxOptions = ['bundler', 'interactive']; // interactive is passed in by e2e tests
52
- // options from https://github.com/expo/expo/blob/main/packages/@expo/cli/src/export/index.ts
53
- function createExportOptions(options, projectRoot) {
54
- return Object.keys(options).reduce((acc, k) => {
55
- if (!nxOptions.includes(k)) {
56
- const v = options[k];
57
- switch (k) {
58
- case 'outputDir':
59
- const path = (0, devkit_1.joinPathFragments)((0, devkit_1.offsetFromRoot)(projectRoot), v); // need to add offset for the outputDir
60
- acc.push('--output-dir', path);
61
- break;
62
- case 'minify':
63
- if (v === false) {
64
- acc.push('--no-minify'); // cli only accpets --no-minify
65
- }
66
- break;
67
- default:
68
- if (typeof v === 'boolean') {
69
- if (v === true) {
70
- // when true, does not need to pass the value true, just need to pass the flag in kebob case
71
- acc.push(`--${(0, devkit_1.names)(k).fileName}`);
72
- }
73
- }
74
- else {
75
- acc.push(`--${(0, devkit_1.names)(k).fileName}`, v);
76
- }
77
- }
78
- }
79
- return acc;
80
- }, []);
81
- }
@@ -1,13 +0,0 @@
1
- // options form https://github.com/expo/expo/blob/main/packages/%40expo/cli/src/export/resolveOptions.ts
2
- // https://github.com/expo/expo/blob/main/packages/%40expo/cli/src/export/index.ts
3
-
4
- export interface ExportExecutorSchema {
5
- platform?: 'ios' | 'android' | 'all' | 'web'; // default is 'all'
6
- outputDir?: string;
7
- clear?: boolean;
8
- dev?: boolean;
9
- minify?: boolean;
10
- maxWorkers?: number;
11
- dumpAssetmap?: boolean;
12
- sourcemap?: boolean;
13
- }
@@ -1,50 +0,0 @@
1
- {
2
- "cli": "nx",
3
- "version": 2,
4
- "outputCapture": "direct-nodejs",
5
- "$id": "NxExpoExport",
6
- "$schema": "https://json-schema.org/schema",
7
- "title": "Expo Export",
8
- "description": "Export the JavaScript and assets for your app using Metro/webpack bundler.",
9
- "type": "object",
10
- "x-deprecated": "The `@nx/expo:export` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/expo:convert-to-inferred` to migrate to the `@nx/expo/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
11
- "properties": {
12
- "platform": {
13
- "description": "Choose the platform to compile for",
14
- "enum": ["ios", "android", "all", "web"],
15
- "default": "all",
16
- "alias": "p",
17
- "x-priority": "important"
18
- },
19
- "dev": {
20
- "type": "boolean",
21
- "description": "Configure static files for developing locally using a non-https server"
22
- },
23
- "clear": {
24
- "type": "boolean",
25
- "description": "Clear the bundler cache before exporting"
26
- },
27
- "minify": {
28
- "type": "boolean",
29
- "description": "Minify source"
30
- },
31
- "outputDir": {
32
- "type": "string",
33
- "description": "Relative to workspace root, the directory to export the static files to. Default: dist"
34
- },
35
- "maxWorkers": {
36
- "type": "number",
37
- "description": "When bundler is metro, the maximum number of tasks to allow the bundler to spawn"
38
- },
39
- "dumpAssetmap": {
40
- "type": "boolean",
41
- "description": "When bundler is metro, whether to dump the asset map for further processing"
42
- },
43
- "sourceMaps": {
44
- "type": "boolean",
45
- "description": "When bundler is metro, whether to emit JavaScript source maps"
46
- }
47
- },
48
- "required": ["platform"],
49
- "examplesFile": "../../../docs/export-examples.md"
50
- }
@@ -1,40 +0,0 @@
1
- {
2
- "cli": "nx",
3
- "version": 2,
4
- "outputCapture": "direct-nodejs",
5
- "$id": "NxExpoInstall",
6
- "$schema": "https://json-schema.org/schema",
7
- "title": "Expo Install",
8
- "description": "Install a module or other package to a project.",
9
- "type": "object",
10
- "x-deprecated": "The `@nx/expo:install` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/expo:convert-to-inferred` to migrate to the `@nx/expo/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
11
- "properties": {
12
- "packages": {
13
- "type": "array",
14
- "items": {
15
- "type": "string"
16
- },
17
- "default": [],
18
- "description": "The names of packages to install",
19
- "$default": {
20
- "$source": "argv",
21
- "index": 0
22
- }
23
- },
24
- "check": {
25
- "type": "boolean",
26
- "description": "Check which installed packages need to be updated",
27
- "default": false
28
- },
29
- "fix": {
30
- "type": "boolean",
31
- "description": "Automatically update any invalid package versions",
32
- "default": false
33
- },
34
- "force": {
35
- "type": "boolean",
36
- "description": "Force the installation of a package, even if it is already installed",
37
- "default": false
38
- }
39
- }
40
- }
@@ -1,7 +0,0 @@
1
- import { ExecutorContext } from '@nx/devkit';
2
- import { ExpoPrebuildOptions } from './schema';
3
- export interface ExpoPrebuildOutput {
4
- success: boolean;
5
- }
6
- export default function prebuildExecutor(options: ExpoPrebuildOptions, context: ExecutorContext): AsyncGenerator<ExpoPrebuildOutput>;
7
- export declare function prebuildAsync(workspaceRoot: string, projectRoot: string, options: ExpoPrebuildOptions): Promise<number>;
@@ -1,77 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = prebuildExecutor;
4
- exports.prebuildAsync = prebuildAsync;
5
- const devkit_1 = require("@nx/devkit");
6
- const internal_1 = require("@nx/devkit/internal");
7
- const child_process_1 = require("child_process");
8
- const resolve_expo_cli_1 = require("../../utils/resolve-expo-cli");
9
- const path_1 = require("path");
10
- const pod_install_task_1 = require("../../utils/pod-install-task");
11
- const deprecation_1 = require("../../utils/deprecation");
12
- let childProcess;
13
- async function* prebuildExecutor(options, context) {
14
- (0, deprecation_1.warnExpoExecutorDeprecation)('prebuild');
15
- const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
16
- try {
17
- await prebuildAsync(context.root, projectRoot, options);
18
- if (options.install) {
19
- const { installAsync, } = require('@expo/cli/build/src/install/installAsync');
20
- await installAsync([], {});
21
- if (options.platform === 'ios') {
22
- (0, pod_install_task_1.podInstall)((0, path_1.join)(context.root, projectRoot, 'ios'));
23
- }
24
- }
25
- yield {
26
- success: true,
27
- };
28
- }
29
- finally {
30
- if (childProcess) {
31
- childProcess.kill();
32
- }
33
- }
34
- }
35
- function prebuildAsync(workspaceRoot, projectRoot, options) {
36
- return new Promise((resolve, reject) => {
37
- childProcess = (0, child_process_1.fork)((0, resolve_expo_cli_1.resolveExpoCliPath)(), ['prebuild', ...createPrebuildOptions(options), '--no-install'], {
38
- cwd: (0, path_1.join)(workspaceRoot, projectRoot),
39
- env: process.env,
40
- });
41
- // Ensure the child process is killed when the parent exits
42
- process.on('exit', () => childProcess.kill());
43
- process.on('SIGTERM', () => childProcess.kill());
44
- childProcess.on('error', (err) => {
45
- reject(err);
46
- });
47
- childProcess.on('exit', (code, signal) => {
48
- if (code === null)
49
- code = (0, internal_1.signalToCode)(signal);
50
- if (code === 0) {
51
- resolve(code);
52
- }
53
- else {
54
- reject(code);
55
- }
56
- });
57
- });
58
- }
59
- const nxOptions = ['install', 'interactive']; // interactive is passed in by e2e tests
60
- // options from https://github.com/expo/expo/blob/main/packages/%40expo/cli/src/prebuild/index.ts
61
- function createPrebuildOptions(options) {
62
- return Object.keys(options).reduce((acc, k) => {
63
- if (!nxOptions.includes(k)) {
64
- const v = options[k];
65
- if (typeof v === 'boolean') {
66
- if (v === true) {
67
- // when true, does not need to pass the value true, just need to pass the flag in kebob case
68
- acc.push(`--${(0, devkit_1.names)(k).fileName}`);
69
- }
70
- }
71
- else {
72
- acc.push(`--${(0, devkit_1.names)(k).fileName}`, v);
73
- }
74
- }
75
- return acc;
76
- }, []);
77
- }
@@ -1,7 +0,0 @@
1
- // options from https://github.com/expo/expo/blob/main/packages/%40expo/cli/src/prebuild/index.ts
2
- export interface ExpoPrebuildOptions {
3
- clean?: boolean; // default is false
4
- install: boolean; // default is true
5
- platform: 'all' | 'android' | 'ios'; // default is all
6
- template?: string;
7
- }
@@ -1,37 +0,0 @@
1
- {
2
- "cli": "nx",
3
- "version": 2,
4
- "outputCapture": "direct-nodejs",
5
- "$id": "NxExpoPrebuild",
6
- "$schema": "https://json-schema.org/schema",
7
- "title": "Expo Prebuild",
8
- "description": "Create native iOS and Android project files for building natively.",
9
- "type": "object",
10
- "x-deprecated": "The `@nx/expo:prebuild` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/expo:convert-to-inferred` to migrate to the `@nx/expo/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
11
- "properties": {
12
- "clean": {
13
- "type": "boolean",
14
- "description": "Delete the native folders and regenerate them before applying changes",
15
- "default": false
16
- },
17
- "install": {
18
- "type": "boolean",
19
- "description": "Installing npm packages and CocoaPods.",
20
- "default": true,
21
- "x-priority": "internal"
22
- },
23
- "platform": {
24
- "description": "Platforms to sync",
25
- "default": "all",
26
- "enum": ["ios", "android", "all"],
27
- "alias": "p",
28
- "x-priority": "important"
29
- },
30
- "template": {
31
- "type": "string",
32
- "description": "Project template to clone from. File path pointing to a local tar file or a github repo"
33
- }
34
- },
35
- "required": ["platform"],
36
- "examplesFile": "../../../docs/prebuild-examples.md"
37
- }
@@ -1,6 +0,0 @@
1
- import { ExecutorContext } from '@nx/devkit';
2
- import { ExpoRunOptions } from './schema';
3
- export interface ExpoRunOutput {
4
- success: boolean;
5
- }
6
- export default function runExecutor(options: ExpoRunOptions, context: ExecutorContext): AsyncGenerator<ExpoRunOutput>;