@expo/cli 0.14.0 → 0.16.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 +13 -5
- package/build/bin/cli.map +1 -1
- package/build/src/api/getVersions.js.map +1 -1
- package/build/src/api/rest/cache/response.js.map +1 -1
- package/build/src/api/rest/client.js +2 -2
- package/build/src/api/rest/client.js.map +1 -1
- package/build/src/api/user/actions.js +1 -1
- package/build/src/api/user/actions.js.map +1 -1
- package/build/src/customize/typescript.js +3 -1
- package/build/src/customize/typescript.js.map +1 -1
- package/build/src/export/createMetadataJson.js +5 -3
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +92 -18
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +3 -3
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/embed/xcodeCompilerLogger.js +97 -0
- package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -0
- package/build/src/export/exportApp.js +106 -130
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +93 -38
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportAsync.js +1 -1
- package/build/src/export/exportAsync.js.map +1 -1
- package/build/src/export/exportHermes.js +0 -90
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +165 -101
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/favicon.js +13 -5
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +84 -57
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/index.js +9 -7
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/metroAssetLocalPath.js +101 -0
- package/build/src/export/metroAssetLocalPath.js.map +1 -0
- package/build/src/export/persistMetroAssets.js +115 -31
- package/build/src/export/persistMetroAssets.js.map +1 -1
- package/build/src/export/publicFolder.js +7 -0
- package/build/src/export/publicFolder.js.map +1 -1
- package/build/src/export/resolveOptions.js +1 -1
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/export/saveAssets.js +168 -43
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/web/exportWebAsync.js +1 -1
- package/build/src/export/web/exportWebAsync.js.map +1 -1
- package/build/src/export/writeContents.js +8 -106
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/install/applyPlugins.js +52 -0
- package/build/src/install/applyPlugins.js.map +1 -0
- package/build/src/install/checkPackages.js +2 -2
- package/build/src/install/checkPackages.js.map +1 -1
- package/build/src/install/fixPackages.js +84 -0
- package/build/src/install/fixPackages.js.map +1 -0
- package/build/src/install/installAsync.js +50 -60
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/installExpoPackage.js +79 -0
- package/build/src/install/installExpoPackage.js.map +1 -0
- package/build/src/prebuild/clearNativeFolder.js +1 -1
- package/build/src/prebuild/clearNativeFolder.js.map +1 -1
- package/build/src/prebuild/configureProjectAsync.js +3 -3
- package/build/src/prebuild/configureProjectAsync.js.map +1 -1
- package/build/src/prebuild/copyTemplateFiles.js +21 -30
- package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +45 -16
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/resolveOptions.js +2 -2
- package/build/src/prebuild/resolveOptions.js.map +1 -1
- package/build/src/prebuild/updateFromTemplate.js +6 -6
- package/build/src/prebuild/updateFromTemplate.js.map +1 -1
- package/build/src/prebuild/updatePackageJson.js +49 -36
- package/build/src/prebuild/updatePackageJson.js.map +1 -1
- package/build/src/prebuild/validateTemplatePlatforms.js +2 -2
- package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -1
- package/build/src/run/hints.js +4 -0
- package/build/src/run/hints.js.map +1 -1
- package/build/src/run/index.js +101 -0
- package/build/src/run/index.js.map +1 -0
- package/build/src/start/doctor/dependencies/bundledNativeModules.js +2 -2
- package/build/src/start/doctor/dependencies/bundledNativeModules.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +22 -7
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/resolvePackages.js +66 -0
- package/build/src/start/doctor/dependencies/resolvePackages.js.map +1 -0
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +22 -33
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +54 -19
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +14 -10
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js +6 -1
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/DevToolsPluginManager.js +63 -0
- package/build/src/start/server/DevToolsPluginManager.js.map +1 -0
- package/build/src/start/server/getStaticRenderFunctions.js +25 -23
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +76 -69
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +6 -2
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js +18 -1
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/bundleApiRoutes.js +5 -3
- package/build/src/start/server/metro/bundleApiRoutes.js.map +1 -1
- package/build/src/start/server/metro/createExpoMetroResolver.js +80 -46
- package/build/src/start/server/metro/createExpoMetroResolver.js.map +1 -1
- package/build/src/start/server/metro/createJResolver.js +152 -0
- package/build/src/start/server/metro/createJResolver.js.map +1 -0
- package/build/src/start/server/metro/createServerRouteMiddleware.js +15 -2
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/{inspector-proxy/device.js → debugging/InspectorDevice.js} +10 -38
- package/build/src/start/server/metro/debugging/InspectorDevice.js.map +1 -0
- package/build/src/start/server/metro/debugging/InspectorProxy.js +116 -0
- package/build/src/start/server/metro/debugging/InspectorProxy.js.map +1 -0
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js +45 -0
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/NetworkResponse.js +3 -4
- package/build/src/start/server/metro/debugging/inspectorHandlers/NetworkResponse.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/PageReload.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeDebuggerGetPossibleBreakpoints.js +5 -6
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerGetPossibleBreakpoints.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeDebuggerScriptParsed.js +3 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerScriptParsed.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeDebuggerSetBreakpointByUrl.js +3 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerSetBreakpointByUrl.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeCallFunctionOn.js +24 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeCallFunctionOn.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeRuntimeGetProperties.js +5 -4
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeGetProperties.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/types.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/utils.js +20 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/utils.js.map +1 -0
- package/build/src/start/server/metro/externals.js +25 -3
- package/build/src/start/server/metro/externals.js.map +1 -1
- package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +40 -15
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +3 -2
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/router.js +5 -6
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +17 -27
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/serializeHtml.js +59 -0
- package/build/src/start/server/metro/serializeHtml.js.map +1 -0
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +1 -2
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +237 -214
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/metro/withMetroResolvers.js +114 -40
- package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js +61 -0
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js.map +1 -0
- package/build/src/start/server/middleware/ExpoMiddleware.js +2 -2
- package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +22 -66
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js +23 -2
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js +30 -26
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js +7 -7
- package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js +5 -2
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js +3 -2
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js +8 -7
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +176 -0
- package/build/src/start/server/middleware/metroOptions.js.map +1 -0
- package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js.map +1 -1
- package/build/src/start/server/type-generation/__typetests__/route.test.js +11 -3
- package/build/src/start/server/type-generation/__typetests__/route.test.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +6 -4
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
- package/build/src/utils/analytics/getMetroDebugProperties.js +1 -2
- package/build/src/utils/analytics/getMetroDebugProperties.js.map +1 -1
- package/build/src/utils/analytics/getMetroProperties.js +1 -2
- package/build/src/utils/analytics/getMetroProperties.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/args.js +4 -2
- package/build/src/utils/args.js.map +1 -1
- package/build/src/utils/cocoapods.js +1 -1
- package/build/src/utils/cocoapods.js.map +1 -1
- package/build/src/utils/codesigning.js +11 -1
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/dir.js +18 -8
- package/build/src/utils/dir.js.map +1 -1
- package/build/src/utils/env.js +10 -1
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/getOrPromptApplicationId.js +2 -4
- package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
- package/build/src/utils/prompts.js +1 -28
- package/build/src/utils/prompts.js.map +1 -1
- package/build/src/utils/tsconfig/loadTsConfigPaths.js +3 -11
- package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +1 -1
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +22 -12
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +1 -1
- package/package.json +19 -18
- package/static/shims/react-native-web/dist/cjs/exports/AppRegistry/AppContainer.js +13 -0
- package/static/shims/react-native-web/dist/exports/AppRegistry/AppContainer.js +12 -0
- package/static/template/index.html +14 -95
- package/build/src/export/printBundleSizes.js +0 -101
- package/build/src/export/printBundleSizes.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/device.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/NetworkResponse.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/PageReload.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerScriptParsed.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerSetBreakpointByUrl.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeGetProperties.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/types.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/index.js +0 -27
- package/build/src/start/server/metro/inspector-proxy/index.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/proxy.js +0 -169
- package/build/src/start/server/metro/inspector-proxy/proxy.js.map +0 -1
- package/build/src/start/server/metro/resolveFromProject.js +0 -90
- package/build/src/start/server/metro/resolveFromProject.js.map +0 -1
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +0 -64
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +0 -1
- /package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/PageReload.js +0 -0
- /package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/types.js +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.installExpoPackageAsync = installExpoPackageAsync;
|
|
6
|
+
var _spawnAsync = _interopRequireDefault(require("@expo/spawn-async"));
|
|
7
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
|
+
var Log = _interopRequireWildcard(require("../log"));
|
|
9
|
+
var _getRunningProcess = require("../utils/getRunningProcess");
|
|
10
|
+
function _interopRequireDefault(obj) {
|
|
11
|
+
return obj && obj.__esModule ? obj : {
|
|
12
|
+
default: obj
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function _interopRequireWildcard(obj) {
|
|
16
|
+
if (obj && obj.__esModule) {
|
|
17
|
+
return obj;
|
|
18
|
+
} else {
|
|
19
|
+
var newObj = {};
|
|
20
|
+
if (obj != null) {
|
|
21
|
+
for(var key in obj){
|
|
22
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
23
|
+
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
|
24
|
+
if (desc.get || desc.set) {
|
|
25
|
+
Object.defineProperty(newObj, key, desc);
|
|
26
|
+
} else {
|
|
27
|
+
newObj[key] = obj[key];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
newObj.default = obj;
|
|
33
|
+
return newObj;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function installExpoPackageAsync(projectRoot, { packageManager , packageManagerArguments , expoPackageToInstall , followUpCommandArgs }) {
|
|
37
|
+
// Check if there's potentially a dev server running in the current folder and warn about it
|
|
38
|
+
// (not guaranteed to be Expo CLI, and the CLI isn't always running on 8081, but it's a good guess)
|
|
39
|
+
const isExpoMaybeRunningForProject = !!await (0, _getRunningProcess).getRunningProcess(8081);
|
|
40
|
+
if (isExpoMaybeRunningForProject) {
|
|
41
|
+
Log.warn("The Expo CLI appears to be running this project in another terminal window. Close and restart any Expo CLI instances after the installation to complete the update.");
|
|
42
|
+
}
|
|
43
|
+
// Safe to use current process to upgrade Expo package- doesn't affect current process
|
|
44
|
+
try {
|
|
45
|
+
await packageManager.addAsync([
|
|
46
|
+
...packageManagerArguments,
|
|
47
|
+
expoPackageToInstall
|
|
48
|
+
]);
|
|
49
|
+
} catch (error) {
|
|
50
|
+
Log.error(_chalk.default`Cannot install the latest Expo package. Install {bold expo@latest} with ${packageManager.name} and then run {bold npx expo install} again.`);
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
Log.log(_chalk.default`\u203A Running {bold npx expo install} under the updated expo version`);
|
|
54
|
+
let commandSegments = [
|
|
55
|
+
"expo",
|
|
56
|
+
"install",
|
|
57
|
+
...followUpCommandArgs
|
|
58
|
+
];
|
|
59
|
+
if (packageManagerArguments.length) {
|
|
60
|
+
commandSegments = [
|
|
61
|
+
...commandSegments,
|
|
62
|
+
"--",
|
|
63
|
+
...packageManagerArguments
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
Log.log("> " + commandSegments.join(" "));
|
|
67
|
+
// Spawn a new process to install the rest of the packages, as only then will the latest Expo package be used
|
|
68
|
+
if (followUpCommandArgs.length) {
|
|
69
|
+
await (0, _spawnAsync).default("npx", commandSegments, {
|
|
70
|
+
stdio: "inherit",
|
|
71
|
+
cwd: projectRoot,
|
|
72
|
+
env: {
|
|
73
|
+
...process.env
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=installExpoPackage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/install/installExpoPackage.ts"],"sourcesContent":["import * as PackageManager from '@expo/package-manager';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\n\nimport * as Log from '../log';\nimport { getRunningProcess } from '../utils/getRunningProcess';\n\n/**\n * Given a list of incompatible packages, installs the correct versions of the packages with the package manager used for the project.\n * This exits immediately after spawning the install command, since the command shouldn't remain running while it is being updated.\n */\nexport async function installExpoPackageAsync(\n projectRoot: string,\n {\n packageManager,\n packageManagerArguments,\n expoPackageToInstall,\n followUpCommandArgs,\n }: {\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n expoPackageToInstall: string;\n followUpCommandArgs: string[];\n }\n) {\n // Check if there's potentially a dev server running in the current folder and warn about it\n // (not guaranteed to be Expo CLI, and the CLI isn't always running on 8081, but it's a good guess)\n const isExpoMaybeRunningForProject = !!(await getRunningProcess(8081));\n\n if (isExpoMaybeRunningForProject) {\n Log.warn(\n 'The Expo CLI appears to be running this project in another terminal window. Close and restart any Expo CLI instances after the installation to complete the update.'\n );\n }\n\n // Safe to use current process to upgrade Expo package- doesn't affect current process\n try {\n await packageManager.addAsync([...packageManagerArguments, expoPackageToInstall]);\n } catch (error) {\n Log.error(\n chalk`Cannot install the latest Expo package. Install {bold expo@latest} with ${packageManager.name} and then run {bold npx expo install} again.`\n );\n throw error;\n }\n\n Log.log(chalk`\\u203A Running {bold npx expo install} under the updated expo version`);\n\n let commandSegments = ['expo', 'install', ...followUpCommandArgs];\n if (packageManagerArguments.length) {\n commandSegments = [...commandSegments, '--', ...packageManagerArguments];\n }\n\n Log.log('> ' + commandSegments.join(' '));\n\n // Spawn a new process to install the rest of the packages, as only then will the latest Expo package be used\n if (followUpCommandArgs.length) {\n await spawnAsync('npx', commandSegments, {\n stdio: 'inherit',\n cwd: projectRoot,\n env: { ...process.env },\n });\n }\n}\n"],"names":["installExpoPackageAsync","Log","projectRoot","packageManager","packageManagerArguments","expoPackageToInstall","followUpCommandArgs","isExpoMaybeRunningForProject","getRunningProcess","warn","addAsync","error","chalk","name","log","command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G,CAAC,IAAI,GAAGC,eAAe,CAACE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAE1C,6GAA6G;IAC7G,IAAIX,mBAAmB,CAACU,MAAM,EAAE;QAC9B,MAAME,CAAAA,GAAAA,WAAU,AAId,CAAA,QAJc,CAAC,KAAK,EAAEH,eAAe,EAAE;YACvCI,KAAK,EAAE,SAAS;YAChBC,GAAG,EAAElB,WAAW;YAChBmB,GAAG,EAAE;gBAAE,GAAGC,OAAO,CAACD,GAAG;aAAE;SACxB,CAAC,CAAC;KACJ;CACF"}
|
|
@@ -124,7 +124,7 @@ async function promptToClearMalformedNativeProjectsAsync(projectRoot, checkPlatf
|
|
|
124
124
|
// Prompt which platforms to reset.
|
|
125
125
|
const message = platforms.length > 1 ? `The ${displayPlatforms[0]} and ${displayPlatforms[1]} projects are malformed` : `The ${displayPlatforms[0]} project is malformed`;
|
|
126
126
|
if (// If the process is non-interactive, default to clearing the malformed native project.
|
|
127
|
-
// This would only happen on re-running
|
|
127
|
+
// This would only happen on re-running prebuild.
|
|
128
128
|
!(0, _interactive).isInteractive() || // Prompt to clear the native folders.
|
|
129
129
|
(await (0, _prompts).confirmAsync({
|
|
130
130
|
message: `${message}, would you like to clear the project files and reinitialize them?`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/clearNativeFolder.ts"],"sourcesContent":["import { AndroidConfig, IOSConfig, ModPlatform } from '@expo/config-plugins';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { directoryExistsAsync } from '../utils/dir';\nimport { isInteractive } from '../utils/interactive';\nimport { logNewSection } from '../utils/ora';\nimport { confirmAsync } from '../utils/prompts';\n\ntype ArbitraryPlatform = ModPlatform | string;\n\n/** Delete the input native folders and print a loading step. */\nexport async function clearNativeFolder(projectRoot: string, folders: string[]) {\n const step = logNewSection(`Clearing ${folders.join(', ')}`);\n try {\n await Promise.all(\n folders.map((folderName) =>\n fs.promises.rm(path.join(projectRoot, folderName), {\n recursive: true,\n force: true,\n })\n )\n );\n step.succeed(`Cleared ${folders.join(', ')} code`);\n } catch (error: any) {\n step.fail(`Failed to delete ${folders.join(', ')} code: ${error.message}`);\n throw error;\n }\n}\n\n/**\n * Returns `true` if a certain subset of required Android project files are intact.\n *\n * This isn't perfect but it serves the purpose of indicating that the user should\n * be warned to nuke the project files, most commonly when git is cleared and the root folder\n * remains in memory.\n */\nexport async function hasRequiredAndroidFilesAsync(projectRoot: string): Promise<boolean> {\n try {\n await Promise.all([\n AndroidConfig.Paths.getAppBuildGradleAsync(projectRoot),\n AndroidConfig.Paths.getProjectBuildGradleAsync(projectRoot),\n AndroidConfig.Paths.getAndroidManifestAsync(projectRoot),\n AndroidConfig.Paths.getMainApplicationAsync(projectRoot),\n ]);\n return true;\n } catch {\n return false;\n }\n}\n\n/** Returns `true` if a certain subset of required iOS project files are intact. */\nexport async function hasRequiredIOSFilesAsync(projectRoot: string) {\n try {\n // If any of the following required files are missing, then the project is malformed.\n await Promise.all([\n IOSConfig.Paths.getAllXcodeProjectPaths(projectRoot),\n IOSConfig.Paths.getAllPBXProjectPaths(projectRoot),\n ]);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Filter out platforms that do not have an existing platform folder.\n * If the user wants to validate that neither of ['ios', 'android'] are malformed then we should\n * first check that both `ios` and `android` folders exist.\n *\n * This optimization prevents us from prompting to clear a \"malformed\" project that doesn't exist yet.\n */\nasync function filterPlatformsThatDoNotExistAsync(\n projectRoot: string,\n platforms: ArbitraryPlatform[]\n): Promise<ArbitraryPlatform[]> {\n const valid = await Promise.all(\n platforms.map(async (platform) => {\n if (await directoryExistsAsync(path.join(projectRoot, platform))) {\n return platform;\n }\n return null;\n })\n );\n return valid.filter(Boolean) as ArbitraryPlatform[];\n}\n\n/** Get a list of native platforms that have existing directories which contain malformed projects. */\nexport async function getMalformedNativeProjectsAsync(\n projectRoot: string,\n platforms: ArbitraryPlatform[]\n): Promise<ArbitraryPlatform[]> {\n const VERIFIERS: Record<ArbitraryPlatform, (root: string) => Promise<boolean>> = {\n android: hasRequiredAndroidFilesAsync,\n ios: hasRequiredIOSFilesAsync,\n };\n\n const checkablePlatforms = platforms.filter((platform) => platform in VERIFIERS);\n const checkPlatforms = await filterPlatformsThatDoNotExistAsync(projectRoot, checkablePlatforms);\n return (\n await Promise.all(\n checkPlatforms.map(async (platform) => {\n if (!VERIFIERS[platform]) {\n return false;\n }\n if (await VERIFIERS[platform](projectRoot)) {\n return false;\n }\n return platform;\n })\n )\n ).filter(Boolean) as ArbitraryPlatform[];\n}\n\nexport async function promptToClearMalformedNativeProjectsAsync(\n projectRoot: string,\n checkPlatforms: ArbitraryPlatform[]\n) {\n const platforms = await getMalformedNativeProjectsAsync(projectRoot, checkPlatforms);\n\n if (!platforms.length) {\n return;\n }\n\n const displayPlatforms = platforms.map((platform) => chalk.cyan(platform));\n // Prompt which platforms to reset.\n const message =\n platforms.length > 1\n ? `The ${displayPlatforms[0]} and ${displayPlatforms[1]} projects are malformed`\n : `The ${displayPlatforms[0]} project is malformed`;\n\n if (\n // If the process is non-interactive, default to clearing the malformed native project.\n // This would only happen on re-running eject.\n !isInteractive() ||\n // Prompt to clear the native folders.\n (await confirmAsync({\n message: `${message}, would you like to clear the project files and reinitialize them?`,\n initial: true,\n }))\n ) {\n if (!isInteractive()) {\n Log.warn(`${message}, project files will be cleared and reinitialized.`);\n }\n await clearNativeFolder(projectRoot, platforms);\n } else {\n // Warn the user that the process may fail.\n Log.warn('Continuing with malformed native projects');\n }\n}\n"],"names":["clearNativeFolder","hasRequiredAndroidFilesAsync","hasRequiredIOSFilesAsync","getMalformedNativeProjectsAsync","promptToClearMalformedNativeProjectsAsync","Log","projectRoot","folders","step","logNewSection","join","Promise","all","map","folderName","fs","promises","rm","path","recursive","force","succeed","error","fail","message","AndroidConfig","Paths","getAppBuildGradleAsync","getProjectBuildGradleAsync","getAndroidManifestAsync","getMainApplicationAsync","IOSConfig","getAllXcodeProjectPaths","getAllPBXProjectPaths","filterPlatformsThatDoNotExistAsync","platforms","valid","platform","directoryExistsAsync","filter","Boolean","VERIFIERS","android","ios","checkablePlatforms","checkPlatforms","length","displayPlatforms","chalk","cyan","isInteractive","confirmAsync","initial","warn"],"mappings":"AAAA;;;;QAcsBA,iBAAiB,GAAjBA,iBAAiB;QAyBjBC,4BAA4B,GAA5BA,4BAA4B;QAe5BC,wBAAwB,GAAxBA,wBAAwB;QAoCxBC,+BAA+B,GAA/BA,+BAA+B;QA0B/BC,yCAAyC,GAAzCA,yCAAyC;AApHT,IAAA,cAAsB,WAAtB,sBAAsB,CAAA;AAC1D,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEXC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACsB,IAAA,IAAc,WAAd,cAAc,CAAA;AACrB,IAAA,YAAsB,WAAtB,sBAAsB,CAAA;AACtB,IAAA,IAAc,WAAd,cAAc,CAAA;AACf,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKxC,eAAeL,iBAAiB,CAACM,WAAmB,EAAEC,OAAiB,EAAE;IAC9E,MAAMC,IAAI,GAAGC,CAAAA,GAAAA,IAAa,AAAkC,CAAA,cAAlC,CAAC,CAAC,SAAS,EAAEF,OAAO,CAACG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,AAAC;IAC7D,IAAI;QACF,MAAMC,OAAO,CAACC,GAAG,CACfL,OAAO,CAACM,GAAG,CAAC,CAACC,UAAU,GACrBC,GAAE,QAAA,CAACC,QAAQ,CAACC,EAAE,CAACC,KAAI,QAAA,CAACR,IAAI,CAACJ,WAAW,EAAEQ,UAAU,CAAC,EAAE;gBACjDK,SAAS,EAAE,IAAI;gBACfC,KAAK,EAAE,IAAI;aACZ,CAAC;QAAA,CACH,CACF,CAAC;Q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AACW,MAAM,EAAE;QACrB,OAAO;KACR;IAED,MAAMC,gBAAgB,GAAGZ,SAAS,CAACtB,GAAG,CAAC,CAACwB,QAAQ,GAAKW,MAAK,QAAA,CAACC,IAAI,CAACZ,QAAQ,CAAC;IAAA,CAAC,AAAC;IAC3E,mCAAmC;IACnC,MAAMb,OAAO,GACXW,SAAS,CAACW,MAAM,GAAG,CAAC,GAChB,CAAC,IAAI,EAAEC,gBAAgB,CAAC,CAAC,CAAC,CAAC,KAAK,EAAEA,gBAAgB,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,GAC9E,CAAC,IAAI,EAAEA,gBAAgB,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,AAAC;IAExD,IACE,uFAAuF;IACvF,8CAA8C;IAC9C,CAACG,CAAAA,GAAAA,YAAa,AAAE,CAAA,cAAF,EAAE,IAChB,sCAAsC;IACtC,CAAC,MAAMC,CAAAA,GAAAA,QAAY,AAGjB,CAAA,aAHiB,CAAC;QAClB3B,OAAO,EAAE,CAAC,EAAEA,OAAO,CAAC,kEAAkE,CAAC;QACvF4B,OAAO,EAAE,IAAI;KACd,CAAC,CAAC,EACH;QACA,IAAI,CAACF,CAAAA,GAAAA,YAAa,AAAE,CAAA,cAAF,EAAE,EAAE;YACpB7C,GAAG,CAACgD,IAAI,CAAC,CAAC,EAAE7B,OAAO,CAAC,kDAAkD,CAAC,CAAC,CAAC;SAC1E;QACD,MAAMxB,iBAAiB,CAACM,WAAW,EAAE6B,SAAS,CAAC,CAAC;KACjD,MAAM;QACL,2CAA2C;QAC3C9B,GAAG,CAACgD,IAAI,CAAC,2CAA2C,CAAC,CAAC;KACvD;CACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/clearNativeFolder.ts"],"sourcesContent":["import { AndroidConfig, IOSConfig, ModPlatform } from '@expo/config-plugins';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { directoryExistsAsync } from '../utils/dir';\nimport { isInteractive } from '../utils/interactive';\nimport { logNewSection } from '../utils/ora';\nimport { confirmAsync } from '../utils/prompts';\n\ntype ArbitraryPlatform = ModPlatform | string;\n\n/** Delete the input native folders and print a loading step. */\nexport async function clearNativeFolder(projectRoot: string, folders: string[]) {\n const step = logNewSection(`Clearing ${folders.join(', ')}`);\n try {\n await Promise.all(\n folders.map((folderName) =>\n fs.promises.rm(path.join(projectRoot, folderName), {\n recursive: true,\n force: true,\n })\n )\n );\n step.succeed(`Cleared ${folders.join(', ')} code`);\n } catch (error: any) {\n step.fail(`Failed to delete ${folders.join(', ')} code: ${error.message}`);\n throw error;\n }\n}\n\n/**\n * Returns `true` if a certain subset of required Android project files are intact.\n *\n * This isn't perfect but it serves the purpose of indicating that the user should\n * be warned to nuke the project files, most commonly when git is cleared and the root folder\n * remains in memory.\n */\nexport async function hasRequiredAndroidFilesAsync(projectRoot: string): Promise<boolean> {\n try {\n await Promise.all([\n AndroidConfig.Paths.getAppBuildGradleAsync(projectRoot),\n AndroidConfig.Paths.getProjectBuildGradleAsync(projectRoot),\n AndroidConfig.Paths.getAndroidManifestAsync(projectRoot),\n AndroidConfig.Paths.getMainApplicationAsync(projectRoot),\n ]);\n return true;\n } catch {\n return false;\n }\n}\n\n/** Returns `true` if a certain subset of required iOS project files are intact. */\nexport async function hasRequiredIOSFilesAsync(projectRoot: string) {\n try {\n // If any of the following required files are missing, then the project is malformed.\n await Promise.all([\n IOSConfig.Paths.getAllXcodeProjectPaths(projectRoot),\n IOSConfig.Paths.getAllPBXProjectPaths(projectRoot),\n ]);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Filter out platforms that do not have an existing platform folder.\n * If the user wants to validate that neither of ['ios', 'android'] are malformed then we should\n * first check that both `ios` and `android` folders exist.\n *\n * This optimization prevents us from prompting to clear a \"malformed\" project that doesn't exist yet.\n */\nasync function filterPlatformsThatDoNotExistAsync(\n projectRoot: string,\n platforms: ArbitraryPlatform[]\n): Promise<ArbitraryPlatform[]> {\n const valid = await Promise.all(\n platforms.map(async (platform) => {\n if (await directoryExistsAsync(path.join(projectRoot, platform))) {\n return platform;\n }\n return null;\n })\n );\n return valid.filter(Boolean) as ArbitraryPlatform[];\n}\n\n/** Get a list of native platforms that have existing directories which contain malformed projects. */\nexport async function getMalformedNativeProjectsAsync(\n projectRoot: string,\n platforms: ArbitraryPlatform[]\n): Promise<ArbitraryPlatform[]> {\n const VERIFIERS: Record<ArbitraryPlatform, (root: string) => Promise<boolean>> = {\n android: hasRequiredAndroidFilesAsync,\n ios: hasRequiredIOSFilesAsync,\n };\n\n const checkablePlatforms = platforms.filter((platform) => platform in VERIFIERS);\n const checkPlatforms = await filterPlatformsThatDoNotExistAsync(projectRoot, checkablePlatforms);\n return (\n await Promise.all(\n checkPlatforms.map(async (platform) => {\n if (!VERIFIERS[platform]) {\n return false;\n }\n if (await VERIFIERS[platform](projectRoot)) {\n return false;\n }\n return platform;\n })\n )\n ).filter(Boolean) as ArbitraryPlatform[];\n}\n\nexport async function promptToClearMalformedNativeProjectsAsync(\n projectRoot: string,\n checkPlatforms: ArbitraryPlatform[]\n) {\n const platforms = await getMalformedNativeProjectsAsync(projectRoot, checkPlatforms);\n\n if (!platforms.length) {\n return;\n }\n\n const displayPlatforms = platforms.map((platform) => chalk.cyan(platform));\n // Prompt which platforms to reset.\n const message =\n platforms.length > 1\n ? `The ${displayPlatforms[0]} and ${displayPlatforms[1]} projects are malformed`\n : `The ${displayPlatforms[0]} project is malformed`;\n\n if (\n // If the process is non-interactive, default to clearing the malformed native project.\n // This would only happen on re-running prebuild.\n !isInteractive() ||\n // Prompt to clear the native folders.\n (await confirmAsync({\n message: `${message}, would you like to clear the project files and reinitialize them?`,\n initial: true,\n }))\n ) {\n if (!isInteractive()) {\n Log.warn(`${message}, project files will be cleared and reinitialized.`);\n }\n await clearNativeFolder(projectRoot, platforms);\n } else {\n // Warn the user that the process may fail.\n Log.warn('Continuing with malformed native projects');\n }\n}\n"],"names":["clearNativeFolder","hasRequiredAndroidFilesAsync","hasRequiredIOSFilesAsync","getMalformedNativeProjectsAsync","promptToClearMalformedNativeProjectsAsync","Log","projectRoot","folders","step","logNewSection","join","Promise","all","map","folderName","fs","promises","rm","path","recursive","force","succeed","error","fail","message","AndroidConfig","Paths","getAppBuildGradleAsync","getProjectBuildGradleAsync","getAndroidManifestAsync","getMainApplicationAsync","IOSConfig","getAllXcodeProjectPaths","getAllPBXProjectPaths","filterPlatformsThatDoNotExistAsync","platforms","valid","platform","directoryExistsAsync","filter","Boolean","VERIFIERS","android","ios","checkablePlatforms","checkPlatforms","length","displayPlatforms","chalk","cyan","isInteractive","confirmAsync","initial","warn"],"mappings":"AAAA;;;;QAcsBA,iBAAiB,GAAjBA,iBAAiB;QAyBjBC,4BAA4B,GAA5BA,4BAA4B;QAe5BC,wBAAwB,GAAxBA,wBAAwB;QAoCxBC,+BAA+B,GAA/BA,+BAA+B;QA0B/BC,yCAAyC,GAAzCA,yCAAyC;AApHT,IAAA,cAAsB,WAAtB,sBAAsB,CAAA;AAC1D,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEXC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACsB,IAAA,IAAc,WAAd,cAAc,CAAA;AACrB,IAAA,YAAsB,WAAtB,sBAAsB,CAAA;AACtB,IAAA,IAAc,WAAd,cAAc,CAAA;AACf,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKxC,eAAeL,iBAAiB,CAACM,WAAmB,EAAEC,OAAiB,EAAE;IAC9E,MAAMC,IAAI,GAAGC,CAAAA,GAAAA,IAAa,AAAkC,CAAA,cAAlC,CAAC,CAAC,SAAS,EAAEF,OAAO,CAACG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,AAAC;IAC7D,IAAI;QACF,MAAMC,OAAO,CAACC,GAAG,C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AAI,CAAC,2CAA2C,CAAC,CAAC;KACvD;CACF"}
|
|
@@ -30,16 +30,16 @@ function _interopRequireWildcard(obj) {
|
|
|
30
30
|
return newObj;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
async function configureProjectAsync(projectRoot, { platforms }) {
|
|
33
|
+
async function configureProjectAsync(projectRoot, { platforms , exp }) {
|
|
34
34
|
let bundleIdentifier;
|
|
35
35
|
if (platforms.includes("ios")) {
|
|
36
36
|
// Check bundle ID before reading the config because it may mutate the config if the user is prompted to define it.
|
|
37
|
-
bundleIdentifier = await (0, _getOrPromptApplicationId).getOrPromptForBundleIdentifier(projectRoot);
|
|
37
|
+
bundleIdentifier = await (0, _getOrPromptApplicationId).getOrPromptForBundleIdentifier(projectRoot, exp);
|
|
38
38
|
}
|
|
39
39
|
let packageName;
|
|
40
40
|
if (platforms.includes("android")) {
|
|
41
41
|
// Check package before reading the config because it may mutate the config if the user is prompted to define it.
|
|
42
|
-
packageName = await (0, _getOrPromptApplicationId).getOrPromptForPackage(projectRoot);
|
|
42
|
+
packageName = await (0, _getOrPromptApplicationId).getOrPromptForPackage(projectRoot, exp);
|
|
43
43
|
}
|
|
44
44
|
let { exp: config } = await (0, _prebuildConfig).getPrebuildConfigAsync(projectRoot, {
|
|
45
45
|
platforms,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/configureProjectAsync.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { compileModsAsync, ModPlatform } from '@expo/config-plugins';\nimport { getPrebuildConfigAsync } from '@expo/prebuild-config';\n\nimport { logConfig } from '../config/configAsync';\nimport * as Log from '../log';\nimport { env } from '../utils/env';\nimport {\n getOrPromptForBundleIdentifier,\n getOrPromptForPackage,\n} from '../utils/getOrPromptApplicationId';\n\nexport async function configureProjectAsync(\n projectRoot: string,\n {\n platforms,\n }: {\n platforms: ModPlatform[];\n }\n): Promise<ExpoConfig> {\n let bundleIdentifier: string | undefined;\n if (platforms.includes('ios')) {\n // Check bundle ID before reading the config because it may mutate the config if the user is prompted to define it.\n bundleIdentifier = await getOrPromptForBundleIdentifier(projectRoot);\n }\n let packageName: string | undefined;\n if (platforms.includes('android')) {\n // Check package before reading the config because it may mutate the config if the user is prompted to define it.\n packageName = await getOrPromptForPackage(projectRoot);\n }\n\n let { exp: config } = await getPrebuildConfigAsync(projectRoot, {\n platforms,\n packageName,\n bundleIdentifier,\n });\n\n // compile all plugins and mods\n config = await compileModsAsync(config, {\n projectRoot,\n platforms,\n assertMissingModProviders: false,\n });\n\n if (env.EXPO_DEBUG) {\n Log.log();\n Log.log('Evaluated config:');\n logConfig(config);\n Log.log();\n }\n\n return config;\n}\n"],"names":["configureProjectAsync","Log","projectRoot","platforms","bundleIdentifier","includes","getOrPromptForBundleIdentifier","packageName","getOrPromptForPackage","
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/configureProjectAsync.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { compileModsAsync, ModPlatform } from '@expo/config-plugins';\nimport { getPrebuildConfigAsync } from '@expo/prebuild-config';\n\nimport { logConfig } from '../config/configAsync';\nimport * as Log from '../log';\nimport { env } from '../utils/env';\nimport {\n getOrPromptForBundleIdentifier,\n getOrPromptForPackage,\n} from '../utils/getOrPromptApplicationId';\n\nexport async function configureProjectAsync(\n projectRoot: string,\n {\n platforms,\n exp,\n }: {\n platforms: ModPlatform[];\n exp?: ExpoConfig;\n }\n): Promise<ExpoConfig> {\n let bundleIdentifier: string | undefined;\n if (platforms.includes('ios')) {\n // Check bundle ID before reading the config because it may mutate the config if the user is prompted to define it.\n bundleIdentifier = await getOrPromptForBundleIdentifier(projectRoot, exp);\n }\n let packageName: string | undefined;\n if (platforms.includes('android')) {\n // Check package before reading the config because it may mutate the config if the user is prompted to define it.\n packageName = await getOrPromptForPackage(projectRoot, exp);\n }\n\n let { exp: config } = await getPrebuildConfigAsync(projectRoot, {\n platforms,\n packageName,\n bundleIdentifier,\n });\n\n // compile all plugins and mods\n config = await compileModsAsync(config, {\n projectRoot,\n platforms,\n assertMissingModProviders: false,\n });\n\n if (env.EXPO_DEBUG) {\n Log.log();\n Log.log('Evaluated config:');\n logConfig(config);\n Log.log();\n }\n\n return config;\n}\n"],"names":["configureProjectAsync","Log","projectRoot","platforms","exp","bundleIdentifier","includes","getOrPromptForBundleIdentifier","packageName","getOrPromptForPackage","config","getPrebuildConfigAsync","compileModsAsync","assertMissingModProviders","env","EXPO_DEBUG","log","logConfig"],"mappings":"AAAA;;;;QAYsBA,qBAAqB,GAArBA,qBAAqB;AAXG,IAAA,cAAsB,WAAtB,sBAAsB,CAAA;AAC7B,IAAA,eAAuB,WAAvB,uBAAuB,CAAA;AAEpC,IAAA,YAAuB,WAAvB,uBAAuB,CAAA;AACrCC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACK,IAAA,IAAc,WAAd,cAAc,CAAA;AAI3B,IAAA,yBAAmC,WAAnC,mCAAmC,CAAA;;;;;;;;;;;;;;;;;;;;;;AAEnC,eAAeD,qBAAqB,CACzCE,WAAmB,EACnB,EACEC,SAAS,CAAA,EACTC,GAAG,CAAA,EAIJ,EACoB;IACrB,IAAIC,gBAAgB,AAAoB,AAAC;IACzC,IAAIF,SAAS,CAACG,QAAQ,CAAC,KAAK,CAAC,EAAE;QAC7B,mHAAmH;QACnHD,gBAAgB,GAAG,MAAME,CAAAA,GAAAA,yBAA8B,AAAkB,CAAA,+BAAlB,CAACL,WAAW,EAAEE,GAAG,CAAC,CAAC;KAC3E;IACD,IAAII,WAAW,AAAoB,AAAC;IACpC,IAAIL,SAAS,CAACG,QAAQ,CAAC,SAAS,CAAC,EAAE;QACjC,iHAAiH;QACjHE,WAAW,GAAG,MAAMC,CAAAA,GAAAA,yBAAqB,AAAkB,CAAA,sBAAlB,CAACP,WAAW,EAAEE,GAAG,CAAC,CAAC;KAC7D;IAED,IAAI,EAAEA,GAAG,EAAEM,MAAM,CAAA,EAAE,GAAG,MAAMC,CAAAA,GAAAA,eAAsB,AAIhD,CAAA,uBAJgD,CAACT,WAAW,EAAE;QAC9DC,SAAS;QACTK,WAAW;QACXH,gBAAgB;KACjB,CAAC,AAAC;IAEH,+BAA+B;IAC/BK,MAAM,GAAG,MAAME,CAAAA,GAAAA,cAAgB,AAI7B,CAAA,iBAJ6B,CAACF,MAAM,EAAE;QACtCR,WAAW;QACXC,SAAS;QACTU,yBAAyB,EAAE,KAAK;KACjC,CAAC,CAAC;IAEH,IAAIC,IAAG,IAAA,CAACC,UAAU,EAAE;QAClBd,GAAG,CAACe,GAAG,EAAE,CAAC;QACVf,GAAG,CAACe,GAAG,CAAC,mBAAmB,CAAC,CAAC;QAC7BC,CAAAA,GAAAA,YAAS,AAAQ,CAAA,UAAR,CAACP,MAAM,CAAC,CAAC;QAClBT,GAAG,CAACe,GAAG,EAAE,CAAC;KACX;IAED,OAAON,MAAM,CAAC;CACf"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.createCopyFilesSuccessMessage = createCopyFilesSuccessMessage;
|
|
6
|
-
exports.
|
|
6
|
+
exports.copyTemplateFiles = copyTemplateFiles;
|
|
7
7
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
8
|
var _fs = _interopRequireDefault(require("fs"));
|
|
9
9
|
var _path = _interopRequireDefault(require("path"));
|
|
@@ -25,51 +25,42 @@ const debug = require("debug")("expo:prebuild:copyTemplateFiles");
|
|
|
25
25
|
, true);
|
|
26
26
|
}
|
|
27
27
|
function createCopyFilesSuccessMessage(platforms, { skippedPaths , gitignore }) {
|
|
28
|
-
|
|
28
|
+
const pluralized = platforms.length > 1 ? "directories" : "directory";
|
|
29
|
+
let message = `Created native ${pluralized}`;
|
|
29
30
|
if (skippedPaths.length) {
|
|
30
|
-
message += _chalk.default.dim(` | ${skippedPaths.map((path)=>_chalk.default.bold(`/${path}`)
|
|
31
|
-
).join(", ")}
|
|
31
|
+
message += _chalk.default.dim(` | reusing ${skippedPaths.map((path)=>_chalk.default.bold(`/${path}`)
|
|
32
|
+
).join(", ")}`);
|
|
32
33
|
}
|
|
33
34
|
if (!gitignore) {
|
|
34
|
-
|
|
35
|
+
// Add no additional message...
|
|
35
36
|
} else if (!gitignore.didMerge) {
|
|
36
|
-
message += _chalk.default.dim(` | gitignore
|
|
37
|
+
message += _chalk.default.dim(` | reusing gitignore`);
|
|
37
38
|
} else if (gitignore.didMerge && gitignore.didClear) {
|
|
38
|
-
|
|
39
|
+
// This is legacy and for non-standard templates. The Expo template adds gitignores to the platform folders.
|
|
40
|
+
message += _chalk.default.dim(` | updated gitignore`);
|
|
39
41
|
}
|
|
40
42
|
return message;
|
|
41
43
|
}
|
|
42
|
-
|
|
43
|
-
const copyResults = await copyPathsFromTemplateAsync(projectRoot, {
|
|
44
|
-
templateDirectory,
|
|
45
|
-
copyFilePaths: platforms
|
|
46
|
-
});
|
|
47
|
-
const hasPlatformSpecificGitIgnores = hasAllPlatformSpecificGitIgnores(templateDirectory, platforms);
|
|
48
|
-
debug(`All platforms have an internal gitignore: ${hasPlatformSpecificGitIgnores}`);
|
|
49
|
-
// TODO: Remove gitignore modifications -- maybe move to `npx expo-doctor`
|
|
50
|
-
const gitignore = hasPlatformSpecificGitIgnores ? null : (0, _mergeGitIgnorePaths).mergeGitIgnorePaths(_path.default.join(projectRoot, ".gitignore"), _path.default.join(templateDirectory, ".gitignore"));
|
|
51
|
-
return {
|
|
52
|
-
...copyResults,
|
|
53
|
-
gitignore
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
async function copyPathsFromTemplateAsync(/** File path to the project. */ projectRoot, { templateDirectory , copyFilePaths }) {
|
|
44
|
+
function copyTemplateFiles(projectRoot, { templateDirectory , platforms }) {
|
|
57
45
|
const copiedPaths = [];
|
|
58
46
|
const skippedPaths = [];
|
|
59
|
-
|
|
47
|
+
platforms.forEach((copyFilePath)=>{
|
|
60
48
|
const projectPath = _path.default.join(projectRoot, copyFilePath);
|
|
61
|
-
if (
|
|
49
|
+
if (_fs.default.existsSync(projectPath)) {
|
|
50
|
+
skippedPaths.push(copyFilePath);
|
|
51
|
+
} else {
|
|
62
52
|
copiedPaths.push(copyFilePath);
|
|
63
53
|
(0, _dir).copySync(_path.default.join(templateDirectory, copyFilePath), projectPath);
|
|
64
|
-
} else {
|
|
65
|
-
skippedPaths.push(copyFilePath);
|
|
66
54
|
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
debug(`
|
|
55
|
+
});
|
|
56
|
+
const hasPlatformSpecificGitIgnores = hasAllPlatformSpecificGitIgnores(templateDirectory, platforms);
|
|
57
|
+
debug(`All platforms have an internal gitignore: ${hasPlatformSpecificGitIgnores}`);
|
|
58
|
+
// TODO: Remove gitignore modifications -- maybe move to `npx expo-doctor`
|
|
59
|
+
const gitignore = hasPlatformSpecificGitIgnores ? null : (0, _mergeGitIgnorePaths).mergeGitIgnorePaths(_path.default.join(projectRoot, ".gitignore"), _path.default.join(templateDirectory, ".gitignore"));
|
|
70
60
|
return {
|
|
71
61
|
copiedPaths,
|
|
72
|
-
skippedPaths
|
|
62
|
+
skippedPaths,
|
|
63
|
+
gitignore
|
|
73
64
|
};
|
|
74
65
|
}
|
|
75
66
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/copyTemplateFiles.ts"],"sourcesContent":["import { ModPlatform } from '@expo/config-plugins';\nimport { MergeResults } from '@expo/config-plugins/build/utils/generateCode';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { copySync
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/copyTemplateFiles.ts"],"sourcesContent":["import { ModPlatform } from '@expo/config-plugins';\nimport { MergeResults } from '@expo/config-plugins/build/utils/generateCode';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { copySync } from '../utils/dir';\nimport { mergeGitIgnorePaths } from '../utils/mergeGitIgnorePaths';\n\nconst debug = require('debug')('expo:prebuild:copyTemplateFiles') as typeof console.log;\n\ntype CopyFilesResults = {\n /** Merge results for the root `.gitignore` file */\n gitignore: MergeResults | null;\n /** List of file paths that were copied from the template into the project. */\n copiedPaths: string[];\n /** List of file paths that were skipped due to a number of factors. */\n skippedPaths: string[];\n};\n\n/**\n * Return true if the given platforms all have an internal `.gitignore` file.\n *\n * @param projectRoot\n * @param platforms\n */\nfunction hasAllPlatformSpecificGitIgnores(projectRoot: string, platforms: ModPlatform[]): boolean {\n return platforms.reduce<boolean>(\n (p, platform) => p && fs.existsSync(path.join(projectRoot, platform, '.gitignore')),\n true\n );\n}\n\n/** Create a custom log message based on the copy file results. */\nexport function createCopyFilesSuccessMessage(\n platforms: ModPlatform[],\n { skippedPaths, gitignore }: CopyFilesResults\n): string {\n const pluralized = platforms.length > 1 ? 'directories' : 'directory';\n let message = `Created native ${pluralized}`;\n\n if (skippedPaths.length) {\n message += chalk.dim(\n ` | reusing ${skippedPaths.map((path) => chalk.bold(`/${path}`)).join(', ')}`\n );\n }\n if (!gitignore) {\n // Add no additional message...\n } else if (!gitignore.didMerge) {\n message += chalk.dim(` | reusing gitignore`);\n } else if (gitignore.didMerge && gitignore.didClear) {\n // This is legacy and for non-standard templates. The Expo template adds gitignores to the platform folders.\n message += chalk.dim(` | updated gitignore`);\n }\n return message;\n}\n\n/** Copy template files into the project and possibly merge the `.gitignore` files. */\nexport function copyTemplateFiles(\n projectRoot: string,\n {\n templateDirectory,\n platforms,\n }: {\n /** File path to the template directory. */\n templateDirectory: string;\n /** List of platforms to copy against. */\n platforms: ModPlatform[];\n }\n): CopyFilesResults {\n const copiedPaths: string[] = [];\n const skippedPaths: string[] = [];\n\n platforms.forEach((copyFilePath) => {\n const projectPath = path.join(projectRoot, copyFilePath);\n if (fs.existsSync(projectPath)) {\n skippedPaths.push(copyFilePath);\n } else {\n copiedPaths.push(copyFilePath);\n copySync(path.join(templateDirectory, copyFilePath), projectPath);\n }\n });\n\n const hasPlatformSpecificGitIgnores = hasAllPlatformSpecificGitIgnores(\n templateDirectory,\n platforms\n );\n debug(`All platforms have an internal gitignore: ${hasPlatformSpecificGitIgnores}`);\n\n // TODO: Remove gitignore modifications -- maybe move to `npx expo-doctor`\n const gitignore = hasPlatformSpecificGitIgnores\n ? null\n : mergeGitIgnorePaths(\n path.join(projectRoot, '.gitignore'),\n path.join(templateDirectory, '.gitignore')\n );\n\n return { copiedPaths, skippedPaths, gitignore };\n}\n"],"names":["createCopyFilesSuccessMessage","copyTemplateFiles","debug","require","hasAllPlatformSpecificGitIgnores","projectRoot","platforms","reduce","p","platform","fs","existsSync","path","join","skippedPaths","gitignore","pluralized","length","message","chalk","dim","map","bold","didMerge","didClear","templateDirectory","copiedPaths","forEach","copyFilePath","projectPath","push","copySync","hasPlatformSpecificGitIgnores","mergeGitIgnorePaths"],"mappings":"AAAA;;;;QAkCgBA,6BAA6B,GAA7BA,6BAA6B;QAwB7BC,iBAAiB,GAAjBA,iBAAiB;AAxDf,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEE,IAAA,IAAc,WAAd,cAAc,CAAA;AACH,IAAA,oBAA8B,WAA9B,8BAA8B,CAAA;;;;;;AAElE,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,iCAAiC,CAAC,AAAsB,AAAC;AAWxF;;;;;GAKG,CACH,SAASC,gCAAgC,CAACC,WAAmB,EAAEC,SAAwB,EAAW;IAChG,OAAOA,SAAS,CAACC,MAAM,CACrB,CAACC,CAAC,EAAEC,QAAQ,GAAKD,CAAC,IAAIE,GAAE,QAAA,CAACC,UAAU,CAACC,KAAI,QAAA,CAACC,IAAI,CAACR,WAAW,EAAEI,QAAQ,EAAE,YAAY,CAAC,CAAC;IAAA,EACnF,IAAI,CACL,CAAC;CACH;AAGM,SAAST,6BAA6B,CAC3CM,SAAwB,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QAAA,CAACC,UAAU,CAACkB,WAAW,CAAC,EAAE;YAC9Bf,YAAY,CAACgB,IAAI,CAACF,YAAY,CAAC,CAAC;SACjC,MAAM;YACLF,WAAW,CAACI,IAAI,CAACF,YAAY,CAAC,CAAC;YAC/BG,CAAAA,GAAAA,IAAQ,AAAyD,CAAA,SAAzD,CAACnB,KAAI,QAAA,CAACC,IAAI,CAACY,iBAAiB,EAAEG,YAAY,CAAC,EAAEC,WAAW,CAAC,CAAC;SACnE;KACF,CAAC,CAAC;IAEH,MAAMG,6BAA6B,GAAG5B,gCAAgC,CACpEqB,iBAAiB,EACjBnB,SAAS,CACV,AAAC;IACFJ,KAAK,CAAC,CAAC,0CAA0C,EAAE8B,6BAA6B,CAAC,CAAC,CAAC,CAAC;IAEpF,0EAA0E;IAC1E,MAAMjB,SAAS,GAAGiB,6BAA6B,GAC3C,IAAI,GACJC,CAAAA,GAAAA,oBAAmB,AAGlB,CAAA,oBAHkB,CACjBrB,KAAI,QAAA,CAACC,IAAI,CAACR,WAAW,EAAE,YAAY,CAAC,EACpCO,KAAI,QAAA,CAACC,IAAI,CAACY,iBAAiB,EAAE,YAAY,CAAC,CAC3C,AAAC;IAEN,OAAO;QAAEC,WAAW;QAAEZ,YAAY;QAAEC,SAAS;KAAE,CAAC;CACjD"}
|
|
@@ -3,17 +3,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.prebuildAsync = prebuildAsync;
|
|
6
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
6
7
|
var _clearNativeFolder = require("./clearNativeFolder");
|
|
7
8
|
var _configureProjectAsync = require("./configureProjectAsync");
|
|
8
9
|
var _ensureConfigAsync = require("./ensureConfigAsync");
|
|
9
10
|
var _resolveOptions = require("./resolveOptions");
|
|
10
11
|
var _updateFromTemplate = require("./updateFromTemplate");
|
|
11
12
|
var _installAsync = require("../install/installAsync");
|
|
13
|
+
var _log = require("../log");
|
|
12
14
|
var _env = require("../utils/env");
|
|
13
15
|
var _nodeEnv = require("../utils/nodeEnv");
|
|
14
16
|
var _nodeModules = require("../utils/nodeModules");
|
|
15
17
|
var _ora = require("../utils/ora");
|
|
16
18
|
var _profile = require("../utils/profile");
|
|
19
|
+
var _prompts = require("../utils/prompts");
|
|
20
|
+
function _interopRequireDefault(obj) {
|
|
21
|
+
return obj && obj.__esModule ? obj : {
|
|
22
|
+
default: obj
|
|
23
|
+
};
|
|
24
|
+
}
|
|
17
25
|
function _interopRequireWildcard(obj) {
|
|
18
26
|
if (obj && obj.__esModule) {
|
|
19
27
|
return obj;
|
|
@@ -62,7 +70,7 @@ async function prebuildAsync(projectRoot, options) {
|
|
|
62
70
|
platforms: options.platforms
|
|
63
71
|
});
|
|
64
72
|
// Create native projects from template.
|
|
65
|
-
const { hasNewProjectFiles , needsPodInstall ,
|
|
73
|
+
const { hasNewProjectFiles , needsPodInstall , changedDependencies } = await (0, _updateFromTemplate).updateFromTemplateAsync(projectRoot, {
|
|
66
74
|
exp,
|
|
67
75
|
pkg,
|
|
68
76
|
template: options.template != null ? (0, _resolveOptions).resolveTemplateOption(options.template) : undefined,
|
|
@@ -71,27 +79,48 @@ async function prebuildAsync(projectRoot, options) {
|
|
|
71
79
|
});
|
|
72
80
|
// Install node modules
|
|
73
81
|
if (options.install) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
if (changedDependencies.length) {
|
|
83
|
+
var ref;
|
|
84
|
+
if ((ref = options.packageManager) == null ? void 0 : ref.npm) {
|
|
85
|
+
await (0, _nodeModules).clearNodeModulesAsync(projectRoot);
|
|
86
|
+
}
|
|
87
|
+
_log.Log.log(_chalk.default.gray(_chalk.default`Dependencies in the {bold package.json} changed:`));
|
|
88
|
+
_log.Log.log(_chalk.default.gray(" " + changedDependencies.join(", ")));
|
|
89
|
+
// Installing dependencies is a legacy feature from the unversioned
|
|
90
|
+
// command. We know opt to not change dependencies unless a template
|
|
91
|
+
// indicates a new dependency is required, or if the core dependencies are wrong.
|
|
92
|
+
if (await (0, _prompts).confirmAsync({
|
|
93
|
+
message: `Install the updated dependencies?`,
|
|
94
|
+
initial: true
|
|
95
|
+
})) {
|
|
96
|
+
var ref1, ref2, ref3, ref4;
|
|
97
|
+
await (0, _installAsync).installAsync([], {
|
|
98
|
+
npm: !!((ref1 = options.packageManager) == null ? void 0 : ref1.npm),
|
|
99
|
+
yarn: !!((ref2 = options.packageManager) == null ? void 0 : ref2.yarn),
|
|
100
|
+
pnpm: !!((ref3 = options.packageManager) == null ? void 0 : ref3.pnpm),
|
|
101
|
+
bun: !!((ref4 = options.packageManager) == null ? void 0 : ref4.bun),
|
|
102
|
+
silent: !(_env.env.EXPO_DEBUG || _env.env.CI)
|
|
103
|
+
});
|
|
104
|
+
}
|
|
77
105
|
}
|
|
78
|
-
await (0, _installAsync).installAsync([], {
|
|
79
|
-
npm: !!((ref1 = options.packageManager) == null ? void 0 : ref1.npm),
|
|
80
|
-
yarn: !!((ref2 = options.packageManager) == null ? void 0 : ref2.yarn),
|
|
81
|
-
pnpm: !!((ref3 = options.packageManager) == null ? void 0 : ref3.pnpm),
|
|
82
|
-
bun: !!((ref4 = options.packageManager) == null ? void 0 : ref4.bun),
|
|
83
|
-
silent: !(_env.env.EXPO_DEBUG || _env.env.CI)
|
|
84
|
-
});
|
|
85
106
|
}
|
|
86
|
-
// Apply Expo config to native projects
|
|
87
|
-
const configSyncingStep =
|
|
107
|
+
// Apply Expo config to native projects. Prevent log-spew from ora when running in debug mode.
|
|
108
|
+
const configSyncingStep = _env.env.EXPO_DEBUG ? {
|
|
109
|
+
succeed (text) {
|
|
110
|
+
_log.Log.log(text);
|
|
111
|
+
},
|
|
112
|
+
fail (text) {
|
|
113
|
+
_log.Log.error(text);
|
|
114
|
+
}
|
|
115
|
+
} : (0, _ora).logNewSection("Running prebuild");
|
|
88
116
|
try {
|
|
89
117
|
await (0, _profile).profile(_configureProjectAsync.configureProjectAsync)(projectRoot, {
|
|
90
|
-
platforms: options.platforms
|
|
118
|
+
platforms: options.platforms,
|
|
119
|
+
exp
|
|
91
120
|
});
|
|
92
|
-
configSyncingStep.succeed("
|
|
121
|
+
configSyncingStep.succeed("Finished prebuild");
|
|
93
122
|
} catch (error) {
|
|
94
|
-
configSyncingStep.fail("
|
|
123
|
+
configSyncingStep.fail("Prebuild failed");
|
|
95
124
|
throw error;
|
|
96
125
|
}
|
|
97
126
|
// Install CocoaPods
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/prebuildAsync.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\n\nimport { clearNativeFolder, promptToClearMalformedNativeProjectsAsync } from './clearNativeFolder';\nimport { configureProjectAsync } from './configureProjectAsync';\nimport { ensureConfigAsync } from './ensureConfigAsync';\nimport { assertPlatforms, ensureValidPlatforms, resolveTemplateOption } from './resolveOptions';\nimport { updateFromTemplateAsync } from './updateFromTemplate';\nimport { installAsync } from '../install/installAsync';\nimport { env } from '../utils/env';\nimport { setNodeEnv } from '../utils/nodeEnv';\nimport { clearNodeModulesAsync } from '../utils/nodeModules';\nimport { logNewSection } from '../utils/ora';\nimport { profile } from '../utils/profile';\n\nconst debug = require('debug')('expo:prebuild') as typeof console.log;\n\nexport type PrebuildResults = {\n /** Expo config. */\n exp: ExpoConfig;\n /** Indicates if the process created new files. */\n hasNewProjectFiles: boolean;\n /** The platforms that were prebuilt. */\n platforms: ModPlatform[];\n /** Indicates if pod install was run. */\n podInstall: boolean;\n /** Indicates if node modules were installed. */\n nodeInstall: boolean;\n};\n\n/**\n * Entry point into the prebuild process, delegates to other helpers to perform various steps.\n *\n * 0. Attempt to clean the project folders.\n * 1. Create native projects (ios, android).\n * 2. Install node modules.\n * 3. Apply config to native projects.\n * 4. Install CocoaPods.\n */\nexport async function prebuildAsync(\n projectRoot: string,\n options: {\n /** Should install node modules and cocoapods. */\n install?: boolean;\n /** List of platforms to prebuild. */\n platforms: ModPlatform[];\n /** Should delete the native folders before attempting to prebuild. */\n clean?: boolean;\n /** URL or file path to the prebuild template. */\n template?: string;\n /** Name of the node package manager to install with. */\n packageManager?: {\n npm?: boolean;\n yarn?: boolean;\n pnpm?: boolean;\n bun?: boolean;\n };\n /** List of node modules to skip updating. */\n skipDependencyUpdate?: string[];\n }\n): Promise<PrebuildResults | null> {\n setNodeEnv('development');\n require('@expo/env').load(projectRoot);\n\n if (options.clean) {\n const { maybeBailOnGitStatusAsync } = await import('../utils/git.js');\n // Clean the project folders...\n if (await maybeBailOnGitStatusAsync()) {\n return null;\n }\n // Clear the native folders before syncing\n await clearNativeFolder(projectRoot, options.platforms);\n } else {\n // Check if the existing project folders are malformed.\n await promptToClearMalformedNativeProjectsAsync(projectRoot, options.platforms);\n }\n\n // Warn if the project is attempting to prebuild an unsupported platform (iOS on Windows).\n options.platforms = ensureValidPlatforms(options.platforms);\n // Assert if no platforms are left over after filtering.\n assertPlatforms(options.platforms);\n\n // Get the Expo config, create it if missing.\n const { exp, pkg } = await ensureConfigAsync(projectRoot, { platforms: options.platforms });\n\n // Create native projects from template.\n const { hasNewProjectFiles, needsPodInstall, hasNewDependencies } = await updateFromTemplateAsync(\n projectRoot,\n {\n exp,\n pkg,\n template: options.template != null ? resolveTemplateOption(options.template) : undefined,\n platforms: options.platforms,\n skipDependencyUpdate: options.skipDependencyUpdate,\n }\n );\n\n // Install node modules\n if (options.install) {\n if (hasNewDependencies && options.packageManager?.npm) {\n await clearNodeModulesAsync(projectRoot);\n }\n\n await installAsync([], {\n npm: !!options.packageManager?.npm,\n yarn: !!options.packageManager?.yarn,\n pnpm: !!options.packageManager?.pnpm,\n bun: !!options.packageManager?.bun,\n silent: !(env.EXPO_DEBUG || env.CI),\n });\n }\n\n // Apply Expo config to native projects\n const configSyncingStep = logNewSection('Config syncing');\n try {\n await profile(configureProjectAsync)(projectRoot, {\n platforms: options.platforms,\n });\n configSyncingStep.succeed('Config synced');\n } catch (error) {\n configSyncingStep.fail('Config sync failed');\n throw error;\n }\n\n // Install CocoaPods\n let podsInstalled: boolean = false;\n // err towards running pod install less because it's slow and users can easily run npx pod-install afterwards.\n if (options.platforms.includes('ios') && options.install && needsPodInstall) {\n const { installCocoaPodsAsync } = await import('../utils/cocoapods.js');\n\n podsInstalled = await installCocoaPodsAsync(projectRoot);\n } else {\n debug('Skipped pod install');\n }\n\n return {\n nodeInstall: !!options.install,\n podInstall: !podsInstalled,\n platforms: options.platforms,\n hasNewProjectFiles,\n exp,\n };\n}\n"],"names":["prebuildAsync","debug","require","projectRoot","options","setNodeEnv","load","clean","maybeBailOnGitStatusAsync","clearNativeFolder","platforms","promptToClearMalformedNativeProjectsAsync","ensureValidPlatforms","assertPlatforms","exp","pkg","ensureConfigAsync","hasNewProjectFiles","needsPodInstall","hasNewDependencies","updateFromTemplateAsync","template","resolveTemplateOption","undefined","skipDependencyUpdate","install","packageManager","npm","clearNodeModulesAsync","installAsync","yarn","pnpm","bun","silent","env","EXPO_DEBUG","CI","configSyncingStep","logNewSection","profile","configureProjectAsync","succeed","error","fail","podsInstalled","includes","installCocoaPodsAsync","nodeInstall","podInstall"],"mappings":"AAAA;;;;QAuCsBA,aAAa,GAAbA,aAAa;AApC0C,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AAC5D,IAAA,sBAAyB,WAAzB,yBAAyB,CAAA;AAC7B,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AACsB,IAAA,eAAkB,WAAlB,kBAAkB,CAAA;AACvD,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AACjC,IAAA,aAAyB,WAAzB,yBAAyB,CAAA;AAClC,IAAA,IAAc,WAAd,cAAc,CAAA;AACP,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;AACP,IAAA,YAAsB,WAAtB,sBAAsB,CAAA;AAC9B,IAAA,IAAc,WAAd,cAAc,CAAA;AACpB,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;;;;;;;;;;;;;;;;;;;;;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Aa;QAC1BlC,SAAS,EAAEN,OAAO,CAACM,SAAS;QAC5BO,kBAAkB;QAClBH,GAAG;KACJ,CAAC;CACH"}
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/prebuildAsync.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport chalk from 'chalk';\n\nimport { clearNativeFolder, promptToClearMalformedNativeProjectsAsync } from './clearNativeFolder';\nimport { configureProjectAsync } from './configureProjectAsync';\nimport { ensureConfigAsync } from './ensureConfigAsync';\nimport { assertPlatforms, ensureValidPlatforms, resolveTemplateOption } from './resolveOptions';\nimport { updateFromTemplateAsync } from './updateFromTemplate';\nimport { installAsync } from '../install/installAsync';\nimport { Log } from '../log';\nimport { env } from '../utils/env';\nimport { setNodeEnv } from '../utils/nodeEnv';\nimport { clearNodeModulesAsync } from '../utils/nodeModules';\nimport { logNewSection } from '../utils/ora';\nimport { profile } from '../utils/profile';\nimport { confirmAsync } from '../utils/prompts';\n\nconst debug = require('debug')('expo:prebuild') as typeof console.log;\n\nexport type PrebuildResults = {\n /** Expo config. */\n exp: ExpoConfig;\n /** Indicates if the process created new files. */\n hasNewProjectFiles: boolean;\n /** The platforms that were prebuilt. */\n platforms: ModPlatform[];\n /** Indicates if pod install was run. */\n podInstall: boolean;\n /** Indicates if node modules were installed. */\n nodeInstall: boolean;\n};\n\n/**\n * Entry point into the prebuild process, delegates to other helpers to perform various steps.\n *\n * 0. Attempt to clean the project folders.\n * 1. Create native projects (ios, android).\n * 2. Install node modules.\n * 3. Apply config to native projects.\n * 4. Install CocoaPods.\n */\nexport async function prebuildAsync(\n projectRoot: string,\n options: {\n /** Should install node modules and cocoapods. */\n install?: boolean;\n /** List of platforms to prebuild. */\n platforms: ModPlatform[];\n /** Should delete the native folders before attempting to prebuild. */\n clean?: boolean;\n /** URL or file path to the prebuild template. */\n template?: string;\n /** Name of the node package manager to install with. */\n packageManager?: {\n npm?: boolean;\n yarn?: boolean;\n pnpm?: boolean;\n bun?: boolean;\n };\n /** List of node modules to skip updating. */\n skipDependencyUpdate?: string[];\n }\n): Promise<PrebuildResults | null> {\n setNodeEnv('development');\n require('@expo/env').load(projectRoot);\n\n if (options.clean) {\n const { maybeBailOnGitStatusAsync } = await import('../utils/git.js');\n // Clean the project folders...\n if (await maybeBailOnGitStatusAsync()) {\n return null;\n }\n // Clear the native folders before syncing\n await clearNativeFolder(projectRoot, options.platforms);\n } else {\n // Check if the existing project folders are malformed.\n await promptToClearMalformedNativeProjectsAsync(projectRoot, options.platforms);\n }\n\n // Warn if the project is attempting to prebuild an unsupported platform (iOS on Windows).\n options.platforms = ensureValidPlatforms(options.platforms);\n // Assert if no platforms are left over after filtering.\n assertPlatforms(options.platforms);\n\n // Get the Expo config, create it if missing.\n const { exp, pkg } = await ensureConfigAsync(projectRoot, { platforms: options.platforms });\n\n // Create native projects from template.\n const { hasNewProjectFiles, needsPodInstall, changedDependencies } =\n await updateFromTemplateAsync(projectRoot, {\n exp,\n pkg,\n template: options.template != null ? resolveTemplateOption(options.template) : undefined,\n platforms: options.platforms,\n skipDependencyUpdate: options.skipDependencyUpdate,\n });\n\n // Install node modules\n if (options.install) {\n if (changedDependencies.length) {\n if (options.packageManager?.npm) {\n await clearNodeModulesAsync(projectRoot);\n }\n\n Log.log(chalk.gray(chalk`Dependencies in the {bold package.json} changed:`));\n Log.log(chalk.gray(' ' + changedDependencies.join(', ')));\n\n // Installing dependencies is a legacy feature from the unversioned\n // command. We know opt to not change dependencies unless a template\n // indicates a new dependency is required, or if the core dependencies are wrong.\n if (\n await confirmAsync({\n message: `Install the updated dependencies?`,\n initial: true,\n })\n ) {\n await installAsync([], {\n npm: !!options.packageManager?.npm,\n yarn: !!options.packageManager?.yarn,\n pnpm: !!options.packageManager?.pnpm,\n bun: !!options.packageManager?.bun,\n silent: !(env.EXPO_DEBUG || env.CI),\n });\n }\n }\n }\n\n // Apply Expo config to native projects. Prevent log-spew from ora when running in debug mode.\n const configSyncingStep: { succeed(text?: string): unknown; fail(text?: string): unknown } =\n env.EXPO_DEBUG\n ? {\n succeed(text) {\n Log.log(text!);\n },\n fail(text) {\n Log.error(text!);\n },\n }\n : logNewSection('Running prebuild');\n try {\n await profile(configureProjectAsync)(projectRoot, {\n platforms: options.platforms,\n exp,\n });\n configSyncingStep.succeed('Finished prebuild');\n } catch (error) {\n configSyncingStep.fail('Prebuild failed');\n throw error;\n }\n\n // Install CocoaPods\n let podsInstalled: boolean = false;\n // err towards running pod install less because it's slow and users can easily run npx pod-install afterwards.\n if (options.platforms.includes('ios') && options.install && needsPodInstall) {\n const { installCocoaPodsAsync } = await import('../utils/cocoapods.js');\n\n podsInstalled = await installCocoaPodsAsync(projectRoot);\n } else {\n debug('Skipped pod install');\n }\n\n return {\n nodeInstall: !!options.install,\n podInstall: !podsInstalled,\n platforms: options.platforms,\n hasNewProjectFiles,\n exp,\n };\n}\n"],"names":["prebuildAsync","debug","require","projectRoot","options","setNodeEnv","load","clean","maybeBailOnGitStatusAsync","clearNativeFolder","platforms","promptToClearMalformedNativeProjectsAsync","ensureValidPlatforms","assertPlatforms","exp","pkg","ensureConfigAsync","hasNewProjectFiles","needsPodInstall","changedDependencies","updateFromTemplateAsync","template","resolveTemplateOption","undefined","skipDependencyUpdate","install","length","packageManager","npm","clearNodeModulesAsync","Log","log","chalk","gray","join","confirmAsync","message","initial","installAsync","yarn","pnpm","bun","silent","env","EXPO_DEBUG","CI","configSyncingStep","succeed","text","fail","error","logNewSection","profile","configureProjectAsync","podsInstalled","includes","installCocoaPodsAsync","nodeInstall","podInstall"],"mappings":"AAAA;;;;QA0CsBA,aAAa,GAAbA,aAAa;AAxCjB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEoD,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AAC5D,IAAA,sBAAyB,WAAzB,yBAAyB,CAAA;AAC7B,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AACsB,IAAA,eAAkB,WAAlB,kBAAkB,CA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resolvePlatformOption(platform = "all", { loose } = {}) {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
function ensureValidPlatforms(platforms) {
|
|
101
|
-
// Skip
|
|
101
|
+
// Skip prebuild for iOS on Windows
|
|
102
102
|
if (process.platform === "win32" && platforms.includes("ios")) {
|
|
103
|
-
Log.warn(_chalk.default`⚠️ Skipping generating the iOS native project files. Run {bold expo
|
|
103
|
+
Log.warn(_chalk.default`⚠️ Skipping generating the iOS native project files. Run {bold npx expo prebuild} again from macOS or Linux to generate the iOS project.\n`);
|
|
104
104
|
return platforms.filter((platform)=>platform !== "ios"
|
|
105
105
|
);
|
|
106
106
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/resolveOptions.ts"],"sourcesContent":["import { ModPlatform } from '@expo/config-plugins';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { CommandError } from '../utils/errors';\nimport { validateUrl } from '../utils/url';\n\nexport function resolvePackageManagerOptions(args: any) {\n const managers: Record<string, boolean> = {\n npm: args['--npm'],\n yarn: args['--yarn'],\n pnpm: args['--pnpm'],\n bun: args['--bun'],\n };\n\n if (\n [managers.npm, managers.pnpm, managers.yarn, managers.bun, !!args['--no-install']].filter(\n Boolean\n ).length > 1\n ) {\n throw new CommandError(\n 'BAD_ARGS',\n 'Specify at most one of: --no-install, --npm, --pnpm, --yarn, --bun'\n );\n }\n\n return managers;\n}\n\n/** Resolves a template option as a URL or file path pointing to a tar file. */\nexport function resolveTemplateOption(template: string) {\n if (validateUrl(template)) {\n return template;\n }\n const templatePath = path.resolve(template);\n assert(fs.existsSync(templatePath), 'template file does not exist: ' + templatePath);\n assert(\n fs.statSync(templatePath).isFile(),\n 'template must be a tar file created by running `npm pack` in a project: ' + templatePath\n );\n\n return templatePath;\n}\n\n/** Resolves dependencies to skip from a string joined by `,`. Example: `react-native,expo,lodash` */\nexport function resolveSkipDependencyUpdate(value: any) {\n if (!value || typeof value !== 'string') {\n return [];\n }\n return value.split(',');\n}\n\n/** Returns an array of platforms based on the input platform identifier and runtime constraints. */\nexport function resolvePlatformOption(\n platform: string = 'all',\n { loose }: { loose?: boolean } = {}\n): ModPlatform[] {\n switch (platform) {\n case 'ios':\n return ['ios'];\n case 'android':\n return ['android'];\n case 'all':\n return loose || process.platform !== 'win32' ? ['android', 'ios'] : ['android'];\n default:\n return [platform as ModPlatform];\n }\n}\n\n/** Warns and filters out unsupported platforms based on the runtime constraints. Essentially this means no iOS on Windows devices. */\nexport function ensureValidPlatforms(platforms: ModPlatform[]): ModPlatform[] {\n // Skip
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/resolveOptions.ts"],"sourcesContent":["import { ModPlatform } from '@expo/config-plugins';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { CommandError } from '../utils/errors';\nimport { validateUrl } from '../utils/url';\n\nexport function resolvePackageManagerOptions(args: any) {\n const managers: Record<string, boolean> = {\n npm: args['--npm'],\n yarn: args['--yarn'],\n pnpm: args['--pnpm'],\n bun: args['--bun'],\n };\n\n if (\n [managers.npm, managers.pnpm, managers.yarn, managers.bun, !!args['--no-install']].filter(\n Boolean\n ).length > 1\n ) {\n throw new CommandError(\n 'BAD_ARGS',\n 'Specify at most one of: --no-install, --npm, --pnpm, --yarn, --bun'\n );\n }\n\n return managers;\n}\n\n/** Resolves a template option as a URL or file path pointing to a tar file. */\nexport function resolveTemplateOption(template: string) {\n if (validateUrl(template)) {\n return template;\n }\n const templatePath = path.resolve(template);\n assert(fs.existsSync(templatePath), 'template file does not exist: ' + templatePath);\n assert(\n fs.statSync(templatePath).isFile(),\n 'template must be a tar file created by running `npm pack` in a project: ' + templatePath\n );\n\n return templatePath;\n}\n\n/** Resolves dependencies to skip from a string joined by `,`. Example: `react-native,expo,lodash` */\nexport function resolveSkipDependencyUpdate(value: any) {\n if (!value || typeof value !== 'string') {\n return [];\n }\n return value.split(',');\n}\n\n/** Returns an array of platforms based on the input platform identifier and runtime constraints. */\nexport function resolvePlatformOption(\n platform: string = 'all',\n { loose }: { loose?: boolean } = {}\n): ModPlatform[] {\n switch (platform) {\n case 'ios':\n return ['ios'];\n case 'android':\n return ['android'];\n case 'all':\n return loose || process.platform !== 'win32' ? ['android', 'ios'] : ['android'];\n default:\n return [platform as ModPlatform];\n }\n}\n\n/** Warns and filters out unsupported platforms based on the runtime constraints. Essentially this means no iOS on Windows devices. */\nexport function ensureValidPlatforms(platforms: ModPlatform[]): ModPlatform[] {\n // Skip prebuild for iOS on Windows\n if (process.platform === 'win32' && platforms.includes('ios')) {\n Log.warn(\n chalk`⚠️ Skipping generating the iOS native project files. Run {bold npx expo prebuild} again from macOS or Linux to generate the iOS project.\\n`\n );\n return platforms.filter((platform) => platform !== 'ios');\n }\n return platforms;\n}\n\n/** Asserts platform length must be greater than zero. */\nexport function assertPlatforms(platforms: ModPlatform[]) {\n if (!platforms?.length) {\n throw new CommandError('At least one platform must be enabled when syncing');\n }\n}\n"],"names":["resolvePackageManagerOptions","resolveTemplateOption","resolveSkipDependencyUpdate","resolvePlatformOption","ensureValidPlatforms","assertPlatforms","Log","args","managers","npm","yarn","pnpm","bun","filter","Boolean","length","CommandError","template","validateUrl","templatePath","path","resolve","assert","fs","existsSync","statSync","isFile","value","split","platform","loose","process","platforms","includes","warn","chalk"],"mappings":"AAAA;;;;QAUgBA,4BAA4B,GAA5BA,4BAA4B;QAuB5BC,qBAAqB,GAArBA,qBAAqB;QAerBC,2BAA2B,GAA3BA,2BAA2B;QAQ3BC,qBAAqB,GAArBA,qBAAqB;QAiBrBC,oBAAoB,GAApBA,oBAAoB;QAYpBC,eAAe,GAAfA,eAAe;AApFZ,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACT,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAA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AAA,CAAC,oDAAoD,CAAC,CAAC;KAC9E;CACF"}
|
|
@@ -60,7 +60,7 @@ async function updateFromTemplateAsync(projectRoot, { exp , pkg , template , tem
|
|
|
60
60
|
return {
|
|
61
61
|
hasNewProjectFiles: !!copiedPaths.length,
|
|
62
62
|
// If the iOS folder changes or new packages are added, we should rerun pod install.
|
|
63
|
-
needsPodInstall: copiedPaths.includes("ios") || depsResults.
|
|
63
|
+
needsPodInstall: copiedPaths.includes("ios") || !!depsResults.changedDependencies.length,
|
|
64
64
|
...depsResults
|
|
65
65
|
};
|
|
66
66
|
}
|
|
@@ -72,7 +72,7 @@ async function updateFromTemplateAsync(projectRoot, { exp , pkg , template , tem
|
|
|
72
72
|
const platformDirectories = unknownPlatforms.map((platform)=>`./${platform}`
|
|
73
73
|
).reverse().join(" and ");
|
|
74
74
|
const pluralized = unknownPlatforms.length > 1 ? "directories" : "directory";
|
|
75
|
-
const ora = (0, _ora).logNewSection(`Creating native
|
|
75
|
+
const ora = (0, _ora).logNewSection(`Creating native ${pluralized} (${platformDirectories})`);
|
|
76
76
|
try {
|
|
77
77
|
await (0, _resolveTemplate).cloneTemplateAsync({
|
|
78
78
|
templateDirectory,
|
|
@@ -80,11 +80,11 @@ async function updateFromTemplateAsync(projectRoot, { exp , pkg , template , tem
|
|
|
80
80
|
exp,
|
|
81
81
|
ora
|
|
82
82
|
});
|
|
83
|
-
const platforms =
|
|
83
|
+
const platforms = (0, _validateTemplatePlatforms).validateTemplatePlatforms({
|
|
84
84
|
templateDirectory,
|
|
85
85
|
platforms: unknownPlatforms
|
|
86
86
|
});
|
|
87
|
-
const results =
|
|
87
|
+
const results = (0, _copyTemplateFiles).copyTemplateFiles(projectRoot, {
|
|
88
88
|
templateDirectory,
|
|
89
89
|
platforms
|
|
90
90
|
});
|
|
@@ -94,8 +94,8 @@ async function updateFromTemplateAsync(projectRoot, { exp , pkg , template , tem
|
|
|
94
94
|
if (!(e instanceof _errors.AbortCommandError)) {
|
|
95
95
|
Log.error(e.message);
|
|
96
96
|
}
|
|
97
|
-
ora.fail(
|
|
98
|
-
Log.log(_chalk.default.yellow(
|
|
97
|
+
ora.fail(`Failed to create the native ${pluralized}`);
|
|
98
|
+
Log.log(_chalk.default.yellow(_chalk.default`You may want to delete the {bold ./ios} and/or {bold ./android} directories before trying again.`));
|
|
99
99
|
throw new _errors.SilentError(e);
|
|
100
100
|
}
|
|
101
101
|
}
|