Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(react-native-storybook): Add native module linking errors #2

Merged
merged 9 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
./examples/expo-example/.builds/ios.tar.gz filter=lfs diff=lfs merge=lfs -text
./examples/expo-example/.builds/android.apk filter=lfs diff=lfs merge=lfs -text
./examples/expo-example/.builds/preview/ios.tar.gz filter=lfs diff=lfs merge=lfs -text
./examples/expo-example/.builds/preview/android.apk filter=lfs diff=lfs merge=lfs -text
./examples/expo-example/builds/ios.tar.gz filter=lfs diff=lfs merge=lfs -text
./examples/expo-example/builds/android.apk filter=lfs diff=lfs merge=lfs -text
./examples/expo-example/builds/preview/ios.tar.gz filter=lfs diff=lfs merge=lfs -text
./examples/expo-example/builds/preview/android.apk filter=lfs diff=lfs merge=lfs -text
8 changes: 4 additions & 4 deletions .github/workflows/build_and_run_sherlo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ jobs:

- name: Build Android example app
if: ${{ github.event.inputs.MAKE_BUILDS == 'true' }}
run: yarn workspace @sherlo/expo-example android:preview
run: yarn workspace @sherlo/expo-example android:build:preview

- name: Upload Android Artifact
uses: actions/upload-artifact@v2
with:
name: android-preview
path: examples/expo-example/.builds/preview/android.apk
path: examples/expo-example/builds/preview/android.apk

ios_preview_build:
runs-on: macos-13
Expand Down Expand Up @@ -103,13 +103,13 @@ jobs:

- name: Build iOS example app
if: ${{ github.event.inputs.MAKE_BUILDS == 'true' }}
run: yarn workspace @sherlo/expo-example ios:preview
run: yarn workspace @sherlo/expo-example ios:build:preview

- name: Upload iOS Artifact
uses: actions/upload-artifact@v2
with:
name: ios-preview
path: examples/expo-example/.builds/preview/ios.tar.gz
path: examples/expo-example/builds/preview/ios.tar.gz

run_sherlo_action:
runs-on: ubuntu-latest
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/pr_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Check PR title
uses: amannn/[email protected]
with:
types: |
feat
fix
docs
chore
style
refactor
perf
test
pattern: '^(feat|fix|docs|chore|style|refactor|perf|test)(\(.+\))?: .{1,72}'
feat
scopes: |
action
cli
react-native-storybook
expo-example
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 0 additions & 3 deletions examples/expo-example/.builds/android.apk

This file was deleted.

3 changes: 0 additions & 3 deletions examples/expo-example/.builds/ios.tar.gz

This file was deleted.

4 changes: 2 additions & 2 deletions examples/expo-example/.gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.builds/ios.tar.gz filter=lfs diff=lfs merge=lfs -text
.builds/android.apk filter=lfs diff=lfs merge=lfs -text
builds/ios.tar.gz filter=lfs diff=lfs merge=lfs -text
builds/android.apk filter=lfs diff=lfs merge=lfs -text
2 changes: 1 addition & 1 deletion examples/expo-example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ node_modules/
.expo/
dist/
web-build/
.builds/sherloexpoexample.app
builds/sherloexpoexample.app

# Native
*.orig.*
Expand Down
4 changes: 2 additions & 2 deletions examples/expo-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ To use the `@sherlo/expo-example` package in your project, follow these steps:
8. **React Native Code Changes**: If you make changes to the React Native code, rebuild the app with the following commands before running visual tests:

```bash
yarn android:preview
yarn ios:preview
yarn android:build:preview
yarn ios:build:preview
```

These builds are then uploaded and tested via `npx @sherlo/cli` command.
Expand Down
3 changes: 3 additions & 0 deletions examples/expo-example/builds/android.apk
Git LFS file not shown
3 changes: 3 additions & 0 deletions examples/expo-example/builds/ios.tar.gz
Git LFS file not shown
29 changes: 0 additions & 29 deletions examples/expo-example/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// metro.config.js
const path = require('path');
const { getDefaultConfig } = require('expo/metro-config');

const { generate } = require('@storybook/react-native/scripts/generate');

generate({
Expand All @@ -11,35 +9,8 @@ generate({
/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname);

// config.resolver.unstable_enablePackageExports = true;
config.transformer.unstable_allowRequireContext = true;

config.resolver.sourceExts.push('mjs');

// const projectRoot = __dirname;
// const monorepoRoot = path.resolve(projectRoot, '../..');

// // Only list the packages within your monorepo that your app uses. No need to add anything else.
// // If your monorepo tooling can give you the list of monorepo workspaces linked
// // in your app workspace, you can automate this list instead of hardcoding them.
// const monorepoPackages = {
// '@sherlo/react-native-storybook': path.resolve(monorepoRoot, 'packages/react-native-storybook'),
// };

// // 1. Watch the local app folder, and only the shared packages (limiting the scope and speeding it up)
// // Note how we change this from `monorepoRoot` to `projectRoot`. This is part of the optimization!
// config.watchFolders = [projectRoot, ...Object.values(monorepoPackages)];

// // Add the monorepo workspaces as `extraNodeModules` to Metro.
// // If your monorepo tooling creates workspace symlinks in the `node_modules` folder,
// // you can either add symlink support to Metro or set the `extraNodeModules` to avoid the symlinks.
// // See: https://facebook.github.io/metro/docs/configuration/#extranodemodules
// config.resolver.extraNodeModules = monorepoPackages;

// // 2. Let Metro know where to resolve packages and in what order
// config.resolver.nodeModulesPaths = [
// path.resolve(projectRoot, 'node_modules'),
// path.resolve(monorepoRoot, 'node_modules'),
// ];

module.exports = config;
24 changes: 10 additions & 14 deletions examples/expo-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,17 @@
"private": true,
"main": "index.ts",
"scripts": {
"start": "expo start --dev-client",
"android": "adb install .builds/android.apk && expo start --android --dev-client",
"android:build": "eas build --platform android --local --profile=development --output=.builds/android.apk",
"android:preview": "eas build --platform android --local --profile=preview --output=.builds/preview/android.apk",
"ios": "tar -xzvf .builds/ios.tar.gz -C .builds/ && xcrun simctl install booted .builds/sherloexpoexample.app && expo start --ios --dev-client",
"ios:build": "eas build --platform ios --local --profile=development --output=.builds/ios.tar.gz",
"ios:preview": "eas build --platform ios --local --profile=preview --output=.builds/preview/ios.tar.gz",
"update": "eas update --branch preview --message update",
"web": "expo start --web",
"storybook:web": "storybook dev -p 6006 -c .storybook-web",
"build-storybook": "storybook build -c .storybook-web",
"android:build:dev": "eas build --platform android --local --profile=development --output=builds/android.apk",
"android:build:preview": "eas build --platform android --local --profile=preview --output=builds/preview/android.apk",
"android:start:dev": "adb install builds/android.apk && expo start --android --dev-client",
"android:start:go": "expo start --android --go",
"ios:build:dev": "eas build --platform ios --local --profile=development --output=builds/ios.tar.gz",
"ios:build:preview": "eas build --platform ios --local --profile=preview --output=builds/preview/ios.tar.gz",
"ios:start:dev": "tar -xzvf builds/ios.tar.gz -C builds/ && xcrun simctl install booted builds/sherloexpoexample.app && expo start --ios --dev-client",
"ios:start:go": "expo start --ios --go",
"sherlo": "sherlo --config sherlo.config.json",
"storybook-generate": "sb-rn-get-stories --config-path .storybook",
"storybook-watch": "sb-rn-watcher --config-path .storybook"
"storybook:web": "storybook dev -p 6006 -c .storybook-web",
"storybook:native:generate": "sb-rn-get-stories --config-path .storybook"
},
"dependencies": {
"@expo-google-fonts/urbanist": "^0.2.3",
Expand All @@ -28,7 +25,6 @@
"@shopify/flash-list": "1.6.3",
"expo": "~50.0.8",
"expo-app-loading": "^2.1.1",
"expo-constants": "^15.4.5",
"expo-dev-client": "~3.3.9",
"expo-font": "~11.10.3",
"expo-linear-gradient": "~12.7.2",
Expand Down
4 changes: 2 additions & 2 deletions examples/expo-example/sherlo.config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"projectToken": "<YOUR_PROJECT_TOKEN>",
"android": {
"path": ".builds/preview/android.apk",
"path": "builds/preview/android.apk",
"packageName": "com.sherlo.example",
"devices": [
{
Expand All @@ -19,7 +19,7 @@
]
},
"ios": {
"path": "./.builds/preview/ios.tar.gz",
"path": "./builds/preview/ios.tar.gz",
"bundleIdentifier": "com.sherlo.example",
"devices": [
{
Expand Down
Loading
Loading