@expo/cli 0.14.0 → 0.15.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.
Files changed (161) hide show
  1. package/build/bin/cli +5 -4
  2. package/build/bin/cli.map +1 -1
  3. package/build/src/api/getVersions.js.map +1 -1
  4. package/build/src/api/rest/cache/response.js.map +1 -1
  5. package/build/src/api/rest/client.js +2 -2
  6. package/build/src/api/rest/client.js.map +1 -1
  7. package/build/src/customize/typescript.js +3 -1
  8. package/build/src/customize/typescript.js.map +1 -1
  9. package/build/src/export/createMetadataJson.js +3 -2
  10. package/build/src/export/createMetadataJson.js.map +1 -1
  11. package/build/src/export/embed/exportEmbedAsync.js +44 -17
  12. package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
  13. package/build/src/export/embed/resolveOptions.js +3 -3
  14. package/build/src/export/embed/resolveOptions.js.map +1 -1
  15. package/build/src/export/exportApp.js +69 -80
  16. package/build/src/export/exportApp.js.map +1 -1
  17. package/build/src/export/exportAssets.js +81 -21
  18. package/build/src/export/exportAssets.js.map +1 -1
  19. package/build/src/export/exportHermes.js +4 -4
  20. package/build/src/export/exportHermes.js.map +1 -1
  21. package/build/src/export/exportStaticAsync.js +55 -20
  22. package/build/src/export/exportStaticAsync.js.map +1 -1
  23. package/build/src/export/favicon.js +2 -2
  24. package/build/src/export/favicon.js.map +1 -1
  25. package/build/src/export/fork-bundleAsync.js +12 -10
  26. package/build/src/export/fork-bundleAsync.js.map +1 -1
  27. package/build/src/export/index.js +9 -7
  28. package/build/src/export/index.js.map +1 -1
  29. package/build/src/export/metroAssetLocalPath.js +101 -0
  30. package/build/src/export/metroAssetLocalPath.js.map +1 -0
  31. package/build/src/export/persistMetroAssets.js +94 -21
  32. package/build/src/export/persistMetroAssets.js.map +1 -1
  33. package/build/src/export/resolveOptions.js +1 -1
  34. package/build/src/export/resolveOptions.js.map +1 -1
  35. package/build/src/export/saveAssets.js +9 -48
  36. package/build/src/export/saveAssets.js.map +1 -1
  37. package/build/src/export/web/exportWebAsync.js +1 -1
  38. package/build/src/export/web/exportWebAsync.js.map +1 -1
  39. package/build/src/export/writeContents.js +3 -2
  40. package/build/src/export/writeContents.js.map +1 -1
  41. package/build/src/install/applyPlugins.js +52 -0
  42. package/build/src/install/applyPlugins.js.map +1 -0
  43. package/build/src/install/checkPackages.js +2 -2
  44. package/build/src/install/checkPackages.js.map +1 -1
  45. package/build/src/install/fixPackages.js +84 -0
  46. package/build/src/install/fixPackages.js.map +1 -0
  47. package/build/src/install/installAsync.js +32 -61
  48. package/build/src/install/installAsync.js.map +1 -1
  49. package/build/src/install/installExpoPackage.js +79 -0
  50. package/build/src/install/installExpoPackage.js.map +1 -0
  51. package/build/src/prebuild/clearNativeFolder.js +1 -1
  52. package/build/src/prebuild/clearNativeFolder.js.map +1 -1
  53. package/build/src/prebuild/configureProjectAsync.js +3 -3
  54. package/build/src/prebuild/configureProjectAsync.js.map +1 -1
  55. package/build/src/prebuild/copyTemplateFiles.js +21 -30
  56. package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
  57. package/build/src/prebuild/prebuildAsync.js +37 -15
  58. package/build/src/prebuild/prebuildAsync.js.map +1 -1
  59. package/build/src/prebuild/resolveOptions.js +2 -2
  60. package/build/src/prebuild/resolveOptions.js.map +1 -1
  61. package/build/src/prebuild/updateFromTemplate.js +6 -6
  62. package/build/src/prebuild/updateFromTemplate.js.map +1 -1
  63. package/build/src/prebuild/updatePackageJson.js +49 -36
  64. package/build/src/prebuild/updatePackageJson.js.map +1 -1
  65. package/build/src/prebuild/validateTemplatePlatforms.js +2 -2
  66. package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -1
  67. package/build/src/start/doctor/dependencies/getVersionedPackages.js +12 -4
  68. package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
  69. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +20 -3
  70. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
  71. package/build/src/start/interface/interactiveActions.js +30 -11
  72. package/build/src/start/interface/interactiveActions.js.map +1 -1
  73. package/build/src/start/server/BundlerDevServer.js +14 -10
  74. package/build/src/start/server/BundlerDevServer.js.map +1 -1
  75. package/build/src/start/server/DevServerManager.js +6 -1
  76. package/build/src/start/server/DevServerManager.js.map +1 -1
  77. package/build/src/start/server/DevToolsPluginManager.js +63 -0
  78. package/build/src/start/server/DevToolsPluginManager.js.map +1 -0
  79. package/build/src/start/server/getStaticRenderFunctions.js +21 -23
  80. package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
  81. package/build/src/start/server/metro/MetroBundlerDevServer.js +48 -64
  82. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  83. package/build/src/start/server/metro/bundleApiRoutes.js +4 -3
  84. package/build/src/start/server/metro/bundleApiRoutes.js.map +1 -1
  85. package/build/src/start/server/metro/createExpoMetroResolver.js +62 -45
  86. package/build/src/start/server/metro/createExpoMetroResolver.js.map +1 -1
  87. package/build/src/start/server/metro/createJResolver.js +149 -0
  88. package/build/src/start/server/metro/createJResolver.js.map +1 -0
  89. package/build/src/start/server/metro/createServerRouteMiddleware.js +13 -1
  90. package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
  91. package/build/src/start/server/metro/externals.js +25 -3
  92. package/build/src/start/server/metro/externals.js.map +1 -1
  93. package/build/src/start/server/metro/inspector-proxy/device.js +3 -1
  94. package/build/src/start/server/metro/inspector-proxy/device.js.map +1 -1
  95. package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.js +3 -4
  96. package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.js.map +1 -1
  97. package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeCallFunctionOn.js +24 -0
  98. package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeCallFunctionOn.js.map +1 -0
  99. package/build/src/start/server/metro/inspector-proxy/handlers/utils.js +11 -0
  100. package/build/src/start/server/metro/inspector-proxy/handlers/utils.js.map +1 -0
  101. package/build/src/start/server/metro/inspector-proxy/index.js +10 -7
  102. package/build/src/start/server/metro/inspector-proxy/index.js.map +1 -1
  103. package/build/src/start/server/metro/instantiateMetro.js +32 -10
  104. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  105. package/build/src/start/server/metro/metroErrorInterface.js +1 -1
  106. package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
  107. package/build/src/start/server/metro/router.js +4 -1
  108. package/build/src/start/server/metro/router.js.map +1 -1
  109. package/build/src/start/server/metro/runServer-fork.js +19 -10
  110. package/build/src/start/server/metro/runServer-fork.js.map +1 -1
  111. package/build/src/start/server/metro/serializeHtml.js +43 -0
  112. package/build/src/start/server/metro/serializeHtml.js.map +1 -0
  113. package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +1 -2
  114. package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
  115. package/build/src/start/server/metro/withMetroMultiPlatform.js +261 -201
  116. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  117. package/build/src/start/server/metro/withMetroResolvers.js +114 -40
  118. package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
  119. package/build/src/start/server/middleware/DevToolsPluginMiddleware.js +61 -0
  120. package/build/src/start/server/middleware/DevToolsPluginMiddleware.js.map +1 -0
  121. package/build/src/start/server/middleware/ExpoMiddleware.js +2 -2
  122. package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
  123. package/build/src/start/server/middleware/ManifestMiddleware.js +15 -66
  124. package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
  125. package/build/src/start/server/middleware/inspector/JsInspector.js +1 -1
  126. package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
  127. package/build/src/start/server/middleware/inspector/LaunchBrowser.js +30 -26
  128. package/build/src/start/server/middleware/inspector/LaunchBrowser.js.map +1 -1
  129. package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js +7 -7
  130. package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js.map +1 -1
  131. package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js +5 -2
  132. package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js.map +1 -1
  133. package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js +3 -2
  134. package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js.map +1 -1
  135. package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js +8 -7
  136. package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js.map +1 -1
  137. package/build/src/start/server/middleware/metroOptions.js +123 -0
  138. package/build/src/start/server/middleware/metroOptions.js.map +1 -0
  139. package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js.map +1 -1
  140. package/build/src/utils/analytics/getMetroDebugProperties.js +1 -2
  141. package/build/src/utils/analytics/getMetroDebugProperties.js.map +1 -1
  142. package/build/src/utils/analytics/getMetroProperties.js +1 -2
  143. package/build/src/utils/analytics/getMetroProperties.js.map +1 -1
  144. package/build/src/utils/analytics/rudderstackClient.js +2 -2
  145. package/build/src/utils/args.js +4 -2
  146. package/build/src/utils/args.js.map +1 -1
  147. package/build/src/utils/cocoapods.js +1 -1
  148. package/build/src/utils/cocoapods.js.map +1 -1
  149. package/build/src/utils/dir.js +18 -8
  150. package/build/src/utils/dir.js.map +1 -1
  151. package/build/src/utils/env.js +3 -0
  152. package/build/src/utils/env.js.map +1 -1
  153. package/build/src/utils/getOrPromptApplicationId.js +2 -4
  154. package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
  155. package/build/src/utils/prompts.js +1 -28
  156. package/build/src/utils/prompts.js.map +1 -1
  157. package/package.json +15 -14
  158. package/static/shims/react-native-web/dist/cjs/exports/AppRegistry/AppContainer.js +13 -0
  159. package/static/shims/react-native-web/dist/exports/AppRegistry/AppContainer.js +12 -0
  160. package/build/src/start/server/metro/resolveFromProject.js +0 -90
  161. package/build/src/start/server/metro/resolveFromProject.js.map +0 -1
@@ -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","exp","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,EAGV,EACoB;IACrB,IAAIC,gBAAgB,AAAoB,AAAC;IACzC,IAAID,SAAS,CAACE,QAAQ,CAAC,KAAK,CAAC,EAAE;QAC7B,mHAAmH;QACnHD,gBAAgB,GAAG,MAAME,CAAAA,GAAAA,yBAA8B,AAAa,CAAA,+BAAb,CAACJ,WAAW,CAAC,CAAC;KACtE;IACD,IAAIK,WAAW,AAAoB,AAAC;IACpC,IAAIJ,SAAS,CAACE,QAAQ,CAAC,SAAS,CAAC,EAAE;QACjC,iHAAiH;QACjHE,WAAW,GAAG,MAAMC,CAAAA,GAAAA,yBAAqB,AAAa,CAAA,sBAAb,CAACN,WAAW,CAAC,CAAC;KACxD;IAED,IAAI,EAAEO,GAAG,EAAEC,MAAM,CAAA,EAAE,GAAG,MAAMC,CAAAA,GAAAA,eAAsB,AAIhD,CAAA,uBAJgD,CAACT,WAAW,EAAE;QAC9DC,SAAS;QACTI,WAAW;QACXH,gBAAgB;KACjB,CAAC,AAAC;IAEH,+BAA+B;IAC/BM,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"}
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.copyTemplateFilesAsync = copyTemplateFilesAsync;
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
- let message = `Created native project${platforms.length > 1 ? "s" : ""}`;
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(", ")} already created`);
31
+ message += _chalk.default.dim(` | reusing ${skippedPaths.map((path)=>_chalk.default.bold(`/${path}`)
32
+ ).join(", ")}`);
32
33
  }
33
34
  if (!gitignore) {
34
- message += _chalk.default.dim(` | gitignore skipped`);
35
+ // Add no additional message...
35
36
  } else if (!gitignore.didMerge) {
36
- message += _chalk.default.dim(` | gitignore already synced`);
37
+ message += _chalk.default.dim(` | reusing gitignore`);
37
38
  } else if (gitignore.didMerge && gitignore.didClear) {
38
- message += _chalk.default.dim(` | synced gitignore`);
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
- async function copyTemplateFilesAsync(projectRoot, { templateDirectory , platforms }) {
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
- for (const copyFilePath of copyFilePaths){
47
+ platforms.forEach((copyFilePath)=>{
60
48
  const projectPath = _path.default.join(projectRoot, copyFilePath);
61
- if (!await (0, _dir).directoryExistsAsync(projectPath)) {
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
- debug(`Copied files:`, copiedPaths);
69
- debug(`Skipped files:`, copiedPaths);
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, 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,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,EACxB,EAAEQ,YAAY,CAAA,EAAEC,SAAS,CAAA,EAAoB,EACrC;I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Files.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,GAAK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MZ,YAAY,GAAa,EAAE,AAAC;IAElCR,SAAS,CAACqB,OAAO,CAAC,CAACC,YAAY,GAAK;QAClC,MAAMC,WAAW,GAAGjB,KAAI,QAAA,CAACC,IAAI,CAACR,WAAW,EAAEuB,YAAY,CAAC,AAAC;QACzD,IAAIlB,GAAE,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 , hasNewDependencies } = await (0, _updateFromTemplate).updateFromTemplateAsync(projectRoot, {
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,41 @@ async function prebuildAsync(projectRoot, options) {
71
79
  });
72
80
  // Install node modules
73
81
  if (options.install) {
74
- var ref, ref1, ref2, ref3, ref4;
75
- if (hasNewDependencies && ((ref = options.packageManager) == null ? void 0 : ref.npm)) {
76
- await (0, _nodeModules).clearNodeModulesAsync(projectRoot);
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
107
  // Apply Expo config to native projects
87
- const configSyncingStep = (0, _ora).logNewSection("Config syncing");
108
+ const configSyncingStep = (0, _ora).logNewSection("Running prebuild");
88
109
  try {
89
110
  await (0, _profile).profile(_configureProjectAsync.configureProjectAsync)(projectRoot, {
90
- platforms: options.platforms
111
+ platforms: options.platforms,
112
+ exp
91
113
  });
92
- configSyncingStep.succeed("Config synced");
114
+ configSyncingStep.succeed("Finished prebuild");
93
115
  } catch (error) {
94
- configSyncingStep.fail("Config sync failed");
116
+ configSyncingStep.fail("Prebuild failed");
95
117
  throw error;
96
118
  }
97
119
  // 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;;;;;;;;;;;;;;;;;;;;;;AAE1C,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,AAAsB,AAAC;AAwB/D,eAAeF,aAAa,CACjCG,WAAmB,EACnBC,OAkBC,EACgC;IACjCC,CAAAA,GAAAA,QAAU,AAAe,CAAA,WAAf,CAAC,aAAa,CAAC,CAAC;IAC1BH,OAAO,CAAC,WAAW,CAAC,CAACI,IAAI,CAACH,WAAW,CAAC,CAAC;IAEvC,IAAIC,OAAO,CAACG,KAAK,EAAE;QACjB,MAAM,EAAEC,yBAAyB,CAAA,EAAE,GAAG,MAAM;mDAAO,iBAAiB;UAAC,AAAC;QACtE,+BAA+B;QAC/B,IAAI,MAAMA,yBAAyB,EAAE,EAAE;YACrC,OAAO,IAAI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B,CAAA,QAAvB,CAACC,sBAAqB,sBAAA,CAAC,CAACrC,WAAW,EAAE;YAChDO,SAAS,EAAEN,OAAO,CAACM,SAAS;SAC7B,CAAC,CAAC;QACH2B,iBAAiB,CAACI,OAAO,CAAC,eAAe,CAAC,CAAC;KAC5C,CAAC,OAAOC,KAAK,EAAE;QACdL,iBAAiB,CAACM,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAC7C,MAAMD,KAAK,CAAC;KACb;IAED,oBAAoB;IACpB,IAAIE,aAAa,GAAY,KAAK,AAAC;IACnC,8GAA8G;IAC9G,IAAIxC,OAAO,CAACM,SAAS,CAACmC,QAAQ,CAAC,KAAK,CAAC,IAAIzC,OAAO,CAACqB,OAAO,IAAIP,eAAe,EAAE;QAC3E,MAAM,EAAE4B,qBAAqB,CAAA,EAAE,GAAG,MAAM;mDAAO,uBAAuB;UAAC,AAAC;QAExEF,aAAa,GAAG,MAAME,qBAAqB,CAAC3C,WAAW,CAAC,CAAC;KAC1D,MAAM;QACLF,KAAK,CAAC,qBAAqB,CAAC,CAAC;KAC9B;IAED,OAAO;QACL8C,WAAW,EAAE,CAAC,CAAC3C,OAAO,CAACqB,OAAO;QAC9BuB,UAAU,EAAE,CAACJ,aAAa;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\n const configSyncingStep = 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","logNewSection","profile","configureProjectAsync","succeed","error","fail","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,CAAA;AACvD,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AACjC,IAAA,aAAyB,WAAzB,yBAAyB,CAAA;AAClC,IAAA,IAAQ,WAAR,QAAQ,CAAA;AACR,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;AACb,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/C,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,AAAsB,AAAC;AAwB/D,eAAeF,aAAa,CACjCG,WAAmB,EACnBC,OAkBC,EACgC;IACjCC,CAAAA,GAAAA,QAAU,AAAe,CAAA,WAAf,CAAC,aAAa,CAAC,CAAC;IAC1BH,OAAO,CAAC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,qBAAqB,CAAA,EAAE,GAAG,MAAM;mDAAO,uBAAuB;UAAC,AAAC;QAExEF,aAAa,GAAG,MAAME,qBAAqB,CAACpD,WAAW,CAAC,CAAC;KAC1D,MAAM;QACLF,KAAK,CAAC,qBAAqB,CAAC,CAAC;KAC9B;IAED,OAAO;QACLuD,WAAW,EAAE,CAAC,CAACpD,OAAO,CAACqB,OAAO;QAC9BgC,UAAU,EAAE,CAACJ,aAAa;QAC1B3C,SAAS,EAAEN,OAAO,CAACM,SAAS;QAC5BO,kBAAkB;QAClBH,GAAG;KACJ,CAAC;CACH"}
@@ -98,9 +98,9 @@ function resolvePlatformOption(platform = "all", { loose } = {}) {
98
98
  }
99
99
  }
100
100
  function ensureValidPlatforms(platforms) {
101
- // Skip ejecting for iOS on Windows
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 eject} again from macOS or Linux to generate the iOS project.\n`);
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 ejecting 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 expo eject} 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","plat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,CACNC,MAAK,QAAA,CAAC,wIAAoI,CAAC,CAC5I,CAAC;QACF,OAAOH,SAAS,CAACnB,MAAM,CAAC,CAACgB,QAAQ,GAAKA,QAAQ,KAAK,KAAK;QAAA,CAAC,CAAC;KAC3D;IACD,OAAOG,SAAS,CAAC;CAClB;AAGM,SAAS3B,eAAe,CAAC2B,SAAwB,EAAE;IACxD,IAAI,CAACA,CAAAA,SAAS,QAAQ,GAAjBA,KAAAA,CAAiB,GAAjBA,SAAS,CAAEjB,MAAM,CAAA,EAAE;QACtB,MAAM,IAAIC,OAAY,aAAA,CAAC,oDAAoD,CAAC,CAAC;KAC9E;CACF"}
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,KAAM,kCAAN,MAAM,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oD,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.hasNewDependencies || depsResults.hasNewDevDependencies,
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 project ${pluralized} (${platformDirectories}) and updating .gitignore`);
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 = await (0, _validateTemplatePlatforms).validateTemplatePlatforms({
83
+ const platforms = (0, _validateTemplatePlatforms).validateTemplatePlatforms({
84
84
  templateDirectory,
85
85
  platforms: unknownPlatforms
86
86
  });
87
- const results = await (0, _copyTemplateFiles).copyTemplateFilesAsync(projectRoot, {
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("Failed to create the native project.");
98
- Log.log(_chalk.default.yellow("You may want to delete the `./ios` and/or `./android` directories before trying again."));
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
  }
@@ -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 { copyTemplateFilesAsync, createCopyFilesSuccessMessage } from './copyTemplateFiles';\nimport { cloneTemplateAsync } from './resolveTemplate';\nimport { DependenciesModificationResults, updatePackageJSONAsync } from './updatePackageJson';\nimport { validateTemplatePlatforms } from './validateTemplatePlatforms';\nimport * as Log from '../log';\nimport { AbortCommandError, SilentError } from '../utils/errors';\nimport { logNewSection } from '../utils/ora';\nimport { profile } from '../utils/profile';\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 platformDirectories = unknownPlatforms\n .map((platform) => `./${platform}`)\n .reverse()\n .join(' and ');\n\n const pluralized = unknownPlatforms.length > 1 ? 'directories' : 'directory';\n const ora = logNewSection(\n `Creating native project ${pluralized} (${platformDirectories}) 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","platformDirectories","map","platform","reverse","join","pluralized","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;AAE6C,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AACxD,IAAA,gBAAmB,WAAnB,mBAAmB,CAAA;AACkB,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AACnD,IAAA,0BAA6B,WAA7B,6BAA6B,CAAA;AAC3DC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACgC,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;AAClC,IAAA,IAAc,WAAd,cAAc,CAAA;AACpB,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOnC,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,GAAGG,SAAS,CAACC,SAAS,EAAE,CAAC;KAC3C;IAED,MAAMC,WAAW,GAAG,MAAMC,CAAAA,GAAAA,QAAO,AAAoC,CAAA,QAApC,CAACC,kCAAkC,CAAC,CAAC;QACpEX,WAAW;QACXG,QAAQ;QACRC,iBAAiB;QACjBH,GAAG;QACHI,SAAS;KACV,CAAC,AAAC;IAEH,MAAMO,WAAW,GAAG,MAAMF,CAAAA,GAAAA,QAAO,AAAwB,CAAA,QAAxB,CAACG,kBAAsB,uBAAA,CAAC,CAACb,WAAW,EAAE;QACrEI,iBAAiB;QACjBF,GAAG;QACHI,oBAAoB;KACrB,CAAC,AAA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ACxDI,iBAAiB;YACjBC,SAAS;SACV,CAAC,AAAC;QAEHsB,GAAG,CAACM,OAAO,CAACC,CAAAA,GAAAA,kBAA6B,AAAoB,CAAA,8BAApB,CAAC7B,SAAS,EAAE0B,OAAO,CAAC,CAAC,CAAC;QAE/D,OAAOA,OAAO,CAACtB,WAAW,CAAC;KAC5B,CAAC,OAAO0B,CAAC,EAAO;QACf,IAAI,CAAC,CAACA,CAAC,YAAYC,OAAiB,kBAAA,CAAC,EAAE;YACrCrC,GAAG,CAACsC,KAAK,CAACF,CAAC,CAACG,OAAO,CAAC,CAAC;SACtB;QACDX,GAAG,CAACY,IAAI,CAAC,sCAAsC,CAAC,CAAC;QACjDxC,GAAG,CAACyC,GAAG,CACLC,MAAK,QAAA,CAACC,MAAM,CACV,wFAAwF,CACzF,CACF,CAAC;QACF,MAAM,IAAIC,OAAW,YAAA,CAACR,CAAC,CAAC,CAAC;KAC1B;CACF"}
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 { copyTemplateFiles, createCopyFilesSuccessMessage } from './copyTemplateFiles';\nimport { cloneTemplateAsync } from './resolveTemplate';\nimport { DependenciesModificationResults, updatePackageJSONAsync } from './updatePackageJson';\nimport { validateTemplatePlatforms } from './validateTemplatePlatforms';\nimport * as Log from '../log';\nimport { AbortCommandError, SilentError } from '../utils/errors';\nimport { logNewSection } from '../utils/ora';\nimport { profile } from '../utils/profile';\n\n/**\n * Creates local native files from an input template file path.\n *\n * @return `true` if the project is prebuilding, 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: copiedPaths.includes('ios') || !!depsResults.changedDependencies.length,\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 platformDirectories = unknownPlatforms\n .map((platform) => `./${platform}`)\n .reverse()\n .join(' and ');\n\n const pluralized = unknownPlatforms.length > 1 ? 'directories' : 'directory';\n const ora = logNewSection(`Creating native ${pluralized} (${platformDirectories})`);\n\n try {\n await cloneTemplateAsync({ templateDirectory, template, exp, ora });\n\n const platforms = validateTemplatePlatforms({\n templateDirectory,\n platforms: unknownPlatforms,\n });\n\n const results = copyTemplateFiles(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 ${pluralized}`);\n Log.log(\n chalk.yellow(\n chalk`You may want to delete the {bold ./ios} and/or {bold ./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","changedDependencies","unknownPlatforms","platformDirectories","map","platform","reverse","join","pluralized","ora","logNewSection","cloneTemplateAsync","validateTemplatePlatforms","results","copyTemplateFiles","succeed","createCopyFilesSuccessMessage","e","AbortCommandError","error","message","fail","log","chalk","yellow","SilentError"],"mappings":"AAAA;;;;QAkBsBA,uBAAuB,GAAvBA,uBAAuB;AAhB3B,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEwC,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AACnD,IAAA,gBAAmB,WAAnB,mBAAmB,CAAA;AACkB,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AACnD,IAAA,0BAA6B,WAA7B,6BAA6B,CAAA;AAC3DC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACgC,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;AAClC,IAAA,IAAc,WAAd,cAAc,CAAA;AACpB,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOnC,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,GAAGG,SAAS,CAACC,SAAS,EAAE,CAAC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,gBAAkB,AAA2C,CAAA,mBAA3C,CAAC;YAAExB,iBAAiB;YAAED,QAAQ;YAAEF,GAAG;YAAEyB,GAAG;SAAE,CAAC,CAAC;QAEpE,MAAMrB,SAAS,GAAGwB,CAAAA,GAAAA,0BAAyB,AAGzC,CAAA,0BAHyC,CAAC;YAC1CzB,iBAAiB;YACjBC,SAAS,EAAEc,gBAAgB;SAC5B,CAAC,AAAC;QAEH,MAAMW,OAAO,GAAGC,CAAAA,GAAAA,kBAAiB,AAG/B,CAAA,kBAH+B,CAAC/B,WAAW,EAAE;YAC7CI,iBAAiB;YACjBC,SAAS;SACV,CAAC,AAAC;QAEHqB,GAAG,CAACM,OAAO,CAACC,CAAAA,GAAAA,kBAA6B,AAAoB,CAAA,8BAApB,CAAC5B,SAAS,EAAEyB,OAAO,CAAC,CAAC,CAAC;QAE/D,OAAOA,OAAO,CAACrB,WAAW,CAAC;KAC5B,CAAC,OAAOyB,CAAC,EAAO;QACf,IAAI,CAAC,CAACA,CAAC,YAAYC,OAAiB,kBAAA,CAAC,EAAE;YACrCpC,GAAG,CAACqC,KAAK,CAACF,CAAC,CAACG,OAAO,CAAC,CAAC;SACtB;QACDX,GAAG,CAACY,IAAI,CAAC,CAAC,4BAA4B,EAAEb,UAAU,CAAC,CAAC,CAAC,CAAC;QACtD1B,GAAG,CAACwC,GAAG,CACLC,MAAK,QAAA,CAACC,MAAM,CACVD,MAAK,QAAA,CAAC,gGAAgG,CAAC,CACxG,CACF,CAAC;QACF,MAAM,IAAIE,OAAW,YAAA,CAACR,CAAC,CAAC,CAAC;KAC1B;CACF"}
@@ -42,25 +42,28 @@ function _interopRequireWildcard(obj) {
42
42
  return newObj;
43
43
  }
44
44
  }
45
- async function updatePackageJSONAsync(projectRoot, { templateDirectory , pkg , skipDependencyUpdate }) {
46
- const updatingPackageJsonStep = (0, _ora).logNewSection("Updating your package.json scripts, dependencies, and main file");
47
- const templatePkg = (0, _config).getPackageJson(templateDirectory);
45
+ async function updatePackageJSONAsync(projectRoot, { templateDirectory , templatePkg =(0, _config).getPackageJson(templateDirectory) , pkg , skipDependencyUpdate }) {
46
+ const updatingPackageJsonStep = (0, _ora).logNewSection("Updating package.json");
48
47
  const results = modifyPackageJson(projectRoot, {
49
48
  templatePkg,
50
49
  pkg,
51
50
  skipDependencyUpdate
52
51
  });
53
- await _fs.default.promises.writeFile(_path.default.resolve(projectRoot, "package.json"), // Add new line to match the format of running yarn.
54
- // This prevents the `package.json` from changing when running `prebuild --no-install` multiple times.
55
- JSON.stringify(pkg, null, 2) + "\n");
56
- updatingPackageJsonStep.succeed("Updated package.json and added index.js entry point for iOS and Android");
52
+ const hasChanges = results.changedDependencies.length || results.scriptsChanged;
53
+ // NOTE: This is effectively bundler caching and subject to breakage if the inputs don't match the mutations.
54
+ if (hasChanges) {
55
+ await _fs.default.promises.writeFile(_path.default.resolve(projectRoot, "package.json"), // Add new line to match the format of running yarn.
56
+ // This prevents the `package.json` from changing when running `prebuild --no-install` multiple times.
57
+ JSON.stringify(pkg, null, 2) + "\n");
58
+ }
59
+ updatingPackageJsonStep.succeed("Updated package.json" + (hasChanges ? "" : _chalk.default.dim(` | no changes`)));
57
60
  return results;
58
61
  }
59
62
  /**
60
63
  * Make required modifications to the `package.json` file as a JSON object.
61
64
  *
62
65
  * 1. Update `package.json` `scripts`.
63
- * 2. Update `package.json` `dependencies` and `devDependencies`.
66
+ * 2. Update `package.json` `dependencies` (not `devDependencies`).
64
67
  * 3. Update `package.json` `main`.
65
68
  *
66
69
  * @param projectRoot The root directory of the project.
@@ -69,33 +72,43 @@ async function updatePackageJSONAsync(projectRoot, { templateDirectory , pkg , s
69
72
  * @param props.skipDependencyUpdate Array of dependencies to skip updating.
70
73
  * @returns
71
74
  */ function modifyPackageJson(projectRoot, { templatePkg , pkg , skipDependencyUpdate }) {
72
- updatePkgScripts({
75
+ const scriptsChanged = updatePkgScripts({
73
76
  pkg
74
77
  });
75
78
  // TODO: Move to `npx expo-doctor`
76
- return updatePkgDependencies(projectRoot, {
77
- pkg,
78
- templatePkg,
79
- skipDependencyUpdate
80
- });
79
+ return {
80
+ scriptsChanged,
81
+ ...updatePkgDependencies(projectRoot, {
82
+ pkg,
83
+ templatePkg,
84
+ skipDependencyUpdate
85
+ })
86
+ };
81
87
  }
82
88
  function updatePkgDependencies(projectRoot, { pkg: pkg1 , templatePkg , skipDependencyUpdate =[] }) {
83
- if (!pkg1.devDependencies) {
84
- pkg1.devDependencies = {};
85
- }
86
- const { dependencies , devDependencies } = templatePkg;
89
+ const { dependencies } = templatePkg;
90
+ // The default values come from the bare-minimum template's package.json.
91
+ // Users can change this by using different templates with the `--template` flag.
92
+ // The main reason for allowing the changing of dependencies would be to include
93
+ // dependencies that are required for the native project to build. For example,
94
+ // it does not need to include dependencies that are used in the JS-code only.
87
95
  const defaultDependencies = createDependenciesMap(dependencies);
88
- const defaultDevDependencies = createDependenciesMap(devDependencies);
96
+ // NOTE: This is a hack to ensure this doesn't trigger an extraneous change in the `package.json`
97
+ // it isn't required for anything in the `ios` and `android` folders.
98
+ delete defaultDependencies["expo-status-bar"];
99
+ // NOTE: Expo splash screen is installed by default in the template but the config plugin also lives in prebuild-config
100
+ // so we can delete it to prevent an extraneous change in the `package.json`.
101
+ delete defaultDependencies["expo-splash-screen"];
89
102
  const combinedDependencies = createDependenciesMap({
90
103
  ...defaultDependencies,
91
104
  ...pkg1.dependencies
92
105
  });
93
106
  // These dependencies are only added, not overwritten from the project
94
107
  const requiredDependencies = [
108
+ // TODO: This is no longer required because it's this same package.
95
109
  "expo",
96
- "expo-splash-screen",
97
- "react",
98
- "react-native"
110
+ // TODO: Drop this somehow.
111
+ "react-native",
99
112
  ].filter((depKey)=>!!defaultDependencies[depKey]
100
113
  );
101
114
  const symlinkedPackages = [];
@@ -132,29 +145,25 @@ function updatePkgDependencies(projectRoot, { pkg: pkg1 , templatePkg , skipDepe
132
145
  Log.warn(`\u203A Using current versions instead of recommended ${nonRecommendedPackages.map((pkg)=>_chalk.default.bold(pkg)
133
146
  ).join(", ")}.`);
134
147
  }
135
- const combinedDevDependencies = createDependenciesMap({
136
- ...defaultDevDependencies,
137
- ...pkg1.devDependencies
138
- });
139
148
  // Only change the dependencies if the normalized hash changes, this helps to reduce meaningless changes.
140
149
  const hasNewDependencies = hashForDependencyMap(pkg1.dependencies) !== hashForDependencyMap(combinedDependencies);
141
- const hasNewDevDependencies = hashForDependencyMap(pkg1.devDependencies) !== hashForDependencyMap(combinedDevDependencies);
142
150
  // Save the dependencies
151
+ let changedDependencies = [];
143
152
  if (hasNewDependencies) {
144
153
  var _dependencies;
154
+ changedDependencies = diffKeys(combinedDependencies, (_dependencies = pkg1.dependencies) != null ? _dependencies : {}).sort();
155
+ var _dependencies1;
145
156
  // Use Object.assign to preserve the original order of dependencies, this makes it easier to see what changed in the git diff.
146
- pkg1.dependencies = Object.assign((_dependencies = pkg1.dependencies) != null ? _dependencies : {}, combinedDependencies);
147
- }
148
- if (hasNewDevDependencies) {
149
- var _devDependencies;
150
- // Same as with dependencies
151
- pkg1.devDependencies = Object.assign((_devDependencies = pkg1.devDependencies) != null ? _devDependencies : {}, combinedDevDependencies);
157
+ pkg1.dependencies = Object.assign((_dependencies1 = pkg1.dependencies) != null ? _dependencies1 : {}, combinedDependencies);
152
158
  }
153
159
  return {
154
- hasNewDependencies,
155
- hasNewDevDependencies
160
+ changedDependencies
156
161
  };
157
162
  }
163
+ function diffKeys(a, b) {
164
+ return Object.keys(a).filter((key)=>a[key] !== b[key]
165
+ );
166
+ }
158
167
  function createDependenciesMap(dependencies) {
159
168
  if (typeof dependencies !== "object") {
160
169
  throw new Error(`Dependency map is invalid, expected object but got ${typeof dependencies}`);
@@ -174,18 +183,22 @@ function createDependenciesMap(dependencies) {
174
183
  }
175
184
  /**
176
185
  * Update package.json scripts - `npm start` should default to `expo
177
- * start --dev-client` rather than `expo start` after ejecting, for example.
186
+ * start --dev-client` rather than `expo start` after prebuilding, for example.
178
187
  */ function updatePkgScripts({ pkg }) {
179
188
  var ref, ref1;
189
+ let hasChanged = false;
180
190
  if (!pkg.scripts) {
181
191
  pkg.scripts = {};
182
192
  }
183
193
  if (!((ref = pkg.scripts.android) == null ? void 0 : ref.includes("run"))) {
184
194
  pkg.scripts.android = "expo run:android";
195
+ hasChanged = true;
185
196
  }
186
197
  if (!((ref1 = pkg.scripts.ios) == null ? void 0 : ref1.includes("run"))) {
187
198
  pkg.scripts.ios = "expo run:ios";
199
+ hasChanged = true;
188
200
  }
201
+ return hasChanged;
189
202
  }
190
203
  function normalizeDependencyMap(deps) {
191
204
  return Object.keys(deps).map((dependency)=>`${dependency}@${deps[dependency]}`