Skip to content

chore: monorepo setup #1002

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

Merged
merged 6 commits into from
Aug 16, 2023
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
20 changes: 15 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
run: yarn
- name: Run test ${{ matrix.test-name }}
run: yarn test:${{ matrix.test-name }}
working-directory: packages/default-storage-backend
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use prefixes so packages get grouped together? I.e. storage-backend-*, storage-core, etc.

Suggested change
working-directory: packages/default-storage-backend
working-directory: packages/storage-backend-default

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought more about TYPE_OF_STORAGE-storage-backend convention. We already have other storage called sqlite-storage-backend. Besides, I don't think we will have more storages in this monorepo anyway

Copy link
Member

@tido64 tido64 Aug 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would look a lot nicer in the directory if we stick to the storage-<category>-<implementation> convention though:

storage-backend-default   # What we have in 1.x
storage-backend-mmkv      # Maybe?
storage-backend-os-prefs  # NSUserDefaults (iOS) or SharedPreference (Android)
storage-backend-sqlite    # SQLite
storage-core              # JS
storage-types             # TypeScript interfaces

But I suppose we could also change this later, so I'll let you decide.

android:
name: Android
runs-on: ubuntu-22.04
Expand All @@ -42,10 +43,11 @@ jobs:
with:
gradle-version: wrapper
arguments: react-native-async-storage_async-storage:test
build-root-directory: example/android
build-root-directory: packages/default-storage-backend/example/android
- name: Build e2e binary
run: |
yarn build:e2e:android
working-directory: packages/default-storage-backend

ios:
name: iOS
Expand All @@ -56,7 +58,7 @@ jobs:
- name: Cache /.ccache
uses: actions/cache@v3
with:
path: .ccache
path: packages/default-storage-backend/.ccache
key: ccache-ios-${{ hashFiles('yarn.lock') }}
restore-keys: ccache-ios-
- name: Set up Node.js
Expand All @@ -70,13 +72,15 @@ jobs:
- name: Bundle JS
run: |
yarn bundle:ios
working-directory: packages/default-storage-backend
- name: Install Pods
run: |
RCT_NEW_ARCH_ENABLED=1 pod install
working-directory: example/ios
working-directory: packages/default-storage-backend/example/ios
- name: Build e2e binary
run: |
yarn build:e2e:ios
working-directory: packages/default-storage-backend

macos:
name: macOS
Expand All @@ -87,7 +91,7 @@ jobs:
- name: Cache /.ccache
uses: actions/cache@v3
with:
path: .ccache
path: packages/default-storage-backend/.ccache
key: ccache-macos-${{ hashFiles('yarn.lock') }}
restore-keys: ccache-macos-
- name: Set up Node.js
Expand All @@ -101,17 +105,20 @@ jobs:
- name: Bundle JS
run: |
yarn bundle:macos
working-directory: packages/default-storage-backend
- name: Install Pods
run: |
RCT_NEW_ARCH_ENABLED=1 pod install
working-directory: example/macos
working-directory: packages/default-storage-backend/example/macos
- name: Build
run: |
yarn build:e2e:macos
working-directory: packages/default-storage-backend
- name: Test
if: false
run: |
yarn test:e2e:macos
working-directory: packages/default-storage-backend

windows:
name: Windows
Expand All @@ -134,9 +141,11 @@ jobs:
- name: Install Windows test app
run: |
yarn install-windows-test-app -p example/windows
working-directory: packages/default-storage-backend
- name: Build
run: |
yarn react-native run-windows --release --arch x64 --logging --no-packager --no-launch --no-deploy --msbuildprops "BundleEntryFile=index.ts" --no-telemetry
working-directory: packages/default-storage-backend

release:
name: Release
Expand Down Expand Up @@ -168,3 +177,4 @@ jobs:
git config user.email ${{ secrets.GH_BOT_EMAIL }}
git config user.name ${{ secrets.GH_BOT_NAME }}
yarn semantic-release
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for later: We should look into replacing semantic-release with something that understands monorepos. In rnx-kit, Changesets has been working very well for us.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet, will remember that 🙏

working-directory: packages/default-storage-backend
10 changes: 5 additions & 5 deletions .github/workflows/website-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches:
- main
paths:
- 'website/**'
- 'packages/website/**'

jobs:
deploy:
Expand All @@ -17,15 +17,15 @@ jobs:
- name: Cache/restore dependencies
uses: actions/cache@v3
with:
path: ./website/.yarn
key: website-${{ hashFiles('website/yarn.lock') }}
path: .yarn
key: website-${{ hashFiles('yarn.lock') }}
- name: Install dependencies
run: yarn
working-directory: ./website
working-directory: ./packages/website
- name: Deploy
run: |
git config --global user.name ${{ secrets.GH_BOT_NAME }}
git config --global user.email ${{ secrets.GH_BOT_EMAIL }}
echo "machine github.com login ${{ secrets.GH_BOT_NAME }} password ${{ secrets.GH_RELEASE_TOKEN }}" > ~/.netrc
GIT_USER=${{ secrets.GH_BOT_NAME }} yarn run deploy
working-directory: ./website
working-directory: ./packages/website
60 changes: 12 additions & 48 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# OSX
#
.DS_Store

# Xcode
#
.idea
.yarn
.gradle
!.yarn/releases
node_modules/
npm-debug.log
yarn-error.log
.vscode/*
.expo
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.xcode.env
build/
*.pbxuser
!default.pbxuser
*.mode1v3
Expand All @@ -14,53 +20,11 @@ build/
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IntelliJ
#
.idea
.gradle
local.properties
*.iml
android/build
android/gradle/
android/gradlew
android/gradlew.bat

# Visual Studio
#
example/windows/.vs
example/windows/*.sln
example/windows/ARM
example/windows/packages
example/windows/x64
msbuild.binlog

# node.js
#
.yarn
!.yarn/releases
node_modules/
npm-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
*.keystore

# Editor config
.vscode/*
!.vscode/extensions.json
.expo
/web-build

# builds by bob
lib/
9 changes: 0 additions & 9 deletions .vscode/extensions.json

This file was deleted.

1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ logFilters:
level: discard
- code: YN0013 # X can't be found in the cache and will be fetched from the remote registry
level: discard
nmHoistingLimits: workspaces
nodeLinker: node-modules
npmRegistryServer: "https://registry.npmjs.org"
packageExtensions:
Expand Down
Loading