Skip to content

Commit

Permalink
Merge pull request #161 from bugsnag/PLAT-11488/support-v50
Browse files Browse the repository at this point in the history
Support Expo SDK 50
  • Loading branch information
yousif-bugsnag authored Feb 7, 2024
2 parents 0fa5a98 + a7995ab commit 5646f22
Show file tree
Hide file tree
Showing 29 changed files with 205 additions and 152 deletions.
17 changes: 10 additions & 7 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ steps:
queue: "opensource-arm-mac-cocoa-12"
env:
EXPO_RELEASE_CHANNEL: ${BUILDKITE_BUILD_ID}
NODE_VERSION: "18"
JAVA_VERSION: "17"
artifact_paths: build/output.apk
commands:
- features/scripts/build-android.sh
Expand All @@ -39,10 +41,11 @@ steps:
key: "build-expo-ipa"
timeout_in_minutes: 20
agents:
queue: "opensource-arm-mac-cocoa-12"
queue: "macos-13-arm"
env:
EXPO_RELEASE_CHANNEL: ${BUILDKITE_BUILD_ID}
DEVELOPER_DIR: "/Applications/Xcode14.app"
DEVELOPER_DIR: "/Applications/Xcode-15.2.0.app"
NODE_VERSION: "18"
artifact_paths: build/output.ipa
commands:
- features/scripts/build-ios.sh
Expand All @@ -66,11 +69,11 @@ steps:
- --a11y-locator
- --fail-fast
- --retry=2
concurrency: 5
concurrency: 5
concurrency_group: 'browserstack-app'
concurrency_method: eager

- label: ':runner: expo iOS 15'
- label: ':runner: expo iOS 16'
depends_on:
- "build-expo-ipa"
- "expo-maze-runner-image"
Expand All @@ -85,15 +88,15 @@ steps:
command:
- --app=build/output.ipa
- --farm=bs
- --device=IOS_15
- --device=IOS_16
- --a11y-locator
- --retry=2
- --order=random
concurrency: 5
concurrency_group: 'browserstack-app'
concurrency_method: eager

- label: ':runner: expo iOS 13'
- label: ':runner: expo iOS 14'
depends_on:
- "build-expo-ipa"
- "expo-maze-runner-image"
Expand All @@ -108,7 +111,7 @@ steps:
command:
- --app=build/output.ipa
- --farm=bs
- --device=IOS_13
- --device=IOS_14
- --a11y-locator
- --retry=2
- --order=random
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: ['14']
node-version: ['18']

steps:
- uses: actions/checkout@v2
Expand All @@ -21,8 +21,6 @@ jobs:

- run: npm install --no-audit --no-package-lock

- run: npx lerna bootstrap --no-ci

- run: npm run test:unit

- run: npm run test:lint
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ compile_commands.json
.cache
.clangd
package-lock.json
yarn.lock
/config
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ cd bugsnag-expo
# Install top-level dependencies
npm i

# Bootstrap all of the packages
npm run bootstrap

# Run the unit tests
npm run test:unit

Expand Down
6 changes: 0 additions & 6 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ Install top level dependencies:
npm i
```

Bootstrap all of the individual packages:

```sh
npm run bootstrap
```

## Unit tests

Runs the unit tests for each package.
Expand Down
4 changes: 2 additions & 2 deletions features/auto_breadcrumbs.feature
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Scenario: Network breadcrumbs are captured by default
And the exception "message" equals "defaultNetworkBreadcrumbsBehaviour"
And the event has a "request" breadcrumb named "XMLHttpRequest succeeded"
And the event "breadcrumbs.1.metaData.status" equals 200
And the event "breadcrumbs.1.metaData.request" equals "GET http://postman-echo.com/get"
And the event "breadcrumbs.1.metaData.request" equals "GET https://postman-echo.com/get"
And the error Bugsnag-Integrity header is valid

Scenario: Network breadcrumbs can be disabled explicitly
Expand Down Expand Up @@ -152,5 +152,5 @@ Scenario: Network breadcrumbs overrides auto-breadcrumbs
And the exception "message" equals "overrideNetworkBreadcrumbsBehaviour"
And the event has a "request" breadcrumb named "XMLHttpRequest succeeded"
And the event "breadcrumbs.0.metaData.status" equals 200
And the event "breadcrumbs.0.metaData.request" equals "GET http://postman-echo.com/get"
And the event "breadcrumbs.0.metaData.request" equals "GET https://postman-echo.com/get"
And the error Bugsnag-Integrity header is valid
1 change: 0 additions & 1 deletion features/fixtures/.gitignore

This file was deleted.

31 changes: 24 additions & 7 deletions features/fixtures/test-app/.gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files

# dependencies
node_modules/

# Expo
.expo/
dist/
npm-debug.*
web-build/

# Native
*.orig.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
scenario.json
bugsnag-expo-*.tgz
android
ios
*.orig.*
web-build/

# Metro
.metro-health-check*

# debug
npm-debug.*
yarn-debug.*
yarn-error.*

# macOS
.DS_Store
*.pem

# local env files
.env*.local

# typescript
*.tsbuildinfo
11 changes: 10 additions & 1 deletion features/fixtures/test-app/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,16 @@
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.bugsnag.expo.testfixture",
"buildNumber": "1"
"buildNumber": "1",
"infoPlist": {
"NSAppTransportSecurity": {
"NSExceptionDomains": {
"bs-local.com": {
"NSExceptionAllowsInsecureHTTPLoads": true
}
}
}
}
},
"android": {
"package": "com.bugsnag.expo.testfixture",
Expand Down
2 changes: 1 addition & 1 deletion features/fixtures/test-app/app/network_breadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default class NetworkBreadcrumbs extends Component {
}

async triggerNetworkBreadcrumbsError(client, message) {
await fetch("http://postman-echo.com/get")
await fetch("https://postman-echo.com/get")
.then(response => {
client.notify(new Error(message))
})
Expand Down
8 changes: 8 additions & 0 deletions features/fixtures/test-app/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { registerRootComponent } from 'expo';

import App from './App';

// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);
30 changes: 18 additions & 12 deletions features/fixtures/test-app/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
const { getDefaultConfig } = require('@expo/metro-config');
const { getDefaultConfig } = require('expo/metro-config');
const path = require('path');

const defaultConfig = getDefaultConfig(__dirname);
// Find the project and workspace directories
const projectRoot = __dirname;
// This can be replaced with `find-yarn-workspace-root`
const workspaceRoot = path.resolve(projectRoot, '../../..');

defaultConfig.resolver.extraNodeModules = {
'expo': `${__dirname}/node_modules/expo`,
'expo-modules-core': `${__dirname}/node_modules/expo-modules-core`,
'react-native': `${__dirname}/node_modules/react-native`,
'react': `${__dirname}/node_modules/react`,
'@babel/runtime': `${__dirname}/node_modules/@babel/runtime`,
'promise': `${__dirname}/node_modules/promise`,
'@unimodules/core': `${__dirname}/node_modules/@unimodules/core`,
}
const config = getDefaultConfig(projectRoot);

module.exports = defaultConfig;
// 1. Watch all files within the monorepo
config.watchFolders = [workspaceRoot];
// 2. Let Metro know where to resolve packages and in what order
config.resolver.nodeModulesPaths = [
path.resolve(projectRoot, 'node_modules'),
path.resolve(workspaceRoot, 'node_modules'),
];
// 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths`
// config.resolver.disableHierarchicalLookup = true;

module.exports = config;
28 changes: 16 additions & 12 deletions features/fixtures/test-app/package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
{
"name": "test-fixture",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"main": "index.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"@react-native-community/netinfo": "9.3.10",
"expo": "^49.0.0",
"expo-application": "~5.3.0",
"expo-constants": "~14.4.2",
"expo-crypto": "~12.4.1",
"expo-device": "~5.4.0",
"expo-file-system": "~15.4.2",
"expo-screen-orientation": "~6.0.2",
"expo-status-bar": "~1.6.0",
"@react-native-community/netinfo": "11.1.0",
"expo": "^50.0.0",
"expo-application": "~5.8.3",
"expo-constants": "~15.4.5",
"expo-crypto": "~12.8.0",
"expo-device": "~5.9.3",
"expo-file-system": "~16.0.5",
"expo-screen-orientation": "~6.4.1",
"expo-status-bar": "~1.11.1",
"react": "18.2.0",
"react-native": "0.72.3"
"react-native": "0.73.2",
"@bugsnag/expo": "*"
},
"devDependencies": {
"@babel/core": "^7.20.0"
"@babel/core": "^7.20.0",
"bugsnag-expo-cli": "*",
"@bugsnag/plugin-expo-eas-sourcemaps": "*",
"@bugsnag/source-maps": "^2.3.1"
},
"private": true
}
2 changes: 1 addition & 1 deletion features/scripts/build-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

pushd features/fixtures/test-app

eas build \
npx eas-cli@latest build \
--local \
-p android \
--output output.apk
Expand Down
19 changes: 3 additions & 16 deletions features/scripts/build-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,12 @@ git clean -xfdf
# And the yarn cache is clean
yarn cache clean --all

# Install expo requirements
npm install

# Bump package versions to a high value so only our values will match
npx lerna version 999.999.999 --no-git-tag-version --no-push --no-changelog --yes

# Pack the packages and move them to the test fixture
npm pack packages/*/
mv *.tgz features/fixtures/test-app
# Install repo dependencies
yarn install

cd features/fixtures/test-app

# Install the bugsnag-expo-cli and run setup
npm install bugsnag-expo-cli*.tgz
# Set the api key via the CLI
./run-bugsnag-expo-cli

# Set EAS Project ID
Expand All @@ -29,11 +21,6 @@ sed -i '' "s/EXPO_EAS_PROJECT_ID/$EXPO_EAS_PROJECT_ID/g" app.json
# set bugsnag-js override versions if this build was triggered from the bugsnag-js repo
./set-bugsnag-js-overrides $BUGSNAG_JS_BRANCH $BUGSNAG_JS_COMMIT

# install the remaining packages, this also re-installs the correct @bugsnag/expo version
npm install *.tgz
npm install
yarn import

./run-bugsnag-expo-cli-install

cp $EXPO_UNIVERSAL_CREDENTIALS_DIR/* .
Expand Down
2 changes: 1 addition & 1 deletion features/scripts/build-ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

pushd features/fixtures/test-app

eas build \
npx eas-cli@latest build \
--local \
-p ios \
--output output.ipa \
Expand Down
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const project = (displayName, packageNames, config = {}) => ({
const extensions = 'js,jsx,ts,tsx'

module.exports = {
preset: 'jest-expo',
transformIgnorePatterns: [
'node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|native-base|react-native-svg)'
],
collectCoverageFrom: [
`**/packages/*/**/*.{${extensions}}`,
`!**/*.test.{${extensions}}`,
Expand Down
7 changes: 2 additions & 5 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"lerna": "2.11.0",
"packages": [
"packages/*"
],
"version": "49.0.2"
"version": "49.0.2",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.18.3",
"eslint-plugin-standard": "^4.0.1",
"expo": "^49.0.0",
"jest": "^26.6.3",
"jest-expo": "^48.0.1",
"lerna": "^6.0.1",
"expo": "^50.0.0",
"jest": "^29.3.1",
"jest-expo": "^50.0.1",
"lerna": "^8.0.2",
"react": "18.2.0",
"react-native": "0.72.3",
"react-native": "0.73.2",
"verdaccio": "^5.10.2"
},
"scripts": {
Expand All @@ -22,5 +22,9 @@
"test:lint": "eslint --report-unused-disable-directives --max-warnings=0 .",
"local-npm:start": "verdaccio --config ./verdaccio-config.yml",
"local-npm:publish-all": "lerna publish --yes --force-publish --exact --no-push --no-git-reset --no-git-tag-version --registry 'http://localhost:4873'"
}
},
"private": true,
"workspaces": [
"packages/*", "features/fixtures/test-app"
]
}
Loading

0 comments on commit 5646f22

Please sign in to comment.