From 9b9233f3ee48012d58c21b36276bf471091c93d1 Mon Sep 17 00:00:00 2001 From: Ben Gourley Date: Wed, 21 Apr 2021 12:10:33 +0100 Subject: [PATCH 01/17] feat(react-native-cli): Use a more exhaustive search for MainApplication.java Ejected Expo projects have a different directory structure to RN projects generated with the RN CLI. This update uses the glob package to determine the location of MainApplication.java no matter where it exists within the app directory. --- packages/react-native-cli/package-lock.json | 77 +++++++++++++++++++ packages/react-native-cli/package.json | 1 + packages/react-native-cli/src/lib/Insert.ts | 23 +++--- .../src/lib/__test__/Insert.test.ts | 41 +++++----- 4 files changed, 111 insertions(+), 31 deletions(-) diff --git a/packages/react-native-cli/package-lock.json b/packages/react-native-cli/package-lock.json index db779a44b4..4a693b2e67 100644 --- a/packages/react-native-cli/package-lock.json +++ b/packages/react-native-cli/package-lock.json @@ -44,6 +44,11 @@ "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz", "integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==" }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, "base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -70,6 +75,15 @@ "big-integer": "^1.6.44" } }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -127,6 +141,11 @@ } } }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, "consola": { "version": "2.15.0", "resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz", @@ -150,11 +169,43 @@ "array-back": "^3.0.1" } }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, "kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -165,6 +216,27 @@ "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=" }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, "plist": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.1.tgz", @@ -272,6 +344,11 @@ } } }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, "xcode": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/xcode/-/xcode-3.0.1.tgz", diff --git a/packages/react-native-cli/package.json b/packages/react-native-cli/package.json index 9739260819..3e83aa1f72 100644 --- a/packages/react-native-cli/package.json +++ b/packages/react-native-cli/package.json @@ -24,6 +24,7 @@ "command-line-args": "^5.1.1", "command-line-usage": "^6.1.0", "consola": "^2.15.0", + "glob": "^7.1.6", "plist": "^3.0.1", "prompts": "^2.4.0", "xcode": "^3.0.1" diff --git a/packages/react-native-cli/src/lib/Insert.ts b/packages/react-native-cli/src/lib/Insert.ts index b1314d184c..288ccf592d 100644 --- a/packages/react-native-cli/src/lib/Insert.ts +++ b/packages/react-native-cli/src/lib/Insert.ts @@ -1,6 +1,10 @@ import { Logger } from '../Logger' import path from 'path' import { promises as fs } from 'fs' +import { promisify } from 'util' +import glob from 'glob' + +const asyncGlob = promisify(glob) const BUGSNAG_JS_IMPORT_INIT = `import Bugsnag from "@bugsnag/react-native"; @@ -76,20 +80,21 @@ export async function insertIos (projectRoot: string, logger: Logger): Promise { logger.info('Adding Bugsnag to the Android layer') - const comDir = path.join(projectRoot, 'android', 'app', 'src', 'main', 'java', 'com') - let appPackagePath + + let mainApplicationPath try { - appPackagePath = (await fs.readdir(comDir))[0] - if (!appPackagePath) { - logger.warn(FAIL_MSG('MainApplication.java')) - return - } + const comDir = path.join(projectRoot, 'android', 'app', 'src', 'main', 'java', 'com') + const relativeMainApplicationPath = (await asyncGlob('**/*/MainApplication.java', { + cwd: comDir + }))[0] + if (!relativeMainApplicationPath) return logger.warn(FAIL_MSG('MainApplication.java')) + mainApplicationPath = path.join(comDir, relativeMainApplicationPath) } catch (e) { - logger.error(FAIL_MSG('MainApplication.java')) + logger.warn(FAIL_MSG('MainApplication.java')) return } + try { - const mainApplicationPath = path.join(comDir, appPackagePath, 'MainApplication.java') const mainApplication = await fs.readFile(mainApplicationPath, 'utf8') if (mainApplication.includes(BUGSNAG_JAVA_IMPORT) || mainApplication.includes(BUGSNAG_JAVA_INIT)) { diff --git a/packages/react-native-cli/src/lib/__test__/Insert.test.ts b/packages/react-native-cli/src/lib/__test__/Insert.test.ts index 1c4ec7f738..f4ca16c011 100644 --- a/packages/react-native-cli/src/lib/__test__/Insert.test.ts +++ b/packages/react-native-cli/src/lib/__test__/Insert.test.ts @@ -2,6 +2,7 @@ import { insertJs, insertAndroid, insertIos } from '../Insert' import logger from '../../Logger' import path from 'path' import { promises as fs } from 'fs' +import glob from 'glob' async function loadFixture (fixture: string) { return jest.requireActual('fs').promises.readFile(fixture, 'utf8') @@ -19,6 +20,9 @@ jest.mock('../../Logger') jest.mock('fs', () => { return { promises: { readFile: jest.fn(), writeFile: jest.fn(), readdir: jest.fn() } } }) +jest.mock('glob', () => { + return jest.fn() +}) afterEach(() => jest.resetAllMocks()) @@ -170,9 +174,8 @@ test('insertIos(): no identifiable app launch method', async () => { }) test('insertAndroid(): success', async () => { - type readdir = (path: string) => Promise - const readdirMock = fs.readdir as unknown as jest.MockedFunction - readdirMock.mockResolvedValue(['bugsnagreactnativeclitest']) + const globMock = glob as unknown as jest.MockedFunction + globMock.mockImplementation((glob, opts, cb) => cb(null, ['bugsnagreactnativeclitest/MainApplication.java'])) const mainApplication = await loadFixture(path.join(__dirname, 'fixtures', 'MainApplication-before.java')) const readFileMock = fs.readFile as jest.MockedFunction @@ -193,9 +196,8 @@ test('insertAndroid(): success', async () => { }) test('insertAndroid(): success, tolerates some differences in source', async () => { - type readdir = (path: string) => Promise - const readdirMock = fs.readdir as unknown as jest.MockedFunction - readdirMock.mockResolvedValue(['bugsnagreactnativeclitest']) + const globMock = glob as unknown as jest.MockedFunction + globMock.mockImplementation((glob, opts, cb) => cb(null, ['bugsnagreactnativeclitest/MainApplication.java'])) const mainApplication = await loadFixture(path.join(__dirname, 'fixtures', 'MainApplication-before-2.java')) const readFileMock = fs.readFile as jest.MockedFunction @@ -216,9 +218,8 @@ test('insertAndroid(): success, tolerates some differences in source', async () }) test('insertAndroid(): already present', async () => { - type readdir = (path: string) => Promise - const readdirMock = fs.readdir as unknown as jest.MockedFunction - readdirMock.mockResolvedValue(['bugsnagreactnativeclitest']) + const globMock = glob as unknown as jest.MockedFunction + globMock.mockImplementation((glob, opts, cb) => cb(null, ['bugsnagreactnativeclitest/MainApplication.java'])) const mainApplication = await loadFixture(path.join(__dirname, 'fixtures', 'MainApplication-after.java')) const readFileMock = fs.readFile as jest.MockedFunction @@ -237,9 +238,8 @@ test('insertAndroid(): already present', async () => { }) test('insertAndroid(): failure to locate file', async () => { - type readdir = (path: string) => Promise - const readdirMock = fs.readdir as unknown as jest.MockedFunction - readdirMock.mockResolvedValue(['bugsnagreactnativeclitest']) + const globMock = glob as unknown as jest.MockedFunction + globMock.mockImplementation((glob, opts, cb) => cb(null, ['bugsnagreactnativeclitest/MainApplication.java'])) const readFileMock = fs.readFile as jest.MockedFunction readFileMock.mockRejectedValue(await generateNotFoundError()) @@ -257,9 +257,8 @@ test('insertAndroid(): failure to locate file', async () => { }) test('insertAndroid(): failure to locate package directory', async () => { - type readdir = (path: string) => Promise - const readdirMock = fs.readdir as unknown as jest.MockedFunction - readdirMock.mockResolvedValue([]) + const globMock = glob as unknown as jest.MockedFunction + globMock.mockImplementation((glob, opts, cb) => cb(null, [])) const readFileMock = fs.readFile as jest.MockedFunction const writeFileMock = fs.writeFile as jest.MockedFunction @@ -272,9 +271,8 @@ test('insertAndroid(): failure to locate package directory', async () => { }) test('insertAndroid(): project directory error', async () => { - type readdir = (path: string) => Promise - const readdirMock = fs.readdir as unknown as jest.MockedFunction - readdirMock.mockRejectedValue(await generateNotFoundError()) + const globMock = glob as unknown as jest.MockedFunction + globMock.mockImplementation((glob, opts, cb) => cb(new Error('oh no'), [])) const readFileMock = fs.readFile as jest.MockedFunction const writeFileMock = fs.writeFile as jest.MockedFunction @@ -283,13 +281,12 @@ test('insertAndroid(): project directory error', async () => { expect(readFileMock).not.toHaveBeenCalled() expect(writeFileMock).not.toHaveBeenCalled() - expect(logger.error).toHaveBeenCalledWith(expect.stringContaining('Failed to update "MainApplication.java" automatically.')) + expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining('Failed to update "MainApplication.java" automatically.')) }) test('insertAndroid(): no identifiable onCreate method', async () => { - type readdir = (path: string) => Promise - const readdirMock = fs.readdir as unknown as jest.MockedFunction - readdirMock.mockResolvedValue(['bugsnagreactnativeclitest']) + const globMock = glob as unknown as jest.MockedFunction + globMock.mockImplementation((glob, opts, cb) => cb(null, ['bugsnagreactnativeclitest/MainApplication.java'])) const readFileMock = fs.readFile as jest.MockedFunction readFileMock.mockResolvedValue('not good java') From fa6c841c9c4422b5e2bc0a617a57f89cae6fdb81 Mon Sep 17 00:00:00 2001 From: Ben Gourley Date: Thu, 22 Apr 2021 09:41:33 +0100 Subject: [PATCH 02/17] test(react-native-cli): Add ejected Expo fixture --- .../features/fixtures/Dockerfile | 1 + .../features/fixtures/docker-compose.yml | 11 + .../rn0_63_expo_ejected/.dockerignore | 3 + .../fixtures/rn0_63_expo_ejected/.gitignore | 73 + .../fixtures/rn0_63_expo_ejected/App.js | 99 + .../rn0_63_expo_ejected/android/app/BUCK | 55 + .../android/app/build.gradle | 219 + .../android/app/build_defs.bzl | 19 + .../android/app/debug.keystore | Bin 0 -> 2257 bytes .../android/app/proguard-rules.pro | 10 + .../android/app/src/debug/AndroidManifest.xml | 7 + .../rn063expoejected/ReactNativeFlipper.java | 69 + .../android/app/src/main/AndroidManifest.xml | 32 + .../rn0_63_expo_ejected/MainActivity.java | 41 + .../rn0_63_expo_ejected/MainApplication.java | 128 + .../generated/BasePackageList.java | 22 + .../src/main/res/drawable/splashscreen.xml | 7 + .../main/res/drawable/splashscreen_image.png | Bin 0 -> 48478 bytes .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 + .../mipmap-anydpi-v26/ic_launcher_round.xml | 5 + .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3300 bytes .../mipmap-hdpi/ic_launcher_foreground.png | Bin 0 -> 3300 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 4103 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2048 bytes .../mipmap-mdpi/ic_launcher_foreground.png | Bin 0 -> 2309 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 0 -> 2613 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4535 bytes .../mipmap-xhdpi/ic_launcher_foreground.png | Bin 0 -> 4517 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 0 -> 5673 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 7345 bytes .../mipmap-xxhdpi/ic_launcher_foreground.png | Bin 0 -> 7179 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 0 -> 9091 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 10108 bytes .../mipmap-xxxhdpi/ic_launcher_foreground.png | Bin 0 -> 9704 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 12469 bytes .../app/src/main/res/values/colors.xml | 6 + .../app/src/main/res/values/strings.xml | 4 + .../app/src/main/res/values/styles.xml | 17 + .../rn0_63_expo_ejected/android/build.gradle | 38 + .../android/gradle.properties | 29 + .../android/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 53639 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + .../rn0_63_expo_ejected/android/gradlew | 183 + .../rn0_63_expo_ejected/android/gradlew.bat | 103 + .../android/settings.gradle | 9 + .../fixtures/rn0_63_expo_ejected/app.json | 34 + .../assets/adaptive-icon.png | Bin 0 -> 17547 bytes .../rn0_63_expo_ejected/assets/favicon.png | Bin 0 -> 1466 bytes .../rn0_63_expo_ejected/assets/icon.png | Bin 0 -> 22380 bytes .../rn0_63_expo_ejected/assets/splash.png | Bin 0 -> 48478 bytes .../rn0_63_expo_ejected/babel.config.js | 6 + .../check-ios-build-script.sh | 13 + .../fixtures/rn0_63_expo_ejected/index.js | 8 + .../fixtures/rn0_63_expo_ejected/ios/Podfile | 19 + .../rn0_63_expo_ejected/ios/Podfile.lock | 655 ++ .../project.pbxproj | 510 + .../xcschemes/rn0_63_expo_ejected.xcscheme | 88 + .../contents.xcworkspacedata | 10 + .../ios/rn0_63_expo_ejected/AppDelegate.h | 10 + .../ios/rn0_63_expo_ejected/AppDelegate.m | 111 + .../Base.lproj/LaunchScreen.xib | 42 + .../AppIcon.appiconset/App-Icon-20x20@1x.png | Bin 0 -> 583 bytes .../AppIcon.appiconset/App-Icon-20x20@2x.png | Bin 0 -> 1562 bytes .../AppIcon.appiconset/App-Icon-20x20@3x.png | Bin 0 -> 2642 bytes .../AppIcon.appiconset/App-Icon-29x29@1x.png | Bin 0 -> 1028 bytes .../AppIcon.appiconset/App-Icon-29x29@2x.png | Bin 0 -> 2492 bytes .../AppIcon.appiconset/App-Icon-29x29@3x.png | Bin 0 -> 4307 bytes .../AppIcon.appiconset/App-Icon-40x40@1x.png | Bin 0 -> 1562 bytes .../AppIcon.appiconset/App-Icon-40x40@2x.png | Bin 0 -> 3806 bytes .../AppIcon.appiconset/App-Icon-40x40@3x.png | Bin 0 -> 6565 bytes .../AppIcon.appiconset/App-Icon-60x60@2x.png | Bin 0 -> 6565 bytes .../AppIcon.appiconset/App-Icon-60x60@3x.png | Bin 0 -> 10430 bytes .../AppIcon.appiconset/App-Icon-76x76@1x.png | Bin 0 -> 3499 bytes .../AppIcon.appiconset/App-Icon-76x76@2x.png | Bin 0 -> 8492 bytes .../App-Icon-83.5x83.5@2x.png | Bin 0 -> 9469 bytes .../AppIcon.appiconset/Contents.json | 122 + .../AppIcon.appiconset/ItunesArtwork@2x.png | Bin 0 -> 59468 bytes .../Images.xcassets/Contents.json | 6 + .../SplashScreen.imageset/Contents.json | 21 + .../SplashScreen.imageset/splashscreen.png | Bin 0 -> 48478 bytes .../Contents.json | 21 + .../background.png | Bin 0 -> 80 bytes .../ios/rn0_63_expo_ejected/Info.plist | 67 + .../SplashScreen.storyboard | 91 + .../rn0_63_expo_ejected/Supporting/Expo.plist | 16 + .../ios/rn0_63_expo_ejected/main.m | 10 + .../rn063expoejected-Bridging-Header.h | 3 + .../rn063expoejected.entitlements | 8 + .../rn0_63_expo_ejected/metro.config.js | 4 + .../rn0_63_expo_ejected/package-lock.json | 8558 +++++++++++++++++ .../fixtures/rn0_63_expo_ejected/package.json | 29 + test/react-native-cli/features/steps/steps.rb | 52 +- 92 files changed, 11691 insertions(+), 23 deletions(-) create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/.dockerignore create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/.gitignore create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/App.js create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/BUCK create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/build.gradle create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/build_defs.bzl create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/debug.keystore create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/proguard-rules.pro create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/debug/AndroidManifest.xml create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/debug/java/com/rn063expoejected/ReactNativeFlipper.java create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/AndroidManifest.xml create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/bugsnag/rn0_63_expo_ejected/MainActivity.java create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/bugsnag/rn0_63_expo_ejected/MainApplication.java create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/java/com/bugsnag/rn0_63_expo_ejected/generated/BasePackageList.java create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/drawable/splashscreen.xml create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/drawable/splashscreen_image.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/values/colors.xml create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/values/strings.xml create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/app/src/main/res/values/styles.xml create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/build.gradle create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/gradle.properties create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/gradle/wrapper/gradle-wrapper.jar create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/gradle/wrapper/gradle-wrapper.properties create mode 100755 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/gradlew create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/gradlew.bat create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/android/settings.gradle create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/app.json create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/assets/adaptive-icon.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/assets/favicon.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/assets/icon.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/assets/splash.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/babel.config.js create mode 100755 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/check-ios-build-script.sh create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/index.js create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/Podfile create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/Podfile.lock create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected.xcodeproj/project.pbxproj create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected.xcodeproj/xcshareddata/xcschemes/rn0_63_expo_ejected.xcscheme create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected.xcworkspace/contents.xcworkspacedata create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/AppDelegate.h create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/AppDelegate.m create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Base.lproj/LaunchScreen.xib create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/AppIcon.appiconset/App-Icon-20x20@1x.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/AppIcon.appiconset/App-Icon-20x20@2x.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/AppIcon.appiconset/App-Icon-20x20@3x.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/AppIcon.appiconset/App-Icon-29x29@1x.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/AppIcon.appiconset/App-Icon-29x29@2x.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/AppIcon.appiconset/App-Icon-29x29@3x.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/AppIcon.appiconset/App-Icon-40x40@1x.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/AppIcon.appiconset/App-Icon-40x40@2x.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/AppIcon.appiconset/App-Icon-40x40@3x.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/AppIcon.appiconset/App-Icon-60x60@2x.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/AppIcon.appiconset/App-Icon-60x60@3x.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/AppIcon.appiconset/App-Icon-76x76@1x.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/AppIcon.appiconset/App-Icon-76x76@2x.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/AppIcon.appiconset/App-Icon-83.5x83.5@2x.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/AppIcon.appiconset/Contents.json create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/Contents.json create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/SplashScreen.imageset/Contents.json create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/SplashScreen.imageset/splashscreen.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/SplashScreenBackground.imageset/Contents.json create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Images.xcassets/SplashScreenBackground.imageset/background.png create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Info.plist create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/SplashScreen.storyboard create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/Supporting/Expo.plist create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/main.m create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/rn063expoejected-Bridging-Header.h create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/ios/rn0_63_expo_ejected/rn063expoejected.entitlements create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/metro.config.js create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/package-lock.json create mode 100644 test/react-native-cli/features/fixtures/rn0_63_expo_ejected/package.json diff --git a/test/react-native-cli/features/fixtures/Dockerfile b/test/react-native-cli/features/fixtures/Dockerfile index 7d8f734948..d3d7bc0526 100644 --- a/test/react-native-cli/features/fixtures/Dockerfile +++ b/test/react-native-cli/features/fixtures/Dockerfile @@ -10,5 +10,6 @@ COPY . /app WORKDIR /app RUN npm i -g bugsnag-react-native-cli-*.tgz +RUN npm i ENTRYPOINT ["/bin/sh"] diff --git a/test/react-native-cli/features/fixtures/docker-compose.yml b/test/react-native-cli/features/fixtures/docker-compose.yml index ced107ed6f..584662428c 100755 --- a/test/react-native-cli/features/fixtures/docker-compose.yml +++ b/test/react-native-cli/features/fixtures/docker-compose.yml @@ -44,6 +44,17 @@ services: aliases: - maze-runner + rn0_63_expo_ejected: + build: + context: rn0_63_expo_ejected + dockerfile: ../Dockerfile + environment: + DEBUG: + networks: + default: + aliases: + - maze-runner + networks: default: name: ${NETWORK_NAME:-react-native-cli-maze-runner} diff --git a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/.dockerignore b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/.dockerignore new file mode 100644 index 0000000000..02f7caec52 --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/.dockerignore @@ -0,0 +1,3 @@ +# Ignore lockfiles as they can influence test runs +package-lock.json +yarn.lock diff --git a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/.gitignore b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/.gitignore new file mode 100644 index 0000000000..a96bdc16f1 --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/.gitignore @@ -0,0 +1,73 @@ +node_modules/ +.expo/ +npm-debug.* +*.jks +*.p8 +*.p12 +*.key +*.mobileprovision +*.orig.* +web-build/ + +# macOS +.DS_Store + +# @generated expo-cli sync-2138f1e3e130677ea10ea873f6d498e3890e677b +# The following patterns were generated by expo-cli + +# OSX +# +.DS_Store + +# Xcode +# +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +*.moved-aside +DerivedData +*.hmap +*.ipa +*.xcuserstate +project.xcworkspace + +# Android/IntelliJ +# +build/ +.idea +.gradle +local.properties +*.iml +*.hprof + +# node.js +# +node_modules/ +npm-debug.log +yarn-error.log + +# BUCK +buck-out/ +\.buckd/ +*.keystore +!debug.keystore + +# Bundle artifacts +*.jsbundle + +# CocoaPods +/ios/Pods/ + +# Expo +.expo/ +web-build/ + +# @end expo-cli \ No newline at end of file diff --git a/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/App.js b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/App.js new file mode 100644 index 0000000000..406e64c093 --- /dev/null +++ b/test/react-native-cli/features/fixtures/rn0_63_expo_ejected/App.js @@ -0,0 +1,99 @@ +import React from 'react'; +import Bugsnag from "@bugsnag/react-native"; +import { + SafeAreaView, + StyleSheet, + ScrollView, + View, + Text, + StatusBar, Button, NativeModules +} from 'react-native' + +import { + Colors +} from 'react-native/Libraries/NewAppScreen'; + +function jsNotify() { + try { // execute crashy code + iMadeThisUp(); + } catch (error) { + console.log('Bugsnag.notify JS error') + Bugsnag.notify(error); + } +} + +function nativeNotify() { + console.log('Bugsnag.notify native error') + NativeModules.CrashyCrashy.handledError() +} + +const App: () => React$Node = () => { + return ( + <> + + + + {global.HermesInternal == null ? null : ( + + Engine: Hermes + + )} + + React Native CLI end-to-end test app +