@expo/cli 0.1.3 → 0.2.0
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 +89 -4
- package/build/bin/cli.map +1 -1
- package/build/src/api/rest/wrapFetchWithOffline.js +2 -23
- package/build/src/api/rest/wrapFetchWithOffline.js.map +1 -1
- package/build/src/customize/customizeAsync.js +40 -0
- package/build/src/customize/customizeAsync.js.map +1 -0
- package/build/src/customize/generate.js +77 -0
- package/build/src/customize/generate.js.map +1 -0
- package/build/src/customize/index.js +41 -0
- package/build/src/customize/index.js.map +1 -0
- package/build/src/customize/resolveOptions.js +18 -0
- package/build/src/customize/resolveOptions.js.map +1 -0
- package/build/src/customize/templates.js +118 -0
- package/build/src/customize/templates.js.map +1 -0
- package/build/src/export/createMetadataJson.js +10 -7
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/exportApp.js +32 -0
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +2 -3
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +51 -34
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/index.js +15 -10
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/printBundleSizes.js +27 -48
- package/build/src/export/printBundleSizes.js.map +1 -1
- package/build/src/export/resolveOptions.js +44 -5
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/export/saveAssets.js +2 -1
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/web/exportWebAsync.js +37 -0
- package/build/src/export/web/exportWebAsync.js.map +1 -0
- package/build/src/export/web/index.js +66 -0
- package/build/src/export/web/index.js.map +1 -0
- package/build/src/export/web/resolveOptions.js +13 -0
- package/build/src/export/web/resolveOptions.js.map +1 -0
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/install/checkPackages.js +2 -1
- package/build/src/install/checkPackages.js.map +1 -1
- package/build/src/install/index.js +1 -0
- package/build/src/install/index.js.map +1 -1
- package/build/src/install/installAsync.js +13 -5
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/resolveOptions.js +12 -65
- package/build/src/install/resolveOptions.js.map +1 -1
- package/build/src/install/utils/autoAddConfigPlugins.js +5 -26
- package/build/src/install/utils/autoAddConfigPlugins.js.map +1 -1
- package/build/src/log.js.map +1 -1
- package/build/src/prebuild/copyTemplateFiles.js +5 -23
- package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
- package/build/src/prebuild/index.js +18 -12
- package/build/src/prebuild/index.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +11 -12
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/resolveOptions.js +17 -0
- package/build/src/prebuild/resolveOptions.js.map +1 -1
- package/build/src/prebuild/resolveTemplate.js +2 -1
- package/build/src/prebuild/resolveTemplate.js.map +1 -1
- package/build/src/prebuild/updatePackageJson.js +5 -5
- package/build/src/prebuild/updatePackageJson.js.map +1 -1
- package/build/src/run/android/resolveInstallApkName.js +5 -26
- package/build/src/run/android/resolveInstallApkName.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/SimulatorAppPrerequisite.js +2 -0
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js.map +1 -1
- 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/doctor/apple/XcodePrerequisite.js +2 -0
- package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -1
- package/build/src/start/doctor/dependencies/bundledNativeModules.js +3 -2
- package/build/src/start/doctor/dependencies/bundledNativeModules.js.map +1 -1
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +7 -13
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
- package/build/src/start/doctor/dependencies/getMissingPackages.js +3 -24
- package/build/src/start/doctor/dependencies/getMissingPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +2 -23
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +17 -9
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/doctor/ngrok/ExternalModule.js +2 -1
- package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js +4 -3
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +32 -31
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
- package/build/src/start/interface/KeyPressHandler.js +2 -0
- package/build/src/start/interface/KeyPressHandler.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +5 -5
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/interface/startInterface.js +3 -2
- package/build/src/start/interface/startInterface.js.map +1 -1
- package/build/src/start/platforms/ExpoGoInstaller.js +2 -1
- package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
- package/build/src/start/platforms/PlatformManager.js +4 -24
- package/build/src/start/platforms/PlatformManager.js.map +1 -1
- package/build/src/start/platforms/android/ADBServer.js +17 -32
- package/build/src/start/platforms/android/ADBServer.js.map +1 -1
- package/build/src/start/platforms/android/AndroidSdk.js +41 -0
- package/build/src/start/platforms/android/AndroidSdk.js.map +1 -0
- package/build/src/start/platforms/android/activateWindow.js +4 -4
- package/build/src/start/platforms/android/activateWindow.js.map +1 -1
- package/build/src/start/platforms/android/adb.js +8 -3
- package/build/src/start/platforms/android/adb.js.map +1 -1
- package/build/src/start/platforms/android/adbReverse.js +3 -2
- package/build/src/start/platforms/android/adbReverse.js.map +1 -1
- 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/gradle.js +2 -2
- package/build/src/start/platforms/android/gradle.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/getBestSimulator.js +4 -4
- package/build/src/start/platforms/ios/getBestSimulator.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/platforms/ios/xcrun.js +2 -23
- package/build/src/start/platforms/ios/xcrun.js.map +1 -1
- package/build/src/start/project/devices.js +2 -0
- package/build/src/start/project/devices.js.map +1 -1
- package/build/src/start/server/AsyncNgrok.js +6 -5
- package/build/src/start/server/AsyncNgrok.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +15 -8
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js +15 -5
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/DevelopmentSession.js +4 -0
- package/build/src/start/server/DevelopmentSession.js.map +1 -1
- package/build/src/start/server/UrlCreator.js +10 -3
- package/build/src/start/server/UrlCreator.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +9 -0
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js +5 -0
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +11 -1
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/resolveFromProject.js +8 -0
- package/build/src/start/server/metro/resolveFromProject.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +115 -0
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -0
- package/build/src/start/server/middleware/ClassicManifestMiddleware.js +1 -1
- package/build/src/start/server/middleware/ExpoMiddleware.js +9 -4
- package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/HistoryFallbackMiddleware.js +24 -0
- package/build/src/start/server/middleware/HistoryFallbackMiddleware.js.map +1 -0
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js +2 -0
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +57 -6
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js +6 -1
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ServeStaticMiddleware.js +62 -0
- package/build/src/start/server/middleware/ServeStaticMiddleware.js.map +1 -0
- package/build/src/start/server/platformBundlers.js +18 -0
- package/build/src/start/server/platformBundlers.js.map +1 -0
- package/build/src/start/server/webTemplate.js +68 -0
- package/build/src/start/server/webTemplate.js.map +1 -0
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js +59 -19
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
- package/build/src/start/server/webpack/compile.js +64 -0
- package/build/src/start/server/webpack/compile.js.map +1 -0
- package/build/src/start/startAsync.js +21 -17
- package/build/src/start/startAsync.js.map +1 -1
- package/build/src/utils/FileNotifier.js +5 -2
- package/build/src/utils/FileNotifier.js.map +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/downloadAppAsync.js +3 -2
- package/build/src/utils/downloadAppAsync.js.map +1 -1
- package/build/src/utils/downloadExpoGoAsync.js +7 -32
- package/build/src/utils/downloadExpoGoAsync.js.map +1 -1
- package/build/src/utils/editor.js +3 -2
- package/build/src/utils/editor.js.map +1 -1
- package/build/src/utils/env.js +3 -0
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/exit.js +4 -25
- package/build/src/utils/exit.js.map +1 -1
- package/build/src/utils/getRunningProcess.js +6 -2
- package/build/src/utils/getRunningProcess.js.map +1 -1
- package/build/src/utils/nodeModules.js +13 -102
- package/build/src/utils/nodeModules.js.map +1 -1
- package/build/src/utils/npm.js +3 -24
- package/build/src/utils/npm.js.map +1 -1
- package/build/src/utils/ora.js +1 -13
- package/build/src/utils/ora.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/progress.js +46 -0
- package/build/src/utils/progress.js.map +1 -1
- package/build/src/utils/prompts.js +19 -3
- 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/tar.js +3 -0
- package/build/src/utils/tar.js.map +1 -1
- package/build/src/utils/terminal.js +10 -0
- package/build/src/utils/terminal.js.map +1 -0
- package/build/src/utils/validateApplicationId.js +9 -2
- package/build/src/utils/validateApplicationId.js.map +1 -1
- package/build/src/utils/variadic.js +47 -0
- package/build/src/utils/variadic.js.map +1 -0
- package/package.json +14 -10
- package/static/template/babel.config.js +6 -0
- package/static/template/index.html +117 -0
- package/static/template/metro.config.js +4 -0
- package/static/template/serve.json +13 -0
- package/static/template/webpack.config.js +7 -0
|
@@ -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,0BAA0B,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEvD,eAAeF,WAAW,CAACG,WAAmB,EAAEC,OAAgB,EAAE;QAyB7D,GAA0C;IAxBpDC,cAAc,EAAE,CAAC;IAEjB,MAAMC,OAAO,GAAG,CAAC,CAACF,OAAO,CAACE,OAAO,AAAC;IAElC,IAAI,AAAC,MAAMC,CAAAA,GAAAA,oBAAwB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C;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"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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","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,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"}
|
|
@@ -32,6 +32,7 @@ function _interopRequireWildcard(obj) {
|
|
|
32
32
|
return newObj;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
const debug = require("debug")("expo:doctor:apple:simulatorApp");
|
|
35
36
|
async function getSimulatorAppIdAsync() {
|
|
36
37
|
try {
|
|
37
38
|
return (await (0, _osascript).execAsync('id of app "Simulator"')).trim();
|
|
@@ -51,6 +52,7 @@ class SimulatorAppPrerequisite extends _prerequisite.Prerequisite {
|
|
|
51
52
|
if (result !== "com.apple.iphonesimulator" && result !== "com.apple.CoreSimulator.SimulatorTrampoline") {
|
|
52
53
|
throw new _prerequisite.PrerequisiteCommandError("SIMULATOR_APP", "Simulator is installed but is identified as '" + result + "'; don't know what that is.");
|
|
53
54
|
}
|
|
55
|
+
debug(`Simulator app id: ${result}`);
|
|
54
56
|
try {
|
|
55
57
|
// make sure we can run simctl
|
|
56
58
|
await (0, _spawnAsync).default("xcrun", [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/doctor/apple/SimulatorAppPrerequisite.ts"],"sourcesContent":["import { execAsync } from '@expo/osascript';\nimport spawnAsync from '@expo/spawn-async';\n\nimport * as Log from '../../../log';\nimport { Prerequisite, PrerequisiteCommandError } from '../Prerequisite';\n\nasync function getSimulatorAppIdAsync(): Promise<string | null> {\n try {\n return (await execAsync('id of app \"Simulator\"')).trim();\n } catch {\n // This error may occur in CI where the users intends to install just the simulators but no Xcode.\n }\n return null;\n}\n\nexport class SimulatorAppPrerequisite extends Prerequisite {\n static instance = new SimulatorAppPrerequisite();\n\n async assertImplementation(): Promise<void> {\n const result = await getSimulatorAppIdAsync();\n if (!result) {\n // This error may occur in CI where the users intends to install just the simulators but no Xcode.\n throw new PrerequisiteCommandError(\n 'SIMULATOR_APP',\n \"Can't determine id of Simulator app; the Simulator is most likely not installed on this machine. Run `sudo xcode-select -s /Applications/Xcode.app`\"\n );\n }\n if (\n result !== 'com.apple.iphonesimulator' &&\n result !== 'com.apple.CoreSimulator.SimulatorTrampoline'\n ) {\n throw new PrerequisiteCommandError(\n 'SIMULATOR_APP',\n \"Simulator is installed but is identified as '\" + result + \"'; don't know what that is.\"\n );\n }\n\n try {\n // make sure we can run simctl\n await spawnAsync('xcrun', ['simctl', 'help']);\n } catch (error: any) {\n Log.warn(`Unable to run simctl:\\n${error.toString()}`);\n throw new PrerequisiteCommandError(\n 'SIMCTL',\n 'xcrun is not configured correctly. Ensure `sudo xcode-select --reset` works before running this command again.'\n );\n }\n }\n}\n"],"names":["Log","getSimulatorAppIdAsync","execAsync","trim","SimulatorAppPrerequisite","Prerequisite","instance","assertImplementation","result","PrerequisiteCommandError","spawnAsync","error","warn","toString"],"mappings":"AAAA;;;;AAA0B,IAAA,UAAiB,WAAjB,iBAAiB,CAAA;AACpB,IAAA,WAAmB,kCAAnB,mBAAmB,EAAA;AAE9BA,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACwC,IAAA,aAAiB,WAAjB,iBAAiB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExE,eAAeC,sBAAsB,GAA2B;IAC9D,IAAI;QACF,OAAO,CAAC,MAAMC,CAAAA,GAAAA,UAAS,AAAyB,CAAA,UAAzB,CAAC,uBAAuB,CAAC,CAAC,CAACC,IAAI,EAAE,CAAC;KAC1D,CAAC,OAAM;IACN,kGAAkG;KACnG;IACD,OAAO,IAAI,CAAC;CACb;AAEM,MAAMC,wBAAwB,SAASC,aAAY,aAAA;IACxD,OAAOC,QAAQ,GAAG,IAAIF,wBAAwB,EAAE,CAAC;IAEjD,MAAMG,oBAAoB,GAAkB;QAC1C,MAAMC,MAAM,GAAG,MAAMP,sBAAsB,EAAE,AAAC;QAC9C,IAAI,CAACO,MAAM,EAAE;YACX,kGAAkG;YAClG,MAAM,IAAIC,aAAwB,yBAAA,CAChC,eAAe,EACf,qJAAqJ,CACtJ,CAAC;SACH;QACD,IACED,MAAM,KAAK,2BAA2B,IACtCA,MAAM,KAAK,6CAA6C,EACxD;YACA,MAAM,IAAIC,aAAwB,yBAAA,CAChC,eAAe,EACf,+CAA+C,GAAGD,MAAM,GAAG,6BAA6B,CACzF,CAAC;SACH;
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/doctor/apple/SimulatorAppPrerequisite.ts"],"sourcesContent":["import { execAsync } from '@expo/osascript';\nimport spawnAsync from '@expo/spawn-async';\n\nimport * as Log from '../../../log';\nimport { Prerequisite, PrerequisiteCommandError } from '../Prerequisite';\n\nconst debug = require('debug')('expo:doctor:apple:simulatorApp') as typeof console.log;\n\nasync function getSimulatorAppIdAsync(): Promise<string | null> {\n try {\n return (await execAsync('id of app \"Simulator\"')).trim();\n } catch {\n // This error may occur in CI where the users intends to install just the simulators but no Xcode.\n }\n return null;\n}\n\nexport class SimulatorAppPrerequisite extends Prerequisite {\n static instance = new SimulatorAppPrerequisite();\n\n async assertImplementation(): Promise<void> {\n const result = await getSimulatorAppIdAsync();\n if (!result) {\n // This error may occur in CI where the users intends to install just the simulators but no Xcode.\n throw new PrerequisiteCommandError(\n 'SIMULATOR_APP',\n \"Can't determine id of Simulator app; the Simulator is most likely not installed on this machine. Run `sudo xcode-select -s /Applications/Xcode.app`\"\n );\n }\n if (\n result !== 'com.apple.iphonesimulator' &&\n result !== 'com.apple.CoreSimulator.SimulatorTrampoline'\n ) {\n throw new PrerequisiteCommandError(\n 'SIMULATOR_APP',\n \"Simulator is installed but is identified as '\" + result + \"'; don't know what that is.\"\n );\n }\n debug(`Simulator app id: ${result}`);\n\n try {\n // make sure we can run simctl\n await spawnAsync('xcrun', ['simctl', 'help']);\n } catch (error: any) {\n Log.warn(`Unable to run simctl:\\n${error.toString()}`);\n throw new PrerequisiteCommandError(\n 'SIMCTL',\n 'xcrun is not configured correctly. Ensure `sudo xcode-select --reset` works before running this command again.'\n );\n }\n }\n}\n"],"names":["Log","debug","require","getSimulatorAppIdAsync","execAsync","trim","SimulatorAppPrerequisite","Prerequisite","instance","assertImplementation","result","PrerequisiteCommandError","spawnAsync","error","warn","toString"],"mappings":"AAAA;;;;AAA0B,IAAA,UAAiB,WAAjB,iBAAiB,CAAA;AACpB,IAAA,WAAmB,kCAAnB,mBAAmB,EAAA;AAE9BA,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACwC,IAAA,aAAiB,WAAjB,iBAAiB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExE,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,gCAAgC,CAAC,AAAsB,AAAC;AAEvF,eAAeC,sBAAsB,GAA2B;IAC9D,IAAI;QACF,OAAO,CAAC,MAAMC,CAAAA,GAAAA,UAAS,AAAyB,CAAA,UAAzB,CAAC,uBAAuB,CAAC,CAAC,CAACC,IAAI,EAAE,CAAC;KAC1D,CAAC,OAAM;IACN,kGAAkG;KACnG;IACD,OAAO,IAAI,CAAC;CACb;AAEM,MAAMC,wBAAwB,SAASC,aAAY,aAAA;IACxD,OAAOC,QAAQ,GAAG,IAAIF,wBAAwB,EAAE,CAAC;IAEjD,MAAMG,oBAAoB,GAAkB;QAC1C,MAAMC,MAAM,GAAG,MAAMP,sBAAsB,EAAE,AAAC;QAC9C,IAAI,CAACO,MAAM,EAAE;YACX,kGAAkG;YAClG,MAAM,IAAIC,aAAwB,yBAAA,CAChC,eAAe,EACf,qJAAqJ,CACtJ,CAAC;SACH;QACD,IACED,MAAM,KAAK,2BAA2B,IACtCA,MAAM,KAAK,6CAA6C,EACxD;YACA,MAAM,IAAIC,aAAwB,yBAAA,CAChC,eAAe,EACf,+CAA+C,GAAGD,MAAM,GAAG,6BAA6B,CACzF,CAAC;SACH;QACDT,KAAK,CAAC,CAAC,kBAAkB,EAAES,MAAM,CAAC,CAAC,CAAC,CAAC;QAErC,IAAI;YACF,8BAA8B;YAC9B,MAAME,CAAAA,GAAAA,WAAU,AAA6B,CAAA,QAA7B,CAAC,OAAO,EAAE;gBAAC,QAAQ;gBAAE,MAAM;aAAC,CAAC,CAAC;SAC/C,CAAC,OAAOC,KAAK,EAAO;YACnBb,GAAG,CAACc,IAAI,CAAC,CAAC,uBAAuB,EAAED,KAAK,CAACE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;YACvD,MAAM,IAAIJ,aAAwB,yBAAA,CAChC,QAAQ,EACR,gHAAgH,CACjH,CAAC;SACH;KACF;CACF;QAlCYL,wBAAwB,GAAxBA,wBAAwB"}
|
|
@@ -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"}
|
|
@@ -36,6 +36,7 @@ function _interopRequireWildcard(obj) {
|
|
|
36
36
|
return newObj;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
const debug = require("debug")("expo:doctor:apple:xcode");
|
|
39
40
|
// Based on the RN docs (Aug 2020).
|
|
40
41
|
const MIN_XCODE_VERSION = 9.4;
|
|
41
42
|
const APP_STORE_ID = "497799835";
|
|
@@ -98,6 +99,7 @@ class XcodePrerequisite extends _prerequisite.Prerequisite {
|
|
|
98
99
|
* Ensure Xcode is installed and recent enough to be used with Expo.
|
|
99
100
|
*/ async assertImplementation() {
|
|
100
101
|
const version = (0, _profile).profile(getXcodeVersionAsync)();
|
|
102
|
+
debug(`Xcode version: ${version}`);
|
|
101
103
|
if (!version) {
|
|
102
104
|
// Almost certainly Xcode isn't installed.
|
|
103
105
|
await promptToOpenAppStoreAsync(`Xcode needs to be installed (don't worry, you won't have to use it), would you like to continue to the App Store?`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/doctor/apple/XcodePrerequisite.ts"],"sourcesContent":["import { execSync } from 'child_process';\nimport semver from 'semver';\n\nimport * as Log from '../../../log';\nimport { AbortCommandError } from '../../../utils/errors';\nimport { profile } from '../../../utils/profile';\nimport { confirmAsync } from '../../../utils/prompts';\nimport { Prerequisite } from '../Prerequisite';\n\n// Based on the RN docs (Aug 2020).\nconst MIN_XCODE_VERSION = 9.4;\nconst APP_STORE_ID = '497799835';\n\nconst SUGGESTED_XCODE_VERSION = `${MIN_XCODE_VERSION}.0`;\n\nconst promptToOpenAppStoreAsync = async (message: string) => {\n // This prompt serves no purpose accept informing the user what to do next, we could just open the App Store but it could be confusing if they don't know what's going on.\n const confirm = await confirmAsync({ initial: true, message });\n if (confirm) {\n Log.log(`Going to the App Store, re-run Expo when Xcode has finished installing.`);\n openAppStore(APP_STORE_ID);\n }\n};\n\n/** Exposed for testing, use `getXcodeVersion` */\nexport const getXcodeVersionAsync = (): string | null | false => {\n try {\n const last = execSync('xcodebuild -version', { stdio: 'pipe' })\n .toString()\n .match(/^Xcode (\\d+\\.\\d+)/)?.[1];\n // Convert to a semver string\n if (last) {\n const version = `${last}.0`;\n\n if (!semver.valid(version)) {\n // Not sure why this would happen, if it does we should add a more confident error message.\n Log.error(`Xcode version is in an unknown format: ${version}`);\n return false;\n }\n\n return version;\n }\n // not sure what's going on\n Log.error(\n 'Unable to check Xcode version. Command ran successfully but no version number was found.'\n );\n } catch {\n // not installed\n }\n return null;\n};\n\n/**\n * Open a link to the App Store. Just link in mobile apps, **never** redirect without prompting first.\n *\n * @param appId\n */\nfunction openAppStore(appId: string) {\n const link = getAppStoreLink(appId);\n execSync(`open ${link}`, { stdio: 'ignore' });\n}\n\nfunction getAppStoreLink(appId: string): string {\n if (process.platform === 'darwin') {\n // TODO: Is there ever a case where the macappstore isn't available on mac?\n return `macappstore://itunes.apple.com/app/id${appId}`;\n }\n return `https://apps.apple.com/us/app/id${appId}`;\n}\n\nexport class XcodePrerequisite extends Prerequisite {\n static instance = new XcodePrerequisite();\n\n /**\n * Ensure Xcode is installed and recent enough to be used with Expo.\n */\n async assertImplementation(): Promise<void> {\n const version = profile(getXcodeVersionAsync)();\n if (!version) {\n // Almost certainly Xcode isn't installed.\n await promptToOpenAppStoreAsync(\n `Xcode needs to be installed (don't worry, you won't have to use it), would you like to continue to the App Store?`\n );\n throw new AbortCommandError();\n }\n\n if (semver.lt(version, SUGGESTED_XCODE_VERSION)) {\n // Xcode version is too old.\n await promptToOpenAppStoreAsync(\n `Xcode (${version}) needs to be updated to at least version ${MIN_XCODE_VERSION}, would you like to continue to the App Store?`\n );\n throw new AbortCommandError();\n }\n }\n}\n"],"names":["Log","MIN_XCODE_VERSION","APP_STORE_ID","SUGGESTED_XCODE_VERSION","promptToOpenAppStoreAsync","message","confirm","confirmAsync","initial","log","openAppStore","getXcodeVersionAsync","execSync","last","stdio","toString","match","version","semver","valid","error","appId","link","getAppStoreLink","process","platform","XcodePrerequisite","Prerequisite","instance","assertImplementation","profile","AbortCommandError","lt"],"mappings":"AAAA;;;;;AAAyB,IAAA,aAAe,WAAf,eAAe,CAAA;AACrB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AAEfA,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACmB,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AACjC,IAAA,QAAwB,WAAxB,wBAAwB,CAAA;AACnB,IAAA,QAAwB,WAAxB,wBAAwB,CAAA;AACxB,IAAA,aAAiB,WAAjB,iBAAiB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9C,mCAAmC;AACnC,MAAMC,iBAAiB,GAAG,GAAG,AAAC;AAC9B,MAAMC,YAAY,GAAG,WAAW,AAAC;AAEjC,MAAMC,uBAAuB,GAAG,CAAC,EAAEF,iBAAiB,CAAC,EAAE,CAAC,AAAC;AAEzD,MAAMG,yBAAyB,GAAG,OAAOC,OAAe,GAAK;IAC3D,0KAA0K;IAC1K,MAAMC,OAAO,GAAG,MAAMC,CAAAA,GAAAA,QAAY,AAA4B,CAAA,aAA5B,CAAC;QAAEC,OAAO,EAAE,IAAI;QAAEH,OAAO;KAAE,CAAC,AAAC;IAC/D,IAAIC,OAAO,EAAE;
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/doctor/apple/XcodePrerequisite.ts"],"sourcesContent":["import { execSync } from 'child_process';\nimport semver from 'semver';\n\nimport * as Log from '../../../log';\nimport { AbortCommandError } from '../../../utils/errors';\nimport { profile } from '../../../utils/profile';\nimport { confirmAsync } from '../../../utils/prompts';\nimport { Prerequisite } from '../Prerequisite';\n\nconst debug = require('debug')('expo:doctor:apple:xcode') as typeof console.log;\n\n// Based on the RN docs (Aug 2020).\nconst MIN_XCODE_VERSION = 9.4;\nconst APP_STORE_ID = '497799835';\n\nconst SUGGESTED_XCODE_VERSION = `${MIN_XCODE_VERSION}.0`;\n\nconst promptToOpenAppStoreAsync = async (message: string) => {\n // This prompt serves no purpose accept informing the user what to do next, we could just open the App Store but it could be confusing if they don't know what's going on.\n const confirm = await confirmAsync({ initial: true, message });\n if (confirm) {\n Log.log(`Going to the App Store, re-run Expo when Xcode has finished installing.`);\n openAppStore(APP_STORE_ID);\n }\n};\n\n/** Exposed for testing, use `getXcodeVersion` */\nexport const getXcodeVersionAsync = (): string | null | false => {\n try {\n const last = execSync('xcodebuild -version', { stdio: 'pipe' })\n .toString()\n .match(/^Xcode (\\d+\\.\\d+)/)?.[1];\n // Convert to a semver string\n if (last) {\n const version = `${last}.0`;\n\n if (!semver.valid(version)) {\n // Not sure why this would happen, if it does we should add a more confident error message.\n Log.error(`Xcode version is in an unknown format: ${version}`);\n return false;\n }\n\n return version;\n }\n // not sure what's going on\n Log.error(\n 'Unable to check Xcode version. Command ran successfully but no version number was found.'\n );\n } catch {\n // not installed\n }\n return null;\n};\n\n/**\n * Open a link to the App Store. Just link in mobile apps, **never** redirect without prompting first.\n *\n * @param appId\n */\nfunction openAppStore(appId: string) {\n const link = getAppStoreLink(appId);\n execSync(`open ${link}`, { stdio: 'ignore' });\n}\n\nfunction getAppStoreLink(appId: string): string {\n if (process.platform === 'darwin') {\n // TODO: Is there ever a case where the macappstore isn't available on mac?\n return `macappstore://itunes.apple.com/app/id${appId}`;\n }\n return `https://apps.apple.com/us/app/id${appId}`;\n}\n\nexport class XcodePrerequisite extends Prerequisite {\n static instance = new XcodePrerequisite();\n\n /**\n * Ensure Xcode is installed and recent enough to be used with Expo.\n */\n async assertImplementation(): Promise<void> {\n const version = profile(getXcodeVersionAsync)();\n debug(`Xcode version: ${version}`);\n if (!version) {\n // Almost certainly Xcode isn't installed.\n await promptToOpenAppStoreAsync(\n `Xcode needs to be installed (don't worry, you won't have to use it), would you like to continue to the App Store?`\n );\n throw new AbortCommandError();\n }\n\n if (semver.lt(version, SUGGESTED_XCODE_VERSION)) {\n // Xcode version is too old.\n await promptToOpenAppStoreAsync(\n `Xcode (${version}) needs to be updated to at least version ${MIN_XCODE_VERSION}, would you like to continue to the App Store?`\n );\n throw new AbortCommandError();\n }\n }\n}\n"],"names":["Log","debug","require","MIN_XCODE_VERSION","APP_STORE_ID","SUGGESTED_XCODE_VERSION","promptToOpenAppStoreAsync","message","confirm","confirmAsync","initial","log","openAppStore","getXcodeVersionAsync","execSync","last","stdio","toString","match","version","semver","valid","error","appId","link","getAppStoreLink","process","platform","XcodePrerequisite","Prerequisite","instance","assertImplementation","profile","AbortCommandError","lt"],"mappings":"AAAA;;;;;AAAyB,IAAA,aAAe,WAAf,eAAe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K,CAAC,CAAC,eAAe,EAAEkB,OAAO,CAAC,CAAC,CAAC,CAAC;QACnC,IAAI,CAACA,OAAO,EAAE;YACZ,0CAA0C;YAC1C,MAAMb,yBAAyB,CAC7B,CAAC,iHAAiH,CAAC,CACpH,CAAC;YACF,MAAM,IAAI2B,OAAiB,kBAAA,EAAE,CAAC;SAC/B;QAED,IAAIb,OAAM,QAAA,CAACc,EAAE,CAACf,OAAO,EAAEd,uBAAuB,CAAC,EAAE;YAC/C,4BAA4B;YAC5B,MAAMC,yBAAyB,CAC7B,CAAC,OAAO,EAAEa,OAAO,CAAC,0CAA0C,EAAEhB,iBAAiB,CAAC,8CAA8C,CAAC,CAChI,CAAC;YACF,MAAM,IAAI8B,OAAiB,kBAAA,EAAE,CAAC;SAC/B;KACF;CACF;QAzBYL,iBAAiB,GAAjBA,iBAAiB"}
|
|
@@ -36,16 +36,17 @@ function _interopRequireWildcard(obj) {
|
|
|
36
36
|
return newObj;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
const debug = require("debug")("expo:doctor:dependencies:bundledNativeModules");
|
|
39
40
|
async function getVersionedNativeModulesAsync(projectRoot, sdkVersion) {
|
|
40
41
|
if (sdkVersion !== "UNVERSIONED" && !_settings.APISettings.isOffline) {
|
|
41
42
|
try {
|
|
42
|
-
|
|
43
|
+
debug("Fetching bundled native modules from the server...");
|
|
43
44
|
return await (0, _getNativeModuleVersions).getNativeModuleVersionsAsync(sdkVersion);
|
|
44
45
|
} catch {
|
|
45
46
|
Log.warn(_chalk.default`Unable to reach Expo servers. Falling back to using the cached dependency map ({bold bundledNativeModules.json}) from the package "{bold expo}" installed in your project.`);
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
+
debug("Fetching bundled native modules from the local JSON file...");
|
|
49
50
|
return await getBundledNativeModulesAsync(projectRoot);
|
|
50
51
|
}
|
|
51
52
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/doctor/dependencies/bundledNativeModules.ts"],"sourcesContent":["import JsonFile from '@expo/json-file';\nimport chalk from 'chalk';\nimport resolveFrom from 'resolve-from';\n\nimport { getNativeModuleVersionsAsync } from '../../../api/getNativeModuleVersions';\nimport { APISettings } from '../../../api/settings';\nimport * as Log from '../../../log';\nimport { CommandError } from '../../../utils/errors';\n\nexport type BundledNativeModules = Record<string, string>;\n\n/**\n * Gets the bundledNativeModules.json for a given SDK version:\n * - Tries to fetch the data from the /sdks/:sdkVersion/native-modules API endpoint.\n * - If the data is missing on the server (it can happen for SDKs that are yet fully released)\n * or there's a downtime, reads the local .json file from the \"expo\" package.\n * - For UNVERSIONED, returns the local .json file contents.\n */\nexport async function getVersionedNativeModulesAsync(\n projectRoot: string,\n sdkVersion: string\n): Promise<BundledNativeModules> {\n if (sdkVersion !== 'UNVERSIONED' && !APISettings.isOffline) {\n try {\n
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/doctor/dependencies/bundledNativeModules.ts"],"sourcesContent":["import JsonFile from '@expo/json-file';\nimport chalk from 'chalk';\nimport resolveFrom from 'resolve-from';\n\nimport { getNativeModuleVersionsAsync } from '../../../api/getNativeModuleVersions';\nimport { APISettings } from '../../../api/settings';\nimport * as Log from '../../../log';\nimport { CommandError } from '../../../utils/errors';\n\nconst debug = require('debug')(\n 'expo:doctor:dependencies:bundledNativeModules'\n) as typeof console.log;\n\nexport type BundledNativeModules = Record<string, string>;\n\n/**\n * Gets the bundledNativeModules.json for a given SDK version:\n * - Tries to fetch the data from the /sdks/:sdkVersion/native-modules API endpoint.\n * - If the data is missing on the server (it can happen for SDKs that are yet fully released)\n * or there's a downtime, reads the local .json file from the \"expo\" package.\n * - For UNVERSIONED, returns the local .json file contents.\n */\nexport async function getVersionedNativeModulesAsync(\n projectRoot: string,\n sdkVersion: string\n): Promise<BundledNativeModules> {\n if (sdkVersion !== 'UNVERSIONED' && !APISettings.isOffline) {\n try {\n debug('Fetching bundled native modules from the server...');\n return await getNativeModuleVersionsAsync(sdkVersion);\n } catch {\n Log.warn(\n chalk`Unable to reach Expo servers. Falling back to using the cached dependency map ({bold bundledNativeModules.json}) from the package \"{bold expo}\" installed in your project.`\n );\n }\n }\n\n debug('Fetching bundled native modules from the local JSON file...');\n return await getBundledNativeModulesAsync(projectRoot);\n}\n\n/**\n * Get the legacy static `bundledNativeModules.json` file\n * that's shipped with the version of `expo` that the project has installed.\n */\nasync function getBundledNativeModulesAsync(projectRoot: string): Promise<BundledNativeModules> {\n // TODO: Revisit now that this code is in the `expo` package.\n const bundledNativeModulesPath = resolveFrom.silent(\n projectRoot,\n 'expo/bundledNativeModules.json'\n );\n if (!bundledNativeModulesPath) {\n Log.log();\n throw new CommandError(\n chalk`The dependency map {bold expo/bundledNativeModules.json} cannot be found, please ensure you have the package \"{bold expo}\" installed in your project.`\n );\n }\n return await JsonFile.readAsync<BundledNativeModules>(bundledNativeModulesPath);\n}\n"],"names":["getVersionedNativeModulesAsync","Log","debug","require","projectRoot","sdkVersion","APISettings","isOffline","getNativeModuleVersionsAsync","warn","chalk","getBundledNativeModulesAsync","bundledNativeModulesPath","resolveFrom","silent","log","CommandError","JsonFile","readAsync"],"mappings":"AAAA;;;;QAsBsBA,8BAA8B,GAA9BA,8BAA8B;AAtB/B,IAAA,SAAiB,kCAAjB,iBAAiB,EAAA;AACpB,IAAA,MAAO,kCAAP,OAAO,EAAA;AACD,IAAA,YAAc,kCAAd,cAAc,EAAA;AAEO,IAAA,wBAAsC,WAAtC,sCAAsC,CAAA;AACvD,IAAA,SAAuB,WAAvB,uBAAuB,CAAA;AACvCC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACc,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEpD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAC5B,+CAA+C,CAChD,AAAsB,AAAC;AAWjB,eAAeH,8BAA8B,CAClDI,WAAmB,EACnBC,UAAkB,EACa;IAC/B,IAAIA,UAAU,KAAK,aAAa,IAAI,CAACC,SAAW,YAAA,CAACC,SAAS,EAAE;QAC1D,IAAI;YACFL,KAAK,CAAC,oDAAoD,CAAC,CAAC;YAC5D,OAAO,MAAMM,CAAAA,GAAAA,wBAA4B,AAAY,CAAA,6BAAZ,CAACH,UAAU,CAAC,CAAC;SACvD,CAAC,OAAM;YACNJ,GAAG,CAACQ,IAAI,CACNC,MAAK,QAAA,CAAC,0KAA0K,CAAC,CAClL,CAAC;SACH;KACF;IAEDR,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACrE,OAAO,MAAMS,4BAA4B,CAACP,WAAW,CAAC,CAAC;CACxD;AAED;;;GAGG,CACH,eAAeO,4BAA4B,CAACP,WAAmB,EAAiC;IAC9F,6DAA6D;IAC7D,MAAMQ,wBAAwB,GAAGC,YAAW,QAAA,CAACC,MAAM,CACjDV,WAAW,EACX,gCAAgC,CACjC,AAAC;IACF,IAAI,CAACQ,wBAAwB,EAAE;QAC7BX,GAAG,CAACc,GAAG,EAAE,CAAC;QACV,MAAM,IAAIC,OAAY,aAAA,CACpBN,MAAK,QAAA,CAAC,qJAAqJ,CAAC,CAC7J,CAAC;KACH;IACD,OAAO,MAAMO,SAAQ,QAAA,CAACC,SAAS,CAAuBN,wBAAwB,CAAC,CAAC;CACjF"}
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
exports.ensureDependenciesAsync = ensureDependenciesAsync;
|
|
6
6
|
exports.createInstallCommand = createInstallCommand;
|
|
7
7
|
var _config = require("@expo/config");
|
|
8
|
-
var PackageManager = _interopRequireWildcard(require("@expo/package-manager"));
|
|
9
8
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
10
9
|
var _wrapAnsi = _interopRequireDefault(require("wrap-ansi"));
|
|
10
|
+
var _installAsync = require("../../../install/installAsync");
|
|
11
11
|
var Log = _interopRequireWildcard(require("../../../log"));
|
|
12
12
|
var _env = require("../../../utils/env");
|
|
13
13
|
var _errors = require("../../../utils/errors");
|
|
@@ -55,7 +55,6 @@ skipPrompt =_env.env.CI }) {
|
|
|
55
55
|
version
|
|
56
56
|
].join("@") : pkg
|
|
57
57
|
).join(", ");
|
|
58
|
-
const isYarn = PackageManager.isUsingYarn(projectRoot);
|
|
59
58
|
let title = installMessage;
|
|
60
59
|
if (skipPrompt) {
|
|
61
60
|
title += "\n\n";
|
|
@@ -73,7 +72,6 @@ skipPrompt =_env.env.CI }) {
|
|
|
73
72
|
);
|
|
74
73
|
// Install packages with versions
|
|
75
74
|
await installPackagesAsync(projectRoot, {
|
|
76
|
-
isYarn,
|
|
77
75
|
packages
|
|
78
76
|
});
|
|
79
77
|
// Try again but skip prompting twice, simply fail if the packages didn't install correctly.
|
|
@@ -88,7 +86,6 @@ skipPrompt =_env.env.CI }) {
|
|
|
88
86
|
title = "";
|
|
89
87
|
}
|
|
90
88
|
const installCommand = createInstallCommand({
|
|
91
|
-
isYarn,
|
|
92
89
|
packages: missing
|
|
93
90
|
});
|
|
94
91
|
const disableMessage = warningMessage;
|
|
@@ -99,8 +96,8 @@ skipPrompt =_env.env.CI }) {
|
|
|
99
96
|
/** Wrap long messages to fit smaller terminals. */ function wrapForTerminal(message) {
|
|
100
97
|
return (0, _wrapAnsi).default(message, process.stdout.columns || 80);
|
|
101
98
|
}
|
|
102
|
-
function createInstallCommand({
|
|
103
|
-
return
|
|
99
|
+
function createInstallCommand({ packages }) {
|
|
100
|
+
return "npx expo install " + packages.map(({ pkg , version })=>{
|
|
104
101
|
if (version) {
|
|
105
102
|
return [
|
|
106
103
|
pkg,
|
|
@@ -110,17 +107,14 @@ function createInstallCommand({ isYarn , packages }) {
|
|
|
110
107
|
return pkg;
|
|
111
108
|
}).join(" ");
|
|
112
109
|
}
|
|
113
|
-
/** Install packages in the project. */ async function installPackagesAsync(projectRoot, {
|
|
114
|
-
const packageManager = PackageManager.createForProject(projectRoot, {
|
|
115
|
-
yarn: isYarn,
|
|
116
|
-
log: Log.log,
|
|
117
|
-
silent: !_env.env.EXPO_DEBUG
|
|
118
|
-
});
|
|
110
|
+
/** Install packages in the project. */ async function installPackagesAsync(projectRoot, { packages }) {
|
|
119
111
|
const packagesStr = _chalk.default.bold(packages.join(", "));
|
|
120
112
|
Log.log();
|
|
121
113
|
const installingPackageStep = (0, _ora).logNewSection(`Installing ${packagesStr}`);
|
|
122
114
|
try {
|
|
123
|
-
await
|
|
115
|
+
await (0, _installAsync).installAsync(packages, {
|
|
116
|
+
projectRoot
|
|
117
|
+
});
|
|
124
118
|
} catch (e) {
|
|
125
119
|
installingPackageStep.fail(`Failed to install ${packagesStr} with error: ${e.message}`);
|
|
126
120
|
throw e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/doctor/dependencies/ensureDependenciesAsync.ts"],"sourcesContent":["import { ExpoConfig, getConfig } from '@expo/config';\nimport
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/doctor/dependencies/ensureDependenciesAsync.ts"],"sourcesContent":["import { ExpoConfig, getConfig } from '@expo/config';\nimport chalk from 'chalk';\nimport wrapAnsi from 'wrap-ansi';\n\nimport { installAsync } from '../../../install/installAsync';\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { logNewSection } from '../../../utils/ora';\nimport { confirmAsync } from '../../../utils/prompts';\nimport { getMissingPackagesAsync, ResolvedPackage } from './getMissingPackages';\n\nexport async function ensureDependenciesAsync(\n projectRoot: string,\n {\n exp = getConfig(projectRoot).exp,\n requiredPackages,\n warningMessage,\n installMessage,\n // Don't prompt in CI\n skipPrompt = env.CI,\n }: {\n exp?: ExpoConfig;\n installMessage: string;\n warningMessage: string;\n requiredPackages: ResolvedPackage[];\n skipPrompt?: boolean;\n }\n): Promise<boolean> {\n const { missing } = await getMissingPackagesAsync(projectRoot, {\n sdkVersion: exp.sdkVersion,\n requiredPackages,\n });\n if (!missing.length) {\n return true;\n }\n\n // Prompt to install or bail out...\n const readableMissingPackages = missing\n .map(({ pkg, version }) => (version ? [pkg, version].join('@') : pkg))\n .join(', ');\n\n let title = installMessage;\n\n if (skipPrompt) {\n title += '\\n\\n';\n } else {\n const confirm = await confirmAsync({\n message: wrapForTerminal(\n title + ` Would you like to install ${chalk.cyan(readableMissingPackages)}?`\n ),\n initial: true,\n });\n\n if (confirm) {\n // Format with version if available.\n const packages = missing.map(({ pkg, version }) =>\n version ? [pkg, version].join('@') : pkg\n );\n // Install packages with versions\n await installPackagesAsync(projectRoot, {\n packages,\n });\n // Try again but skip prompting twice, simply fail if the packages didn't install correctly.\n return await ensureDependenciesAsync(projectRoot, {\n skipPrompt: true,\n installMessage,\n warningMessage,\n requiredPackages,\n });\n }\n\n // Reset the title so it doesn't print twice in interactive mode.\n title = '';\n }\n\n const installCommand = createInstallCommand({\n packages: missing,\n });\n\n const disableMessage = warningMessage;\n\n const solution = `Please install ${chalk.bold(\n readableMissingPackages\n )} by running:\\n\\n ${chalk.reset.bold(installCommand)}\\n\\n`;\n\n // This prevents users from starting a misconfigured JS or TS project by default.\n throw new CommandError(wrapForTerminal(title + solution + disableMessage + '\\n'));\n}\n\n/** Wrap long messages to fit smaller terminals. */\nfunction wrapForTerminal(message: string): string {\n return wrapAnsi(message, process.stdout.columns || 80);\n}\n\n/** Create the bash install command from a given set of packages and settings. */\nexport function createInstallCommand({\n packages,\n}: {\n packages: {\n file: string;\n pkg: string;\n version?: string | undefined;\n }[];\n}) {\n return (\n 'npx expo install ' +\n packages\n .map(({ pkg, version }) => {\n if (version) {\n return [pkg, version].join('@');\n }\n return pkg;\n })\n .join(' ')\n );\n}\n\n/** Install packages in the project. */\nasync function installPackagesAsync(projectRoot: string, { packages }: { packages: string[] }) {\n const packagesStr = chalk.bold(packages.join(', '));\n Log.log();\n const installingPackageStep = logNewSection(`Installing ${packagesStr}`);\n try {\n await installAsync(packages, { projectRoot });\n } catch (e: any) {\n installingPackageStep.fail(`Failed to install ${packagesStr} with error: ${e.message}`);\n throw e;\n }\n installingPackageStep.succeed(`Installed ${packagesStr}`);\n}\n"],"names":["ensureDependenciesAsync","createInstallCommand","Log","projectRoot","exp","getConfig","requiredPackages","warningMessage","installMessage","skipPrompt","env","CI","missing","getMissingPackagesAsync","sdkVersion","length","readableMissingPackages","map","pkg","version","join","title","confirm","confirmAsync","message","wrapForTerminal","chalk","cyan","initial","packages","installPackagesAsync","installCommand","disableMessage","solution","bold","reset","CommandError","wrapAnsi","process","stdout","columns","packagesStr","log","installingPackageStep","logNewSection","installAsync","e","fail","succeed"],"mappings":"AAAA;;;;QAYsBA,uBAAuB,GAAvBA,uBAAuB;QAoF7BC,oBAAoB,GAApBA,oBAAoB;AAhGE,IAAA,OAAc,WAAd,cAAc,CAAA;AAClC,IAAA,MAAO,kCAAP,OAAO,EAAA;AACJ,IAAA,SAAW,kCAAX,WAAW,EAAA;AAEH,IAAA,aAA+B,WAA/B,+BAA+B,CAAA;AAChDC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACK,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACX,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AACtB,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACrB,IAAA,QAAwB,WAAxB,wBAAwB,CAAA;AACI,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExE,eAAeF,uBAAuB,CAC3CG,WAAmB,EACnB,EACEC,GAAG,EAAGC,CAAAA,GAAAA,OAAS,AAAa,CAAA,UAAb,CAACF,WAAW,CAAC,CAACC,GAAG,CAAA,EAChCE,gBAAgB,CAAA,EAChBC,cAAc,CAAA,EACdC,cAAc,CAAA,EACd,qBAAqB;AACrBC,UAAU,EAAGC,IAAG,IAAA,CAACC,EAAE,CAAA,EAOpB,EACiB;IAClB,MAAM,EAAEC,OAAO,CAAA,EAAE,GAAG,MAAMC,CAAAA,GAAAA,mBAAuB,AAG/C,CAAA,wBAH+C,CAACV,WAAW,EAAE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