@expo/cli 0.1.1 → 0.1.4
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/build/bin/cli +8 -2
- package/build/bin/cli.map +1 -1
- package/build/src/export/index.js +1 -0
- package/build/src/export/index.js.map +1 -1
- package/build/src/run/android/runAndroidAsync.js +3 -3
- package/build/src/run/android/runAndroidAsync.js.map +1 -1
- package/build/src/run/ensureNativeProject.js +3 -0
- package/build/src/run/ensureNativeProject.js.map +1 -1
- package/build/src/run/hints.js +1 -1
- package/build/src/run/hints.js.map +1 -1
- package/build/src/run/ios/XcodeBuild.js +275 -0
- package/build/src/run/ios/XcodeBuild.js.map +1 -0
- package/build/src/run/ios/XcodeBuild.types.js +6 -0
- package/build/src/run/ios/XcodeBuild.types.js.map +1 -0
- package/build/src/run/ios/appleDevice/AppleDevice.js +161 -0
- package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -0
- package/build/src/run/ios/appleDevice/ClientManager.js +161 -0
- package/build/src/run/ios/appleDevice/ClientManager.js.map +1 -0
- package/build/src/run/ios/appleDevice/client/AFCClient.js +195 -0
- package/build/src/run/ios/appleDevice/client/AFCClient.js.map +1 -0
- package/build/src/run/ios/appleDevice/client/DebugserverClient.js +107 -0
- package/build/src/run/ios/appleDevice/client/DebugserverClient.js.map +1 -0
- package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js +97 -0
- package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -0
- package/build/src/run/ios/appleDevice/client/LockdowndClient.js +140 -0
- package/build/src/run/ios/appleDevice/client/LockdowndClient.js.map +1 -0
- package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js +91 -0
- package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js.map +1 -0
- package/build/src/run/ios/appleDevice/client/ServiceClient.js +21 -0
- package/build/src/run/ios/appleDevice/client/ServiceClient.js.map +1 -0
- package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js +117 -0
- package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js.map +1 -0
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js +90 -0
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js.map +1 -0
- package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js +332 -0
- package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js.map +1 -0
- package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js +115 -0
- package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js.map +1 -0
- package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js +126 -0
- package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js.map +1 -0
- package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js +74 -0
- package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js.map +1 -0
- package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js +65 -0
- package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js.map +1 -0
- package/build/src/run/ios/codeSigning/Security.js +85 -0
- package/build/src/run/ios/codeSigning/Security.js.map +1 -0
- package/build/src/run/ios/codeSigning/configureCodeSigning.js +77 -0
- package/build/src/run/ios/codeSigning/configureCodeSigning.js.map +1 -0
- package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js +102 -0
- package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js.map +1 -0
- package/build/src/run/ios/codeSigning/settings.js +21 -0
- package/build/src/run/ios/codeSigning/settings.js.map +1 -0
- package/build/src/run/ios/codeSigning/xcodeCodeSigning.js +76 -0
- package/build/src/run/ios/codeSigning/xcodeCodeSigning.js.map +1 -0
- package/build/src/run/ios/index.js +98 -0
- package/build/src/run/ios/index.js.map +1 -0
- package/build/src/run/ios/launchApp.js +75 -0
- package/build/src/run/ios/launchApp.js.map +1 -0
- package/build/src/run/ios/options/promptDevice.js +50 -0
- package/build/src/run/ios/options/promptDevice.js.map +1 -0
- package/build/src/run/ios/options/resolveDevice.js +92 -0
- package/build/src/run/ios/options/resolveDevice.js.map +1 -0
- package/build/src/run/ios/options/resolveNativeScheme.js +92 -0
- package/build/src/run/ios/options/resolveNativeScheme.js.map +1 -0
- package/build/src/run/ios/options/resolveOptions.js +44 -0
- package/build/src/run/ios/options/resolveOptions.js.map +1 -0
- package/build/src/run/ios/options/resolveXcodeProject.js +39 -0
- package/build/src/run/ios/options/resolveXcodeProject.js.map +1 -0
- package/build/src/run/ios/runIosAsync.js +85 -0
- package/build/src/run/ios/runIosAsync.js.map +1 -0
- package/build/src/run/resolveBundlerProps.js +9 -6
- package/build/src/run/resolveBundlerProps.js.map +1 -1
- package/build/src/run/startBundler.js +4 -2
- package/build/src/run/startBundler.js.map +1 -1
- package/build/src/start/doctor/Prerequisite.js +4 -4
- package/build/src/start/doctor/Prerequisite.js.map +1 -1
- package/build/src/start/doctor/SecurityBinPrerequisite.js +27 -0
- package/build/src/start/doctor/SecurityBinPrerequisite.js.map +1 -0
- package/build/src/start/doctor/apple/XcodeDeveloperDiskImagePrerequisite.js +69 -0
- package/build/src/start/doctor/apple/XcodeDeveloperDiskImagePrerequisite.js.map +1 -0
- package/build/src/start/platforms/android/emulator.js +8 -0
- package/build/src/start/platforms/android/emulator.js.map +1 -1
- package/build/src/start/platforms/android/promptAndroidDevice.js +1 -5
- package/build/src/start/platforms/android/promptAndroidDevice.js.map +1 -1
- package/build/src/start/platforms/ios/AppleDeviceManager.js +5 -1
- package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
- package/build/src/start/platforms/ios/promptAppleDevice.js +1 -5
- package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -1
- package/build/src/start/platforms/ios/simctl.js +14 -0
- package/build/src/start/platforms/ios/simctl.js.map +1 -1
- package/build/src/start/platforms/ios/simctlLogging.js +220 -0
- package/build/src/start/platforms/ios/simctlLogging.js.map +1 -0
- package/build/src/start/server/middleware/ClassicManifestMiddleware.js +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +30 -3
- package/build/src/utils/analytics/rudderstackClient.js.map +1 -1
- package/build/src/utils/cocoapods.js +47 -0
- package/build/src/utils/cocoapods.js.map +1 -1
- package/build/src/utils/dir.js +6 -1
- package/build/src/utils/dir.js.map +1 -1
- package/build/src/utils/plist.js +59 -0
- package/build/src/utils/plist.js.map +1 -0
- package/build/src/utils/prompts.js +16 -0
- package/build/src/utils/prompts.js.map +1 -1
- package/build/src/utils/resolveArgs.js +4 -1
- package/build/src/utils/resolveArgs.js.map +1 -1
- package/build/src/utils/terminal.js +10 -0
- package/build/src/utils/terminal.js.map +1 -0
- package/package.json +9 -8
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.resolveOptionsAsync = resolveOptionsAsync;
|
|
6
|
+
var _simctl = require("../../../start/platforms/ios/simctl");
|
|
7
|
+
var _resolveBundlerProps = require("../../resolveBundlerProps");
|
|
8
|
+
var _resolveDevice = require("./resolveDevice");
|
|
9
|
+
var _resolveNativeScheme = require("./resolveNativeScheme");
|
|
10
|
+
var _resolveXcodeProject = require("./resolveXcodeProject");
|
|
11
|
+
async function resolveOptionsAsync(projectRoot, options) {
|
|
12
|
+
const xcodeProject = (0, _resolveXcodeProject).resolveXcodeProject(projectRoot);
|
|
13
|
+
const bundlerProps = await (0, _resolveBundlerProps).resolveBundlerPropsAsync(projectRoot, options);
|
|
14
|
+
// Resolve the scheme before the device so we can filter devices based on
|
|
15
|
+
// whichever scheme is selected (i.e. don't present TV devices if the scheme cannot be run on a TV).
|
|
16
|
+
const { osType , name: scheme } = await (0, _resolveNativeScheme).resolveNativeSchemePropsAsync(projectRoot, options, xcodeProject);
|
|
17
|
+
// Resolve the device based on the provided device id or prompt
|
|
18
|
+
// from a list of devices (connected or simulated) that are filtered by the scheme.
|
|
19
|
+
const device = await (0, _resolveDevice).resolveDeviceAsync(options.device, {
|
|
20
|
+
// It's unclear if there's any value to asserting that we haven't hardcoded the os type in the CLI.
|
|
21
|
+
osType: (0, _simctl).isOSType(osType) ? osType : undefined
|
|
22
|
+
});
|
|
23
|
+
const isSimulator = (0, _resolveDevice).isSimulatorDevice(device);
|
|
24
|
+
// Use the configuration or `Debug` if none is provided.
|
|
25
|
+
const configuration = options.configuration || "Debug";
|
|
26
|
+
// This optimization skips resetting the Metro cache needlessly.
|
|
27
|
+
// The cache is reset in `../node_modules/react-native/scripts/react-native-xcode.sh` when the
|
|
28
|
+
// project is running in Debug and built onto a physical device. It seems that this is done because
|
|
29
|
+
// the script is run from Xcode and unaware of the CLI instance.
|
|
30
|
+
const shouldSkipInitialBundling = configuration === "Debug" && !isSimulator;
|
|
31
|
+
return {
|
|
32
|
+
...bundlerProps,
|
|
33
|
+
projectRoot,
|
|
34
|
+
isSimulator,
|
|
35
|
+
xcodeProject,
|
|
36
|
+
device,
|
|
37
|
+
configuration,
|
|
38
|
+
shouldSkipInitialBundling,
|
|
39
|
+
buildCache: options.buildCache !== false,
|
|
40
|
+
scheme
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=resolveOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/run/ios/options/resolveOptions.ts"],"sourcesContent":["import { isOSType } from '../../../start/platforms/ios/simctl';\nimport { resolveBundlerPropsAsync } from '../../resolveBundlerProps';\nimport { BuildProps, Options } from '../XcodeBuild.types';\nimport { isSimulatorDevice, resolveDeviceAsync } from './resolveDevice';\nimport { resolveNativeSchemePropsAsync } from './resolveNativeScheme';\nimport { resolveXcodeProject } from './resolveXcodeProject';\n\n/** Resolve arguments for the `run:ios` command. */\nexport async function resolveOptionsAsync(\n projectRoot: string,\n options: Options\n): Promise<BuildProps> {\n const xcodeProject = resolveXcodeProject(projectRoot);\n\n const bundlerProps = await resolveBundlerPropsAsync(projectRoot, options);\n\n // Resolve the scheme before the device so we can filter devices based on\n // whichever scheme is selected (i.e. don't present TV devices if the scheme cannot be run on a TV).\n const { osType, name: scheme } = await resolveNativeSchemePropsAsync(\n projectRoot,\n options,\n xcodeProject\n );\n\n // Resolve the device based on the provided device id or prompt\n // from a list of devices (connected or simulated) that are filtered by the scheme.\n const device = await resolveDeviceAsync(options.device, {\n // It's unclear if there's any value to asserting that we haven't hardcoded the os type in the CLI.\n osType: isOSType(osType) ? osType : undefined,\n });\n\n const isSimulator = isSimulatorDevice(device);\n\n // Use the configuration or `Debug` if none is provided.\n const configuration = options.configuration || 'Debug';\n\n // This optimization skips resetting the Metro cache needlessly.\n // The cache is reset in `../node_modules/react-native/scripts/react-native-xcode.sh` when the\n // project is running in Debug and built onto a physical device. It seems that this is done because\n // the script is run from Xcode and unaware of the CLI instance.\n const shouldSkipInitialBundling = configuration === 'Debug' && !isSimulator;\n\n return {\n ...bundlerProps,\n projectRoot,\n isSimulator,\n xcodeProject,\n device,\n configuration,\n shouldSkipInitialBundling,\n buildCache: options.buildCache !== false,\n scheme,\n };\n}\n"],"names":["resolveOptionsAsync","projectRoot","options","xcodeProject","resolveXcodeProject","bundlerProps","resolveBundlerPropsAsync","osType","name","scheme","resolveNativeSchemePropsAsync","device","resolveDeviceAsync","isOSType","undefined","isSimulator","isSimulatorDevice","configuration","shouldSkipInitialBundling","buildCache"],"mappings":"AAAA;;;;QAQsBA,mBAAmB,GAAnBA,mBAAmB;AARhB,IAAA,OAAqC,WAArC,qCAAqC,CAAA;AACrB,IAAA,oBAA2B,WAA3B,2BAA2B,CAAA;AAEd,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AACzB,IAAA,oBAAuB,WAAvB,uBAAuB,CAAA;AACjC,IAAA,oBAAuB,WAAvB,uBAAuB,CAAA;AAGpD,eAAeA,mBAAmB,CACvCC,WAAmB,EACnBC,OAAgB,EACK;IACrB,MAAMC,YAAY,GAAGC,CAAAA,GAAAA,oBAAmB,AAAa,CAAA,oBAAb,CAACH,WAAW,CAAC,AAAC;IAE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veXcodeProject;
|
|
6
|
+
var _glob = require("glob");
|
|
7
|
+
var _errors = require("../../../utils/errors");
|
|
8
|
+
const ignoredPaths = [
|
|
9
|
+
"**/@(Carthage|Pods|vendor|node_modules)/**"
|
|
10
|
+
];
|
|
11
|
+
function findXcodeProjectPaths(projectRoot, extension) {
|
|
12
|
+
return (0, _glob).sync(`ios/*.${extension}`, {
|
|
13
|
+
absolute: true,
|
|
14
|
+
cwd: projectRoot,
|
|
15
|
+
ignore: ignoredPaths
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function resolveXcodeProject(projectRoot) {
|
|
19
|
+
let paths = findXcodeProjectPaths(projectRoot, "xcworkspace");
|
|
20
|
+
if (paths.length) {
|
|
21
|
+
return {
|
|
22
|
+
// Use full path instead of relative project root so that warnings and errors contain full paths as well, this helps with filtering.
|
|
23
|
+
// Also helps keep things consistent in monorepos.
|
|
24
|
+
name: paths[0],
|
|
25
|
+
// name: path.relative(projectRoot, paths[0]),
|
|
26
|
+
isWorkspace: true
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
paths = findXcodeProjectPaths(projectRoot, "xcodeproj");
|
|
30
|
+
if (paths.length) {
|
|
31
|
+
return {
|
|
32
|
+
name: paths[0],
|
|
33
|
+
isWorkspace: false
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
throw new _errors.CommandError("IOS_MALFORMED", `Xcode project not found in project: ${projectRoot}. You can generate a project with \`npx expo prebuild\``);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=resolveXcodeProject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/run/ios/options/resolveXcodeProject.ts"],"sourcesContent":["import { sync as globSync } from 'glob';\n\nimport { CommandError } from '../../../utils/errors';\nimport { ProjectInfo } from '../XcodeBuild.types';\n\nconst ignoredPaths = ['**/@(Carthage|Pods|vendor|node_modules)/**'];\n\nfunction findXcodeProjectPaths(\n projectRoot: string,\n extension: 'xcworkspace' | 'xcodeproj'\n): string[] {\n return globSync(`ios/*.${extension}`, {\n absolute: true,\n cwd: projectRoot,\n ignore: ignoredPaths,\n });\n}\n\n/** Return the path and type of Xcode project in the given folder. */\nexport function resolveXcodeProject(projectRoot: string): ProjectInfo {\n let paths = findXcodeProjectPaths(projectRoot, 'xcworkspace');\n if (paths.length) {\n return {\n // Use full path instead of relative project root so that warnings and errors contain full paths as well, this helps with filtering.\n // Also helps keep things consistent in monorepos.\n name: paths[0],\n // name: path.relative(projectRoot, paths[0]),\n isWorkspace: true,\n };\n }\n paths = findXcodeProjectPaths(projectRoot, 'xcodeproj');\n if (paths.length) {\n return { name: paths[0], isWorkspace: false };\n }\n throw new CommandError(\n 'IOS_MALFORMED',\n `Xcode project not found in project: ${projectRoot}. You can generate a project with \\`npx expo prebuild\\``\n );\n}\n"],"names":["resolveXcodeProject","ignoredPaths","findXcodeProjectPaths","projectRoot","extension","globSync","absolute","cwd","ignore","paths","length","name","isWorkspace","CommandError"],"mappings":"AAAA;;;;QAmBgBA,mBAAmB,GAAnBA,mBAAmB;AAnBF,IAAA,KAAM,WAAN,MAAM,CAAA;AAEV,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AAGpD,MAAMC,YAAY,GAAG;IAAC,4CAA4C;CAAC,AAAC;AAEpE,SAASC,qBAAqB,CAC5BC,WAAmB,EACnBC,SAAsC,EAC5B;IACV,OAAOC,CAAAA,GAAAA,KAAQ,AAIb,CAAA,KAJa,CAAC,CAAC,MAAM,EAAED,SAAS,CAAC,CAAC,EAAE;QACpCE,QAAQ,EAAE,IAAI;QACdC,GAAG,EAAEJ,WAAW;QAChBK,MAAM,EAAEP,YAAY;KACrB,CAAC,CAAC;CACJ;AAGM,SAASD,mBAAmB,CAACG,WAAmB,EAAe;IACpE,IAAIM,KAAK,GAAGP,qBAAqB,CAACC,WAAW,EAAE,aAAa,CAAC,AAAC;IAC9D,IAAIM,KAAK,CAACC,MAAM,EAAE;QAChB,OAAO;YACL,oIAAoI;YACpI,kDAAkD;YAClDC,IAAI,EAAEF,KAAK,CAAC,CAAC,CAAC;YACd,8CAA8C;YAC9CG,WAAW,EAAE,IAAI;SAClB,CAAC;KACH;IACDH,KAAK,GAAGP,qBAAqB,CAACC,WAAW,EAAE,WAAW,CAAC,CAAC;IACxD,IAAIM,KAAK,CAACC,MAAM,EAAE;QAChB,OAAO;YAAEC,IAAI,EAAEF,KAAK,CAAC,CAAC,CAAC;YAAEG,WAAW,EAAE,KAAK;SAAE,CAAC;KAC/C;IACD,MAAM,IAAIC,OAAY,aAAA,CACpB,eAAe,EACf,CAAC,oCAAoC,EAAEV,WAAW,CAAC,uDAAuD,CAAC,CAC5G,CAAC;CACH"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.runIosAsync = runIosAsync;
|
|
6
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
7
|
+
var Log = _interopRequireWildcard(require("../../log"));
|
|
8
|
+
var _cocoapods = require("../../utils/cocoapods");
|
|
9
|
+
var _profile = require("../../utils/profile");
|
|
10
|
+
var _scheme = require("../../utils/scheme");
|
|
11
|
+
var _ensureNativeProject = require("../ensureNativeProject");
|
|
12
|
+
var _hints = require("../hints");
|
|
13
|
+
var _startBundler = require("../startBundler");
|
|
14
|
+
var XcodeBuild = _interopRequireWildcard(require("./XcodeBuild"));
|
|
15
|
+
var _launchApp = require("./launchApp");
|
|
16
|
+
var _resolveOptions = require("./options/resolveOptions");
|
|
17
|
+
function _interopRequireDefault(obj) {
|
|
18
|
+
return obj && obj.__esModule ? obj : {
|
|
19
|
+
default: obj
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function _interopRequireWildcard(obj) {
|
|
23
|
+
if (obj && obj.__esModule) {
|
|
24
|
+
return obj;
|
|
25
|
+
} else {
|
|
26
|
+
var newObj = {};
|
|
27
|
+
if (obj != null) {
|
|
28
|
+
for(var key in obj){
|
|
29
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
30
|
+
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
|
31
|
+
if (desc.get || desc.set) {
|
|
32
|
+
Object.defineProperty(newObj, key, desc);
|
|
33
|
+
} else {
|
|
34
|
+
newObj[key] = obj[key];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
newObj.default = obj;
|
|
40
|
+
return newObj;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function runIosAsync(projectRoot, options) {
|
|
44
|
+
var ref;
|
|
45
|
+
assertPlatform();
|
|
46
|
+
const install = !!options.install;
|
|
47
|
+
if (await (0, _ensureNativeProject).ensureNativeProjectAsync(projectRoot, {
|
|
48
|
+
platform: "ios",
|
|
49
|
+
install
|
|
50
|
+
}) && install) {
|
|
51
|
+
await (0, _cocoapods).maybePromptToSyncPodsAsync(projectRoot);
|
|
52
|
+
}
|
|
53
|
+
// Resolve the CLI arguments into useable options.
|
|
54
|
+
const props = await (0, _resolveOptions).resolveOptionsAsync(projectRoot, options);
|
|
55
|
+
// Spawn the `xcodebuild` process to create the app binary.
|
|
56
|
+
const buildOutput = await XcodeBuild.buildAsync(props);
|
|
57
|
+
// Find the path to the built app binary, this will be used to install the binary
|
|
58
|
+
// on a device.
|
|
59
|
+
const binaryPath = await (0, _profile).profile(XcodeBuild.getAppBinaryPath)(buildOutput);
|
|
60
|
+
// Start the dev server which creates all of the required info for
|
|
61
|
+
// launching the app on a simulator.
|
|
62
|
+
const manager = await (0, _startBundler).startBundlerAsync(projectRoot, {
|
|
63
|
+
port: props.port,
|
|
64
|
+
headless: !props.shouldStartBundler,
|
|
65
|
+
// If a scheme is specified then use that instead of the package name.
|
|
66
|
+
scheme: (ref = await (0, _scheme).getSchemesForIosAsync(projectRoot)) == null ? void 0 : ref[0]
|
|
67
|
+
});
|
|
68
|
+
// Install and launch the app binary on a device.
|
|
69
|
+
await (0, _launchApp).launchAppAsync(binaryPath, manager, {
|
|
70
|
+
isSimulator: props.isSimulator,
|
|
71
|
+
device: props.device,
|
|
72
|
+
shouldStartBundler: props.shouldStartBundler
|
|
73
|
+
});
|
|
74
|
+
// Log the location of the JS logs for the device.
|
|
75
|
+
if (props.shouldStartBundler) {
|
|
76
|
+
(0, _hints).logProjectLogsLocation();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function assertPlatform() {
|
|
80
|
+
if (process.platform !== "darwin") {
|
|
81
|
+
Log.exit(_chalk.default`iOS apps can only be built on macOS devices. Use {cyan eas build -p ios} to build in the cloud.`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
//# sourceMappingURL=runIosAsync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/run/ios/runIosAsync.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport * as Log from '../../log';\nimport { maybePromptToSyncPodsAsync } from '../../utils/cocoapods';\nimport { profile } from '../../utils/profile';\nimport { getSchemesForIosAsync } from '../../utils/scheme';\nimport { ensureNativeProjectAsync } from '../ensureNativeProject';\nimport { logProjectLogsLocation } from '../hints';\nimport { startBundlerAsync } from '../startBundler';\nimport * as XcodeBuild from './XcodeBuild';\nimport { Options } from './XcodeBuild.types';\nimport { launchAppAsync } from './launchApp';\nimport { resolveOptionsAsync } from './options/resolveOptions';\n\nexport async function runIosAsync(projectRoot: string, options: Options) {\n assertPlatform();\n\n const install = !!options.install;\n\n if ((await ensureNativeProjectAsync(projectRoot, { platform: 'ios', install })) && install) {\n await maybePromptToSyncPodsAsync(projectRoot);\n }\n\n // Resolve the CLI arguments into useable options.\n const props = await resolveOptionsAsync(projectRoot, options);\n\n // Spawn the `xcodebuild` process to create the app binary.\n const buildOutput = await XcodeBuild.buildAsync(props);\n\n // Find the path to the built app binary, this will be used to install the binary\n // on a device.\n const binaryPath = await profile(XcodeBuild.getAppBinaryPath)(buildOutput);\n\n // Start the dev server which creates all of the required info for\n // launching the app on a simulator.\n const manager = await startBundlerAsync(projectRoot, {\n port: props.port,\n headless: !props.shouldStartBundler,\n // If a scheme is specified then use that instead of the package name.\n scheme: (await getSchemesForIosAsync(projectRoot))?.[0],\n });\n\n // Install and launch the app binary on a device.\n await launchAppAsync(binaryPath, manager, {\n isSimulator: props.isSimulator,\n device: props.device,\n shouldStartBundler: props.shouldStartBundler,\n });\n\n // Log the location of the JS logs for the device.\n if (props.shouldStartBundler) {\n logProjectLogsLocation();\n }\n}\n\nfunction assertPlatform() {\n if (process.platform !== 'darwin') {\n Log.exit(\n chalk`iOS apps can only be built on macOS devices. Use {cyan eas build -p ios} to build in the cloud.`\n );\n }\n}\n"],"names":["runIosAsync","Log","XcodeBuild","projectRoot","options","assertPlatform","install","ensureNativeProjectAsync","platform","maybePromptToSyncPodsAsync","props","resolveOptionsAsync","buildOutput","buildAsync","binaryPath","profile","getAppBinaryPath","manager","startBundlerAsync","port","headless","shouldStartBundler","scheme","getSchemesForIosAsync","launchAppAsync","isSimulator","device","logProjectLogsLocation","process","exit","chalk"],"mappings":"AAAA;;;;QAcsBA,WAAW,GAAXA,WAAW;AAdf,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEbC,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AAC4B,IAAA,UAAuB,WAAvB,uBAAuB,CAAA;AAC1C,IAAA,QAAqB,WAArB,qBAAqB,CAAA;AACP,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AACjB,IAAA,oBAAwB,WAAxB,wBAAwB,CAAA;AAC1B,IAAA,MAAU,WAAV,UAAU,CAAA;AACf,IAAA,aAAiB,WAAjB,iBAAiB,CAAA;AACvCC,IAAAA,UAAU,mCAAM,cAAc,EAApB;AAES,IAAA,UAAa,WAAb,aAAa,CAAA;AACR,IAAA,eAA0B,WAA1B,0BAA0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AC;IAEH,iDAAiD;IACjD,MAAMqB,CAAAA,GAAAA,UAAc,AAIlB,CAAA,eAJkB,CAACV,UAAU,EAAEG,OAAO,EAAE;QACxCQ,WAAW,EAAEf,KAAK,CAACe,WAAW;QAC9BC,MAAM,EAAEhB,KAAK,CAACgB,MAAM;QACpBL,kBAAkB,EAAEX,KAAK,CAACW,kBAAkB;KAC7C,CAAC,CAAC;IAEH,kDAAkD;IAClD,IAAIX,KAAK,CAACW,kBAAkB,EAAE;QAC5BM,CAAAA,GAAAA,MAAsB,AAAE,CAAA,uBAAF,EAAE,CAAC;KAC1B;CACF;AAED,SAAStB,cAAc,GAAG;IACxB,IAAIuB,OAAO,CAACpB,QAAQ,KAAK,QAAQ,EAAE;QACjCP,GAAG,CAAC4B,IAAI,CACNC,MAAK,QAAA,CAAC,+FAA+F,CAAC,CACvG,CAAC;KACH;CACF"}
|
|
@@ -3,27 +3,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.resolveBundlerPropsAsync = resolveBundlerPropsAsync;
|
|
6
|
+
var _log = require("../log");
|
|
6
7
|
var _errors = require("../utils/errors");
|
|
7
8
|
var _port = require("../utils/port");
|
|
8
9
|
async function resolveBundlerPropsAsync(projectRoot, options) {
|
|
9
|
-
|
|
10
|
+
var _bundler;
|
|
11
|
+
options.bundler = (_bundler = options.bundler) != null ? _bundler : true;
|
|
10
12
|
if (// If the user disables the bundler then they should not pass in the port property.
|
|
11
|
-
|
|
13
|
+
!options.bundler && options.port) {
|
|
12
14
|
throw new _errors.CommandError("BAD_ARGS", "--port and --no-bundler are mutually exclusive arguments");
|
|
13
15
|
}
|
|
14
16
|
// Resolve the port if the bundler is used.
|
|
15
|
-
let port =
|
|
17
|
+
let port = options.bundler ? await (0, _port).resolvePortAsync(projectRoot, {
|
|
16
18
|
reuseExistingPort: true,
|
|
17
19
|
defaultPort: options.port
|
|
18
|
-
});
|
|
19
|
-
// Skip bundling if the port is null
|
|
20
|
+
}) : null;
|
|
21
|
+
// Skip bundling if the port is null -- meaning skip the bundler if the port is already running the app.
|
|
20
22
|
options.bundler = !!port;
|
|
21
23
|
if (!port) {
|
|
22
24
|
// any random number
|
|
23
25
|
port = 8081;
|
|
24
26
|
}
|
|
27
|
+
_log.Log.debug(`Resolved port: ${port}, start dev server: ${options.bundler}`);
|
|
25
28
|
return {
|
|
26
|
-
shouldStartBundler:
|
|
29
|
+
shouldStartBundler: !!options.bundler,
|
|
27
30
|
port
|
|
28
31
|
};
|
|
29
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/run/resolveBundlerProps.ts"],"sourcesContent":["import { CommandError } from '../utils/errors';\nimport { resolvePortAsync } from '../utils/port';\n\nexport interface BundlerProps {\n port: number;\n shouldStartBundler: boolean;\n}\n\nexport async function resolveBundlerPropsAsync(\n projectRoot: string,\n options: {\n port?: number;\n bundler?: boolean;\n }\n): Promise<BundlerProps> {\n
|
|
1
|
+
{"version":3,"sources":["../../../src/run/resolveBundlerProps.ts"],"sourcesContent":["import { Log } from '../log';\nimport { CommandError } from '../utils/errors';\nimport { resolvePortAsync } from '../utils/port';\n\nexport interface BundlerProps {\n /** Port to start the dev server on. */\n port: number;\n /** Skip opening the bundler from the native script. */\n shouldStartBundler: boolean;\n}\n\nexport async function resolveBundlerPropsAsync(\n projectRoot: string,\n options: {\n port?: number;\n bundler?: boolean;\n }\n): Promise<BundlerProps> {\n options.bundler = options.bundler ?? true;\n\n if (\n // If the user disables the bundler then they should not pass in the port property.\n !options.bundler &&\n options.port\n ) {\n throw new CommandError('BAD_ARGS', '--port and --no-bundler are mutually exclusive arguments');\n }\n\n // Resolve the port if the bundler is used.\n let port = options.bundler\n ? await resolvePortAsync(projectRoot, { reuseExistingPort: true, defaultPort: options.port })\n : null;\n\n // Skip bundling if the port is null -- meaning skip the bundler if the port is already running the app.\n options.bundler = !!port;\n if (!port) {\n // any random number\n port = 8081;\n }\n Log.debug(`Resolved port: ${port}, start dev server: ${options.bundler}`);\n\n return {\n shouldStartBundler: !!options.bundler,\n port,\n };\n}\n"],"names":["resolveBundlerPropsAsync","projectRoot","options","bundler","port","CommandError","resolvePortAsync","reuseExistingPort","defaultPort","Log","debug","shouldStartBundler"],"mappings":"AAAA;;;;QAWsBA,wBAAwB,GAAxBA,wBAAwB;AAX1B,IAAA,IAAQ,WAAR,QAAQ,CAAA;AACC,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;AACb,IAAA,KAAe,WAAf,eAAe,CAAA;AASzC,eAAeA,wBAAwB,CAC5CC,WAAmB,EACnBC,OAGC,EACsB;QACLA,QAAe;IAAjCA,OAAO,CAACC,OAAO,GAAGD,CAAAA,QAAe,GAAfA,OAAO,CAACC,OAAO,YAAfD,QAAe,GAAI,IAAI,CAAC;IAE1C,IACE,mFAAmF;IACnF,CAACA,OAAO,CAACC,OAAO,IAChBD,OAAO,CAACE,IAAI,EACZ;QACA,MAAM,IAAIC,OAAY,aAAA,CAAC,UAAU,EAAE,0DAA0D,CAAC,CAAC;KAChG;IAED,2CAA2C;IAC3C,IAAID,IAAI,GAAGF,OAAO,CAACC,OAAO,GACtB,MAAMG,CAAAA,GAAAA,KAAgB,AAAqE,CAAA,iBAArE,CAACL,WAAW,EAAE;QAAEM,iBAAiB,EAAE,IAAI;QAAEC,WAAW,EAAEN,OAAO,CAACE,IAAI;KAAE,CAAC,GAC3F,IAAI,AAAC;IAET,wGAAwG;IACxGF,OAAO,CAACC,OAAO,GAAG,CAAC,CAACC,IAAI,CAAC;IACzB,IAAI,CAACA,IAAI,EAAE;QACT,oBAAoB;QACpBA,IAAI,GAAG,IAAI,CAAC;KACb;IACDK,IAAG,IAAA,CAACC,KAAK,CAAC,CAAC,eAAe,EAAEN,IAAI,CAAC,oBAAoB,EAAEF,OAAO,CAACC,OAAO,CAAC,CAAC,CAAC,CAAC;IAE1E,OAAO;QACLQ,kBAAkB,EAAE,CAAC,CAACT,OAAO,CAACC,OAAO;QACrCC,IAAI;KACL,CAAC;CACH"}
|
|
@@ -35,12 +35,14 @@ function _interopRequireWildcard(obj) {
|
|
|
35
35
|
return newObj;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
async function startBundlerAsync(projectRoot, { port , headless }) {
|
|
38
|
+
async function startBundlerAsync(projectRoot, { port , headless , scheme }) {
|
|
39
39
|
const options = {
|
|
40
40
|
port,
|
|
41
41
|
headless,
|
|
42
42
|
devClient: true,
|
|
43
|
-
location: {
|
|
43
|
+
location: {
|
|
44
|
+
scheme
|
|
45
|
+
}
|
|
44
46
|
};
|
|
45
47
|
const devServerManager = new _devServerManager.DevServerManager(projectRoot, options);
|
|
46
48
|
await devServerManager.startAsync([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/run/startBundler.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport chalk from 'chalk';\n\nimport * as Log from '../log';\nimport { startInterfaceAsync } from '../start/interface/startInterface';\nimport { DevServerManager } from '../start/server/DevServerManager';\nimport { env } from '../utils/env';\n\nexport async function startBundlerAsync(\n projectRoot: string,\n {\n port,\n headless,\n }: {\n port: number;\n headless?: boolean;\n }\n): Promise<DevServerManager> {\n const options = {\n port,\n headless,\n devClient: true,\n location: {},\n };\n\n const devServerManager = new DevServerManager(projectRoot, options);\n\n await devServerManager.startAsync([\n {\n // TODO: Allow swapping this value for another bundler.\n type: 'metro',\n options,\n },\n ]);\n\n // Present the Terminal UI.\n if (!headless && !env.CI) {\n // Only read the config if we are going to use the results.\n const { exp } = getConfig(projectRoot, {\n // We don't need very many fields here, just use the lightest possible read.\n skipSDKVersionRequirement: true,\n skipPlugins: true,\n });\n await startInterfaceAsync(devServerManager, {\n platforms: exp.platforms ?? [],\n });\n } else {\n // Display the server location in CI...\n const url = devServerManager.getDefaultDevServer()?.getDevServerUrl();\n if (url) {\n Log.log(chalk`Waiting on {underline ${url}}`);\n }\n }\n return devServerManager;\n}\n"],"names":["startBundlerAsync","Log","projectRoot","port","headless","options","devClient","location","devServerManager","DevServerManager","startAsync","type","env","CI","exp","getConfig","skipSDKVersionRequirement","skipPlugins","startInterfaceAsync","platforms","url","getDefaultDevServer","getDevServerUrl","log","chalk"],"mappings":"AAAA;;;;QAQsBA,iBAAiB,GAAjBA,iBAAiB;AARb,IAAA,OAAc,WAAd,cAAc,CAAA;AACtB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEbC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACqB,IAAA,eAAmC,WAAnC,mCAAmC,CAAA;AACtC,IAAA,iBAAkC,WAAlC,kCAAkC,CAAA;AAC/C,IAAA,IAAc,WAAd,cAAc,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3B,eAAeD,iBAAiB,CACrCE,WAAmB,EACnB,EACEC,IAAI,CAAA,EACJC,QAAQ,CAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/run/startBundler.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport chalk from 'chalk';\n\nimport * as Log from '../log';\nimport { startInterfaceAsync } from '../start/interface/startInterface';\nimport { DevServerManager } from '../start/server/DevServerManager';\nimport { env } from '../utils/env';\n\nexport async function startBundlerAsync(\n projectRoot: string,\n {\n port,\n headless,\n scheme,\n }: {\n port: number;\n headless?: boolean;\n scheme?: string;\n }\n): Promise<DevServerManager> {\n const options = {\n port,\n headless,\n devClient: true,\n\n location: {\n scheme,\n },\n };\n\n const devServerManager = new DevServerManager(projectRoot, options);\n\n await devServerManager.startAsync([\n {\n // TODO: Allow swapping this value for another bundler.\n type: 'metro',\n options,\n },\n ]);\n\n // Present the Terminal UI.\n if (!headless && !env.CI) {\n // Only read the config if we are going to use the results.\n const { exp } = getConfig(projectRoot, {\n // We don't need very many fields here, just use the lightest possible read.\n skipSDKVersionRequirement: true,\n skipPlugins: true,\n });\n await startInterfaceAsync(devServerManager, {\n platforms: exp.platforms ?? [],\n });\n } else {\n // Display the server location in CI...\n const url = devServerManager.getDefaultDevServer()?.getDevServerUrl();\n if (url) {\n Log.log(chalk`Waiting on {underline ${url}}`);\n }\n }\n return devServerManager;\n}\n"],"names":["startBundlerAsync","Log","projectRoot","port","headless","scheme","options","devClient","location","devServerManager","DevServerManager","startAsync","type","env","CI","exp","getConfig","skipSDKVersionRequirement","skipPlugins","startInterfaceAsync","platforms","url","getDefaultDevServer","getDevServerUrl","log","chalk"],"mappings":"AAAA;;;;QAQsBA,iBAAiB,GAAjBA,iBAAiB;AARb,IAAA,OAAc,WAAd,cAAc,CAAA;AACtB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEbC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACqB,IAAA,eAAmC,WAAnC,mCAAmC,CAAA;AACtC,IAAA,iBAAkC,WAAlC,kCAAkC,CAAA;AAC/C,IAAA,IAAc,WAAd,cAAc,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3B,eAAeD,iBAAiB,CACrCE,WAAmB,EACnB,EACEC,IAAI,CAAA,EACJC,QAAQ,CAAA,EACRC,MAAM,CAAA,EAKP,EAC0B;IAC3B,MAAMC,OAAO,GAAG;QACdH,IAAI;QACJC,QAAQ;QACRG,SAAS,EAAE,IAAI;QAEfC,QAAQ,EAAE;YACRH,MAAM;SACP;KACF,AAAC;IAEF,MAAMI,gBAAgB,GAAG,IAAIC,iBAAgB,iBAAA,CAACR,WAAW,EAAEI,OAAO,CAAC,AAAC;IAEpE,MAAMG,gBAAgB,CAACE,UAAU,CAAC;QAChC;YACE,uDAAuD;YACvDC,IAAI,EAAE,OAAO;YACbN,OAAO;SACR;KACF,CAAC,CAAC;IAEH,2BAA2B;IAC3B,IAAI,CAACF,QAAQ,IAAI,CAACS,IAAG,IAAA,CAACC,EAAE,EAAE;QACxB,2DAA2D;QAC3D,MAAM,EAAEC,GAAG,CAAA,EAAE,GAAGC,CAAAA,GAAAA,OAAS,AAIvB,CAAA,UAJuB,CAACd,WAAW,EAAE;YACrC,4EAA4E;YAC5Ee,yBAAyB,EAAE,IAAI;YAC/BC,WAAW,EAAE,IAAI;SAClB,CAAC,AAAC;YAEUH,UAAa;QAD1B,MAAMI,CAAAA,GAAAA,eAAmB,AAEvB,CAAA,oBAFuB,CAACV,gBAAgB,EAAE;YAC1CW,SAAS,EAAEL,CAAAA,UAAa,GAAbA,GAAG,CAACK,SAAS,YAAbL,UAAa,GAAI,EAAE;SAC/B,CAAC,CAAC;KACJ,MAAM;YAEON,GAAsC;QADlD,uCAAuC;QACvC,MAAMY,GAAG,GAAGZ,CAAAA,GAAsC,GAAtCA,gBAAgB,CAACa,mBAAmB,EAAE,SAAiB,GAAvDb,KAAAA,CAAuD,GAAvDA,GAAsC,CAAEc,eAAe,EAAE,AAAC;QACtE,IAAIF,GAAG,EAAE;YACPpB,GAAG,CAACuB,GAAG,CAACC,MAAK,QAAA,CAAC,sBAAsB,EAAEJ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SAC/C;KACF;IACD,OAAOZ,gBAAgB,CAAC;CACzB"}
|
|
@@ -14,16 +14,16 @@ class Prerequisite {
|
|
|
14
14
|
constructor(){
|
|
15
15
|
this._assertAsync = (0, _fn).memoize(this.assertImplementation.bind(this));
|
|
16
16
|
}
|
|
17
|
-
/** Reset the assertion memo and warning message. */ resetAssertion() {
|
|
17
|
+
/** Reset the assertion memo and warning message. */ resetAssertion(props) {
|
|
18
18
|
this.cachedError = undefined;
|
|
19
19
|
this._assertAsync = (0, _fn).memoize(this.assertImplementation.bind(this));
|
|
20
20
|
}
|
|
21
|
-
async assertAsync() {
|
|
21
|
+
async assertAsync(props) {
|
|
22
22
|
if (this.cachedError) {
|
|
23
23
|
throw this.cachedError;
|
|
24
24
|
}
|
|
25
25
|
try {
|
|
26
|
-
return await this._assertAsync();
|
|
26
|
+
return await this._assertAsync(props);
|
|
27
27
|
} catch (error) {
|
|
28
28
|
if (error instanceof PrerequisiteCommandError) {
|
|
29
29
|
this.cachedError = error;
|
|
@@ -31,7 +31,7 @@ class Prerequisite {
|
|
|
31
31
|
throw error;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
/** Exposed for testing. */ async assertImplementation() {
|
|
34
|
+
/** Exposed for testing. */ async assertImplementation(props) {
|
|
35
35
|
throw new _errors.UnimplementedError();
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/doctor/Prerequisite.ts"],"sourcesContent":["import { CommandError, UnimplementedError } from '../../utils/errors';\nimport { memoize } from '../../utils/fn';\n\n/** An error that is memoized and asserted whenever a Prerequisite.assertAsync is subsequently called. */\nexport class PrerequisiteCommandError extends CommandError {\n constructor(code: string, message: string = '') {\n super(message ? 'VALIDATE_' + code : code, message);\n }\n}\n\nexport class Prerequisite {\n /** Memoized results of `assertImplementation` */\n private _assertAsync: () => Promise<
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/doctor/Prerequisite.ts"],"sourcesContent":["import { CommandError, UnimplementedError } from '../../utils/errors';\nimport { memoize } from '../../utils/fn';\n\n/** An error that is memoized and asserted whenever a Prerequisite.assertAsync is subsequently called. */\nexport class PrerequisiteCommandError extends CommandError {\n constructor(code: string, message: string = '') {\n super(message ? 'VALIDATE_' + code : code, message);\n }\n}\n\nexport class Prerequisite<T = void, TProps = void> {\n /** Memoized results of `assertImplementation` */\n private _assertAsync: (props: TProps) => Promise<T>;\n\n constructor() {\n this._assertAsync = memoize(this.assertImplementation.bind(this));\n }\n\n /** An optional warning to call before running the memoized assertion. */\n protected cachedError?: PrerequisiteCommandError;\n\n /** Reset the assertion memo and warning message. */\n public resetAssertion(props: TProps) {\n this.cachedError = undefined;\n this._assertAsync = memoize(this.assertImplementation.bind(this));\n }\n\n async assertAsync(props: TProps): Promise<T> {\n if (this.cachedError) {\n throw this.cachedError;\n }\n try {\n return await this._assertAsync(props);\n } catch (error) {\n if (error instanceof PrerequisiteCommandError) {\n this.cachedError = error;\n }\n throw error;\n }\n }\n\n /** Exposed for testing. */\n async assertImplementation(props: TProps): Promise<T> {\n throw new UnimplementedError();\n }\n}\n\n/** A prerequisite that is project specific. */\nexport class ProjectPrerequisite extends Prerequisite {\n constructor(protected projectRoot: string) {\n super();\n }\n}\n"],"names":["PrerequisiteCommandError","CommandError","constructor","code","message","Prerequisite","_assertAsync","memoize","assertImplementation","bind","resetAssertion","props","cachedError","undefined","assertAsync","error","UnimplementedError","ProjectPrerequisite","projectRoot"],"mappings":"AAAA;;;;AAAiD,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AAC7C,IAAA,GAAgB,WAAhB,gBAAgB,CAAA;AAGjC,MAAMA,wBAAwB,SAASC,OAAY,aAAA;IACxDC,YAAYC,IAAY,EAAEC,OAAe,GAAG,EAAE,CAAE;QAC9C,KAAK,CAACA,OAAO,GAAG,WAAW,GAAGD,IAAI,GAAGA,IAAI,EAAEC,OAAO,CAAC,CAAC;KACrD;CACF;QAJYJ,wBAAwB,GAAxBA,wBAAwB;AAM9B,MAAMK,YAAY;IAIvBH,aAAc;QACZ,IAAI,CAACI,YAAY,GAAGC,CAAAA,GAAAA,GAAO,AAAsC,CAAA,QAAtC,CAAC,IAAI,CAACC,oBAAoB,CAACC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;KACnE;IAKD,oDAAoD,CACpD,AAAOC,cAAc,CAACC,KAAa,EAAE;QACnC,IAAI,CAACC,WAAW,GAAGC,SAAS,CAAC;QAC7B,IAAI,CAACP,YAAY,GAAGC,CAAAA,GAAAA,GAAO,AAAsC,CAAA,QAAtC,CAAC,IAAI,CAACC,oBAAoB,CAACC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;KACnE;IAED,MAAMK,WAAW,CAACH,KAAa,EAAc;QAC3C,IAAI,IAAI,CAACC,WAAW,EAAE;YACpB,MAAM,IAAI,CAACA,WAAW,CAAC;SACxB;QACD,IAAI;YACF,OAAO,MAAM,IAAI,CAACN,YAAY,CAACK,KAAK,CAAC,CAAC;SACvC,CAAC,OAAOI,KAAK,EAAE;YACd,IAAIA,KAAK,YAAYf,wBAAwB,EAAE;gBAC7C,IAAI,CAACY,WAAW,GAAGG,KAAK,CAAC;aAC1B;YACD,MAAMA,KAAK,CAAC;SACb;KACF;IAED,2BAA2B,CAC3B,MAAMP,oBAAoB,CAACG,KAAa,EAAc;QACpD,MAAM,IAAIK,OAAkB,mBAAA,EAAE,CAAC;KAChC;CACF;QAnCYX,YAAY,GAAZA,YAAY;AAsClB,MAAMY,mBAAmB,SAASZ,YAAY;IACnDH,YAAsBgB,WAAmB,CAAE;QACzC,KAAK,EAAE,CAAC;aADYA,WAAmB,GAAnBA,WAAmB;KAExC;CACF;QAJYD,mBAAmB,GAAnBA,mBAAmB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
var _spawnAsync = _interopRequireDefault(require("@expo/spawn-async"));
|
|
6
|
+
var _prerequisite = require("./Prerequisite");
|
|
7
|
+
function _interopRequireDefault(obj) {
|
|
8
|
+
return obj && obj.__esModule ? obj : {
|
|
9
|
+
default: obj
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
class SecurityBinPrerequisite extends _prerequisite.Prerequisite {
|
|
13
|
+
static instance = new SecurityBinPrerequisite();
|
|
14
|
+
async assertImplementation() {
|
|
15
|
+
try {
|
|
16
|
+
// make sure we can run security
|
|
17
|
+
await (0, _spawnAsync).default("which", [
|
|
18
|
+
"security"
|
|
19
|
+
]);
|
|
20
|
+
} catch {
|
|
21
|
+
throw new _prerequisite.PrerequisiteCommandError("SECURITY_BIN", "Cannot code sign project because the CLI `security` is not available on your computer.\nPlease ensure it's installed and try again.");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.SecurityBinPrerequisite = SecurityBinPrerequisite;
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=SecurityBinPrerequisite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/doctor/SecurityBinPrerequisite.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\n\nimport { Prerequisite, PrerequisiteCommandError } from './Prerequisite';\n\nexport class SecurityBinPrerequisite extends Prerequisite {\n static instance = new SecurityBinPrerequisite();\n\n async assertImplementation(): Promise<void> {\n try {\n // make sure we can run security\n await spawnAsync('which', ['security']);\n } catch {\n throw new PrerequisiteCommandError(\n 'SECURITY_BIN',\n \"Cannot code sign project because the CLI `security` is not available on your computer.\\nPlease ensure it's installed and try again.\"\n );\n }\n }\n}\n"],"names":["SecurityBinPrerequisite","Prerequisite","instance","assertImplementation","spawnAsync","PrerequisiteCommandError"],"mappings":"AAAA;;;;AAAuB,IAAA,WAAmB,kCAAnB,mBAAmB,EAAA;AAEa,IAAA,aAAgB,WAAhB,gBAAgB,CAAA;;;;;;AAEhE,MAAMA,uBAAuB,SAASC,aAAY,aAAA;IACvD,OAAOC,QAAQ,GAAG,IAAIF,uBAAuB,EAAE,CAAC;IAEhD,MAAMG,oBAAoB,GAAkB;QAC1C,IAAI;YACF,gCAAgC;YAChC,MAAMC,CAAAA,GAAAA,WAAU,AAAuB,CAAA,QAAvB,CAAC,OAAO,EAAE;gBAAC,UAAU;aAAC,CAAC,CAAC;SACzC,CAAC,OAAM;YACN,MAAM,IAAIC,aAAwB,yBAAA,CAChC,cAAc,EACd,qIAAqI,CACtI,CAAC;SACH;KACF;CACF;QAdYL,uBAAuB,GAAvBA,uBAAuB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
var _spawnAsync = _interopRequireDefault(require("@expo/spawn-async"));
|
|
6
|
+
var _promises = _interopRequireDefault(require("fs/promises"));
|
|
7
|
+
var Log = _interopRequireWildcard(require("../../../log"));
|
|
8
|
+
var _prerequisite = require("../Prerequisite");
|
|
9
|
+
function _interopRequireDefault(obj) {
|
|
10
|
+
return obj && obj.__esModule ? obj : {
|
|
11
|
+
default: obj
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function _interopRequireWildcard(obj) {
|
|
15
|
+
if (obj && obj.__esModule) {
|
|
16
|
+
return obj;
|
|
17
|
+
} else {
|
|
18
|
+
var newObj = {};
|
|
19
|
+
if (obj != null) {
|
|
20
|
+
for(var key in obj){
|
|
21
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
22
|
+
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
|
23
|
+
if (desc.get || desc.set) {
|
|
24
|
+
Object.defineProperty(newObj, key, desc);
|
|
25
|
+
} else {
|
|
26
|
+
newObj[key] = obj[key];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
newObj.default = obj;
|
|
32
|
+
return newObj;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const ERROR_CODE = "XCODE_DEVELOPER_DISK_IMAGE";
|
|
36
|
+
async function getXcodePathAsync() {
|
|
37
|
+
try {
|
|
38
|
+
const { stdout } = await (0, _spawnAsync).default("xcode-select", [
|
|
39
|
+
"-p"
|
|
40
|
+
]);
|
|
41
|
+
if (stdout) {
|
|
42
|
+
return stdout.trim();
|
|
43
|
+
}
|
|
44
|
+
} catch (error) {
|
|
45
|
+
Log.debug(`Could not find Xcode path: %O`, error);
|
|
46
|
+
}
|
|
47
|
+
throw new _prerequisite.PrerequisiteCommandError(ERROR_CODE, "Unable to locate Xcode.");
|
|
48
|
+
}
|
|
49
|
+
class XcodeDeveloperDiskImagePrerequisite extends _prerequisite.Prerequisite {
|
|
50
|
+
static instance = new XcodeDeveloperDiskImagePrerequisite();
|
|
51
|
+
async assertImplementation({ version }) {
|
|
52
|
+
const xcodePath = await getXcodePathAsync();
|
|
53
|
+
// Like "11.2 (15C107)"
|
|
54
|
+
const versions = await _promises.default.readdir(`${xcodePath}/Platforms/iPhoneOS.platform/DeviceSupport/`);
|
|
55
|
+
const prefix = version.match(/\d+\.\d+/);
|
|
56
|
+
if (prefix === null) {
|
|
57
|
+
throw new _prerequisite.PrerequisiteCommandError(ERROR_CODE, `Invalid iOS version: ${version}`);
|
|
58
|
+
}
|
|
59
|
+
for (const directory of versions){
|
|
60
|
+
if (directory.includes(prefix[0])) {
|
|
61
|
+
return `${xcodePath}/Platforms/iPhoneOS.platform/DeviceSupport/${directory}/DeveloperDiskImage.dmg`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
throw new _prerequisite.PrerequisiteCommandError(ERROR_CODE, `Unable to find Developer Disk Image path for SDK ${version}.`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.XcodeDeveloperDiskImagePrerequisite = XcodeDeveloperDiskImagePrerequisite;
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=XcodeDeveloperDiskImagePrerequisite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/doctor/apple/XcodeDeveloperDiskImagePrerequisite.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport fs from 'fs/promises';\n\nimport * as Log from '../../../log';\nimport { Prerequisite, PrerequisiteCommandError } from '../Prerequisite';\n\nconst ERROR_CODE = 'XCODE_DEVELOPER_DISK_IMAGE';\nasync function getXcodePathAsync(): Promise<string> {\n try {\n const { stdout } = await spawnAsync('xcode-select', ['-p']);\n if (stdout) {\n return stdout.trim();\n }\n } catch (error: any) {\n Log.debug(`Could not find Xcode path: %O`, error);\n }\n throw new PrerequisiteCommandError(ERROR_CODE, 'Unable to locate Xcode.');\n}\n\nexport class XcodeDeveloperDiskImagePrerequisite extends Prerequisite<string, { version: string }> {\n static instance = new XcodeDeveloperDiskImagePrerequisite();\n\n async assertImplementation({ version }: { version: string }): Promise<string> {\n const xcodePath = await getXcodePathAsync();\n // Like \"11.2 (15C107)\"\n const versions = await fs.readdir(`${xcodePath}/Platforms/iPhoneOS.platform/DeviceSupport/`);\n const prefix = version.match(/\\d+\\.\\d+/);\n if (prefix === null) {\n throw new PrerequisiteCommandError(ERROR_CODE, `Invalid iOS version: ${version}`);\n }\n for (const directory of versions) {\n if (directory.includes(prefix[0])) {\n return `${xcodePath}/Platforms/iPhoneOS.platform/DeviceSupport/${directory}/DeveloperDiskImage.dmg`;\n }\n }\n throw new PrerequisiteCommandError(\n ERROR_CODE,\n `Unable to find Developer Disk Image path for SDK ${version}.`\n );\n }\n}\n"],"names":["Log","ERROR_CODE","getXcodePathAsync","stdout","spawnAsync","trim","error","debug","PrerequisiteCommandError","XcodeDeveloperDiskImagePrerequisite","Prerequisite","instance","assertImplementation","version","xcodePath","versions","fs","readdir","prefix","match","directory","includes"],"mappings":"AAAA;;;;AAAuB,IAAA,WAAmB,kCAAnB,mBAAmB,EAAA;AAC3B,IAAA,SAAa,kCAAb,aAAa,EAAA;AAEhBA,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACwC,IAAA,aAAiB,WAAjB,iBAAiB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExE,MAAMC,UAAU,GAAG,4BAA4B,AAAC;AAChD,eAAeC,iBAAiB,GAAoB;IAClD,IAAI;QACF,MAAM,EAAEC,MAAM,CAAA,EAAE,GAAG,MAAMC,CAAAA,GAAAA,WAAU,AAAwB,CAAA,QAAxB,CAAC,cAAc,EAAE;YAAC,IAAI;SAAC,CAAC,AAAC;QAC5D,IAAID,MAAM,EAAE;YACV,OAAOA,MAAM,CAACE,IAAI,EAAE,CAAC;SACtB;KACF,CAAC,OAAOC,KAAK,EAAO;QACnBN,GAAG,CAACO,KAAK,CAAC,CAAC,6BAA6B,CAAC,EAAED,KAAK,CAAC,CAAC;KACnD;IACD,MAAM,IAAIE,aAAwB,yBAAA,CAACP,UAAU,EAAE,yBAAyB,CAAC,CAAC;CAC3E;AAEM,MAAMQ,mCAAmC,SAASC,aAAY,aAAA;IACnE,OAAOC,QAAQ,GAAG,IAAIF,mCAAmC,EAAE,CAAC;IAE5D,MAAMG,oBAAoB,CAAC,EAAEC,OAAO,CAAA,EAAuB,EAAmB;QAC5E,MAAMC,SAAS,GAAG,MAAMZ,iBAAiB,EAAE,AAAC;QAC5C,uBAAuB;QACvB,MAAMa,QAAQ,GAAG,MAAMC,SAAE,QAAA,CAACC,OAAO,CAAC,CAAC,EAAEH,SAAS,CAAC,2CAA2C,CAAC,CAAC,AAAC;QAC7F,MAAMI,MAAM,GAAGL,OAAO,CAACM,KAAK,YAAY,AAAC;QACzC,IAAID,MAAM,KAAK,IAAI,EAAE;YACnB,MAAM,IAAIV,aAAwB,yBAAA,CAACP,UAAU,EAAE,CAAC,qBAAqB,EAAEY,OAAO,CAAC,CAAC,CAAC,CAAC;SACnF;QACD,KAAK,MAAMO,SAAS,IAAIL,QAAQ,CAAE;YAChC,IAAIK,SAAS,CAACC,QAAQ,CAACH,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;gBACjC,OAAO,CAAC,EAAEJ,SAAS,CAAC,2CAA2C,EAAEM,SAAS,CAAC,uBAAuB,CAAC,CAAC;aACrG;SACF;QACD,MAAM,IAAIZ,aAAwB,yBAAA,CAChCP,UAAU,EACV,CAAC,iDAAiD,EAAEY,OAAO,CAAC,CAAC,CAAC,CAC/D,CAAC;KACH;CACF;QArBYJ,mCAAmC,GAAnCA,mCAAmC"}
|
|
@@ -11,6 +11,8 @@ var _chalk = _interopRequireDefault(require("chalk"));
|
|
|
11
11
|
var _childProcess = require("child_process");
|
|
12
12
|
var _os = _interopRequireDefault(require("os"));
|
|
13
13
|
var Log = _interopRequireWildcard(require("../../../log"));
|
|
14
|
+
var _errors = require("../../../utils/errors");
|
|
15
|
+
var _exit = require("../../../utils/exit");
|
|
14
16
|
var _adb = require("./adb");
|
|
15
17
|
function _interopRequireDefault(obj) {
|
|
16
18
|
return obj && obj.__esModule ? obj : {
|
|
@@ -101,11 +103,17 @@ async function startDeviceAsync(device, { timeout =EMULATOR_MAX_WAIT_TIMEOUT , i
|
|
|
101
103
|
const stopWaiting = ()=>{
|
|
102
104
|
clearTimeout(maxTimer);
|
|
103
105
|
clearInterval(waitTimer);
|
|
106
|
+
removeExitHook();
|
|
104
107
|
};
|
|
105
108
|
const stopWaitingAndReject = (message)=>{
|
|
106
109
|
stopWaiting();
|
|
107
110
|
reject(new Error(message));
|
|
108
111
|
};
|
|
112
|
+
const removeExitHook = (0, _exit).installExitHooks((signal)=>{
|
|
113
|
+
stopWaiting();
|
|
114
|
+
emulatorProcess.kill(signal);
|
|
115
|
+
reject(new _errors.AbortCommandError());
|
|
116
|
+
});
|
|
109
117
|
emulatorProcess.on("error", ({ message })=>stopWaitingAndReject(message)
|
|
110
118
|
);
|
|
111
119
|
emulatorProcess.on("exit", ()=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/android/emulator.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport { spawn } from 'child_process';\nimport os from 'os';\n\nimport * as Log from '../../../log';\nimport { Device, getAttachedDevicesAsync, isBootAnimationCompleteAsync } from './adb';\n\nexport const EMULATOR_MAX_WAIT_TIMEOUT = 60 * 1000 * 3;\n\nexport function whichEmulator(): string {\n // https://developer.android.com/studio/command-line/variables\n // TODO: Add ANDROID_SDK_ROOT support as well https://github.com/expo/expo/pull/16516#discussion_r820037917\n if (process.env.ANDROID_HOME) {\n return `${process.env.ANDROID_HOME}/emulator/emulator`;\n }\n return 'emulator';\n}\n\n/** Returns a list of emulator names. */\nexport async function listAvdsAsync(): Promise<Device[]> {\n try {\n const { stdout } = await spawnAsync(whichEmulator(), ['-list-avds']);\n return stdout\n .split(os.EOL)\n .filter(Boolean)\n .map((name) => ({\n name,\n type: 'emulator',\n // unsure from this\n isBooted: false,\n isAuthorized: true,\n }));\n } catch {\n return [];\n }\n}\n\n/** Start an Android device and wait until it is booted. */\nexport async function startDeviceAsync(\n device: Pick<Device, 'name'>,\n {\n timeout = EMULATOR_MAX_WAIT_TIMEOUT,\n interval = 1000,\n }: {\n /** Time in milliseconds to wait before asserting a timeout error. */\n timeout?: number;\n interval?: number;\n } = {}\n): Promise<Device> {\n Log.log(`\\u203A Opening emulator ${chalk.bold(device.name)}`);\n\n // Start a process to open an emulator\n const emulatorProcess = spawn(\n whichEmulator(),\n [\n `@${device.name}`,\n // disable animation for faster boot -- this might make it harder to detect if it mounted properly tho\n //'-no-boot-anim'\n ],\n {\n stdio: 'ignore',\n detached: true,\n }\n );\n\n emulatorProcess.unref();\n\n return new Promise<Device>((resolve, reject) => {\n const waitTimer = setInterval(async () => {\n try {\n const bootedDevices = await getAttachedDevicesAsync();\n const connected = bootedDevices.find(({ name }) => name === device.name);\n if (connected) {\n const isBooted = await isBootAnimationCompleteAsync(connected.pid);\n if (isBooted) {\n stopWaiting();\n resolve(connected);\n }\n }\n } catch (error) {\n stopWaiting();\n reject(error);\n }\n }, interval);\n\n // Reject command after timeout\n const maxTimer = setTimeout(() => {\n const manualCommand = `${whichEmulator()} @${device.name}`;\n stopWaitingAndReject(\n `It took too long to start the Android emulator: ${device.name}. You can try starting the emulator manually from the terminal with: ${manualCommand}`\n );\n }, timeout);\n\n const stopWaiting = () => {\n clearTimeout(maxTimer);\n clearInterval(waitTimer);\n };\n\n const stopWaitingAndReject = (message: string) => {\n stopWaiting();\n reject(new Error(message));\n };\n\n emulatorProcess.on('error', ({ message }) => stopWaitingAndReject(message));\n\n emulatorProcess.on('exit', () => {\n const manualCommand = `${whichEmulator()} @${device.name}`;\n stopWaitingAndReject(\n `The emulator (${device.name}) quit before it finished opening. You can try starting the emulator manually from the terminal with: ${manualCommand}`\n );\n });\n });\n}\n"],"names":["whichEmulator","listAvdsAsync","startDeviceAsync","Log","EMULATOR_MAX_WAIT_TIMEOUT","process","env","ANDROID_HOME","stdout","spawnAsync","split","os","EOL","filter","Boolean","map","name","type","isBooted","isAuthorized","device","timeout","interval","log","chalk","bold","emulatorProcess","spawn","stdio","detached","unref","Promise","resolve","reject","waitTimer","setInterval","bootedDevices","getAttachedDevicesAsync","connected","find","isBootAnimationCompleteAsync","pid","stopWaiting","error","maxTimer","setTimeout","manualCommand","stopWaitingAndReject","clearTimeout","clearInterval","message","Error","on"],"mappings":"AAAA;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/android/emulator.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport { spawn } from 'child_process';\nimport os from 'os';\n\nimport * as Log from '../../../log';\nimport { AbortCommandError } from '../../../utils/errors';\nimport { installExitHooks } from '../../../utils/exit';\nimport { Device, getAttachedDevicesAsync, isBootAnimationCompleteAsync } from './adb';\n\nexport const EMULATOR_MAX_WAIT_TIMEOUT = 60 * 1000 * 3;\n\nexport function whichEmulator(): string {\n // https://developer.android.com/studio/command-line/variables\n // TODO: Add ANDROID_SDK_ROOT support as well https://github.com/expo/expo/pull/16516#discussion_r820037917\n if (process.env.ANDROID_HOME) {\n return `${process.env.ANDROID_HOME}/emulator/emulator`;\n }\n return 'emulator';\n}\n\n/** Returns a list of emulator names. */\nexport async function listAvdsAsync(): Promise<Device[]> {\n try {\n const { stdout } = await spawnAsync(whichEmulator(), ['-list-avds']);\n return stdout\n .split(os.EOL)\n .filter(Boolean)\n .map((name) => ({\n name,\n type: 'emulator',\n // unsure from this\n isBooted: false,\n isAuthorized: true,\n }));\n } catch {\n return [];\n }\n}\n\n/** Start an Android device and wait until it is booted. */\nexport async function startDeviceAsync(\n device: Pick<Device, 'name'>,\n {\n timeout = EMULATOR_MAX_WAIT_TIMEOUT,\n interval = 1000,\n }: {\n /** Time in milliseconds to wait before asserting a timeout error. */\n timeout?: number;\n interval?: number;\n } = {}\n): Promise<Device> {\n Log.log(`\\u203A Opening emulator ${chalk.bold(device.name)}`);\n\n // Start a process to open an emulator\n const emulatorProcess = spawn(\n whichEmulator(),\n [\n `@${device.name}`,\n // disable animation for faster boot -- this might make it harder to detect if it mounted properly tho\n //'-no-boot-anim'\n ],\n {\n stdio: 'ignore',\n detached: true,\n }\n );\n\n emulatorProcess.unref();\n\n return new Promise<Device>((resolve, reject) => {\n const waitTimer = setInterval(async () => {\n try {\n const bootedDevices = await getAttachedDevicesAsync();\n const connected = bootedDevices.find(({ name }) => name === device.name);\n if (connected) {\n const isBooted = await isBootAnimationCompleteAsync(connected.pid);\n if (isBooted) {\n stopWaiting();\n resolve(connected);\n }\n }\n } catch (error) {\n stopWaiting();\n reject(error);\n }\n }, interval);\n\n // Reject command after timeout\n const maxTimer = setTimeout(() => {\n const manualCommand = `${whichEmulator()} @${device.name}`;\n stopWaitingAndReject(\n `It took too long to start the Android emulator: ${device.name}. You can try starting the emulator manually from the terminal with: ${manualCommand}`\n );\n }, timeout);\n\n const stopWaiting = () => {\n clearTimeout(maxTimer);\n clearInterval(waitTimer);\n removeExitHook();\n };\n\n const stopWaitingAndReject = (message: string) => {\n stopWaiting();\n reject(new Error(message));\n };\n\n const removeExitHook = installExitHooks((signal) => {\n stopWaiting();\n emulatorProcess.kill(signal);\n reject(new AbortCommandError());\n });\n\n emulatorProcess.on('error', ({ message }) => stopWaitingAndReject(message));\n\n emulatorProcess.on('exit', () => {\n const manualCommand = `${whichEmulator()} @${device.name}`;\n stopWaitingAndReject(\n `The emulator (${device.name}) quit before it finished opening. You can try starting the emulator manually from the terminal with: ${manualCommand}`\n );\n });\n });\n}\n"],"names":["whichEmulator","listAvdsAsync","startDeviceAsync","Log","EMULATOR_MAX_WAIT_TIMEOUT","process","env","ANDROID_HOME","stdout","spawnAsync","split","os","EOL","filter","Boolean","map","name","type","isBooted","isAuthorized","device","timeout","interval","log","chalk","bold","emulatorProcess","spawn","stdio","detached","unref","Promise","resolve","reject","waitTimer","setInterval","bootedDevices","getAttachedDevicesAsync","connected","find","isBootAnimationCompleteAsync","pid","stopWaiting","error","maxTimer","setTimeout","manualCommand","stopWaitingAndReject","clearTimeout","clearInterval","removeExitHook","message","Error","installExitHooks","signal","kill","AbortCommandError","on"],"mappings":"AAAA;;;;QAYgBA,aAAa,GAAbA,aAAa;QAUPC,aAAa,GAAbA,aAAa;QAmBbC,gBAAgB,GAAhBA,gBAAgB;;AAzCf,IAAA,WAAmB,kCAAnB,mBAAmB,EAAA;AACxB,IAAA,MAAO,kCAAP,OAAO,EAAA;AACH,IAAA,aAAe,WAAf,eAAe,CAAA;AACtB,IAAA,GAAI,kCAAJ,IAAI,EAAA;AAEPC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACmB,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AACxB,IAAA,KAAqB,WAArB,qBAAqB,CAAA;AACwB,IAAA,IAAO,WAAP,OAAO,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9E,MAAMC,yBAAyB,GAAG,EAAE,GAAG,IAAI,GAAG,CAAC,AAAC;QAA1CA,yBAAyB,GAAzBA,yBAAyB;AAE/B,SAASJ,aAAa,GAAW;IACtC,8DAA8D;IAC9D,2GAA2G;IAC3G,IAAIK,OAAO,CAACC,GAAG,CAACC,YAAY,EAAE;QAC5B,OAAO,CAAC,EAAEF,OAAO,CAACC,GAAG,CAACC,YAAY,CAAC,kBAAkB,CAAC,CAAC;KACxD;IACD,OAAO,UAAU,CAAC;CACnB;AAGM,eAAeN,aAAa,GAAsB;IACvD,IAAI;QACF,MAAM,EAAEO,MAAM,CAAA,EAAE,GAAG,MAAMC,CAAAA,GAAAA,WAAU,AAAiC,CAAA,QAAjC,CAACT,aAAa,EAAE,EAAE;YAAC,YAAY;SAAC,CAAC,AAAC;QACrE,OAAOQ,MAAM,CACVE,KAAK,CAACC,GAAE,QAAA,CAACC,GAAG,CAAC,CACbC,MAAM,CAACC,OAAO,CAAC,CACfC,GAAG,CAAC,CAACC,IAAI,GAAK,CAAC;gBACdA,IAAI;gBACJC,IAAI,EAAE,UAAU;gBAChB,mBAAmB;gBACnBC,QAAQ,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,aAAa,GAAG,CAAC,EAAE9C,aAAa,EAAE,CAAC,EAAE,EAAEoB,MAAM,CAACJ,IAAI,CAAC,CAAC,AAAC;YAC3D+B,oBAAoB,CAClB,CAAC,cAAc,EAAE3B,MAAM,CAACJ,IAAI,CAAC,sGAAsG,EAAE8B,aAAa,CAAC,CAAC,CACrJ,CAAC;SACH,CAAC,CAAC;KACJ,CAAC,CAAC;CACJ"}
|
|
@@ -42,11 +42,7 @@ async function promptForDeviceAsync(devices) {
|
|
|
42
42
|
value: item.name
|
|
43
43
|
};
|
|
44
44
|
}),
|
|
45
|
-
suggest: (
|
|
46
|
-
const regex = new RegExp(input, "i");
|
|
47
|
-
return choices.filter((choice)=>regex.test(choice.title)
|
|
48
|
-
);
|
|
49
|
-
}
|
|
45
|
+
suggest: (0, _prompts).createSelectionFilter()
|
|
50
46
|
});
|
|
51
47
|
const device = devices.find(({ name })=>name === value
|
|
52
48
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/android/promptAndroidDevice.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { AbortCommandError } from '../../../utils/errors';\nimport { promptAsync } from '../../../utils/prompts';\nimport { Device, logUnauthorized } from './adb';\n\nfunction nameStyleForDevice(device: Device): (name: string) => string {\n const isActive = device.isBooted;\n if (!isActive) {\n // Use no style changes for a disconnected device that is available to be opened.\n return (text: string) => text;\n }\n // A device that is connected and ready to be used should be bolded to match iOS.\n if (device.isAuthorized) {\n return chalk.bold;\n }\n // Devices that are unauthorized and connected cannot be used, but they are connected so gray them out.\n return (text: string) => chalk.bold(chalk.gray(text));\n}\n\nexport async function promptForDeviceAsync(devices: Device[]): Promise<Device> {\n // TODO: provide an option to add or download more simulators\n\n const { value } = await promptAsync({\n type: 'autocomplete',\n name: 'value',\n limit: 11,\n message: 'Select a device/emulator',\n choices: devices.map((item) => {\n const format = nameStyleForDevice(item);\n const type = item.isAuthorized ? item.type : 'unauthorized';\n return {\n title: `${format(item.name)} ${chalk.dim(`(${type})`)}`,\n value: item.name,\n };\n }),\n suggest: (
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/android/promptAndroidDevice.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { AbortCommandError } from '../../../utils/errors';\nimport { createSelectionFilter, promptAsync } from '../../../utils/prompts';\nimport { Device, logUnauthorized } from './adb';\n\nfunction nameStyleForDevice(device: Device): (name: string) => string {\n const isActive = device.isBooted;\n if (!isActive) {\n // Use no style changes for a disconnected device that is available to be opened.\n return (text: string) => text;\n }\n // A device that is connected and ready to be used should be bolded to match iOS.\n if (device.isAuthorized) {\n return chalk.bold;\n }\n // Devices that are unauthorized and connected cannot be used, but they are connected so gray them out.\n return (text: string) => chalk.bold(chalk.gray(text));\n}\n\nexport async function promptForDeviceAsync(devices: Device[]): Promise<Device> {\n // TODO: provide an option to add or download more simulators\n\n const { value } = await promptAsync({\n type: 'autocomplete',\n name: 'value',\n limit: 11,\n message: 'Select a device/emulator',\n choices: devices.map((item) => {\n const format = nameStyleForDevice(item);\n const type = item.isAuthorized ? item.type : 'unauthorized';\n return {\n title: `${format(item.name)} ${chalk.dim(`(${type})`)}`,\n value: item.name,\n };\n }),\n suggest: createSelectionFilter(),\n });\n\n const device = devices.find(({ name }) => name === value);\n\n if (device?.isAuthorized === false) {\n logUnauthorized(device);\n throw new AbortCommandError();\n }\n\n return device!;\n}\n"],"names":["promptForDeviceAsync","nameStyleForDevice","device","isActive","isBooted","text","isAuthorized","chalk","bold","gray","devices","value","promptAsync","type","name","limit","message","choices","map","item","format","title","dim","suggest","createSelectionFilter","find","logUnauthorized","AbortCommandError"],"mappings":"AAAA;;;;QAoBsBA,oBAAoB,GAApBA,oBAAoB;AApBxB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAES,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AACN,IAAA,QAAwB,WAAxB,wBAAwB,CAAA;AACnC,IAAA,IAAO,WAAP,OAAO,CAAA;;;;;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ACjC,CAAC,AAAC;IAEH,MAAMtB,MAAM,GAAGQ,OAAO,CAACe,IAAI,CAAC,CAAC,EAAEX,IAAI,CAAA,EAAE,GAAKA,IAAI,KAAKH,KAAK;IAAA,CAAC,AAAC;IAE1D,IAAIT,CAAAA,MAAM,QAAc,GAApBA,KAAAA,CAAoB,GAApBA,MAAM,CAAEI,YAAY,CAAA,KAAK,KAAK,EAAE;QAClCoB,CAAAA,GAAAA,IAAe,AAAQ,CAAA,gBAAR,CAACxB,MAAM,CAAC,CAAC;QACxB,MAAM,IAAIyB,OAAiB,kBAAA,EAAE,CAAC;KAC/B;IAED,OAAOzB,MAAM,CAAE;CAChB"}
|
|
@@ -125,7 +125,11 @@ class AppleDeviceManager extends _deviceManager.DeviceManager {
|
|
|
125
125
|
} catch (error) {
|
|
126
126
|
let errorMessage = `Couldn't open iOS app with ID "${appId}" on device "${this.name}".`;
|
|
127
127
|
if (error instanceof _errors.CommandError && error.code === "APP_NOT_INSTALLED") {
|
|
128
|
-
|
|
128
|
+
if (appId === EXPO_GO_BUNDLE_IDENTIFIER) {
|
|
129
|
+
errorMessage = `Couldn't open Expo Go app on device "${this.name}". Please install.`;
|
|
130
|
+
} else {
|
|
131
|
+
errorMessage += `\nThe app might not be installed, try installing it with: ${_chalk.default.bold(`expo run:ios -d ${this.device.udid}`)}`;
|
|
132
|
+
}
|
|
129
133
|
}
|
|
130
134
|
if (error.stderr) {
|
|
131
135
|
errorMessage += _chalk.default.gray(`\n${error.stderr}`);
|