@nx/expo 24.0.0-beta.1 → 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.
- package/dist/plugins/plugin.js +8 -4
- package/dist/src/executors/install/{install.impl.d.ts → install-packages.d.ts} +0 -4
- package/dist/src/executors/install/{install.impl.js → install-packages.js} +0 -17
- package/dist/src/executors/update/update.impl.js +2 -2
- package/dist/src/generators/application/application.js +2 -3
- package/dist/src/generators/application/files/base/package.json.template +1 -0
- package/dist/src/generators/application/lib/add-e2e.js +4 -5
- package/dist/src/generators/application/lib/add-eas-scripts.d.ts +3 -0
- package/dist/src/generators/application/lib/add-eas-scripts.js +103 -3
- package/dist/src/generators/application/lib/add-project.js +1 -82
- package/dist/src/generators/application/lib/normalize-options.js +0 -4
- package/dist/src/generators/application/schema.d.ts +0 -1
- package/dist/src/generators/init/init.js +18 -32
- package/dist/src/generators/init/schema.d.ts +0 -1
- package/dist/src/generators/library/lib/normalize-options.js +0 -5
- package/dist/src/generators/library/library.js +2 -3
- package/dist/src/generators/library/schema.d.ts +0 -1
- package/dist/src/migrations/update-24-0-0/add-eas-build-pre-install.d.ts +2 -0
- package/dist/src/migrations/update-24-0-0/add-eas-build-pre-install.js +42 -0
- package/dist/src/migrations/update-24-0-0/add-eas-build-pre-install.md +32 -0
- package/dist/src/migrations/update-24-0-0/finish-inferred-conversion.md +12 -0
- package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.d.ts +6 -0
- package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.js +30 -0
- package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.md +72 -0
- package/dist/src/utils/add-linting.d.ts +0 -1
- package/dist/src/utils/add-linting.js +0 -1
- package/dist/src/utils/jest/add-jest.d.ts +1 -1
- package/dist/src/utils/jest/add-jest.js +1 -2
- package/executors.json +0 -40
- package/migrations.json +13 -0
- package/package.json +10 -10
- package/dist/docs/export-examples.md +0 -107
- package/dist/docs/prebuild-examples.md +0 -65
- package/dist/docs/run-examples.md +0 -86
- package/dist/docs/start-examples.md +0 -100
- package/dist/src/executors/build/build.impl.d.ts +0 -6
- package/dist/src/executors/build/build.impl.js +0 -142
- package/dist/src/executors/build/schema.d.ts +0 -18
- package/dist/src/executors/build/schema.json +0 -100
- package/dist/src/executors/export/export.impl.d.ts +0 -7
- package/dist/src/executors/export/export.impl.js +0 -81
- package/dist/src/executors/export/schema.d.ts +0 -13
- package/dist/src/executors/export/schema.json +0 -50
- package/dist/src/executors/install/schema.json +0 -40
- package/dist/src/executors/prebuild/prebuild.impl.d.ts +0 -7
- package/dist/src/executors/prebuild/prebuild.impl.js +0 -77
- package/dist/src/executors/prebuild/schema.d.ts +0 -7
- package/dist/src/executors/prebuild/schema.json +0 -37
- package/dist/src/executors/run/run.impl.d.ts +0 -6
- package/dist/src/executors/run/run.impl.js +0 -102
- package/dist/src/executors/run/schema.d.ts +0 -24
- package/dist/src/executors/run/schema.json +0 -67
- package/dist/src/executors/serve/lib/is-packager-running.d.ts +0 -1
- package/dist/src/executors/serve/lib/is-packager-running.js +0 -13
- package/dist/src/executors/serve/schema.d.ts +0 -7
- package/dist/src/executors/serve/schema.json +0 -37
- package/dist/src/executors/serve/serve.impl.d.ts +0 -10
- package/dist/src/executors/serve/serve.impl.js +0 -134
- package/dist/src/executors/start/schema.d.ts +0 -22
- package/dist/src/executors/start/schema.json +0 -95
- package/dist/src/executors/start/start.impl.d.ts +0 -7
- package/dist/src/executors/start/start.impl.js +0 -84
- package/dist/src/executors/submit/schema.d.ts +0 -12
- package/dist/src/executors/submit/schema.json +0 -58
- package/dist/src/executors/submit/submit.impl.d.ts +0 -6
- package/dist/src/executors/submit/submit.impl.js +0 -75
- package/dist/src/utils/deprecation.d.ts +0 -3
- package/dist/src/utils/deprecation.js +0 -23
- package/dist/src/utils/pod-install-task.d.ts +0 -17
- package/dist/src/utils/pod-install-task.js +0 -69
- package/dist/src/utils/resolve-expo-cli.d.ts +0 -11
- package/dist/src/utils/resolve-expo-cli.js +0 -21
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = runExecutor;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
-
const child_process_1 = require("child_process");
|
|
7
|
-
const resolve_expo_cli_1 = require("../../utils/resolve-expo-cli");
|
|
8
|
-
const node_fs_1 = require("node:fs");
|
|
9
|
-
const os_1 = require("os");
|
|
10
|
-
const path_1 = require("path");
|
|
11
|
-
const prebuild_impl_1 = require("../prebuild/prebuild.impl");
|
|
12
|
-
const pod_install_task_1 = require("../../utils/pod-install-task");
|
|
13
|
-
const deprecation_1 = require("../../utils/deprecation");
|
|
14
|
-
let childProcess;
|
|
15
|
-
async function* runExecutor(options, context) {
|
|
16
|
-
(0, deprecation_1.warnExpoExecutorDeprecation)('run');
|
|
17
|
-
if ((0, os_1.platform)() !== 'darwin' && options.platform === 'ios') {
|
|
18
|
-
throw new Error(`The run-ios build requires Mac to run`);
|
|
19
|
-
}
|
|
20
|
-
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
21
|
-
if (!(0, node_fs_1.existsSync)((0, path_1.join)(context.root, projectRoot, options.platform))) {
|
|
22
|
-
await (0, prebuild_impl_1.prebuildAsync)(context.root, projectRoot, {
|
|
23
|
-
install: options.install,
|
|
24
|
-
platform: options.platform,
|
|
25
|
-
clean: options.clean,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
if (options.install) {
|
|
29
|
-
const { installAsync, } = require('@expo/cli/build/src/install/installAsync');
|
|
30
|
-
await installAsync([], {});
|
|
31
|
-
if (options.platform === 'ios') {
|
|
32
|
-
(0, pod_install_task_1.podInstall)((0, path_1.join)(context.root, projectRoot, 'ios'));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
try {
|
|
36
|
-
await runCliRun(context.root, projectRoot, options);
|
|
37
|
-
yield { success: true };
|
|
38
|
-
}
|
|
39
|
-
finally {
|
|
40
|
-
if (childProcess) {
|
|
41
|
-
childProcess.kill();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function runCliRun(workspaceRoot, projectRoot, options) {
|
|
46
|
-
return new Promise((resolve, reject) => {
|
|
47
|
-
childProcess = (0, child_process_1.fork)((0, resolve_expo_cli_1.resolveExpoCliPath)(), ['run:' + options.platform, ...createRunOptions(options), '--no-install'], // pass in no-install to prevent node_modules install
|
|
48
|
-
{
|
|
49
|
-
cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
|
|
50
|
-
env: process.env,
|
|
51
|
-
});
|
|
52
|
-
// Ensure the child process is killed when the parent exits
|
|
53
|
-
process.on('exit', () => childProcess.kill());
|
|
54
|
-
process.on('SIGTERM', () => childProcess.kill());
|
|
55
|
-
childProcess.on('error', (err) => {
|
|
56
|
-
reject(err);
|
|
57
|
-
});
|
|
58
|
-
childProcess.on('exit', (code, signal) => {
|
|
59
|
-
if (code === null)
|
|
60
|
-
code = (0, internal_1.signalToCode)(signal);
|
|
61
|
-
if (code === 0) {
|
|
62
|
-
resolve(code);
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
reject(code);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
const nxOptions = ['platform', 'clean'];
|
|
71
|
-
const iOSOptions = ['xcodeConfiguration', 'schema'];
|
|
72
|
-
const androidOptions = ['variant'];
|
|
73
|
-
/*
|
|
74
|
-
* run options:
|
|
75
|
-
* ios: https://github.com/expo/expo/blob/main/packages/@expo/cli/src/run/ios/index.ts
|
|
76
|
-
* android: https://github.com/expo/expo/blob/main/packages/@expo/cli/src/run/android/index.ts
|
|
77
|
-
*/
|
|
78
|
-
function createRunOptions(options) {
|
|
79
|
-
return Object.keys(options).reduce((acc, k) => {
|
|
80
|
-
if (nxOptions.includes(k) ||
|
|
81
|
-
(options.platform === 'ios' && androidOptions.includes(k)) ||
|
|
82
|
-
(options.platform === 'android' && iOSOptions.includes(k))) {
|
|
83
|
-
return acc;
|
|
84
|
-
}
|
|
85
|
-
const v = options[k];
|
|
86
|
-
{
|
|
87
|
-
if (k === 'xcodeConfiguration') {
|
|
88
|
-
acc.push('--configuration', v);
|
|
89
|
-
}
|
|
90
|
-
else if (typeof v === 'boolean') {
|
|
91
|
-
// no need to pass in the flag when it is true, pass the --no-<flag> when it is false. e.g. --no-build-cache, --no-bundler
|
|
92
|
-
if (v === false) {
|
|
93
|
-
acc.push(`--no-${(0, devkit_1.names)(k).fileName}`);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
acc.push(`--${(0, devkit_1.names)(k).fileName}`, v);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return acc;
|
|
101
|
-
}, []);
|
|
102
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* options from
|
|
3
|
-
* - android: https://github.com/expo/expo/blob/main/packages/%40expo/cli/src/run/android/resolveOptions.ts
|
|
4
|
-
* - ios: https://github.com/expo/expo/blob/main/packages/%40expo/cli/src/run/ios/options/resolveOptions.ts
|
|
5
|
-
*/
|
|
6
|
-
export interface ExpoRunOptions {
|
|
7
|
-
// nx options
|
|
8
|
-
platform: 'ios' | 'android';
|
|
9
|
-
install?: boolean; // default is true
|
|
10
|
-
clean?: boolean; // default is false
|
|
11
|
-
|
|
12
|
-
// ios only
|
|
13
|
-
scheme?: string; // Xcode scheme to build.
|
|
14
|
-
xcodeConfiguration?: XcodeConfiguration; // Xcode configuration to build. Default `Debug`
|
|
15
|
-
|
|
16
|
-
// android only
|
|
17
|
-
variant?: string;
|
|
18
|
-
|
|
19
|
-
// shared between ios and android
|
|
20
|
-
device?: string;
|
|
21
|
-
port: number; // default is 8081
|
|
22
|
-
bundler: boolean; // default is true
|
|
23
|
-
buildCache?: boolean;
|
|
24
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 2,
|
|
3
|
-
"continuous": true,
|
|
4
|
-
"outputCapture": "direct-nodejs",
|
|
5
|
-
"cli": "nx",
|
|
6
|
-
"$id": "NxExpoRun",
|
|
7
|
-
"$schema": "https://json-schema.org/schema",
|
|
8
|
-
"title": "Run iOS or Android application",
|
|
9
|
-
"description": "Run Expo target options.",
|
|
10
|
-
"type": "object",
|
|
11
|
-
"x-deprecated": "The `@nx/expo:run` 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.",
|
|
12
|
-
"properties": {
|
|
13
|
-
"platform": {
|
|
14
|
-
"description": "Platform to run for (ios, android).",
|
|
15
|
-
"enum": ["ios", "android"],
|
|
16
|
-
"default": "ios",
|
|
17
|
-
"alias": "p"
|
|
18
|
-
},
|
|
19
|
-
"xcodeConfiguration": {
|
|
20
|
-
"type": "string",
|
|
21
|
-
"description": "(iOS) Xcode configuration to use. Debug or Release",
|
|
22
|
-
"default": "Debug",
|
|
23
|
-
"x-priority": "important"
|
|
24
|
-
},
|
|
25
|
-
"scheme": {
|
|
26
|
-
"type": "string",
|
|
27
|
-
"description": "(iOS) Explicitly set the Xcode scheme to use"
|
|
28
|
-
},
|
|
29
|
-
"variant": {
|
|
30
|
-
"type": "string",
|
|
31
|
-
"description": "(Android) Specify your app's build variant (e.g. debug, release).",
|
|
32
|
-
"default": "debug",
|
|
33
|
-
"x-priority": "important"
|
|
34
|
-
},
|
|
35
|
-
"device": {
|
|
36
|
-
"type": "string",
|
|
37
|
-
"description": "Device name or UDID to build the app on. The value is not required if you have a single device connected.",
|
|
38
|
-
"alias": "d"
|
|
39
|
-
},
|
|
40
|
-
"port": {
|
|
41
|
-
"type": "number",
|
|
42
|
-
"description": "Port to start the Metro bundler on",
|
|
43
|
-
"default": 8081,
|
|
44
|
-
"alias": "p"
|
|
45
|
-
},
|
|
46
|
-
"bundler": {
|
|
47
|
-
"type": "boolean",
|
|
48
|
-
"description": "Whether to skip starting the Metro bundler. True to start it, false to skip it."
|
|
49
|
-
},
|
|
50
|
-
"install": {
|
|
51
|
-
"type": "boolean",
|
|
52
|
-
"description": "Installing npm packages and CocoaPods before building.",
|
|
53
|
-
"default": true
|
|
54
|
-
},
|
|
55
|
-
"buildCache": {
|
|
56
|
-
"type": "boolean",
|
|
57
|
-
"description": "Should use derived data for builds."
|
|
58
|
-
},
|
|
59
|
-
"clean": {
|
|
60
|
-
"type": "boolean",
|
|
61
|
-
"description": "Delete the native folders and regenerate them before applying changes",
|
|
62
|
-
"default": false
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
"required": ["platform"],
|
|
66
|
-
"examplesFile": "../../../docs/run-examples.md"
|
|
67
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isPackagerRunning(packagerPort: number): Promise<'running' | 'not_running' | 'unrecognized'>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isPackagerRunning = isPackagerRunning;
|
|
4
|
-
async function isPackagerRunning(packagerPort) {
|
|
5
|
-
try {
|
|
6
|
-
const resp = await fetch(`http://localhost:${packagerPort}/status`);
|
|
7
|
-
const data = await resp.text();
|
|
8
|
-
return data === 'packager-status:running' ? 'running' : 'unrecognized';
|
|
9
|
-
}
|
|
10
|
-
catch {
|
|
11
|
-
return 'not_running';
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 2,
|
|
3
|
-
"continuous": true,
|
|
4
|
-
"outputCapture": "direct-nodejs",
|
|
5
|
-
"cli": "nx",
|
|
6
|
-
"$id": "NxExpoServe",
|
|
7
|
-
"$schema": "http://json-schema.org/schema",
|
|
8
|
-
"title": "Serve web app for Expo",
|
|
9
|
-
"description": "Packager Server target options.",
|
|
10
|
-
"type": "object",
|
|
11
|
-
"x-deprecated": "The `@nx/expo:serve` 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.",
|
|
12
|
-
"properties": {
|
|
13
|
-
"port": {
|
|
14
|
-
"type": "number",
|
|
15
|
-
"description": "Port to start the native Metro bundler on (does not apply to web or tunnel)",
|
|
16
|
-
"default": 4200,
|
|
17
|
-
"alias": "p"
|
|
18
|
-
},
|
|
19
|
-
"clear": {
|
|
20
|
-
"type": "boolean",
|
|
21
|
-
"description": "Clear the Metro bundler cache",
|
|
22
|
-
"alias": "c"
|
|
23
|
-
},
|
|
24
|
-
"maxWorkers": {
|
|
25
|
-
"type": "number",
|
|
26
|
-
"description": "Maximum number of tasks to allow Metro to spawn"
|
|
27
|
-
},
|
|
28
|
-
"dev": {
|
|
29
|
-
"type": "boolean",
|
|
30
|
-
"description": "Turn development mode on or off"
|
|
31
|
-
},
|
|
32
|
-
"minify": {
|
|
33
|
-
"type": "boolean",
|
|
34
|
-
"description": "Whether or not to minify code"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
-
import { ChildProcess } from 'child_process';
|
|
3
|
-
import { ExpoServeExecutorSchema } from './schema';
|
|
4
|
-
export interface ExpoServeOutput {
|
|
5
|
-
port?: number;
|
|
6
|
-
baseUrl?: string;
|
|
7
|
-
success: boolean;
|
|
8
|
-
}
|
|
9
|
-
export default function serveExecutor(options: ExpoServeExecutorSchema, context: ExecutorContext): AsyncGenerator<ExpoServeOutput>;
|
|
10
|
-
export declare function runCliServe(workspaceRoot: string, projectRoot: string, options: ExpoServeExecutorSchema): Promise<ChildProcess>;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = serveExecutor;
|
|
4
|
-
exports.runCliServe = runCliServe;
|
|
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 is_packager_running_1 = require("./lib/is-packager-running");
|
|
11
|
-
const deprecation_1 = require("../../utils/deprecation");
|
|
12
|
-
async function* serveExecutor(options, context) {
|
|
13
|
-
(0, deprecation_1.warnExpoExecutorDeprecation)('serve');
|
|
14
|
-
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
15
|
-
const serveProcess = await runCliServe(context.root, projectRoot, options);
|
|
16
|
-
yield {
|
|
17
|
-
port: options.port,
|
|
18
|
-
baseUrl: `http://localhost:${options.port}`,
|
|
19
|
-
success: true,
|
|
20
|
-
};
|
|
21
|
-
if (!serveProcess) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
await new Promise((resolve) => {
|
|
25
|
-
const processExitListener = (signal) => () => {
|
|
26
|
-
serveProcess.kill(signal);
|
|
27
|
-
resolve();
|
|
28
|
-
process.exit();
|
|
29
|
-
};
|
|
30
|
-
process.once('exit', (signal) => serveProcess.kill(signal));
|
|
31
|
-
process.once('SIGTERM', processExitListener);
|
|
32
|
-
process.once('SIGINT', processExitListener);
|
|
33
|
-
process.once('SIGQUIT', processExitListener);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
async function runCliServe(workspaceRoot, projectRoot, options) {
|
|
37
|
-
const result = await (0, is_packager_running_1.isPackagerRunning)(options.port);
|
|
38
|
-
if (result === 'running') {
|
|
39
|
-
devkit_1.logger.info(`JS server already running on port ${options.port}.`);
|
|
40
|
-
}
|
|
41
|
-
else if (result === 'unrecognized') {
|
|
42
|
-
devkit_1.logger.warn('JS server not recognized.');
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
// result === 'not_running'
|
|
46
|
-
devkit_1.logger.info('Starting JS server...');
|
|
47
|
-
try {
|
|
48
|
-
return await serveAsync(workspaceRoot, projectRoot, options);
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
devkit_1.logger.error(`Failed to serve the packager server. Error details: ${error.message}`);
|
|
52
|
-
throw error;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function serveAsync(workspaceRoot, projectRoot, options) {
|
|
57
|
-
return new Promise((resolve, reject) => {
|
|
58
|
-
const childProcess = (0, child_process_1.fork)((0, resolve_expo_cli_1.resolveExpoCliPath)(), ['start', '--web', ...createServeOptions(options)], {
|
|
59
|
-
cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
|
|
60
|
-
env: process.env,
|
|
61
|
-
stdio: ['inherit', 'pipe', 'pipe', 'ipc'],
|
|
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
|
-
})();
|
|
88
|
-
childProcess.stdout.on('data', (data) => {
|
|
89
|
-
process.stdout.write(data);
|
|
90
|
-
if (data.toString().includes('Bundling complete') ||
|
|
91
|
-
data.toString().includes('Bundled')) {
|
|
92
|
-
settleResolve(childProcess);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
childProcess.stderr.on('data', (data) => {
|
|
96
|
-
process.stderr.write(data);
|
|
97
|
-
});
|
|
98
|
-
childProcess.on('error', (err) => {
|
|
99
|
-
settleReject(err);
|
|
100
|
-
});
|
|
101
|
-
childProcess.on('exit', (code, signal) => {
|
|
102
|
-
if (code === null)
|
|
103
|
-
code = (0, internal_1.signalToCode)(signal);
|
|
104
|
-
if (code === 0) {
|
|
105
|
-
settleResolve(childProcess);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
settleReject(code);
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
function createServeOptions(options) {
|
|
114
|
-
return Object.keys(options).reduce((acc, k) => {
|
|
115
|
-
const v = options[k];
|
|
116
|
-
if (k === 'dev') {
|
|
117
|
-
if (v === false) {
|
|
118
|
-
acc.push(`--no-dev`); // only no-dev flag is supported
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
if (typeof v === 'boolean') {
|
|
123
|
-
if (v === true) {
|
|
124
|
-
// when true, does not need to pass the value true, just need to pass the flag in kebob case
|
|
125
|
-
acc.push(`--${(0, devkit_1.names)(k).fileName}`);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
acc.push(`--${(0, devkit_1.names)(k).fileName}`, v);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return acc;
|
|
133
|
-
}, []);
|
|
134
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// options from https://github.com/expo/expo/blob/main/packages/%40expo/cli/src/start/resolveOptions.ts
|
|
2
|
-
|
|
3
|
-
export interface ExpoStartOptions {
|
|
4
|
-
forceManifestType: 'classic' | 'expo-updates';
|
|
5
|
-
privateKeyPath?: string;
|
|
6
|
-
port: number;
|
|
7
|
-
dev?: boolean;
|
|
8
|
-
devClient?: boolean;
|
|
9
|
-
minify?: boolean;
|
|
10
|
-
https?: boolean;
|
|
11
|
-
clear?: boolean;
|
|
12
|
-
maxWorkers?: number;
|
|
13
|
-
scheme?: string;
|
|
14
|
-
ios?: boolean;
|
|
15
|
-
android?: boolean;
|
|
16
|
-
web?: boolean;
|
|
17
|
-
host?: 'localhost' | 'lan' | 'tunnel';
|
|
18
|
-
lan?: boolean;
|
|
19
|
-
localhost?: boolean;
|
|
20
|
-
tunnel?: boolean;
|
|
21
|
-
offline?: boolean;
|
|
22
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 2,
|
|
3
|
-
"continuous": true,
|
|
4
|
-
"outputCapture": "direct-nodejs",
|
|
5
|
-
"cli": "nx",
|
|
6
|
-
"$id": "NxExpoStart",
|
|
7
|
-
"$schema": "https://json-schema.org/schema",
|
|
8
|
-
"title": "Packager Server for Expo",
|
|
9
|
-
"description": "Packager Server target options.",
|
|
10
|
-
"type": "object",
|
|
11
|
-
"x-deprecated": "The `@nx/expo:start` 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.",
|
|
12
|
-
"properties": {
|
|
13
|
-
"forceManifestType": {
|
|
14
|
-
"type": "string",
|
|
15
|
-
"description": "Override auto detection of manifest type.",
|
|
16
|
-
"enum": ["expo-updates", "classic"]
|
|
17
|
-
},
|
|
18
|
-
"privateKeyPath": {
|
|
19
|
-
"type": "string",
|
|
20
|
-
"description": "Path to private key for code signing. Default: 'private-key.pem' in the same directory as the certificate specified by the expo-updates configuration in app.json."
|
|
21
|
-
},
|
|
22
|
-
"port": {
|
|
23
|
-
"type": "number",
|
|
24
|
-
"description": "Port to start the native Metro bundler on (does not apply to web or tunnel)",
|
|
25
|
-
"default": 19000,
|
|
26
|
-
"alias": "p"
|
|
27
|
-
},
|
|
28
|
-
"clear": {
|
|
29
|
-
"type": "boolean",
|
|
30
|
-
"description": "Clear the Metro bundler cache",
|
|
31
|
-
"alias": "c"
|
|
32
|
-
},
|
|
33
|
-
"maxWorkers": {
|
|
34
|
-
"type": "number",
|
|
35
|
-
"description": "Maximum number of tasks to allow Metro to spawn"
|
|
36
|
-
},
|
|
37
|
-
"dev": {
|
|
38
|
-
"type": "boolean",
|
|
39
|
-
"description": "Turn development mode on or off"
|
|
40
|
-
},
|
|
41
|
-
"devClient": {
|
|
42
|
-
"type": "boolean",
|
|
43
|
-
"description": "Experimental: Starts the bundler for use with the expo-development-client"
|
|
44
|
-
},
|
|
45
|
-
"minify": {
|
|
46
|
-
"type": "boolean",
|
|
47
|
-
"description": "Whether or not to minify code"
|
|
48
|
-
},
|
|
49
|
-
"https": {
|
|
50
|
-
"type": "boolean",
|
|
51
|
-
"description": "To start webpack with https or http protocol"
|
|
52
|
-
},
|
|
53
|
-
"scheme": {
|
|
54
|
-
"type": "string",
|
|
55
|
-
"description": "Custom URI protocol to use with a development build"
|
|
56
|
-
},
|
|
57
|
-
"android": {
|
|
58
|
-
"type": "boolean",
|
|
59
|
-
"description": "Opens your app in Expo Go on a connected Android device",
|
|
60
|
-
"alias": "a"
|
|
61
|
-
},
|
|
62
|
-
"ios": {
|
|
63
|
-
"type": "boolean",
|
|
64
|
-
"description": "Opens your app in Expo Go in a currently running iOS simulator on your computer",
|
|
65
|
-
"alias": "i"
|
|
66
|
-
},
|
|
67
|
-
"web": {
|
|
68
|
-
"type": "boolean",
|
|
69
|
-
"description": " Opens your app in a web browser",
|
|
70
|
-
"alias": "w"
|
|
71
|
-
},
|
|
72
|
-
"host": {
|
|
73
|
-
"type": "string",
|
|
74
|
-
"description": "lan (default), tunnel, localhost. Type of host to use. lan uses the local network; tunnel ues any network by tunnel through ngrok; localhost connects to the dev server over localhost.",
|
|
75
|
-
"enum": ["localhost", "lan", "tunnel"]
|
|
76
|
-
},
|
|
77
|
-
"tunnel": {
|
|
78
|
-
"type": "boolean",
|
|
79
|
-
"description": "Same as --host tunnel"
|
|
80
|
-
},
|
|
81
|
-
"lan": {
|
|
82
|
-
"type": "boolean",
|
|
83
|
-
"description": "Same as --host lan"
|
|
84
|
-
},
|
|
85
|
-
"localhost": {
|
|
86
|
-
"type": "boolean",
|
|
87
|
-
"description": "Same as --host localhost"
|
|
88
|
-
},
|
|
89
|
-
"offline": {
|
|
90
|
-
"type": "boolean",
|
|
91
|
-
"description": "Allows this command to run while offline"
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
"examplesFile": "../../../docs/start-examples.md"
|
|
95
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
-
import { ExpoStartOptions } from './schema';
|
|
3
|
-
export interface ExpoStartOutput {
|
|
4
|
-
baseUrl?: string;
|
|
5
|
-
success: boolean;
|
|
6
|
-
}
|
|
7
|
-
export default function startExecutor(options: ExpoStartOptions, context: ExecutorContext): AsyncGenerator<ExpoStartOutput>;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = startExecutor;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pc = tslib_1.__importStar(require("picocolors"));
|
|
6
|
-
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const internal_1 = require("@nx/devkit/internal");
|
|
8
|
-
const child_process_1 = require("child_process");
|
|
9
|
-
const resolve_expo_cli_1 = require("../../utils/resolve-expo-cli");
|
|
10
|
-
const path_1 = require("path");
|
|
11
|
-
const deprecation_1 = require("../../utils/deprecation");
|
|
12
|
-
let childProcess;
|
|
13
|
-
async function* startExecutor(options, context) {
|
|
14
|
-
(0, deprecation_1.warnExpoExecutorDeprecation)('start');
|
|
15
|
-
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
16
|
-
try {
|
|
17
|
-
const baseUrl = `http://localhost:${options.port}`;
|
|
18
|
-
devkit_1.logger.info(pc.cyan(`Packager is ready at ${baseUrl}`));
|
|
19
|
-
await startAsync(context.root, projectRoot, options);
|
|
20
|
-
yield {
|
|
21
|
-
baseUrl,
|
|
22
|
-
success: true,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
finally {
|
|
26
|
-
if (childProcess) {
|
|
27
|
-
childProcess.kill();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
function startAsync(workspaceRoot, projectRoot, options) {
|
|
32
|
-
return new Promise((resolve, reject) => {
|
|
33
|
-
childProcess = (0, child_process_1.fork)((0, resolve_expo_cli_1.resolveExpoCliPath)(), ['start', ...createStartOptions(options)], {
|
|
34
|
-
cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
|
|
35
|
-
env: {
|
|
36
|
-
RCT_METRO_PORT: options.port.toString(),
|
|
37
|
-
...process.env,
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
// Ensure the child process is killed when the parent exits
|
|
41
|
-
process.on('exit', () => childProcess.kill());
|
|
42
|
-
process.on('SIGTERM', () => childProcess.kill());
|
|
43
|
-
childProcess.on('error', (err) => {
|
|
44
|
-
reject(err);
|
|
45
|
-
});
|
|
46
|
-
childProcess.on('exit', (code, signal) => {
|
|
47
|
-
if (code === null)
|
|
48
|
-
code = (0, internal_1.signalToCode)(signal);
|
|
49
|
-
if (code === 0) {
|
|
50
|
-
resolve(code);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
reject(code);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
// options from https://github.com/expo/expo/blob/main/packages/%40expo/cli/src/start/index.ts
|
|
59
|
-
const nxOptions = ['sync'];
|
|
60
|
-
function createStartOptions(options) {
|
|
61
|
-
return Object.keys(options).reduce((acc, k) => {
|
|
62
|
-
if (nxOptions.includes(k)) {
|
|
63
|
-
return acc;
|
|
64
|
-
}
|
|
65
|
-
const v = options[k];
|
|
66
|
-
if (k === 'dev') {
|
|
67
|
-
if (v === false) {
|
|
68
|
-
acc.push(`--no-dev`); // only no-dev flag is supported
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
if (typeof v === 'boolean') {
|
|
73
|
-
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
|
-
}
|
|
82
|
-
return acc;
|
|
83
|
-
}, []);
|
|
84
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// command to run https://github.com/expo/eas-cli/tree/main#eas-submit
|
|
2
|
-
// options from https://github.com/expo/eas-cli/blob/main/packages/eas-cli/src/commands/submit.ts
|
|
3
|
-
export interface SubmitExecutorSchema {
|
|
4
|
-
profile?: string;
|
|
5
|
-
platform?: 'ios' | 'android' | 'all';
|
|
6
|
-
id?: string;
|
|
7
|
-
latest?: boolean;
|
|
8
|
-
interactive: boolean; // default is true
|
|
9
|
-
path?: string;
|
|
10
|
-
url?: string;
|
|
11
|
-
wait: boolean; // default is true
|
|
12
|
-
}
|