@expo/cli 0.8.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +8 -3
- package/build/bin/cli.map +1 -1
- package/build/src/export/createBundles.js +1 -0
- package/build/src/export/createBundles.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +1 -2
- 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/exportApp.js +4 -4
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +18 -18
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +0 -1
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/index.js +5 -1
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/resolveOptions.js +1 -0
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/install/checkPackages.js +6 -0
- package/build/src/install/checkPackages.js.map +1 -1
- package/build/src/install/installAsync.js +15 -1
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/prebuild/copyTemplateFiles.js +3 -33
- package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
- package/build/src/prebuild/ensureConfigAsync.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +1 -1
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/updateFromTemplate.js +1 -8
- package/build/src/prebuild/updateFromTemplate.js.map +1 -1
- package/build/src/prebuild/updatePackageJson.js +33 -47
- package/build/src/prebuild/updatePackageJson.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +13 -2
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +11 -1
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/doctor/ngrok/ExternalModule.js +2 -2
- package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
- package/build/src/start/index.js +3 -1
- package/build/src/start/index.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +2 -1
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +16 -33
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/externals.js +7 -30
- 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 +7 -4
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +26 -3
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/router.js +14 -5
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +0 -1
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +10 -4
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/middleware/ClassicManifestMiddleware.js +1 -1
- package/build/src/start/server/middleware/CreateFileMiddleware.js +6 -3
- package/build/src/start/server/middleware/CreateFileMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +75 -15
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +8 -3
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/type-generation/index.js +9 -1
- package/build/src/start/server/type-generation/index.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +2 -3
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/cocoapods.js +1 -1
- package/build/src/utils/cocoapods.js.map +1 -1
- package/build/src/utils/dir.js +16 -6
- package/build/src/utils/dir.js.map +1 -1
- package/build/src/utils/downloadExpoGoAsync.js +2 -1
- package/build/src/utils/downloadExpoGoAsync.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/strings.js +24 -0
- package/build/src/utils/strings.js.map +1 -0
- package/package.json +6 -8
- package/build/src/prebuild/writeMetroConfig.js +0 -89
- package/build/src/prebuild/writeMetroConfig.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../bin/cli';\nimport { assertArgs, getProjectRoot, printHelp } from '../utils/args';\nimport { logCmdError } from '../utils/errors';\n\nexport const expoExport: Command = async (argv) => {\n const args = assertArgs(\n {\n // Types\n '--help': Boolean,\n '--clear': Boolean,\n '--dump-assetmap': Boolean,\n '--dev': Boolean,\n '--dump-sourcemap': Boolean,\n '--max-workers': Number,\n '--output-dir': String,\n '--platform': String,\n\n // Hack: This is added because EAS CLI always includes the flag.\n // If supplied, we'll do nothing with the value, but at least the process won't crash.\n // Note that we also don't show this value in the `--help` prompt since we don't want people to use it.\n '--experimental-bundle': Boolean,\n\n // Aliases\n '-h': '--help',\n // '-s': '--dump-sourcemap',\n // '-d': '--dump-assetmap',\n '-c': '--clear',\n '-p': '--platform',\n },\n argv\n );\n\n if (args['--help']) {\n printHelp(\n `Export the static files of the app for hosting it on a web server`,\n chalk`npx expo export {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n `--dev Configure static files for developing locally using a non-https server`,\n chalk`--output-dir <dir> The directory to export the static files to. {dim Default: dist}`,\n `--max-workers <number> Maximum number of tasks to allow the bundler to spawn`,\n `--dump-assetmap Dump the asset map for further processing`,\n `--dump-sourcemap Dump the source map for debugging the JS bundle`,\n chalk`-p, --platform <platform> Options: android, ios, web, all. {dim Default: all}`,\n `-c, --clear Clear the bundler cache`,\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n const projectRoot = getProjectRoot(args);\n const { resolveOptionsAsync } = await import('./resolveOptions');\n const options = await resolveOptionsAsync(projectRoot, args).catch(logCmdError);\n\n const { exportAsync } = await import('./exportAsync');\n return exportAsync(projectRoot, options).catch(logCmdError);\n};\n"],"names":["expoExport","argv","args","assertArgs","Boolean","Number","String","printHelp","chalk","join","projectRoot","getProjectRoot","resolveOptionsAsync","options","catch","logCmdError","exportAsync"],"mappings":"AAAA;;;;;;AACkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAG6B,IAAA,KAAe,WAAf,eAAe,CAAA;AACzC,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtC,MAAMA,UAAU,GAAY,OAAOC,IAAI,GAAK;IACjD,MAAMC,IAAI,GAAGC,CAAAA,GAAAA,KAAU,
|
|
1
|
+
{"version":3,"sources":["../../../src/export/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../bin/cli';\nimport { assertArgs, getProjectRoot, printHelp } from '../utils/args';\nimport { logCmdError } from '../utils/errors';\n\nexport const expoExport: Command = async (argv) => {\n const args = assertArgs(\n {\n // Types\n '--help': Boolean,\n '--clear': Boolean,\n '--dump-assetmap': Boolean,\n '--dev': Boolean,\n '--dump-sourcemap': Boolean,\n '--max-workers': Number,\n '--output-dir': String,\n '--platform': String,\n '--no-minify': Boolean,\n\n // Hack: This is added because EAS CLI always includes the flag.\n // If supplied, we'll do nothing with the value, but at least the process won't crash.\n // Note that we also don't show this value in the `--help` prompt since we don't want people to use it.\n '--experimental-bundle': Boolean,\n\n // Aliases\n '-h': '--help',\n // '-s': '--dump-sourcemap',\n // '-d': '--dump-assetmap',\n '-c': '--clear',\n '-p': '--platform',\n // Interop with Metro docs and RedBox errors.\n '--reset-cache': '--clear',\n },\n argv\n );\n\n if (args['--help']) {\n printHelp(\n `Export the static files of the app for hosting it on a web server`,\n chalk`npx expo export {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n `--dev Configure static files for developing locally using a non-https server`,\n chalk`--output-dir <dir> The directory to export the static files to. {dim Default: dist}`,\n `--max-workers <number> Maximum number of tasks to allow the bundler to spawn`,\n `--dump-assetmap Dump the asset map for further processing`,\n `--dump-sourcemap Dump the source map for debugging the JS bundle`,\n chalk`-p, --platform <platform> Options: android, ios, web, all. {dim Default: all}`,\n `--no-minify Prevent minifying source`,\n `-c, --clear Clear the bundler cache`,\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n const projectRoot = getProjectRoot(args);\n const { resolveOptionsAsync } = await import('./resolveOptions');\n const options = await resolveOptionsAsync(projectRoot, args).catch(logCmdError);\n\n const { exportAsync } = await import('./exportAsync');\n return exportAsync(projectRoot, options).catch(logCmdError);\n};\n"],"names":["expoExport","argv","args","assertArgs","Boolean","Number","String","printHelp","chalk","join","projectRoot","getProjectRoot","resolveOptionsAsync","options","catch","logCmdError","exportAsync"],"mappings":"AAAA;;;;;;AACkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAG6B,IAAA,KAAe,WAAf,eAAe,CAAA;AACzC,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtC,MAAMA,UAAU,GAAY,OAAOC,IAAI,GAAK;IACjD,MAAMC,IAAI,GAAGC,CAAAA,GAAAA,KAAU,AA4BtB,CAAA,WA5BsB,CACrB;QACE,QAAQ;QACR,QAAQ,EAAEC,OAAO;QACjB,SAAS,EAAEA,OAAO;QAClB,iBAAiB,EAAEA,OAAO;QAC1B,OAAO,EAAEA,OAAO;QAChB,kBAAkB,EAAEA,OAAO;QAC3B,eAAe,EAAEC,MAAM;QACvB,cAAc,EAAEC,MAAM;QACtB,YAAY,EAAEA,MAAM;QACpB,aAAa,EAAEF,OAAO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AAAC;QAxDWf,UAAU,GAAVA,UAAU"}
|
|
@@ -52,6 +52,7 @@ async function resolveOptionsAsync(projectRoot, args) {
|
|
|
52
52
|
return {
|
|
53
53
|
outputDir: (ref1 = args["--output-dir"]) != null ? ref1 : "dist",
|
|
54
54
|
platforms,
|
|
55
|
+
minify: !args["--no-minify"],
|
|
55
56
|
clear: !!args["--clear"],
|
|
56
57
|
dev: !!args["--dev"],
|
|
57
58
|
maxWorkers: args["--max-workers"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/resolveOptions.ts"],"sourcesContent":["import { getConfig, Platform } from '@expo/config';\n\nimport { getPlatformBundlers, PlatformBundlers } from '../start/server/platformBundlers';\nimport { CommandError } from '../utils/errors';\n\nexport type Options = {\n outputDir: string;\n platforms: Platform[];\n maxWorkers?: number;\n dev: boolean;\n clear: boolean;\n dumpAssetmap: boolean;\n dumpSourcemap: boolean;\n};\n\n/** Returns an array of platforms based on the input platform identifier and runtime constraints. */\nexport function resolvePlatformOption(\n platformBundlers: PlatformBundlers,\n platform: string = 'all'\n): Platform[] {\n const platforms: Partial<PlatformBundlers> = Object.fromEntries(\n Object.entries(platformBundlers).filter(([, bundler]) => bundler === 'metro')\n );\n\n if (!Object.keys(platforms).length) {\n throw new CommandError(\n `No platforms are configured to use the Metro bundler in the project Expo config.`\n );\n }\n\n const assertPlatformBundler = (platform: Platform) => {\n if (!platforms[platform]) {\n throw new CommandError(\n 'BAD_ARGS',\n `Platform \"${platform}\" is not configured to use the Metro bundler in the project Expo config.`\n );\n }\n };\n\n switch (platform) {\n case 'ios':\n assertPlatformBundler('ios');\n return ['ios'];\n case 'web':\n assertPlatformBundler('web');\n return ['web'];\n case 'android':\n assertPlatformBundler('android');\n return ['android'];\n case 'all':\n return Object.keys(platforms) as Platform[];\n default:\n throw new CommandError(\n `Unsupported platform \"${platform}\". Options are: ${Object.keys(platforms).join(',')}, all`\n );\n }\n}\n\nexport async function resolveOptionsAsync(projectRoot: string, args: any): Promise<Options> {\n const { exp } = getConfig(projectRoot, { skipPlugins: true, skipSDKVersionRequirement: true });\n const platformBundlers = getPlatformBundlers(exp);\n const platforms: Platform[] = resolvePlatformOption(\n platformBundlers,\n args['--platform'] ?? 'all'\n );\n\n return {\n outputDir: args['--output-dir'] ?? 'dist',\n platforms,\n clear: !!args['--clear'],\n dev: !!args['--dev'],\n maxWorkers: args['--max-workers'],\n dumpAssetmap: !!args['--dump-assetmap'],\n dumpSourcemap: !!args['--dump-sourcemap'],\n };\n}\n"],"names":["resolvePlatformOption","resolveOptionsAsync","platformBundlers","platform","platforms","Object","fromEntries","entries","filter","bundler","keys","length","CommandError","assertPlatformBundler","join","projectRoot","args","exp","getConfig","skipPlugins","skipSDKVersionRequirement","getPlatformBundlers","outputDir","clear","dev","maxWorkers","dumpAssetmap","dumpSourcemap"],"mappings":"AAAA;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/export/resolveOptions.ts"],"sourcesContent":["import { getConfig, Platform } from '@expo/config';\n\nimport { getPlatformBundlers, PlatformBundlers } from '../start/server/platformBundlers';\nimport { CommandError } from '../utils/errors';\n\nexport type Options = {\n outputDir: string;\n platforms: Platform[];\n maxWorkers?: number;\n dev: boolean;\n clear: boolean;\n minify: boolean;\n dumpAssetmap: boolean;\n dumpSourcemap: boolean;\n};\n\n/** Returns an array of platforms based on the input platform identifier and runtime constraints. */\nexport function resolvePlatformOption(\n platformBundlers: PlatformBundlers,\n platform: string = 'all'\n): Platform[] {\n const platforms: Partial<PlatformBundlers> = Object.fromEntries(\n Object.entries(platformBundlers).filter(([, bundler]) => bundler === 'metro')\n );\n\n if (!Object.keys(platforms).length) {\n throw new CommandError(\n `No platforms are configured to use the Metro bundler in the project Expo config.`\n );\n }\n\n const assertPlatformBundler = (platform: Platform) => {\n if (!platforms[platform]) {\n throw new CommandError(\n 'BAD_ARGS',\n `Platform \"${platform}\" is not configured to use the Metro bundler in the project Expo config.`\n );\n }\n };\n\n switch (platform) {\n case 'ios':\n assertPlatformBundler('ios');\n return ['ios'];\n case 'web':\n assertPlatformBundler('web');\n return ['web'];\n case 'android':\n assertPlatformBundler('android');\n return ['android'];\n case 'all':\n return Object.keys(platforms) as Platform[];\n default:\n throw new CommandError(\n `Unsupported platform \"${platform}\". Options are: ${Object.keys(platforms).join(',')}, all`\n );\n }\n}\n\nexport async function resolveOptionsAsync(projectRoot: string, args: any): Promise<Options> {\n const { exp } = getConfig(projectRoot, { skipPlugins: true, skipSDKVersionRequirement: true });\n const platformBundlers = getPlatformBundlers(exp);\n const platforms: Platform[] = resolvePlatformOption(\n platformBundlers,\n args['--platform'] ?? 'all'\n );\n\n return {\n outputDir: args['--output-dir'] ?? 'dist',\n platforms,\n minify: !args['--no-minify'],\n clear: !!args['--clear'],\n dev: !!args['--dev'],\n maxWorkers: args['--max-workers'],\n dumpAssetmap: !!args['--dump-assetmap'],\n dumpSourcemap: !!args['--dump-sourcemap'],\n };\n}\n"],"names":["resolvePlatformOption","resolveOptionsAsync","platformBundlers","platform","platforms","Object","fromEntries","entries","filter","bundler","keys","length","CommandError","assertPlatformBundler","join","projectRoot","args","exp","getConfig","skipPlugins","skipSDKVersionRequirement","getPlatformBundlers","outputDir","minify","clear","dev","maxWorkers","dumpAssetmap","dumpSourcemap"],"mappings":"AAAA;;;;QAiBgBA,qBAAqB,GAArBA,qBAAqB;QA0CfC,mBAAmB,GAAnBA,mBAAmB;AA3DL,IAAA,OAAc,WAAd,cAAc,CAAA;AAEI,IAAA,iBAAkC,WAAlC,kCAAkC,CAAA;AAC3D,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;AAcvC,SAASD,qBAAqB,CACnCE,gBAAkC,EAClCC,SAAgB,GAAG,KAAK,EACZ;IACZ,MAAMC,SAAS,GAA8BC,MAAM,CAACC,WAAW,CAC7DD,MAAM,CAACE,OAAO,CAACL,gBAAgB,CAAC,CAACM,MAAM,CAAC,CAAC,GAAGC,OAAO,CAAC,GAAKA,OAAO,KAAK,OAAO;IAAA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AAAA,iBAAmB,AAAK,CAAA,oBAAL,CAACJ,GAAG,CAAC,AAAC;QAGhDD,GAAkB;IAFpB,MAAMZ,SAAS,GAAeJ,qBAAqB,CACjDE,gBAAgB,EAChBc,CAAAA,GAAkB,GAAlBA,IAAI,CAAC,YAAY,CAAC,YAAlBA,GAAkB,GAAI,KAAK,CAC5B,AAAC;QAGWA,IAAoB;IADjC,OAAO;QACLM,SAAS,EAAEN,CAAAA,IAAoB,GAApBA,IAAI,CAAC,cAAc,CAAC,YAApBA,IAAoB,GAAI,MAAM;QACzCZ,SAAS;QACTmB,MAAM,EAAE,CAACP,IAAI,CAAC,aAAa,CAAC;QAC5BQ,KAAK,EAAE,CAAC,CAACR,IAAI,CAAC,SAAS,CAAC;QACxBS,GAAG,EAAE,CAAC,CAACT,IAAI,CAAC,OAAO,CAAC;QACpBU,UAAU,EAAEV,IAAI,CAAC,eAAe,CAAC;QACjCW,YAAY,EAAE,CAAC,CAACX,IAAI,CAAC,iBAAiB,CAAC;QACvCY,aAAa,EAAE,CAAC,CAACZ,IAAI,CAAC,kBAAkB,CAAC;KAC1C,CAAC;CACH"}
|
|
@@ -8,7 +8,9 @@ var _chalk = _interopRequireDefault(require("chalk"));
|
|
|
8
8
|
var Log = _interopRequireWildcard(require("../log"));
|
|
9
9
|
var _validateDependenciesVersions = require("../start/doctor/dependencies/validateDependenciesVersions");
|
|
10
10
|
var _interactive = require("../utils/interactive");
|
|
11
|
+
var _link = require("../utils/link");
|
|
11
12
|
var _prompts = require("../utils/prompts");
|
|
13
|
+
var _strings = require("../utils/strings");
|
|
12
14
|
var _installAsync = require("./installAsync");
|
|
13
15
|
function _interopRequireDefault(obj) {
|
|
14
16
|
return obj && obj.__esModule ? obj : {
|
|
@@ -38,12 +40,16 @@ function _interopRequireWildcard(obj) {
|
|
|
38
40
|
}
|
|
39
41
|
const debug = require("debug")("expo:install:check");
|
|
40
42
|
async function checkPackagesAsync(projectRoot, { packages , packageManager , options: { fix } , packageManagerArguments }) {
|
|
43
|
+
var ref, ref1, ref2;
|
|
41
44
|
// Read the project Expo config without plugins.
|
|
42
45
|
const { exp , pkg } = (0, _config).getConfig(projectRoot, {
|
|
43
46
|
// Sometimes users will add a plugin to the config before installing the library,
|
|
44
47
|
// this wouldn't work unless we dangerously disable plugin serialization.
|
|
45
48
|
skipPlugins: true
|
|
46
49
|
});
|
|
50
|
+
if ((ref = pkg.expo) == null ? void 0 : (ref1 = ref.install) == null ? void 0 : (ref2 = ref1.exclude) == null ? void 0 : ref2.length) {
|
|
51
|
+
Log.log(_chalk.default`Skipped ${fix ? "fixing" : "checking"} dependencies: ${(0, _strings).joinWithCommasAnd(pkg.expo.install.exclude)}. These dependencies are listed in {bold expo.install.exclude} in package.json. ${(0, _link).learnMore("https://expo.dev/more/expo-cli/#configuring-dependency-validation")}`);
|
|
52
|
+
}
|
|
47
53
|
const dependencies = await (0, _validateDependenciesVersions).getVersionedDependenciesAsync(projectRoot, exp, pkg, packages);
|
|
48
54
|
if (!dependencies.length) {
|
|
49
55
|
Log.exit(_chalk.default.greenBright("Dependencies are up to date"), 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/install/checkPackages.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport * as PackageManager from '@expo/package-manager';\nimport chalk from 'chalk';\n\nimport * as Log from '../log';\nimport {\n getVersionedDependenciesAsync,\n logIncorrectDependencies,\n} from '../start/doctor/dependencies/validateDependenciesVersions';\nimport { isInteractive } from '../utils/interactive';\nimport { confirmAsync } from '../utils/prompts';\nimport { fixPackagesAsync } from './installAsync';\nimport { Options } from './resolveOptions';\n\nconst debug = require('debug')('expo:install:check') as typeof console.log;\n\n// Exposed for testing.\nexport async function checkPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n options: { fix },\n packageManagerArguments,\n }: {\n /**\n * List of packages to version\n * @example ['uuid', 'react-native-reanimated@latest']\n */\n packages: string[];\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n\n /** How the check should resolve */\n options: Pick<Options, 'fix'>;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n) {\n // Read the project Expo config without plugins.\n const { exp, pkg } = getConfig(projectRoot, {\n // Sometimes users will add a plugin to the config before installing the library,\n // this wouldn't work unless we dangerously disable plugin serialization.\n skipPlugins: true,\n });\n\n const dependencies = await getVersionedDependenciesAsync(projectRoot, exp, pkg, packages);\n\n if (!dependencies.length) {\n Log.exit(chalk.greenBright('Dependencies are up to date'), 0);\n }\n\n logIncorrectDependencies(dependencies);\n\n const value =\n // If `--fix` then always fix.\n fix ||\n // Otherwise prompt to fix when not running in CI.\n (isInteractive() && (await confirmAsync({ message: 'Fix dependencies?' }).catch(() => false)));\n\n if (value) {\n debug('Installing fixed dependencies:', dependencies);\n // Install the corrected dependencies.\n return fixPackagesAsync(projectRoot, {\n packageManager,\n packages: dependencies,\n packageManagerArguments,\n sdkVersion: exp.sdkVersion!,\n });\n }\n // Exit with non-zero exit code if any of the dependencies are out of date.\n Log.exit(chalk.red('Found outdated dependencies'), 1);\n}\n"],"names":["checkPackagesAsync","Log","debug","require","projectRoot","packages","packageManager","options","fix","packageManagerArguments","
|
|
1
|
+
{"version":3,"sources":["../../../src/install/checkPackages.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport * as PackageManager from '@expo/package-manager';\nimport chalk from 'chalk';\n\nimport * as Log from '../log';\nimport {\n getVersionedDependenciesAsync,\n logIncorrectDependencies,\n} from '../start/doctor/dependencies/validateDependenciesVersions';\nimport { isInteractive } from '../utils/interactive';\nimport { learnMore } from '../utils/link';\nimport { confirmAsync } from '../utils/prompts';\nimport { joinWithCommasAnd } from '../utils/strings';\nimport { fixPackagesAsync } from './installAsync';\nimport { Options } from './resolveOptions';\n\nconst debug = require('debug')('expo:install:check') as typeof console.log;\n\n// Exposed for testing.\nexport async function checkPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n options: { fix },\n packageManagerArguments,\n }: {\n /**\n * List of packages to version\n * @example ['uuid', 'react-native-reanimated@latest']\n */\n packages: string[];\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n\n /** How the check should resolve */\n options: Pick<Options, 'fix'>;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n) {\n // Read the project Expo config without plugins.\n const { exp, pkg } = getConfig(projectRoot, {\n // Sometimes users will add a plugin to the config before installing the library,\n // this wouldn't work unless we dangerously disable plugin serialization.\n skipPlugins: true,\n });\n\n if (pkg.expo?.install?.exclude?.length) {\n Log.log(\n chalk`Skipped ${fix ? 'fixing' : 'checking'} dependencies: ${joinWithCommasAnd(\n pkg.expo.install.exclude\n )}. These dependencies are listed in {bold expo.install.exclude} in package.json. ${learnMore(\n 'https://expo.dev/more/expo-cli/#configuring-dependency-validation'\n )}`\n );\n }\n\n const dependencies = await getVersionedDependenciesAsync(projectRoot, exp, pkg, packages);\n\n if (!dependencies.length) {\n Log.exit(chalk.greenBright('Dependencies are up to date'), 0);\n }\n\n logIncorrectDependencies(dependencies);\n\n const value =\n // If `--fix` then always fix.\n fix ||\n // Otherwise prompt to fix when not running in CI.\n (isInteractive() && (await confirmAsync({ message: 'Fix dependencies?' }).catch(() => false)));\n\n if (value) {\n debug('Installing fixed dependencies:', dependencies);\n // Install the corrected dependencies.\n return fixPackagesAsync(projectRoot, {\n packageManager,\n packages: dependencies,\n packageManagerArguments,\n sdkVersion: exp.sdkVersion!,\n });\n }\n // Exit with non-zero exit code if any of the dependencies are out of date.\n Log.exit(chalk.red('Found outdated dependencies'), 1);\n}\n"],"names":["checkPackagesAsync","Log","debug","require","projectRoot","packages","packageManager","options","fix","packageManagerArguments","pkg","exp","getConfig","skipPlugins","expo","install","exclude","length","log","chalk","joinWithCommasAnd","learnMore","dependencies","getVersionedDependenciesAsync","exit","greenBright","logIncorrect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;KACJ;IACD,2EAA2E;IAC3EhC,GAAG,CAACuB,IAAI,CAACL,MAAK,QAAA,CAACe,GAAG,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC,CAAC;CACvD"}
|
|
@@ -12,7 +12,9 @@ var Log = _interopRequireWildcard(require("../log"));
|
|
|
12
12
|
var _getVersionedPackages = require("../start/doctor/dependencies/getVersionedPackages");
|
|
13
13
|
var _array = require("../utils/array");
|
|
14
14
|
var _findUp = require("../utils/findUp");
|
|
15
|
+
var _link = require("../utils/link");
|
|
15
16
|
var _nodeEnv = require("../utils/nodeEnv");
|
|
17
|
+
var _strings = require("../utils/strings");
|
|
16
18
|
var _checkPackages = require("./checkPackages");
|
|
17
19
|
function _interopRequireDefault(obj) {
|
|
18
20
|
return obj && obj.__esModule ? obj : {
|
|
@@ -78,12 +80,24 @@ async function installAsync(packages, options, packageManagerArguments = []) {
|
|
|
78
80
|
});
|
|
79
81
|
}
|
|
80
82
|
async function installPackagesAsync(projectRoot, { packages , packageManager , sdkVersion , packageManagerArguments }) {
|
|
83
|
+
// Read the project Expo config without plugins.
|
|
84
|
+
const { pkg } = (0, _config).getConfig(projectRoot, {
|
|
85
|
+
// Sometimes users will add a plugin to the config before installing the library,
|
|
86
|
+
// this wouldn't work unless we dangerously disable plugin serialization.
|
|
87
|
+
skipPlugins: true
|
|
88
|
+
});
|
|
89
|
+
//assertNotInstallingExcludedPackages(projectRoot, packages, pkg);
|
|
81
90
|
const versioning = await (0, _getVersionedPackages).getVersionedPackagesAsync(projectRoot, {
|
|
82
91
|
packages,
|
|
83
92
|
// sdkVersion is always defined because we don't skipSDKVersionRequirement in getConfig.
|
|
84
|
-
sdkVersion
|
|
93
|
+
sdkVersion,
|
|
94
|
+
pkg
|
|
85
95
|
});
|
|
86
96
|
Log.log(_chalk.default`\u203A Installing ${versioning.messages.length ? versioning.messages.join(" and ") + " " : ""}using {bold ${packageManager.name}}`);
|
|
97
|
+
if (versioning.excludedNativeModules.length) {
|
|
98
|
+
Log.log(_chalk.default`\u203A Using latest version instead of ${(0, _strings).joinWithCommasAnd(versioning.excludedNativeModules.map(({ bundledNativeVersion , name })=>`${bundledNativeVersion} for ${name}`
|
|
99
|
+
))} because ${versioning.excludedNativeModules.length > 1 ? "they are" : "it is"} listed in {bold expo.install.exclude} in package.json. ${(0, _link).learnMore("https://expo.dev/more/expo-cli/#configuring-dependency-validation")}`);
|
|
100
|
+
}
|
|
87
101
|
await packageManager.addAsync([
|
|
88
102
|
...packageManagerArguments,
|
|
89
103
|
...versioning.packages
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/install/installAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport * as PackageManager from '@expo/package-manager';\nimport chalk from 'chalk';\n\nimport * as Log from '../log';\nimport {\n getOperationLog,\n getVersionedPackagesAsync,\n} from '../start/doctor/dependencies/getVersionedPackages';\nimport { getVersionedDependenciesAsync } from '../start/doctor/dependencies/validateDependenciesVersions';\nimport { groupBy } from '../utils/array';\nimport { findUpProjectRootOrAssert } from '../utils/findUp';\nimport { setNodeEnv } from '../utils/nodeEnv';\nimport { checkPackagesAsync } from './checkPackages';\nimport { Options } from './resolveOptions';\n\nexport async function installAsync(\n packages: string[],\n options: Options & { projectRoot?: string },\n packageManagerArguments: string[] = []\n) {\n setNodeEnv('development');\n // Locate the project root based on the process current working directory.\n // This enables users to run `npx expo install` from a subdirectory of the project.\n const projectRoot = options.projectRoot ?? findUpProjectRootOrAssert(process.cwd());\n require('@expo/env').load(projectRoot);\n\n // Resolve the package manager used by the project, or based on the provided arguments.\n const packageManager = PackageManager.createForProject(projectRoot, {\n npm: options.npm,\n yarn: options.yarn,\n pnpm: options.pnpm,\n silent: options.silent,\n log: Log.log,\n });\n\n if (options.check || options.fix) {\n return await checkPackagesAsync(projectRoot, {\n packages,\n options,\n packageManager,\n packageManagerArguments,\n });\n }\n\n // Read the project Expo config without plugins.\n const { exp } = getConfig(projectRoot, {\n // Sometimes users will add a plugin to the config before installing the library,\n // this wouldn't work unless we dangerously disable plugin serialization.\n skipPlugins: true,\n });\n\n // Resolve the versioned packages, then install them.\n return installPackagesAsync(projectRoot, {\n packageManager,\n packages,\n packageManagerArguments,\n sdkVersion: exp.sdkVersion!,\n });\n}\n\n/** Version packages and install in a project. */\nexport async function installPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n sdkVersion,\n packageManagerArguments,\n }: {\n /**\n * List of packages to version, grouped by the type of dependency.\n * @example ['uuid', 'react-native-reanimated@latest']\n */\n packages: string[];\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n /**\n * SDK to version `packages` for.\n * @example '44.0.0'\n */\n sdkVersion: string;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n): Promise<void> {\n const versioning = await getVersionedPackagesAsync(projectRoot, {\n packages,\n // sdkVersion is always defined because we don't skipSDKVersionRequirement in getConfig.\n sdkVersion,\n });\n\n Log.log(\n chalk`\\u203A Installing ${\n versioning.messages.length ? versioning.messages.join(' and ') + ' ' : ''\n }using {bold ${packageManager.name}}`\n );\n\n await packageManager.addAsync([...packageManagerArguments, ...versioning.packages]);\n\n await applyPluginsAsync(projectRoot, versioning.packages);\n}\n\nexport async function fixPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n sdkVersion,\n packageManagerArguments,\n }: {\n packages: Awaited<ReturnType<typeof getVersionedDependenciesAsync>>;\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n /**\n * SDK to version `packages` for.\n * @example '44.0.0'\n */\n sdkVersion: string;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n): Promise<void> {\n if (!packages.length) {\n return;\n }\n\n const { dependencies = [], devDependencies = [] } = groupBy(packages, (dep) => dep.packageType);\n const versioningMessages = getOperationLog({\n othersCount: 0, // All fixable packages are versioned\n nativeModulesCount: packages.length,\n sdkVersion,\n });\n\n Log.log(\n chalk`\\u203A Installing ${\n versioningMessages.length ? versioningMessages.join(' and ') + ' ' : ''\n }using {bold ${packageManager.name}}`\n );\n\n if (dependencies.length) {\n const versionedPackages = dependencies.map(\n (dep) => `${dep.packageName}@${dep.expectedVersionOrRange}`\n );\n\n await packageManager.addAsync([...packageManagerArguments, ...versionedPackages]);\n\n await applyPluginsAsync(projectRoot, versionedPackages);\n }\n\n if (devDependencies.length) {\n await packageManager.addDevAsync([\n ...packageManagerArguments,\n ...devDependencies.map((dep) => `${dep.packageName}@${dep.expectedVersionOrRange}`),\n ]);\n }\n}\n\n/**\n * A convenience feature for automatically applying Expo Config Plugins to the `app.json` after installing them.\n * This should be dropped in favor of autolinking in the future.\n */\nasync function applyPluginsAsync(projectRoot: string, packages: string[]) {\n const { autoAddConfigPluginsAsync } = await import('./utils/autoAddConfigPlugins');\n\n try {\n const { exp } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n\n // Only auto add plugins if the plugins array is defined or if the project is using SDK +42.\n await autoAddConfigPluginsAsync(\n projectRoot,\n exp,\n // Split any possible NPM tags. i.e. `expo@latest` -> `expo`\n packages.map((pkg) => pkg.split('@')[0]).filter(Boolean)\n );\n } catch (error: any) {\n // If we fail to apply plugins, the log a warning and continue.\n if (error.isPluginError) {\n Log.warn(`Skipping config plugin check: ` + error.message);\n return;\n }\n // Any other error, rethrow.\n throw error;\n }\n}\n"],"names":["installAsync","installPackagesAsync","fixPackagesAsync","PackageManager","Log","packages","options","packageManagerArguments","setNodeEnv","projectRoot","findUpProjectRootOrAssert","process","cwd","require","load","packageManager","createForProject","npm","yarn","pnpm","silent","log","check","fix","checkPackagesAsync","exp","getConfig","skipPlugins","sdkVersion","versioning","getVersionedPackagesAsync","chalk","messages","length","join","name","addAsync","applyPluginsAsync","dependencies","devDependencies","groupBy","dep","packageType","versioningMessages","getOperationLog","othersCount","nativeModulesCount","versionedPackages","map","packageName","expectedVersionOrRange","addDevAsync","autoAddConfigPluginsAsync","skipSDKVersionRequirement","pkg","split","filter","Boolean","error","isPluginError","warn","message"],"mappings":"AAAA;;;;QAgBsBA,YAAY,GAAZA,YAAY;QA8CZC,oBAAoB,GAApBA,oBAAoB;QA4CpBC,gBAAgB,GAAhBA,gBAAgB;AA1GZ,IAAA,OAAc,WAAd,cAAc,CAAA;AAC5BC,IAAAA,cAAc,mCAAM,uBAAuB,EAA7B;AACR,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEbC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AAIR,IAAA,qBAAmD,WAAnD,mDAAmD,CAAA;AAElC,IAAA,MAAgB,WAAhB,gBAAgB,CAAA;AACE,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;AAChC,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;AACV,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG7C,eAAeJ,YAAY,CAChCK,QAAkB,EAClBC,OAA2C,EAC3CC,uBAAiC,GAAG,EAAE,EACtC;IACAC,CAAAA,GAAAA,QAAU,AAAe,CAAA,WAAf,CAAC,aAAa,CAAC,CAAC;QAGNF,YAAmB;IAFvC,0EAA0E;IAC1E,mFAAmF;IACnF,MAAMG,WAAW,GAAGH,CAAAA,YAAmB,GAAnBA,OAAO,CAACG,WAAW,YAAnBH,YAAmB,GAAII,CAAAA,GAAAA,OAAyB,AAAe,CAAA,0BAAf,CAACC,OAAO,CAACC,GAAG,EAAE,CAAC,AAAC;IACpFC,OAAO,CAAC,WAAW,CAAC,CAACC,IAAI,CAACL,WAAW,CAAC,CAAC;IAEvC,uFAAuF;IACvF,MAAMM,cAAc,GAAGZ,cAAc,CAACa,gBAAgB,CAACP,WAAW,EAAE;QAClEQ,GAAG,EAAEX,OAAO,CAACW,GAAG;QAChBC,IAAI,EAAEZ,OAAO,CAACY,IAAI;QAClBC,IAAI,EAAEb,OAAO,CAACa,IA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/install/installAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport * as PackageManager from '@expo/package-manager';\nimport chalk from 'chalk';\n\nimport * as Log from '../log';\nimport {\n getOperationLog,\n getVersionedPackagesAsync,\n} from '../start/doctor/dependencies/getVersionedPackages';\nimport { getVersionedDependenciesAsync } from '../start/doctor/dependencies/validateDependenciesVersions';\nimport { groupBy } from '../utils/array';\nimport { findUpProjectRootOrAssert } from '../utils/findUp';\nimport { learnMore } from '../utils/link';\nimport { setNodeEnv } from '../utils/nodeEnv';\nimport { joinWithCommasAnd } from '../utils/strings';\nimport { checkPackagesAsync } from './checkPackages';\nimport { Options } from './resolveOptions';\n\nexport async function installAsync(\n packages: string[],\n options: Options & { projectRoot?: string },\n packageManagerArguments: string[] = []\n) {\n setNodeEnv('development');\n // Locate the project root based on the process current working directory.\n // This enables users to run `npx expo install` from a subdirectory of the project.\n const projectRoot = options.projectRoot ?? findUpProjectRootOrAssert(process.cwd());\n require('@expo/env').load(projectRoot);\n\n // Resolve the package manager used by the project, or based on the provided arguments.\n const packageManager = PackageManager.createForProject(projectRoot, {\n npm: options.npm,\n yarn: options.yarn,\n pnpm: options.pnpm,\n silent: options.silent,\n log: Log.log,\n });\n\n if (options.check || options.fix) {\n return await checkPackagesAsync(projectRoot, {\n packages,\n options,\n packageManager,\n packageManagerArguments,\n });\n }\n\n // Read the project Expo config without plugins.\n const { exp } = getConfig(projectRoot, {\n // Sometimes users will add a plugin to the config before installing the library,\n // this wouldn't work unless we dangerously disable plugin serialization.\n skipPlugins: true,\n });\n\n // Resolve the versioned packages, then install them.\n return installPackagesAsync(projectRoot, {\n packageManager,\n packages,\n packageManagerArguments,\n sdkVersion: exp.sdkVersion!,\n });\n}\n\n/** Version packages and install in a project. */\nexport async function installPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n sdkVersion,\n packageManagerArguments,\n }: {\n /**\n * List of packages to version, grouped by the type of dependency.\n * @example ['uuid', 'react-native-reanimated@latest']\n */\n packages: string[];\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n /**\n * SDK to version `packages` for.\n * @example '44.0.0'\n */\n sdkVersion: string;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n): Promise<void> {\n // Read the project Expo config without plugins.\n const { pkg } = getConfig(projectRoot, {\n // Sometimes users will add a plugin to the config before installing the library,\n // this wouldn't work unless we dangerously disable plugin serialization.\n skipPlugins: true,\n });\n\n //assertNotInstallingExcludedPackages(projectRoot, packages, pkg);\n\n const versioning = await getVersionedPackagesAsync(projectRoot, {\n packages,\n // sdkVersion is always defined because we don't skipSDKVersionRequirement in getConfig.\n sdkVersion,\n pkg,\n });\n\n Log.log(\n chalk`\\u203A Installing ${\n versioning.messages.length ? versioning.messages.join(' and ') + ' ' : ''\n }using {bold ${packageManager.name}}`\n );\n\n if (versioning.excludedNativeModules.length) {\n Log.log(\n chalk`\\u203A Using latest version instead of ${joinWithCommasAnd(\n versioning.excludedNativeModules.map(\n ({ bundledNativeVersion, name }) => `${bundledNativeVersion} for ${name}`\n )\n )} because ${\n versioning.excludedNativeModules.length > 1 ? 'they are' : 'it is'\n } listed in {bold expo.install.exclude} in package.json. ${learnMore(\n 'https://expo.dev/more/expo-cli/#configuring-dependency-validation'\n )}`\n );\n }\n\n await packageManager.addAsync([...packageManagerArguments, ...versioning.packages]);\n\n await applyPluginsAsync(projectRoot, versioning.packages);\n}\n\nexport async function fixPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n sdkVersion,\n packageManagerArguments,\n }: {\n packages: Awaited<ReturnType<typeof getVersionedDependenciesAsync>>;\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n /**\n * SDK to version `packages` for.\n * @example '44.0.0'\n */\n sdkVersion: string;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n): Promise<void> {\n if (!packages.length) {\n return;\n }\n\n const { dependencies = [], devDependencies = [] } = groupBy(packages, (dep) => dep.packageType);\n const versioningMessages = getOperationLog({\n othersCount: 0, // All fixable packages are versioned\n nativeModulesCount: packages.length,\n sdkVersion,\n });\n\n Log.log(\n chalk`\\u203A Installing ${\n versioningMessages.length ? versioningMessages.join(' and ') + ' ' : ''\n }using {bold ${packageManager.name}}`\n );\n\n if (dependencies.length) {\n const versionedPackages = dependencies.map(\n (dep) => `${dep.packageName}@${dep.expectedVersionOrRange}`\n );\n\n await packageManager.addAsync([...packageManagerArguments, ...versionedPackages]);\n\n await applyPluginsAsync(projectRoot, versionedPackages);\n }\n\n if (devDependencies.length) {\n await packageManager.addDevAsync([\n ...packageManagerArguments,\n ...devDependencies.map((dep) => `${dep.packageName}@${dep.expectedVersionOrRange}`),\n ]);\n }\n}\n\n/**\n * A convenience feature for automatically applying Expo Config Plugins to the `app.json` after installing them.\n * This should be dropped in favor of autolinking in the future.\n */\nasync function applyPluginsAsync(projectRoot: string, packages: string[]) {\n const { autoAddConfigPluginsAsync } = await import('./utils/autoAddConfigPlugins');\n\n try {\n const { exp } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n\n // Only auto add plugins if the plugins array is defined or if the project is using SDK +42.\n await autoAddConfigPluginsAsync(\n projectRoot,\n exp,\n // Split any possible NPM tags. i.e. `expo@latest` -> `expo`\n packages.map((pkg) => pkg.split('@')[0]).filter(Boolean)\n );\n } catch (error: any) {\n // If we fail to apply plugins, the log a warning and continue.\n if (error.isPluginError) {\n Log.warn(`Skipping config plugin check: ` + error.message);\n return;\n }\n // Any other error, rethrow.\n throw error;\n }\n}\n"],"names":["installAsync","installPackagesAsync","fixPackagesAsync","PackageManager","Log","packages","options","packageManagerArguments","setNodeEnv","projectRoot","findUpProjectRootOrAssert","process","cwd","require","load","packageManager","createForProject","npm","yarn","pnpm","silent","log","check","fix","checkPackagesAsync","exp","getConfig","skipPlugins","sdkVersion","pkg","versioning","getVersionedPackagesAsync","chalk","messages","length","join","name","excludedNativeModules","joinWithCommasAnd","map","bundledNativeVersion","learnMore","addAsync","applyPluginsAsync","dependencies","devDependencies","groupBy","dep","packageType","versioningMessages","getOperationLog","othersCount","nativeModulesCount","versionedPackages","packageName","expectedVersionOrRange","addDevAsync","autoAddConfigPluginsAsync","skipSDKVersionRequirement","split","filter","Boolean","error","isPluginError","warn","message"],"mappings":"AAAA;;;;QAkBsBA,YAAY,GAAZA,YAAY;QA8CZC,oBAAoB,GAApBA,oBAAoB;QAoEpBC,gBAAgB,GAAhBA,gBAAgB;AApIZ,IAAA,OAAc,WAAd,cAAc,CAAA;AAC5BC,IAAAA,cAAc,mCAAM,uBAAuB,EAA7B;AACR,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEbC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AAIR,IAAA,qBAAmD,WAAnD,mDAAmD,CAAA;AAElC,IAAA,MAAgB,WAAhB,gBAAgB,CAAA;AACE,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;AACjC,IAAA,KAAe,WAAf,eAAe,CAAA;AACd,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;AACX,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;AACjB,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG7C,eAAeJ,YAAY,CAChCK,QAAkB,EAClBC,OAA2C,EAC3CC,uBAAiC,GAAG,EAAE,EACtC;IACAC,CAAAA,GAAAA,QAAU,AAAe,CAAA,WAAf,CAAC,aAAa,CAAC,CAAC;QAGNF,YAAmB;IAFvC,0EAA0E;IAC1E,mFAAmF;IACnF,MAAMG,WAAW,GAAGH,CAAAA,YAAmB,GAAnBA,OAAO,CAACG,WAAW,YAAnBH,YAAmB,GAAII,CAAAA,GAAAA,OAAyB,AAAe,CAAA,0BAAf,CAACC,OAAO,CAACC,GAAG,EAAE,CAAC,AAAC;IACpFC,OAAO,CAAC,WAAW,CAAC,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,eAAe,CAACN,GAAG,CAAC,CAACQ,GAAG,GAAK,CAAC,EAAEA,GAAG,CAACO,WAAW,CAAC,CAAC,EAAEP,GAAG,CAACQ,sBAAsB,CAAC,CAAC;YAAA,CAAC;SACpF,CAAC,CAAC;KACJ;CACF;AAED;;;GAGG,CACH,eAAeZ,iBAAiB,CAAClC,WAAmB,EAAEJ,QAAkB,EAAE;IACxE,MAAM,EAAEoD,yBAAyB,CAAA,EAAE,GAAG,MAAM;+CAAO,8BAA8B;MAAC,AAAC;IAEnF,IAAI;QACF,MAAM,EAAEhC,GAAG,CAAA,EAAE,GAAGC,CAAAA,GAAAA,OAAS,AAAkD,CAAA,UAAlD,CAACjB,WAAW,EAAE;YAAEiD,yBAAyB,EAAE,IAAI;SAAE,CAAC,AAAC;QAE5E,4FAA4F;QAC5F,MAAMD,yBAAyB,CAC7BhD,WAAW,EACXgB,GAAG,EACH,4DAA4D;QAC5DpB,QAAQ,CAACkC,GAAG,CAAC,CAACV,GAAG,GAAKA,GAAG,CAAC8B,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAAA,CAAC,CAACC,MAAM,CAACC,OAAO,CAAC,CACzD,CAAC;KACH,CAAC,OAAOC,KAAK,EAAO;QACnB,+DAA+D;QAC/D,IAAIA,KAAK,CAACC,aAAa,EAAE;YACvB3D,GAAG,CAAC4D,IAAI,CAAC,CAAC,8BAA8B,CAAC,GAAGF,KAAK,CAACG,OAAO,CAAC,CAAC;YAC3D,OAAO;SACR;QACD,4BAA4B;QAC5B,MAAMH,KAAK,CAAC;KACb;CACF"}
|
|
@@ -4,14 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
exports.createCopyFilesSuccessMessage = createCopyFilesSuccessMessage;
|
|
6
6
|
exports.copyTemplateFilesAsync = copyTemplateFilesAsync;
|
|
7
|
-
exports.resolveBareEntryFile = resolveBareEntryFile;
|
|
8
|
-
var _paths = require("@expo/config/paths");
|
|
9
7
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
10
8
|
var _fs = _interopRequireDefault(require("fs"));
|
|
11
9
|
var _path = _interopRequireDefault(require("path"));
|
|
12
10
|
var _dir = require("../utils/dir");
|
|
13
11
|
var _mergeGitIgnorePaths = require("../utils/mergeGitIgnorePaths");
|
|
14
|
-
var _updatePackageJson = require("./updatePackageJson");
|
|
15
12
|
function _interopRequireDefault(obj) {
|
|
16
13
|
return obj && obj.__esModule ? obj : {
|
|
17
14
|
default: obj
|
|
@@ -42,14 +39,14 @@ function createCopyFilesSuccessMessage(platforms, { skippedPaths , gitignore })
|
|
|
42
39
|
}
|
|
43
40
|
return message;
|
|
44
41
|
}
|
|
45
|
-
async function copyTemplateFilesAsync(projectRoot, {
|
|
46
|
-
const copyFilePaths = getFilePathsToCopy(projectRoot, pkg, platforms);
|
|
42
|
+
async function copyTemplateFilesAsync(projectRoot, { templateDirectory , platforms }) {
|
|
47
43
|
const copyResults = await copyPathsFromTemplateAsync(projectRoot, {
|
|
48
44
|
templateDirectory,
|
|
49
|
-
copyFilePaths
|
|
45
|
+
copyFilePaths: platforms
|
|
50
46
|
});
|
|
51
47
|
const hasPlatformSpecificGitIgnores = hasAllPlatformSpecificGitIgnores(templateDirectory, platforms);
|
|
52
48
|
debug(`All platforms have an internal gitignore: ${hasPlatformSpecificGitIgnores}`);
|
|
49
|
+
// TODO: Remove gitignore modifications -- maybe move to `npx expo-doctor`
|
|
53
50
|
const gitignore = hasPlatformSpecificGitIgnores ? null : (0, _mergeGitIgnorePaths).mergeGitIgnorePaths(_path.default.join(projectRoot, ".gitignore"), _path.default.join(templateDirectory, ".gitignore"));
|
|
54
51
|
return {
|
|
55
52
|
...copyResults,
|
|
@@ -75,32 +72,5 @@ async function copyPathsFromTemplateAsync(/** File path to the project. */ proje
|
|
|
75
72
|
skippedPaths
|
|
76
73
|
};
|
|
77
74
|
}
|
|
78
|
-
/** Get a list of relative file paths to copy from the template folder. Example: `['ios', 'android', 'index.js']` */ function getFilePathsToCopy(projectRoot, pkg, platforms) {
|
|
79
|
-
const targetPaths = [
|
|
80
|
-
...platforms
|
|
81
|
-
];
|
|
82
|
-
const bareEntryFile = resolveBareEntryFile(projectRoot, pkg.main);
|
|
83
|
-
// Only create index.js if we cannot resolve the existing entry point (after replacing the expo entry).
|
|
84
|
-
if (!bareEntryFile) {
|
|
85
|
-
targetPaths.push("index.js");
|
|
86
|
-
}
|
|
87
|
-
debug(`Files to copy:`, targetPaths);
|
|
88
|
-
return targetPaths;
|
|
89
|
-
}
|
|
90
|
-
function resolveBareEntryFile(projectRoot, main) {
|
|
91
|
-
// expo app entry is not needed for bare projects.
|
|
92
|
-
if ((0, _updatePackageJson).isPkgMainExpoAppEntry(main)) {
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
// Look at the `package.json`s `main` field for the main file.
|
|
96
|
-
const resolvedMainField = main != null ? main : "./index";
|
|
97
|
-
// Get a list of possible extensions for the main file.
|
|
98
|
-
const extensions = (0, _paths).getBareExtensions([
|
|
99
|
-
"ios",
|
|
100
|
-
"android"
|
|
101
|
-
]);
|
|
102
|
-
// Testing the main field against all of the provided extensions - for legacy reasons we can't use node module resolution as the package.json allows you to pass in a file without a relative path and expect it as a relative path.
|
|
103
|
-
return (0, _paths).getFileWithExtensions(projectRoot, resolvedMainField, extensions);
|
|
104
|
-
}
|
|
105
75
|
|
|
106
76
|
//# sourceMappingURL=copyTemplateFiles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/copyTemplateFiles.ts"],"sourcesContent":["import { PackageJSONConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport { MergeResults } from '@expo/config-plugins/build/utils/generateCode';\nimport { getBareExtensions, getFileWithExtensions } from '@expo/config/paths';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { copySync, directoryExistsAsync } from '../utils/dir';\nimport { mergeGitIgnorePaths } from '../utils/mergeGitIgnorePaths';\nimport { isPkgMainExpoAppEntry } from './updatePackageJson';\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 let message = `Created native project${platforms.length > 1 ? 's' : ''}`;\n\n if (skippedPaths.length) {\n message += chalk.dim(\n ` | ${skippedPaths.map((path) => chalk.bold(`/${path}`)).join(', ')} already created`\n );\n }\n if (!gitignore) {\n message += chalk.dim(` | gitignore skipped`);\n } else if (!gitignore.didMerge) {\n message += chalk.dim(` | gitignore already synced`);\n } else if (gitignore.didMerge && gitignore.didClear) {\n message += chalk.dim(` | synced gitignore`);\n }\n return message;\n}\n\n/** Copy template files into the project and possibly merge the `.gitignore` files. */\nexport async function copyTemplateFilesAsync(\n projectRoot: string,\n {\n pkg,\n templateDirectory,\n platforms,\n }: {\n /** Project `package.json` as JSON. */\n pkg: PackageJSONConfig;\n /** File path to the template directory. */\n templateDirectory: string;\n /** List of platforms to copy against. */\n platforms: ModPlatform[];\n }\n): Promise<CopyFilesResults> {\n const copyFilePaths = getFilePathsToCopy(projectRoot, pkg, platforms);\n\n const copyResults = await copyPathsFromTemplateAsync(projectRoot, {\n templateDirectory,\n copyFilePaths,\n });\n\n const hasPlatformSpecificGitIgnores = hasAllPlatformSpecificGitIgnores(\n templateDirectory,\n platforms\n );\n debug(`All platforms have an internal gitignore: ${hasPlatformSpecificGitIgnores}`);\n const gitignore = hasPlatformSpecificGitIgnores\n ? null\n : mergeGitIgnorePaths(\n path.join(projectRoot, '.gitignore'),\n path.join(templateDirectory, '.gitignore')\n );\n\n return { ...copyResults, gitignore };\n}\n\nasync function copyPathsFromTemplateAsync(\n /** File path to the project. */\n projectRoot: string,\n {\n templateDirectory,\n copyFilePaths,\n }: {\n /** File path to the template project. */\n templateDirectory: string;\n /** List of relative paths to copy from the template to the project. */\n copyFilePaths: string[];\n }\n): Promise<Pick<CopyFilesResults, 'copiedPaths' | 'skippedPaths'>> {\n const copiedPaths = [];\n const skippedPaths = [];\n for (const copyFilePath of copyFilePaths) {\n const projectPath = path.join(projectRoot, copyFilePath);\n if (!(await directoryExistsAsync(projectPath))) {\n copiedPaths.push(copyFilePath);\n copySync(path.join(templateDirectory, copyFilePath), projectPath);\n } else {\n skippedPaths.push(copyFilePath);\n }\n }\n debug(`Copied files:`, copiedPaths);\n debug(`Skipped files:`, copiedPaths);\n return { copiedPaths, skippedPaths };\n}\n\n/** Get a list of relative file paths to copy from the template folder. Example: `['ios', 'android', 'index.js']` */\nfunction getFilePathsToCopy(projectRoot: string, pkg: PackageJSONConfig, platforms: ModPlatform[]) {\n const targetPaths: string[] = [...platforms];\n\n const bareEntryFile = resolveBareEntryFile(projectRoot, pkg.main);\n // Only create index.js if we cannot resolve the existing entry point (after replacing the expo entry).\n if (!bareEntryFile) {\n targetPaths.push('index.js');\n }\n\n debug(`Files to copy:`, targetPaths);\n return targetPaths;\n}\n\nexport function resolveBareEntryFile(projectRoot: string, main: any) {\n // expo app entry is not needed for bare projects.\n if (isPkgMainExpoAppEntry(main)) {\n return null;\n }\n // Look at the `package.json`s `main` field for the main file.\n const resolvedMainField = main ?? './index';\n // Get a list of possible extensions for the main file.\n const extensions = getBareExtensions(['ios', 'android']);\n // Testing the main field against all of the provided extensions - for legacy reasons we can't use node module resolution as the package.json allows you to pass in a file without a relative path and expect it as a relative path.\n return getFileWithExtensions(projectRoot, resolvedMainField, extensions);\n}\n"],"names":["createCopyFilesSuccessMessage","copyTemplateFilesAsync","resolveBareEntryFile","debug","require","hasAllPlatformSpecificGitIgnores","projectRoot","platforms","reduce","p","platform","fs","existsSync","path","join","skippedPaths","gitignore","message","length","chalk","dim","map","bold","didMerge","didClear","pkg","templateDirectory","copyFilePaths","getFilePathsToCopy","copyResults","copyPathsFromTemplateAsync","hasPlatformSpecificGitIgnores","mergeGitIgnorePaths","copiedPaths","copyFilePath","projectPath","directoryExistsAsync","push","copySync","targetPaths","bareEntryFile","main","isPkgMainExpoAppEntry","resolvedMainField","extensions","getBareExtensions","getFileWithExtensions"],"mappings":"AAAA;;;;QAqCgBA,6BAA6B,GAA7BA,6BAA6B;QAsBvBC,sBAAsB,GAAtBA,sBAAsB;QAgF5BC,oBAAoB,GAApBA,oBAAoB;AAxIqB,IAAA,MAAoB,WAApB,oBAAoB,CAAA;AAC3D,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEwB,IAAA,IAAc,WAAd,cAAc,CAAA;AACzB,IAAA,oBAA8B,WAA9B,8BAA8B,CAAA;AAC5B,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;;;;;;AAE3D,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,SAASV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IACpC9B,KAAK,CAAC,CAAC,cAAc,CAAC,EAAE8B,WAAW,CAAC,CAAC;IACrC,OAAO;QAAEA,WAAW;QAAElB,YAAY;KAAE,CAAC;CACtC;AAED,oHAAoH,CACpH,SAASa,kBAAkB,CAACtB,WAAmB,EAAEmB,GAAsB,EAAElB,SAAwB,EAAE;IACjG,MAAMgC,WAAW,GAAa;WAAIhC,SAAS;KAAC,AAAC;IAE7C,MAAMiC,aAAa,GAAGtC,oBAAoB,CAACI,WAAW,EAAEmB,GAAG,CAACgB,IAAI,CAAC,AAAC;IAClE,uGAAuG;IACvG,IAAI,CAACD,aAAa,EAAE;QAClBD,WAAW,CAACF,IAAI,CAAC,UAAU,CAAC,CAAC;KAC9B;IAEDlC,KAAK,CAAC,CAAC,cAAc,CAAC,EAAEoC,WAAW,CAAC,CAAC;IACrC,OAAOA,WAAW,CAAC;CACpB;AAEM,SAASrC,oBAAoB,CAACI,WAAmB,EAAEmC,IAAS,EAAE;IACnE,kDAAkD;IAClD,IAAIC,CAAAA,GAAAA,kBAAqB,AAAM,CAAA,sBAAN,CAACD,IAAI,CAAC,EAAE;QAC/B,OAAO,IAAI,CAAC;KACb;IACD,8DAA8D;IAC9D,MAAME,iBAAiB,GAAGF,IAAI,WAAJA,IAAI,GAAI,SAAS,AAAC;IAC5C,uDAAuD;IACvD,MAAMG,UAAU,GAAGC,CAAAA,GAAAA,MAAiB,AAAoB,CAAA,kBAApB,CAAC;QAAC,KAAK;QAAE,SAAS;KAAC,CAAC,AAAC;IACzD,oOAAoO;IACpO,OAAOC,CAAAA,GAAAA,MAAqB,AAA4C,CAAA,sBAA5C,CAACxC,WAAW,EAAEqC,iBAAiB,EAAEC,UAAU,CAAC,CAAC;CAC1E"}
|
|
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, directoryExistsAsync } 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 let message = `Created native project${platforms.length > 1 ? 's' : ''}`;\n\n if (skippedPaths.length) {\n message += chalk.dim(\n ` | ${skippedPaths.map((path) => chalk.bold(`/${path}`)).join(', ')} already created`\n );\n }\n if (!gitignore) {\n message += chalk.dim(` | gitignore skipped`);\n } else if (!gitignore.didMerge) {\n message += chalk.dim(` | gitignore already synced`);\n } else if (gitignore.didMerge && gitignore.didClear) {\n message += chalk.dim(` | synced gitignore`);\n }\n return message;\n}\n\n/** Copy template files into the project and possibly merge the `.gitignore` files. */\nexport async function copyTemplateFilesAsync(\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): Promise<CopyFilesResults> {\n const copyResults = await copyPathsFromTemplateAsync(projectRoot, {\n templateDirectory,\n copyFilePaths: platforms,\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 { ...copyResults, gitignore };\n}\n\nasync function copyPathsFromTemplateAsync(\n /** File path to the project. */\n projectRoot: string,\n {\n templateDirectory,\n copyFilePaths,\n }: {\n /** File path to the template project. */\n templateDirectory: string;\n /** List of relative paths to copy from the template to the project. */\n copyFilePaths: string[];\n }\n): Promise<Pick<CopyFilesResults, 'copiedPaths' | 'skippedPaths'>> {\n const copiedPaths = [];\n const skippedPaths = [];\n for (const copyFilePath of copyFilePaths) {\n const projectPath = path.join(projectRoot, copyFilePath);\n if (!(await directoryExistsAsync(projectPath))) {\n copiedPaths.push(copyFilePath);\n copySync(path.join(templateDirectory, copyFilePath), projectPath);\n } else {\n skippedPaths.push(copyFilePath);\n }\n }\n debug(`Copied files:`, copiedPaths);\n debug(`Skipped files:`, copiedPaths);\n return { copiedPaths, skippedPaths };\n}\n"],"names":["createCopyFilesSuccessMessage","copyTemplateFilesAsync","debug","require","hasAllPlatformSpecificGitIgnores","projectRoot","platforms","reduce","p","platform","fs","existsSync","path","join","skippedPaths","gitignore","message","length","chalk","dim","map","bold","didMerge","didClear","templateDirectory","copyResults","copyPathsFromTemplateAsync","copyFilePaths","hasPlatformSpecificGitIgnores","mergeGitIgnorePaths","copiedPaths","copyFilePath","projectPath","directoryExistsAsync","push","copySync"],"mappings":"AAAA;;;;QAkCgBA,6BAA6B,GAA7BA,6BAA6B;QAsBvBC,sBAAsB,GAAtBA,sBAAsB;AAtD1B,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEwB,IAAA,IAAc,WAAd,cAAc,CAAA;AACzB,IAAA,oBAA8B,WAA9B,8BAA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AC9CF,WAAW,CAACI,IAAI,CAACH,YAAY,CAAC,CAAC;YAC/BI,CAAAA,GAAAA,IAAQ,AAAyD,CAAA,SAAzD,CAACvB,KAAI,QAAA,CAACC,IAAI,CAACW,iBAAiB,EAAEO,YAAY,CAAC,EAAEC,WAAW,CAAC,CAAC;SACnE,MAAM;YACLlB,YAAY,CAACoB,IAAI,CAACH,YAAY,CAAC,CAAC;SACjC;KACF;IACD7B,KAAK,CAAC,CAAC,aAAa,CAAC,EAAE4B,WAAW,CAAC,CAAC;IACpC5B,KAAK,CAAC,CAAC,cAAc,CAAC,EAAE4B,WAAW,CAAC,CAAC;IACrC,OAAO;QAAEA,WAAW;QAAEhB,YAAY;KAAE,CAAC;CACtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/ensureConfigAsync.ts"],"sourcesContent":["import { ExpoConfig, getConfig, PackageJSONConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport JsonFile, { JSONObject } from '@expo/json-file';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { CommandError } from '../utils/errors';\nimport {\n getOrPromptForBundleIdentifier,\n getOrPromptForPackage,\n} from '../utils/getOrPromptApplicationId';\n\n/**\n * If an Expo config file does not exist, write a new one using the in-memory config.\n *\n * @param projectRoot\n */\nexport async function ensureConfigExistsAsync(projectRoot: string) {\n try {\n const config = getConfig(projectRoot, { skipSDKVersionRequirement: false });\n // If no config exists in the file system then we should generate one so the process doesn't fail.\n if (!config.dynamicConfigPath && !config.staticConfigPath) {\n // Remove the internal object before writing.\n delete config.exp._internal;\n\n // Write the generated config.\n await JsonFile.writeAsync(\n path.join(projectRoot, 'app.json'),\n { expo: config.exp as unknown as JSONObject },\n { json5: false }\n );\n }\n } catch (error: any) {\n // TODO(Bacon): Currently this is already handled in the command\n Log.log();\n throw new CommandError(`${error.message}\\n`);\n }\n}\n\n/** Ensure config is written, prompts for application identifiers
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/ensureConfigAsync.ts"],"sourcesContent":["import { ExpoConfig, getConfig, PackageJSONConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport JsonFile, { JSONObject } from '@expo/json-file';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { CommandError } from '../utils/errors';\nimport {\n getOrPromptForBundleIdentifier,\n getOrPromptForPackage,\n} from '../utils/getOrPromptApplicationId';\n\n/**\n * If an Expo config file does not exist, write a new one using the in-memory config.\n *\n * @param projectRoot\n */\nexport async function ensureConfigExistsAsync(projectRoot: string) {\n try {\n const config = getConfig(projectRoot, { skipSDKVersionRequirement: false });\n // If no config exists in the file system then we should generate one so the process doesn't fail.\n if (!config.dynamicConfigPath && !config.staticConfigPath) {\n // Remove the internal object before writing.\n delete config.exp._internal;\n\n // Write the generated config.\n await JsonFile.writeAsync(\n path.join(projectRoot, 'app.json'),\n { expo: config.exp as unknown as JSONObject },\n { json5: false }\n );\n }\n } catch (error: any) {\n // TODO(Bacon): Currently this is already handled in the command\n Log.log();\n throw new CommandError(`${error.message}\\n`);\n }\n}\n\n/** Ensure config is written, and prompts for application identifiers. */\nexport async function ensureConfigAsync(\n projectRoot: string,\n {\n platforms,\n }: {\n platforms: ModPlatform[];\n }\n): Promise<{ exp: ExpoConfig; pkg: PackageJSONConfig }> {\n await ensureConfigExistsAsync(projectRoot);\n\n // Prompt for the Android package first because it's more strict than the bundle identifier\n // this means you'll have a better chance at matching the bundle identifier with the package name.\n if (platforms.includes('android')) {\n await getOrPromptForPackage(projectRoot);\n }\n\n if (platforms.includes('ios')) {\n await getOrPromptForBundleIdentifier(projectRoot);\n }\n\n // Read config again because prompting for bundle id or package name may have mutated the results.\n return getConfig(projectRoot);\n}\n"],"names":["ensureConfigExistsAsync","ensureConfigAsync","Log","projectRoot","config","getConfig","skipSDKVersionRequirement","dynamicConfigPath","staticConfigPath","exp","_internal","JsonFile","writeAsync","path","join","expo","json5","error","log","CommandError","message","platforms","includes","getOrPromptForPack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uBAAuB,CAACG,WAAW,CAAC,CAAC;IAE3C,2FAA2F;IAC3F,kGAAkG;IAClG,IAAIkB,SAAS,CAACC,QAAQ,CAAC,SAAS,CAAC,EAAE;QACjC,MAAMC,CAAAA,GAAAA,yBAAqB,AAAa,CAAA,sBAAb,CAACpB,WAAW,CAAC,CAAC;KAC1C;IAED,IAAIkB,SAAS,CAACC,QAAQ,CAAC,KAAK,CAAC,EAAE;QAC7B,MAAME,CAAAA,GAAAA,yBAA8B,AAAa,CAAA,+BAAb,CAACrB,WAAW,CAAC,CAAC;KACnD;IAED,kGAAkG;IAClG,OAAOE,CAAAA,GAAAA,OAAS,AAAa,CAAA,UAAb,CAACF,WAAW,CAAC,CAAC;CAC/B"}
|
|
@@ -79,7 +79,7 @@ async function prebuildAsync(projectRoot, options) {
|
|
|
79
79
|
npm: !!((ref1 = options.packageManager) == null ? void 0 : ref1.npm),
|
|
80
80
|
yarn: !!((ref2 = options.packageManager) == null ? void 0 : ref2.yarn),
|
|
81
81
|
pnpm: !!((ref3 = options.packageManager) == null ? void 0 : ref3.pnpm),
|
|
82
|
-
silent: !_env.env.EXPO_DEBUG
|
|
82
|
+
silent: !(_env.env.EXPO_DEBUG || _env.env.CI)
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
// Apply Expo config to native projects
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/prebuildAsync.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\n\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';\nimport { clearNativeFolder, promptToClearMalformedNativeProjectsAsync } from './clearNativeFolder';\nimport { configureProjectAsync } from './configureProjectAsync';\nimport { ensureConfigAsync } from './ensureConfigAsync';\nimport { assertPlatforms, ensureValidPlatforms, resolveTemplateOption } from './resolveOptions';\nimport { updateFromTemplateAsync } from './updateFromTemplate';\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 };\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');\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 silent: !env.EXPO_DEBUG,\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');\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","silent","env","EXPO_DEBUG","configSyncingStep","logNewSection","profile","configureProjectAsync","succeed","error","fail","podsInstalled","includes","installCocoaPodsAsync","nodeInstall","podInstall"],"mappings":"AAAA;;;;QAuCsBA,aAAa,GA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B,CAAAA,GAAAA,aAAY,AAKhB,CAAA,aALgB,CAAC,EAAE,EAAE;YACrBF,GAAG,EAAE,CAAC,CAACvB,CAAAA,CAAAA,IAAsB,GAAtBA,OAAO,CAACsB,cAAc,SAAK,GAA3BtB,KAAAA,CAA2B,GAA3BA,IAAsB,CAAEuB,GAAG,CAAA;YAClCG,IAAI,EAAE,CAAC,CAAC1B,CAAAA,CAAAA,IAAsB,GAAtBA,OAAO,CAACsB,cAAc,SAAM,GAA5BtB,KAAAA,CAA4B,GAA5BA,IAAsB,CAAE0B,IAAI,CAAA;YACpCC,IAAI,EAAE,CAAC,CAAC3B,CAAAA,CAAAA,IAAsB,GAAtBA,OAAO,CAACsB,cAAc,SAAM,GAA5BtB,KAAAA,CAA4B,GAA5BA,IAAsB,CAAE2B,IAAI,CAAA;YACpCC,MAAM,EAAE,CAACC,IAAG,IAAA,CAACC,UAAU;
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/prebuildAsync.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\n\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';\nimport { clearNativeFolder, promptToClearMalformedNativeProjectsAsync } from './clearNativeFolder';\nimport { configureProjectAsync } from './configureProjectAsync';\nimport { ensureConfigAsync } from './ensureConfigAsync';\nimport { assertPlatforms, ensureValidPlatforms, resolveTemplateOption } from './resolveOptions';\nimport { updateFromTemplateAsync } from './updateFromTemplate';\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 };\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');\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 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');\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","silent","env","EXPO_DEBUG","CI","configSyncingStep","logNewSection","profile","configureProjectAsync","succeed","error","fail","podsInstalled","includes","installCocoaPodsAsync","nodeInstall","podInstall"],"mappings":"AAAA;;;;QAuCsBA,aAAa,GAAbA,aAAa;AApCN,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;AACmC,IAAA,kBAAqB,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O,CAACqB,OAAO;QAC9BsB,UAAU,EAAE,CAACJ,aAAa;QAC1BjC,SAAS,EAAEN,OAAO,CAACM,SAAS;QAC5BO,kBAAkB;QAClBH,GAAG;KACJ,CAAC;CACH"}
|
|
@@ -12,7 +12,6 @@ var _copyTemplateFiles = require("./copyTemplateFiles");
|
|
|
12
12
|
var _resolveTemplate = require("./resolveTemplate");
|
|
13
13
|
var _updatePackageJson = require("./updatePackageJson");
|
|
14
14
|
var _validateTemplatePlatforms = require("./validateTemplatePlatforms");
|
|
15
|
-
var _writeMetroConfig = require("./writeMetroConfig");
|
|
16
15
|
function _interopRequireDefault(obj) {
|
|
17
16
|
return obj && obj.__esModule ? obj : {
|
|
18
17
|
default: obj
|
|
@@ -51,13 +50,8 @@ async function updateFromTemplateAsync(projectRoot, { exp , pkg , template , tem
|
|
|
51
50
|
template,
|
|
52
51
|
templateDirectory,
|
|
53
52
|
exp,
|
|
54
|
-
pkg,
|
|
55
53
|
platforms
|
|
56
54
|
});
|
|
57
|
-
(0, _profile).profile(_writeMetroConfig.writeMetroConfig)(projectRoot, {
|
|
58
|
-
pkg,
|
|
59
|
-
templateDirectory
|
|
60
|
-
});
|
|
61
55
|
const depsResults = await (0, _profile).profile(_updatePackageJson.updatePackageJSONAsync)(projectRoot, {
|
|
62
56
|
templateDirectory,
|
|
63
57
|
pkg,
|
|
@@ -74,7 +68,7 @@ async function updateFromTemplateAsync(projectRoot, { exp , pkg , template , tem
|
|
|
74
68
|
* Extract the template and copy the ios and android directories over to the project directory.
|
|
75
69
|
*
|
|
76
70
|
* @return `true` if any project files were created.
|
|
77
|
-
*/ async function cloneTemplateAndCopyToProjectAsync({ projectRoot , templateDirectory , template , exp ,
|
|
71
|
+
*/ async function cloneTemplateAndCopyToProjectAsync({ projectRoot , templateDirectory , template , exp , platforms: unknownPlatforms }) {
|
|
78
72
|
const ora = (0, _ora).logNewSection("Creating native project directories (./ios and ./android) and updating .gitignore");
|
|
79
73
|
try {
|
|
80
74
|
await (0, _resolveTemplate).cloneTemplateAsync({
|
|
@@ -88,7 +82,6 @@ async function updateFromTemplateAsync(projectRoot, { exp , pkg , template , tem
|
|
|
88
82
|
platforms: unknownPlatforms
|
|
89
83
|
});
|
|
90
84
|
const results = await (0, _copyTemplateFiles).copyTemplateFilesAsync(projectRoot, {
|
|
91
|
-
pkg,
|
|
92
85
|
templateDirectory,
|
|
93
86
|
platforms
|
|
94
87
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/updateFromTemplate.ts"],"sourcesContent":["import { ExpoConfig, PackageJSONConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport chalk from 'chalk';\n\nimport * as Log from '../log';\nimport { AbortCommandError, SilentError } from '../utils/errors';\nimport { logNewSection } from '../utils/ora';\nimport { profile } from '../utils/profile';\nimport { copyTemplateFilesAsync, createCopyFilesSuccessMessage } from './copyTemplateFiles';\nimport { cloneTemplateAsync } from './resolveTemplate';\nimport { DependenciesModificationResults, updatePackageJSONAsync } from './updatePackageJson';\nimport { validateTemplatePlatforms } from './validateTemplatePlatforms';\
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/updateFromTemplate.ts"],"sourcesContent":["import { ExpoConfig, PackageJSONConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport chalk from 'chalk';\n\nimport * as Log from '../log';\nimport { AbortCommandError, SilentError } from '../utils/errors';\nimport { logNewSection } from '../utils/ora';\nimport { profile } from '../utils/profile';\nimport { copyTemplateFilesAsync, createCopyFilesSuccessMessage } from './copyTemplateFiles';\nimport { cloneTemplateAsync } from './resolveTemplate';\nimport { DependenciesModificationResults, updatePackageJSONAsync } from './updatePackageJson';\nimport { validateTemplatePlatforms } from './validateTemplatePlatforms';\n\n/**\n * Creates local native files from an input template file path.\n *\n * @return `true` if the project is ejecting, and `false` if it's syncing.\n */\nexport async function updateFromTemplateAsync(\n projectRoot: string,\n {\n exp,\n pkg,\n template,\n templateDirectory,\n platforms,\n skipDependencyUpdate,\n }: {\n /** Expo Config */\n exp: ExpoConfig;\n /** package.json as JSON */\n pkg: PackageJSONConfig;\n /** Template reference ID. */\n template?: string;\n /** Directory to write the template to before copying into the project. */\n templateDirectory?: string;\n /** List of platforms to clone. */\n platforms: ModPlatform[];\n /** List of dependencies to skip updating. */\n skipDependencyUpdate?: string[];\n }\n): Promise<\n {\n /** Indicates if new files were created in the project. */\n hasNewProjectFiles: boolean;\n /** Indicates that the project needs to run `pod install` */\n needsPodInstall: boolean;\n } & DependenciesModificationResults\n> {\n if (!templateDirectory) {\n const temporary = await import('tempy');\n templateDirectory = temporary.directory();\n }\n\n const copiedPaths = await profile(cloneTemplateAndCopyToProjectAsync)({\n projectRoot,\n template,\n templateDirectory,\n exp,\n platforms,\n });\n\n const depsResults = await profile(updatePackageJSONAsync)(projectRoot, {\n templateDirectory,\n pkg,\n skipDependencyUpdate,\n });\n\n return {\n hasNewProjectFiles: !!copiedPaths.length,\n // If the iOS folder changes or new packages are added, we should rerun pod install.\n needsPodInstall:\n copiedPaths.includes('ios') ||\n depsResults.hasNewDependencies ||\n depsResults.hasNewDevDependencies,\n ...depsResults,\n };\n}\n\n/**\n * Extract the template and copy the ios and android directories over to the project directory.\n *\n * @return `true` if any project files were created.\n */\nasync function cloneTemplateAndCopyToProjectAsync({\n projectRoot,\n templateDirectory,\n template,\n exp,\n platforms: unknownPlatforms,\n}: {\n projectRoot: string;\n templateDirectory: string;\n template?: string;\n exp: Pick<ExpoConfig, 'name' | 'sdkVersion'>;\n platforms: ModPlatform[];\n}): Promise<string[]> {\n const ora = logNewSection(\n 'Creating native project directories (./ios and ./android) and updating .gitignore'\n );\n\n try {\n await cloneTemplateAsync({ templateDirectory, template, exp, ora });\n\n const platforms = await validateTemplatePlatforms({\n templateDirectory,\n platforms: unknownPlatforms,\n });\n\n const results = await copyTemplateFilesAsync(projectRoot, {\n templateDirectory,\n platforms,\n });\n\n ora.succeed(createCopyFilesSuccessMessage(platforms, results));\n\n return results.copiedPaths;\n } catch (e: any) {\n if (!(e instanceof AbortCommandError)) {\n Log.error(e.message);\n }\n ora.fail('Failed to create the native project.');\n Log.log(\n chalk.yellow(\n 'You may want to delete the `./ios` and/or `./android` directories before trying again.'\n )\n );\n throw new SilentError(e);\n }\n}\n"],"names":["updateFromTemplateAsync","Log","projectRoot","exp","pkg","template","templateDirectory","platforms","skipDependencyUpdate","temporary","directory","copiedPaths","profile","cloneTemplateAndCopyToProjectAsync","depsResults","updatePackageJSONAsync","hasNewProjectFiles","length","needsPodInstall","includes","hasNewDependencies","hasNewDevDependencies","unknownPlatforms","ora","logNewSection","cloneTemplateAsync","validateTemplatePlatforms","results","copyTemplateFilesAsync","succeed","createCopyFilesSuccessMessage","e","AbortCommandError","error","message","fail","log","chalk","yellow","SilentError"],"mappings":"AAAA;;;;QAkBsBA,uBAAuB,GAAvBA,uBAAuB;AAhB3B,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEbC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACgC,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;AAClC,IAAA,IAAc,WAAd,cAAc,CAAA;AACpB,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;AAC4B,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AACxD,IAAA,gBAAmB,WAAnB,mBAAmB,CAAA;AACkB,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AACnD,IAAA,0BAA6B,WAA7B,6BAA6B,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOhE,eAAeD,uBAAuB,CAC3CE,WAAmB,EACnB,EACEC,GAAG,CAAA,EACHC,GAAG,CAAA,EACHC,QAAQ,CAAA,EACRC,iBAAiB,CAAA,EACjBC,SAAS,CAAA,EACTC,oBAAoB,CAAA,EAcrB,EAQD;IACA,IAAI,CAACF,iBAAiB,EAAE;QACtB,MAAMG,SAAS,GAAG,MAAM;mDAAO,OAAO;UAAC,AAAC;QACxCH,iBAAiB,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