create-react-native-library 0.44.2 → 0.45.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 (60) hide show
  1. package/lib/{utils → exampleApp}/addCodegenBuildScript.js +8 -2
  2. package/lib/exampleApp/addCodegenBuildScript.js.map +1 -0
  3. package/lib/exampleApp/dependencies.js +32 -0
  4. package/lib/exampleApp/dependencies.js.map +1 -0
  5. package/lib/{utils → exampleApp}/generateExampleApp.js +2 -2
  6. package/lib/exampleApp/generateExampleApp.js.map +1 -0
  7. package/lib/index.js +91 -624
  8. package/lib/index.js.map +1 -1
  9. package/lib/inform.js +91 -0
  10. package/lib/inform.js.map +1 -0
  11. package/lib/input.js +266 -0
  12. package/lib/input.js.map +1 -0
  13. package/lib/template.js +175 -0
  14. package/lib/template.js.map +1 -0
  15. package/lib/utils/assert.js +59 -0
  16. package/lib/utils/assert.js.map +1 -0
  17. package/lib/utils/initialCommit.js +34 -0
  18. package/lib/utils/initialCommit.js.map +1 -0
  19. package/lib/utils/promiseWithFallback.js +25 -0
  20. package/lib/utils/promiseWithFallback.js.map +1 -0
  21. package/package.json +2 -2
  22. package/templates/common/$package.json +2 -2
  23. package/templates/common/CONTRIBUTING.md +0 -25
  24. package/templates/common/babel.config.js +1 -3
  25. package/templates/common/tsconfig.json +1 -0
  26. package/templates/common-local/$package.json +1 -1
  27. package/templates/example-module-legacy/example/src/App.tsx +25 -0
  28. package/templates/example-module-new/example/src/App.tsx +20 -0
  29. package/templates/example-view/example/src/App.tsx +23 -0
  30. package/templates/js-library/src/index.tsx +2 -2
  31. package/templates/kotlin-library-new/android/src/main/java/com/{%- project.package_dir %}/{%- project.name %}Package.kt +2 -2
  32. package/templates/native-common/android/build.gradle +3 -19
  33. package/templates/objc-library/ios/{%- project.name %}.h +4 -4
  34. package/templates/objc-library/ios/{%- project.name %}.mm +1 -6
  35. package/templates/objc-view-new/ios/{%- project.name %}View.h +0 -3
  36. package/templates/objc-view-new/ios/{%- project.name %}View.mm +6 -6
  37. package/lib/utils/addCodegenBuildScript.js.map +0 -1
  38. package/lib/utils/generateExampleApp.js.map +0 -1
  39. package/templates/common-example/example/src/App.tsx +0 -57
  40. package/templates/kotlin-library-mixed/android/src/main/java/com/{%- project.package_dir %}/{%- project.name %}Module.kt +0 -24
  41. package/templates/kotlin-library-mixed/android/src/main/java/com/{%- project.package_dir %}/{%- project.name %}Package.kt +0 -35
  42. package/templates/kotlin-library-mixed/android/src/newarch/{%- project.name %}Spec.kt +0 -7
  43. package/templates/kotlin-library-mixed/android/src/oldarch/{%- project.name %}Spec.kt +0 -11
  44. package/templates/kotlin-view-mixed/android/src/main/java/com/{%- project.package_dir %}/{%- project.name %}Package.kt +0 -19
  45. package/templates/kotlin-view-mixed/android/src/main/java/com/{%- project.package_dir %}/{%- project.name %}View.kt +0 -15
  46. package/templates/kotlin-view-mixed/android/src/main/java/com/{%- project.package_dir %}/{%- project.name %}ViewManager.kt +0 -28
  47. package/templates/kotlin-view-mixed/android/src/newarch/{%- project.name %}ViewManagerSpec.kt +0 -21
  48. package/templates/kotlin-view-mixed/android/src/oldarch/{%- project.name %}ViewManagerSpec.kt +0 -9
  49. package/templates/native-library-mixed/react-native.config.js +0 -16
  50. package/templates/native-library-mixed/src/Native{%- project.name %}.ts +0 -8
  51. package/templates/native-library-mixed/src/index.tsx +0 -29
  52. package/templates/native-view-mixed/react-native.config.js +0 -16
  53. package/templates/native-view-mixed/src/index.tsx +0 -2
  54. package/templates/native-view-mixed/src/{%- project.name %}ViewNativeComponent.ts +0 -8
  55. package/templates/objc-view-mixed/ios/Utils.h +0 -8
  56. package/templates/objc-view-mixed/ios/Utils.m +0 -26
  57. package/templates/objc-view-mixed/ios/{%- project.name %}View.h +0 -17
  58. package/templates/objc-view-mixed/ios/{%- project.name %}View.mm +0 -60
  59. package/templates/objc-view-mixed/ios/{%- project.name %}ViewManager.mm +0 -23
  60. /package/templates/{common-example → example-common}/example/metro.config.js +0 -0
@@ -16,8 +16,14 @@ def isNewArchitectureEnabled() {
16
16
  if (isNewArchitectureEnabled()) {
17
17
  // Since our library doesn't invoke codegen automatically we need to do it here.
18
18
  tasks.register('invokeLibraryCodegen', Exec) {
19
- workingDir "$rootDir/../../"
20
- commandLine "npx", "bob", "build", "--target", "codegen"
19
+ workingDir "$rootDir/../../"
20
+ def isWindows = System.getProperty('os.name').toLowerCase().contains('windows')
21
+
22
+ if (isWindows) {
23
+ commandLine 'cmd', '/c', 'npx bob build --target codegen'
24
+ } else {
25
+ commandLine 'sh', '-c', 'npx bob build --target codegen'
26
+ }
21
27
  }
22
28
  preBuild.dependsOn invokeLibraryCodegen
23
29
  }`;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addCodegenBuildScript.js","names":["_path","_interopRequireDefault","require","_fsExtra","e","__esModule","default","GRADLE_INVOKE_CODEGEN_TASK","PODSPEC_INVOKE_CODEGEN_SCRIPT","addCodegenBuildScript","libraryPath","appBuildGradlePath","path","join","podfilePath","appBuildGradle","fs","readFile","toString","writeFile","podfile","split","podfilePostInstallIndex","findIndex","line","includes","splice"],"sources":["../../src/exampleApp/addCodegenBuildScript.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs-extra';\n\n// This is added to the example app's build.gradle file to invoke codegen before every build\nconst GRADLE_INVOKE_CODEGEN_TASK = `\ndef isNewArchitectureEnabled() {\n return rootProject.hasProperty(\"newArchEnabled\") && rootProject.getProperty(\"newArchEnabled\") == \"true\"\n}\n\nif (isNewArchitectureEnabled()) {\n // Since our library doesn't invoke codegen automatically we need to do it here.\n tasks.register('invokeLibraryCodegen', Exec) {\n workingDir \"$rootDir/../../\"\n def isWindows = System.getProperty('os.name').toLowerCase().contains('windows')\n\n if (isWindows) {\n commandLine 'cmd', '/c', 'npx bob build --target codegen'\n } else {\n commandLine 'sh', '-c', 'npx bob build --target codegen'\n }\n }\n preBuild.dependsOn invokeLibraryCodegen\n}`;\n\n// You need to have the files before calling pod install otherwise they won't be registered in your pod.\n// So we add a pre_install hook to the podfile that invokes codegen\nconst PODSPEC_INVOKE_CODEGEN_SCRIPT = `\n pre_install do |installer|\n system(\"cd ../../ && npx bob build --target codegen\")\n end\n`;\n\n/**\n * Codegen isn't invoked for libraries with `includesGeneratedCode` set to `true`.\n * This patches the example app to invoke library codegen on every app build.\n */\nexport async function addCodegenBuildScript(libraryPath: string) {\n const appBuildGradlePath = path.join(\n libraryPath,\n 'example',\n 'android',\n 'app',\n 'build.gradle'\n );\n const podfilePath = path.join(libraryPath, 'example', 'ios', 'Podfile');\n\n // Add a gradle task that runs before every build\n let appBuildGradle = (await fs.readFile(appBuildGradlePath)).toString();\n appBuildGradle += GRADLE_INVOKE_CODEGEN_TASK;\n\n await fs.writeFile(appBuildGradlePath, appBuildGradle);\n\n // Add a preinstall action to the podfile that invokes codegen\n const podfile = (await fs.readFile(podfilePath)).toString().split('\\n');\n const podfilePostInstallIndex = podfile.findIndex((line) =>\n line.includes('post_install do |installer|')\n );\n podfile.splice(podfilePostInstallIndex, 0, PODSPEC_INVOKE_CODEGEN_SCRIPT);\n\n await fs.writeFile(podfilePath, podfile.join('\\n'));\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA0B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE1B;AACA,MAAMG,0BAA0B,GAAG;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA;AACA,MAAMC,6BAA6B,GAAG;AACtC;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACO,eAAeC,qBAAqBA,CAACC,WAAmB,EAAE;EAC/D,MAAMC,kBAAkB,GAAGC,aAAI,CAACC,IAAI,CAClCH,WAAW,EACX,SAAS,EACT,SAAS,EACT,KAAK,EACL,cACF,CAAC;EACD,MAAMI,WAAW,GAAGF,aAAI,CAACC,IAAI,CAACH,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC;;EAEvE;EACA,IAAIK,cAAc,GAAG,CAAC,MAAMC,gBAAE,CAACC,QAAQ,CAACN,kBAAkB,CAAC,EAAEO,QAAQ,CAAC,CAAC;EACvEH,cAAc,IAAIR,0BAA0B;EAE5C,MAAMS,gBAAE,CAACG,SAAS,CAACR,kBAAkB,EAAEI,cAAc,CAAC;;EAEtD;EACA,MAAMK,OAAO,GAAG,CAAC,MAAMJ,gBAAE,CAACC,QAAQ,CAACH,WAAW,CAAC,EAAEI,QAAQ,CAAC,CAAC,CAACG,KAAK,CAAC,IAAI,CAAC;EACvE,MAAMC,uBAAuB,GAAGF,OAAO,CAACG,SAAS,CAAEC,IAAI,IACrDA,IAAI,CAACC,QAAQ,CAAC,6BAA6B,CAC7C,CAAC;EACDL,OAAO,CAACM,MAAM,CAACJ,uBAAuB,EAAE,CAAC,EAAEd,6BAA6B,CAAC;EAEzE,MAAMQ,gBAAE,CAACG,SAAS,CAACL,WAAW,EAAEM,OAAO,CAACP,IAAI,CAAC,IAAI,CAAC,CAAC;AACrD","ignoreList":[]}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getDependencyVersionsFromExampleApp = getDependencyVersionsFromExampleApp;
7
+ var _nodeAssert = _interopRequireDefault(require("node:assert"));
8
+ var _path = _interopRequireDefault(require("path"));
9
+ var _fsExtra = _interopRequireDefault(require("fs-extra"));
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ async function getDependencyVersionsFromExampleApp(folder, exampleAppType) {
12
+ const examplePackageJson = await _fsExtra.default.readJSON(_path.default.join(folder, 'example', 'package.json'));
13
+ const react = examplePackageJson.dependencies?.react;
14
+ (0, _nodeAssert.default)(react !== undefined, "The generated example app doesn't have React installed.");
15
+ const reactNative = examplePackageJson.dependencies?.['react-native'];
16
+ (0, _nodeAssert.default)(reactNative !== undefined, "The generated example app doesn't have React Native installed.");
17
+ const devDependencies = {
18
+ react,
19
+ 'react-native': reactNative
20
+ };
21
+ if (exampleAppType === 'vanilla') {
22
+ // React Native doesn't provide the community CLI as a dependency.
23
+ // We have to get read the version from the example app and put to the root package json
24
+ const exampleCommunityCLIVersion = examplePackageJson.devDependencies['@react-native-community/cli'];
25
+ (0, _nodeAssert.default)(exampleCommunityCLIVersion !== undefined, "The generated example app doesn't have community CLI installed");
26
+ devDependencies['@react-native-community/cli'] = exampleCommunityCLIVersion;
27
+ }
28
+ return {
29
+ devDependencies
30
+ };
31
+ }
32
+ //# sourceMappingURL=dependencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependencies.js","names":["_nodeAssert","_interopRequireDefault","require","_path","_fsExtra","e","__esModule","default","getDependencyVersionsFromExampleApp","folder","exampleAppType","examplePackageJson","fs","readJSON","path","join","react","dependencies","assert","undefined","reactNative","devDependencies","exampleCommunityCLIVersion"],"sources":["../../src/exampleApp/dependencies.ts"],"sourcesContent":["import assert from 'node:assert';\nimport path from 'path';\nimport fs from 'fs-extra';\nimport type { ExampleApp } from '../input';\n\nexport async function getDependencyVersionsFromExampleApp(\n folder: string,\n exampleAppType: ExampleApp\n) {\n const examplePackageJson = await fs.readJSON(\n path.join(folder, 'example', 'package.json')\n );\n\n const react: string = examplePackageJson.dependencies?.react;\n assert(\n react !== undefined,\n \"The generated example app doesn't have React installed.\"\n );\n const reactNative: string = examplePackageJson.dependencies?.['react-native'];\n assert(\n reactNative !== undefined,\n \"The generated example app doesn't have React Native installed.\"\n );\n\n const devDependencies: Record<string, string> = {\n react,\n 'react-native': reactNative,\n };\n\n if (exampleAppType === 'vanilla') {\n // React Native doesn't provide the community CLI as a dependency.\n // We have to get read the version from the example app and put to the root package json\n const exampleCommunityCLIVersion =\n examplePackageJson.devDependencies['@react-native-community/cli'];\n assert(\n exampleCommunityCLIVersion !== undefined,\n \"The generated example app doesn't have community CLI installed\"\n );\n\n devDependencies['@react-native-community/cli'] = exampleCommunityCLIVersion;\n }\n\n return {\n devDependencies,\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AAA0B,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGnB,eAAeG,mCAAmCA,CACvDC,MAAc,EACdC,cAA0B,EAC1B;EACA,MAAMC,kBAAkB,GAAG,MAAMC,gBAAE,CAACC,QAAQ,CAC1CC,aAAI,CAACC,IAAI,CAACN,MAAM,EAAE,SAAS,EAAE,cAAc,CAC7C,CAAC;EAED,MAAMO,KAAa,GAAGL,kBAAkB,CAACM,YAAY,EAAED,KAAK;EAC5D,IAAAE,mBAAM,EACJF,KAAK,KAAKG,SAAS,EACnB,yDACF,CAAC;EACD,MAAMC,WAAmB,GAAGT,kBAAkB,CAACM,YAAY,GAAG,cAAc,CAAC;EAC7E,IAAAC,mBAAM,EACJE,WAAW,KAAKD,SAAS,EACzB,gEACF,CAAC;EAED,MAAME,eAAuC,GAAG;IAC9CL,KAAK;IACL,cAAc,EAAEI;EAClB,CAAC;EAED,IAAIV,cAAc,KAAK,SAAS,EAAE;IAChC;IACA;IACA,MAAMY,0BAA0B,GAC9BX,kBAAkB,CAACU,eAAe,CAAC,6BAA6B,CAAC;IACnE,IAAAH,mBAAM,EACJI,0BAA0B,KAAKH,SAAS,EACxC,gEACF,CAAC;IAEDE,eAAe,CAAC,6BAA6B,CAAC,GAAGC,0BAA0B;EAC7E;EAEA,OAAO;IACLD;EACF,CAAC;AACH","ignoreList":[]}
@@ -7,8 +7,8 @@ exports.default = generateExampleApp;
7
7
  var _fsExtra = _interopRequireDefault(require("fs-extra"));
8
8
  var _path = _interopRequireDefault(require("path"));
9
9
  var _https = _interopRequireDefault(require("https"));
10
- var _spawn = require("./spawn");
11
- var _sortObjectKeys = _interopRequireDefault(require("./sortObjectKeys"));
10
+ var _spawn = require("../utils/spawn");
11
+ var _sortObjectKeys = _interopRequireDefault(require("../utils/sortObjectKeys"));
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
13
  const FILES_TO_DELETE = ['__tests__', '.buckconfig', '.eslintrc.js', '.flowconfig', '.git', '.gitignore', '.prettierrc.js', 'App.js', 'App.tsx', 'index.js', 'tsconfig.json'];
14
14
  const PACKAGES_TO_REMOVE = ['@react-native/eslint-config', '@tsconfig/react-native', '@types/jest', '@types/react', '@types/react-test-renderer', '@typescript-eslint/eslint-plugin', '@typescript-eslint/parser', 'babel-jest', 'eslint', 'jest', 'prettier', 'react-test-renderer', 'typescript'];
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateExampleApp.js","names":["_fsExtra","_interopRequireDefault","require","_path","_https","_spawn","_sortObjectKeys","e","__esModule","default","FILES_TO_DELETE","PACKAGES_TO_REMOVE","PACKAGES_TO_ADD_WEB","generateExampleApp","type","dest","arch","project","bobVersion","reactNativeVersion","directory","path","join","testAppArgs","name","vanillaArgs","package","expoArgs","args","spawn","env","process","npm_config_yes","file","fs","remove","pkg","readJSON","slug","jest","scripts","dependencies","devDependencies","test","lint","SCRIPTS_TO_ADD","Object","assign","androidBuild","iosBuild","app","android","ios","bundleIdentifier","writeJSON","spaces","forEach","PACKAGES_TO_ADD_DEV","sdkVersion","expo","split","replace","bundledNativeModules","Promise","resolve","reject","https","get","res","data","on","chunk","JSON","parse","entries","version","web","field","sortObjectKeys","gradleProperties","readFile","podfile","writeFile","includes"],"sources":["../../src/exampleApp/generateExampleApp.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport path from 'path';\nimport https from 'https';\nimport { spawn } from '../utils/spawn';\nimport sortObjectKeys from '../utils/sortObjectKeys';\nimport type { ExampleApp } from '../input';\n\nconst FILES_TO_DELETE = [\n '__tests__',\n '.buckconfig',\n '.eslintrc.js',\n '.flowconfig',\n '.git',\n '.gitignore',\n '.prettierrc.js',\n 'App.js',\n 'App.tsx',\n 'index.js',\n 'tsconfig.json',\n];\n\nconst PACKAGES_TO_REMOVE = [\n '@react-native/eslint-config',\n '@tsconfig/react-native',\n '@types/jest',\n '@types/react',\n '@types/react-test-renderer',\n '@typescript-eslint/eslint-plugin',\n '@typescript-eslint/parser',\n 'babel-jest',\n 'eslint',\n 'jest',\n 'prettier',\n 'react-test-renderer',\n 'typescript',\n];\n\nconst PACKAGES_TO_ADD_WEB = {\n '@expo/metro-runtime': '~3.2.1',\n 'react-dom': '18.2.0',\n 'react-native-web': '~0.18.10',\n};\n\nexport default async function generateExampleApp({\n type,\n dest,\n arch,\n project,\n bobVersion,\n reactNativeVersion = 'latest',\n}: {\n type: ExampleApp;\n dest: string;\n arch: 'new' | 'legacy';\n project: {\n slug: string;\n name: string;\n package: string;\n };\n bobVersion: string;\n reactNativeVersion?: string;\n}) {\n const directory = path.join(dest, 'example');\n\n // `npx --package react-native-test-app@latest init --name ${projectName}Example --destination example --version ${reactNativeVersion}`\n const testAppArgs = [\n '--package',\n `react-native-test-app@latest`,\n 'init',\n '--name',\n `${project.name}Example`,\n `--destination`,\n directory,\n ...(reactNativeVersion !== 'latest'\n ? ['--version', reactNativeVersion]\n : []),\n '--platform',\n 'ios',\n '--platform',\n 'android',\n ];\n\n // `npx @react-native-community/cli init <projectName> --directory example --skip-install`\n const vanillaArgs = [\n `@react-native-community/cli`,\n 'init',\n `${project.name}Example`,\n '--package-name',\n `${project.package}.example`,\n '--directory',\n directory,\n '--version',\n reactNativeVersion,\n '--skip-install',\n '--pm',\n 'npm',\n ];\n\n // `npx create-expo-app example --no-install --template blank`\n const expoArgs = [\n 'create-expo-app@latest',\n directory,\n '--no-install',\n '--template',\n 'blank',\n ];\n\n let args: string[] = [];\n\n switch (type) {\n case 'vanilla':\n args = vanillaArgs;\n break;\n case 'test-app':\n args = testAppArgs;\n break;\n case 'expo':\n args = expoArgs;\n break;\n }\n\n await spawn('npx', args, {\n env: { ...process.env, npm_config_yes: 'true' },\n });\n\n // Remove unnecessary files and folders\n for (const file of FILES_TO_DELETE) {\n await fs.remove(path.join(directory, file));\n }\n\n // Patch the example app's package.json\n const pkg = await fs.readJSON(path.join(directory, 'package.json'));\n\n pkg.name = `${project.slug}-example`;\n\n // Remove Jest config for now\n delete pkg.jest;\n\n const { scripts, dependencies, devDependencies } = pkg;\n\n delete scripts.test;\n delete scripts.lint;\n\n const SCRIPTS_TO_ADD = {\n 'build:android':\n 'react-native build-android --extra-params \"--no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a\"',\n 'build:ios': `react-native build-ios --scheme ${project.name}Example --mode Debug --extra-params \"-sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO\"`,\n };\n\n if (type === 'vanilla') {\n Object.assign(scripts, SCRIPTS_TO_ADD);\n } else if (type === 'test-app') {\n // `react-native-test-app` doesn't bundle application by default in 'Release' mode and also `bundle` command doesn't create a directory.\n // `mkdist` script should be removed after stable React Native major contains this fix: https://github.com/facebook/react-native/pull/45182.\n\n const androidBuild = [\n 'npm run mkdist',\n 'react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.android.jsbundle --assets-dest dist',\n SCRIPTS_TO_ADD['build:android'],\n ].join(' && ');\n\n const iosBuild = [\n 'npm run mkdist',\n 'react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist',\n SCRIPTS_TO_ADD['build:ios'],\n ].join(' && ');\n\n Object.assign(scripts, {\n 'build:android': androidBuild,\n 'build:ios': iosBuild,\n });\n\n const app = await fs.readJSON(path.join(directory, 'app.json'));\n\n app.android = app.android || {};\n app.android.package = `${project.package}.example`;\n app.ios = app.ios || {};\n app.ios.bundleIdentifier = `${project.package}.example`;\n\n await fs.writeJSON(path.join(directory, 'app.json'), app, {\n spaces: 2,\n });\n }\n\n PACKAGES_TO_REMOVE.forEach((name) => {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete devDependencies[name];\n });\n\n const PACKAGES_TO_ADD_DEV = {\n 'react-native-builder-bob': `^${bobVersion}`,\n };\n\n Object.assign(devDependencies, PACKAGES_TO_ADD_DEV);\n\n if (type === 'expo') {\n const sdkVersion = dependencies.expo.split('.')[0].replace(/[^\\d]/, '');\n\n let bundledNativeModules: Record<string, string>;\n\n try {\n bundledNativeModules = await new Promise((resolve, reject) => {\n https\n .get(\n `https://raw.githubusercontent.com/expo/expo/sdk-${sdkVersion}/packages/expo/bundledNativeModules.json`,\n (res) => {\n let data = '';\n\n res.on('data', (chunk) => (data += chunk));\n res.on('end', () => {\n try {\n resolve(JSON.parse(data));\n } catch (e) {\n reject(e);\n }\n });\n }\n )\n .on('error', reject);\n });\n } catch (e) {\n bundledNativeModules = {};\n }\n\n Object.entries(PACKAGES_TO_ADD_WEB).forEach(([name, version]) => {\n dependencies[name] = bundledNativeModules[name] || version;\n });\n\n scripts.web = 'expo start --web';\n\n const app = await fs.readJSON(path.join(directory, 'app.json'));\n\n app.expo.android = app.expo.android || {};\n app.expo.android.package = `${project.package}.example`;\n app.expo.ios = app.expo.ios || {};\n app.expo.ios.bundleIdentifier = `${project.package}.example`;\n\n await fs.writeJSON(path.join(directory, 'app.json'), app, {\n spaces: 2,\n });\n }\n\n for (const field of ['dependencies', 'devDependencies']) {\n if (pkg[field]) {\n pkg[field] = sortObjectKeys(pkg[field]);\n }\n }\n\n await fs.writeJSON(path.join(directory, 'package.json'), pkg, {\n spaces: 2,\n });\n\n if (type !== 'expo') {\n let gradleProperties = await fs.readFile(\n path.join(directory, 'android', 'gradle.properties'),\n 'utf8'\n );\n\n // Disable Jetifier.\n // Remove this when the app template is updated.\n gradleProperties = gradleProperties.replace(\n 'android.enableJetifier=true',\n 'android.enableJetifier=false'\n );\n\n // If the library is on new architecture, enable new arch for iOS and Android\n if (arch === 'new') {\n // iOS\n // Add ENV['RCT_NEW_ARCH_ENABLED'] = 1 on top of example/ios/Podfile\n const podfile = await fs.readFile(\n path.join(directory, 'ios', 'Podfile'),\n 'utf8'\n );\n\n await fs.writeFile(\n path.join(directory, 'ios', 'Podfile'),\n \"ENV['RCT_NEW_ARCH_ENABLED'] = '1'\\n\\n\" + podfile\n );\n\n // Android\n // Make sure newArchEnabled=true is present in android/gradle.properties\n if (gradleProperties.split('\\n').includes('#newArchEnabled=true')) {\n gradleProperties = gradleProperties.replace(\n '#newArchEnabled=true',\n 'newArchEnabled=true'\n );\n } else if (\n gradleProperties.split('\\n').includes('newArchEnabled=false')\n ) {\n gradleProperties = gradleProperties.replace(\n 'newArchEnabled=false',\n 'newArchEnabled=true'\n );\n } else {\n gradleProperties += '\\nnewArchEnabled=true';\n }\n }\n\n await fs.writeFile(\n path.join(directory, 'android', 'gradle.properties'),\n gradleProperties\n );\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAqD,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGrD,MAAMG,eAAe,GAAG,CACtB,WAAW,EACX,aAAa,EACb,cAAc,EACd,aAAa,EACb,MAAM,EACN,YAAY,EAC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