diff --git a/.buildkite/basic/react-native-android-full-pipeline.yml b/.buildkite/basic/react-native-android-full-pipeline.yml index fda9113fd3..dacf5f4e4e 100644 --- a/.buildkite/basic/react-native-android-full-pipeline.yml +++ b/.buildkite/basic/react-native-android-full-pipeline.yml @@ -50,6 +50,7 @@ steps: timeout_in_minutes: 20 env: REACT_NATIVE_VERSION: "rn0.68-hermes" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" plugins: - docker-compose#v4.12.0: pull: react-native-android-builder-java-11-node-16 @@ -69,6 +70,7 @@ steps: timeout_in_minutes: 20 env: REACT_NATIVE_VERSION: "rn0.69" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" plugins: - docker-compose#v4.12.0: pull: react-native-android-builder-java-11-node-16 @@ -82,7 +84,6 @@ steps: - label: ':android: Build RN {{matrix}} test fixture APK (Old Arch)' key: "build-react-native-android-fixture-old-arch-full" - depends_on: "publish-js" timeout_in_minutes: 15 agents: queue: macos-node-18 @@ -92,6 +93,7 @@ steps: RN_VERSION: "{{matrix}}" RCT_NEW_ARCH_ENABLED: "0" BUILD_ANDROID: "true" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/old-arch/**/reactnative.apk" commands: @@ -110,7 +112,6 @@ steps: - label: ':android: Build RN {{matrix}} test fixture APK (New Arch)' key: "build-react-native-android-fixture-new-arch-full" - depends_on: "publish-js" timeout_in_minutes: 15 agents: queue: macos-node-18 @@ -120,6 +121,7 @@ steps: RN_VERSION: "{{matrix}}" RCT_NEW_ARCH_ENABLED: "1" BUILD_ANDROID: "true" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/new-arch/**/reactnative.apk" commands: @@ -138,7 +140,6 @@ steps: - label: ':android: Build react-native-navigation {{matrix}} test fixture APK (Old Arch)' key: "build-react-native-navigation-android-fixture-old-arch" - depends_on: "publish-js" timeout_in_minutes: 30 agents: queue: macos-node-18 @@ -149,6 +150,7 @@ steps: RCT_NEW_ARCH_ENABLED: "0" BUILD_ANDROID: "true" REACT_NATIVE_NAVIGATION: "true" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/react-native-navigation/old-arch/**/reactnative.apk" commands: @@ -164,7 +166,6 @@ steps: - label: ':android: Build react-native-navigation {{matrix}} test fixture APK (New Arch)' key: "build-react-native-navigation-android-fixture-new-arch" - depends_on: "publish-js" timeout_in_minutes: 30 agents: queue: macos-node-18 @@ -175,6 +176,7 @@ steps: RCT_NEW_ARCH_ENABLED: "1" BUILD_ANDROID: "true" REACT_NATIVE_NAVIGATION: "true" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/react-native-navigation/new-arch/**/reactnative.apk" commands: diff --git a/.buildkite/basic/react-native-android-pipeline.yml b/.buildkite/basic/react-native-android-pipeline.yml index aab114e22a..a29436b8bf 100644 --- a/.buildkite/basic/react-native-android-pipeline.yml +++ b/.buildkite/basic/react-native-android-pipeline.yml @@ -7,7 +7,6 @@ steps: steps: - label: ':android: Build RN {{matrix}} test fixture APK (Old Arch)' key: "build-react-native-android-fixture-old-arch" - depends_on: "publish-js" timeout_in_minutes: 15 agents: queue: macos-node-18 @@ -17,6 +16,7 @@ steps: RN_VERSION: "{{matrix}}" RCT_NEW_ARCH_ENABLED: "0" BUILD_ANDROID: "true" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/old-arch/**/reactnative.apk" commands: @@ -31,7 +31,6 @@ steps: - label: ':android: Build RN {{matrix}} test fixture APK (New Arch)' key: "build-react-native-android-fixture-new-arch" - depends_on: "publish-js" timeout_in_minutes: 15 agents: queue: macos-node-18 @@ -41,6 +40,7 @@ steps: RN_VERSION: "{{matrix}}" RCT_NEW_ARCH_ENABLED: "1" BUILD_ANDROID: "true" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/new-arch/**/reactnative.apk" commands: diff --git a/.buildkite/basic/react-native-cli-pipeline.yml b/.buildkite/basic/react-native-cli-pipeline.yml index 717ef68f2a..0167a6ecc7 100644 --- a/.buildkite/basic/react-native-cli-pipeline.yml +++ b/.buildkite/basic/react-native-cli-pipeline.yml @@ -7,7 +7,6 @@ steps: steps: - label: ':android: RN CLI - {{matrix}} Android build and sourcemap upload tests' key: "build-react-native-cli-android-fixture" - depends_on: "publish-js" timeout_in_minutes: 15 agents: queue: "macos-15-isolated" @@ -18,6 +17,7 @@ steps: RCT_NEW_ARCH_ENABLED: "0" BUILD_ANDROID: "true" INIT_RN_CLI: "true" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native-cli/features/fixtures/generated/old-arch/**/reactnative.apk" commands: @@ -35,7 +35,6 @@ steps: - label: ':mac: RN CLI - {{matrix}} iOS build and sourcemap upload tests' key: "build-react-native-cli-ios-fixture" - depends_on: "publish-js" timeout_in_minutes: 20 agents: queue: "macos-15-isolated" @@ -47,6 +46,7 @@ steps: XCODE_VERSION: "16.2.0" INIT_RN_CLI: "true" EXPORT_ARCHIVE: "0" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native-cli/features/fixtures/generated/old-arch/**/output/reactnative.ipa" commands: diff --git a/.buildkite/basic/react-native-ios-full-pipeline.yml b/.buildkite/basic/react-native-ios-full-pipeline.yml index 0fcc6a74db..557320073e 100644 --- a/.buildkite/basic/react-native-ios-full-pipeline.yml +++ b/.buildkite/basic/react-native-ios-full-pipeline.yml @@ -11,7 +11,6 @@ steps: # - label: ":ios: Build RN 0.68 Hermes ipa" key: "rn-0-68-hermes-ipa" - depends_on: "publish-js" timeout_in_minutes: 20 agents: queue: "macos-12-arm" @@ -19,8 +18,10 @@ steps: REACT_NATIVE_VERSION: rn0.68-hermes LANG: "en_US.UTF-8" DEVELOPER_DIR: "/Applications/Xcode14.app" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: build/rn0.68-hermes.ipa commands: + - npm run test:publish - npm run test:build-react-native-ios retry: automatic: @@ -29,7 +30,6 @@ steps: - label: ":ios: Build RN 0.69 ipa" key: "rn-0-69-ipa" - depends_on: "publish-js" timeout_in_minutes: 20 agents: queue: "macos-12-arm" @@ -37,8 +37,10 @@ steps: REACT_NATIVE_VERSION: rn0.69 LANG: "en_US.UTF-8" DEVELOPER_DIR: "/Applications/Xcode14.app" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: build/rn0.69.ipa commands: + - npm run test:publish - npm run test:build-react-native-ios retry: automatic: @@ -47,7 +49,6 @@ steps: - label: ':mac: Build RN {{matrix}} test fixture ipa (Old Arch)' key: "build-react-native-ios-fixture-old-arch-full" - depends_on: "publish-js" timeout_in_minutes: 30 agents: queue: "macos-15" @@ -57,6 +58,7 @@ steps: RCT_NEW_ARCH_ENABLED: "0" BUILD_IOS: "true" XCODE_VERSION: "16.2.0" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/old-arch/**/output/reactnative.ipa" commands: @@ -75,7 +77,6 @@ steps: - label: ':mac: Build RN {{matrix}} test fixture ipa (New Arch)' key: "build-react-native-ios-fixture-new-arch-full" - depends_on: "publish-js" timeout_in_minutes: 30 agents: queue: "macos-15" @@ -85,6 +86,7 @@ steps: RCT_NEW_ARCH_ENABLED: "1" BUILD_IOS: "true" XCODE_VERSION: "16.2.0" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/new-arch/**/output/reactnative.ipa" commands: @@ -103,7 +105,6 @@ steps: - label: ':mac: Build react-native-navigation {{matrix}} test fixture ipa (Old Arch)' key: "build-react-native-navigation-ios-fixture-old-arch" - depends_on: "publish-js" timeout_in_minutes: 30 agents: queue: "macos-15" @@ -114,6 +115,7 @@ steps: BUILD_IOS: "true" XCODE_VERSION: "16.2.0" REACT_NATIVE_NAVIGATION: "true" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/react-native-navigation/old-arch/**/output/reactnative.ipa" commands: diff --git a/.buildkite/basic/react-native-ios-pipeline.yml b/.buildkite/basic/react-native-ios-pipeline.yml index cf58a57c63..e64e79515a 100644 --- a/.buildkite/basic/react-native-ios-pipeline.yml +++ b/.buildkite/basic/react-native-ios-pipeline.yml @@ -11,7 +11,10 @@ steps: # - label: ':mac: Build RN {{matrix}} test fixture ipa (Old Arch)' key: "build-react-native-ios-fixture-old-arch" - depends_on: "publish-js" + depends_on: "publish-js-new" + plugins: + artifacts#v1.9.0: + download: "packages.zip" timeout_in_minutes: 20 agents: queue: "macos-15" @@ -21,10 +24,12 @@ steps: RCT_NEW_ARCH_ENABLED: "0" BUILD_IOS: "true" XCODE_VERSION: "16.2.0" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/old-arch/**/output/reactnative.ipa" commands: - "bundle install" + - "unzip -q packages.zip" - "node scripts/generate-react-native-fixture.js" matrix: - "0.79" @@ -35,7 +40,10 @@ steps: - label: ':mac: Build RN {{matrix}} test fixture ipa (New Arch)' key: "build-react-native-ios-fixture-new-arch" - depends_on: "publish-js" + depends_on: "publish-js-new" + plugins: + artifacts#v1.9.0: + download: "packages.zip" timeout_in_minutes: 20 agents: queue: "macos-15" @@ -45,10 +53,12 @@ steps: RCT_NEW_ARCH_ENABLED: "1" BUILD_IOS: "true" XCODE_VERSION: "16.2.0" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" artifact_paths: - "test/react-native/features/fixtures/generated/new-arch/**/output/reactnative.ipa" commands: - "bundle install" + - "unzip -q packages.zip" - "node scripts/generate-react-native-fixture.js" matrix: - "0.79" diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 5bd701b08f..d125f06cf7 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -38,6 +38,23 @@ steps: - exit_status: "*" limit: 1 + - label: "Build and publish JS packages (local)" + key: "publish-js-new" + timeout_in_minutes: 10 + agents: + queue: "macos-node-18" + env: + NODE_VERSION: "18" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" + command: + - "node scripts/publish-packages.js" + - "zip -r packages.zip dist/*.tgz" + artifact_paths: "packages.zip" + retry: + automatic: + - exit_status: "*" + limit: 1 + # # Core tests and checks # diff --git a/package.json b/package.json index 07d341ab39..638617bb6c 100644 --- a/package.json +++ b/package.json @@ -92,6 +92,7 @@ "test:build-react-native-ios": "bundle install && node -e 'require(\"./scripts/react-native-helper\").buildIOS()'", "test:build-react-native-maze-runner": "docker-compose build --pull react-native-maze-runner", "test:node": "npm run test:build-node-container && docker compose run --use-aliases node-maze-runner", + "test:publish": "node scripts/publish-packages.js", "test:react-native:ios": "npm run test:build-react-native-ios && npm run test:build-react-native-maze-runner && APP_LOCATION=build/$REACT_NATIVE_VERSION.ipa docker-compose run --use-aliases react-native-maze-runner", "local-npm:start": "verdaccio --config test/electron/local-npm-config.yml --listen 0.0.0.0:5539", "local-npm:publish-all": "lerna publish \"$VERSION_IDENTIFIER\" --yes --force-publish --exact --no-push --no-git-reset --no-git-tag-version --registry 'http://0.0.0.0:5539'", diff --git a/scripts/generate-react-native-cli-fixture.js b/scripts/generate-react-native-cli-fixture.js index e45c5d2922..c551626487 100644 --- a/scripts/generate-react-native-cli-fixture.js +++ b/scripts/generate-react-native-cli-fixture.js @@ -12,11 +12,6 @@ if (!process.env.RN_VERSION) { process.exit(1) } -if (!process.env.REGISTRY_URL) { - console.error('Please provide a Registry URL') - process.exit(1) -} - if (!process.env.RCT_NEW_ARCH_ENABLED || (process.env.RCT_NEW_ARCH_ENABLED !== '1' && process.env.RCT_NEW_ARCH_ENABLED !== '0')) { console.error('RCT_NEW_ARCH_ENABLED must be set to 1 or 0') process.exit(1) @@ -43,9 +38,22 @@ const fixtureDir = resolve(ROOT_DIR, fixturePath, reactNativeVersion) const replacementFilesDir = resolve(ROOT_DIR, 'test/react-native-cli/features/fixtures/app/dynamic/') -const PEER_DEPENDENCIES = [ - `@bugsnag/react-native-cli@${notifierVersion}` -] +function packLocalPackages () { + // Build all packages first + execSync('npm ci', { cwd: ROOT_DIR, stdio: 'inherit' }) + execSync('npm run build', { cwd: ROOT_DIR, stdio: 'inherit' }) + + // Pack the react-native-cli package + const packagesDir = resolve(ROOT_DIR, 'packages') + const packages = [ + 'react-native-cli' + ] + + // Pack each package and move the tarballs to the fixture directory + for (const pkg of packages) { + execSync(`npm pack "${resolve(packagesDir, pkg)}" --pack-destination "${fixtureDir}"`, { stdio: 'inherit' }) + } +} // Generate the fixture if (!process.env.SKIP_GENERATE_FIXTURE) { @@ -64,8 +72,9 @@ if (!process.env.SKIP_GENERATE_FIXTURE) { iosUtils.configureIOSProject(fixtureDir) - // install the peer dependencies - execSync(`npm install --save ${PEER_DEPENDENCIES} --registry ${process.env.REGISTRY_URL} --legacy-peer-deps`, { cwd: fixtureDir, stdio: 'inherit' }) + // Pack and install local packages + packLocalPackages() + execSync('npm install --save bugsnag-*.tgz --legacy-peer-deps', { cwd: fixtureDir, stdio: 'inherit' }) if (process.env.INIT_RN_CLI === 'true' || process.env.INIT_RN_CLI === '1') { enableSourceMaps() diff --git a/scripts/generate-react-native-fixture.js b/scripts/generate-react-native-fixture.js old mode 100644 new mode 100755 index 44087a7eb7..88ed73e77e --- a/scripts/generate-react-native-fixture.js +++ b/scripts/generate-react-native-fixture.js @@ -3,7 +3,6 @@ const { execFileSync, execSync } = require('child_process') const { resolve } = require('path') const fs = require('fs') -const common = require('./common') const androidUtils = require('./react-native/android-utils') const iosUtils = require('./react-native/ios-utils') @@ -12,18 +11,11 @@ if (!process.env.RN_VERSION) { process.exit(1) } -if (!process.env.REGISTRY_URL) { - console.error('Please provide a Registry URL') - process.exit(1) -} - if (!process.env.RCT_NEW_ARCH_ENABLED || (process.env.RCT_NEW_ARCH_ENABLED !== '1' && process.env.RCT_NEW_ARCH_ENABLED !== '0')) { console.error('RCT_NEW_ARCH_ENABLED must be set to 1 or 0') process.exit(1) } -const notifierVersion = process.env.NOTIFIER_VERSION || common.getCommitId() - const reactNativeVersion = process.env.RN_VERSION const ROOT_DIR = resolve(__dirname, '../') @@ -42,16 +34,8 @@ if (isNewArchEnabled) { } const fixtureDir = resolve(ROOT_DIR, fixturePath, reactNativeVersion) - const replacementFilesDir = resolve(ROOT_DIR, 'test/react-native/features/fixtures/app/dynamic/') -const PEER_DEPENDENCIES = [ - 'react-native-file-access@3.1.1', - `@bugsnag/react-native@${notifierVersion}`, - `@bugsnag/plugin-react-navigation@${notifierVersion}`, - `@bugsnag/plugin-react-native-navigation@${notifierVersion}` -] - let reactNavigationVersion = '6.1.18' let reactNavigationNativeStackVersion = '6.11.0' let reactNativeScreensVersion = '3.35.0' @@ -72,7 +56,7 @@ const REACT_NAVIGATION_PEER_DEPENDENCIES = [ `react-native-safe-area-context@${reactNativeSafeAreaContextVersion}` ] -const reactNativeNavigationVersion = '7.41.0' // Issue with 7.42.0 +const reactNativeNavigationVersion = '7.41.0' const REACT_NATIVE_NAVIGATION_PEER_DEPENDENCIES = [ `react-native-navigation@${reactNativeNavigationVersion}` ] @@ -118,24 +102,62 @@ if (process.env.BUILD_IOS === 'true' || process.env.BUILD_IOS === '1') { iosUtils.buildIPA(fixtureDir) } +// Move all the required Bugsnag packages to the fixture directory +function getLocalPackages () { + const packagesDir = resolve(ROOT_DIR, 'dist') + const packages = [ + 'react-native', + 'plugin-react-native-navigation', + 'plugin-react-navigation' + ] + + // Pack each package and move the tarballs to the fixture directory + for (const pkg of packages) { + // move the tarball to the fixture directory + const tarballName = `bugsnag-${pkg}-*.tgz` + const tarballFiles = fs.readdirSync(packagesDir).filter(file => file.match(new RegExp(tarballName.replace('*', '.*')))) + if (tarballFiles.length === 0) { + console.warn(`No tarball found for ${tarballName} in ${packagesDir}. Please ensure the package is built and available.`) + continue + } + + const tarballFile = tarballFiles[0] + const tarballPath = resolve(packagesDir, tarballFile) + fs.copyFileSync(tarballPath, resolve(fixtureDir, tarballFile)) + console.log(`Copied ${tarballFile} to ${fixtureDir}`) + } +} + function installFixtureDependencies () { - // add dependencies for react-native-navigation (wix) + // Get local packages first + getLocalPackages() + + // Install non-Bugsnag dependencies + const externalDependencies = [] + + // Add dependencies for react-native-navigation (wix) if (process.env.REACT_NATIVE_NAVIGATION === 'true' || process.env.REACT_NATIVE_NAVIGATION === '1') { - PEER_DEPENDENCIES.push(...REACT_NATIVE_NAVIGATION_PEER_DEPENDENCIES) + externalDependencies.push(...REACT_NATIVE_NAVIGATION_PEER_DEPENDENCIES) } else if (!isNewArchEnabled) { - // add dependencies for @react-navigation - PEER_DEPENDENCIES.push(...REACT_NAVIGATION_PEER_DEPENDENCIES) + // Add dependencies for @react-navigation + externalDependencies.push(...REACT_NAVIGATION_PEER_DEPENDENCIES) } - const fixtureDependencyArgs = PEER_DEPENDENCIES.join(' ') + // Add react-native-file-access which is a non-Bugsnag dependency + externalDependencies.push('react-native-file-access@3.1.1') + + // Install external dependencies first + if (externalDependencies.length > 0) { + execSync(`npm install --save --save-exact ${externalDependencies.join(' ')} --legacy-peer-deps`, { cwd: fixtureDir, stdio: 'inherit' }) + } - // install test fixture dependencies - execSync(`npm install --save --save-exact ${fixtureDependencyArgs} --registry ${process.env.REGISTRY_URL} --legacy-peer-deps`, { cwd: fixtureDir, stdio: 'inherit' }) + // Install local Bugsnag packages from tarballs + execSync('npm install --save bugsnag-*.tgz --legacy-peer-deps', { cwd: fixtureDir, stdio: 'inherit' }) - // install the scenario launcher package + // Pack and install the scenario launcher package const scenarioLauncherPackage = `${ROOT_DIR}/test/react-native/features/fixtures/scenario-launcher` execSync(`npm pack ${scenarioLauncherPackage} --pack-destination ${fixtureDir}`, { cwd: ROOT_DIR, stdio: 'inherit' }) - execSync(`npm install --save bugsnag-react-native-scenarios-*.tgz --registry ${process.env.REGISTRY_URL}`, { cwd: fixtureDir, stdio: 'inherit' }) + execSync('npm install --save bugsnag-react-native-scenarios-*.tgz', { cwd: fixtureDir, stdio: 'inherit' }) } /** Replace native files generated by react-native cli with pre-configured files */ diff --git a/scripts/publish-packages.js b/scripts/publish-packages.js new file mode 100755 index 0000000000..9aa49ade3a --- /dev/null +++ b/scripts/publish-packages.js @@ -0,0 +1,54 @@ +#!/usr/bin/env node + +const { execSync } = require('child_process') +const { resolve } = require('path') +const fs = require('fs') + +const ROOT_DIR = resolve(__dirname, '..') + +function run (command, options = {}) { + console.log(`Running: ${command}`) + execSync(command, { stdio: 'inherit', ...options }) +} + +function packPackages () { + // Get all package directories + const packagesDir = resolve(ROOT_DIR, 'packages') + const packages = fs.readdirSync(packagesDir) + .filter(dir => { + // Filter out any non-directories or hidden directories + const stat = fs.statSync(resolve(packagesDir, dir)) + return stat.isDirectory() && !dir.startsWith('.') + }) + + // Create a dist directory if it doesn't exist + const distDir = resolve(ROOT_DIR, 'dist') + if (!fs.existsSync(distDir)) { + fs.mkdirSync(distDir) + } + + console.log('\nPacking packages...') + for (const pkg of packages) { + const packagePath = resolve(packagesDir, pkg) + run(`npm pack "${packagePath}"`, { cwd: distDir }) + } +} + +async function main () { + try { + console.log('Installing dependencies...') + run('npm ci', { cwd: ROOT_DIR }) + + console.log('\nBuilding packages...') + run('npm run build', { cwd: ROOT_DIR }) + + packPackages() + + console.log('\nDone! Packages are available in the dist directory') + } catch (error) { + console.error('Error:', error) + process.exit(1) + } +} + +main() diff --git a/scripts/react-native-helper.js b/scripts/react-native-helper.js index 720a138d9b..8fb8ec52aa 100644 --- a/scripts/react-native-helper.js +++ b/scripts/react-native-helper.js @@ -1,6 +1,7 @@ // This script is designed to be run within the react-native-android-builder Docker image // It copies just the files it needs from the source 'fixtures' directory in the destination, // before running gradlew (to avoid the need to download gradle multiple times). +const { resolve } = require('path') const common = require('./common') const fs = require('fs') @@ -67,7 +68,6 @@ module.exports = { try { const version = process.env.NOTIFIER_VERSION || common.getCommitId() const rnVersion = process.env.REACT_NATIVE_VERSION - const registryUrl = process.env.REGISTRY_URL const fixtureDir = 'test/react-native/features/fixtures' const targetDir = `${fixtureDir}/${rnVersion}` const initialDir = process.cwd() @@ -83,28 +83,31 @@ module.exports = { } // We're not in docker so check the above are set - if (rnVersion === undefined || registryUrl === undefined) { - throw new Error('Both REACT_NATIVE_VERSION and REGISTRY_URL environment variables must be set') + if (rnVersion === undefined) { + throw new Error('REACT_NATIVE_VERSION environment variables must be set') } // Copy the JS code into the test fixture console.log(`Copying JS app data from ${fixtureDir}/app to ${targetDir}`) common.run(`rsync -a ${fixtureDir}/app/${jsSourceDir}/ ${targetDir}`, true) + const reactNativePath = resolve('dist', 'bugsnag-react-native-cli-*.tgz') + // JavaScript layer console.log(`Changing directory to: ${targetDir} and running "npm install"`) common.changeDir(`${targetDir}`) - common.run(`npm install --registry ${registryUrl}`, true) + common.run('npm ci', true) // Install notifier - console.log(`Installing notifier: ${version}`) - const command = `npm install @bugsnag/react-native@${version} --registry ${registryUrl} --legacy-peer-deps` + console.log('Installing notifier') + const command = `npm install ${reactNativePath}` common.run(command, true) // Install react-native-file-access - const RNFACommand = `npm install react-native-file-access@3.0.4 --registry ${registryUrl}` + const RNFACommand = 'npm install react-native-file-access@3.0.4' common.run(RNFACommand, true) + // TODO: What does this do? Do we need it? // Install any required secondary files if (fs.existsSync('./install.sh')) { common.run(`BUGSNAG_VERSION=${version} ./install.sh`, true)