Skip to content

Commit

Permalink
v2.3.2 (#41)
Browse files Browse the repository at this point in the history
* Monorepo support (#37)

* Upgrade to expo 50 sdk

* Upgrade morrowdigital/watermelondb-expo-plugin

* Add Android monorepo support

* Add ios monorepo support

- Adds monorepo support to ios
- Removes unnecessary pods as they are already auto-linked

* Remove unused code

* Remove duplicated bridgingHeader

Expo 50 there is already an empty .swift file for this

* Add monorepo support

* apply changes to build

* bump version 2.3.2-beta.0

* Chore/docs update (#38)

* add changelog and contributions

* maintainer's guide

* Chore/GitHub actions (#39)

* 2.3.2-beta.1

* add pushing back to repo

* remove dry-run

* github actions / add beta action

* chore/fix git push

* remove version bump

* add Environment again

* add version bumping

* removed version upgrade

* added npm token placeholder

* different npm token in previous step

* add yarn gha

* more places for NPM_TOKEN

* Chore/update docs on gha (#40)

* update docs and npmrc

* update releaes gha

* bugfix/revert test code

* 2.3.2

* update CHANGELOG.md

---------

Co-authored-by: Carlos Moreno <[email protected]>
  • Loading branch information
killerchip and clmoreno authored Apr 27, 2024
1 parent f48c1ff commit 9972e43
Show file tree
Hide file tree
Showing 12 changed files with 1,398 additions and 1,149 deletions.
35 changes: 14 additions & 21 deletions .github/workflows/release-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,34 @@ on:
jobs:
publish:
runs-on: ubuntu-latest
# environment:
# name: Beta
environment:
name: Beta
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
ref: beta

- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

- name: Setup Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install dependencies
run: yarn install
uses: borales/actions-yarn@v4
with:
cmd: install
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}


- name: Build and publish
- name: Publish
run: |
yarn run build
npm version prerelease --preid=beta
npm publish --tag beta --dry-run
npm publish --tag beta
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
#
# - name: Prepare Git
# uses: actions/checkout@v4
# with:
# persist-credentials: false
#
# - name: Push changes
# run: |
# git config user.name "GitHub Actions"
# git config user.email "[email protected]"
# git add .
# git commit -m "Bump version and publish beta package"
# git push origin HEAD:beta

41 changes: 41 additions & 0 deletions .github/workflows/release-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish Production Package

on:
workflow_dispatch:
branches:
- main

jobs:
publish:
runs-on: ubuntu-latest
environment:
name: Production
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
ref: beta

- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install dependencies
uses: borales/actions-yarn@v4
with:
cmd: install
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}


- name: Publish
run: |
npm publish --tag latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ android/
!.yarn/sdks
!.yarn/versions

.npmrc
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# CHANGELOG
## [2.3.2] - 29/3/2024
### Added
- Monorepo support
- Documentation for Maintainers and Contributors
- Github actions for Publishing Beta and Release


## [2.3.1] - 21/3/2024

26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Contributing to `watermelondb-expo-plugin`

Thank you for your interest in contributing to `watermelondb-expo-plugin`! We appreciate your help in making our project better.

## Getting Started

To contribute to this project, follow these steps:

1. **Fork** the repository by clicking on the "Fork" button at the top right corner of this page. This will create a copy of the repository in your GitHub account.

2. **Clone** your forked repository to your local machine:

3. **Make** update and changes to the codebase.

## Create a Pull Request

Submit a **Pull Request** to the `beta` branch of the original repository.

* Ensure that your changes are made to the beta branch of your forked repository.
* Submit your pull request (PR) from the branch where you made your changes to the beta branch of the original repository.
* Provide a clear and descriptive title for your PR and include any relevant information about the changes you've made.

## Code Review
Once your pull request is submitted, it will undergo review by project maintainers. We appreciate your patience during this process and welcome any feedback or suggestions for improvement.

Thank you for your contributions!
40 changes: 40 additions & 0 deletions MAINTAINERS_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# MAINTAINER'S GUIDE

## Gitflow

* `main`: branch is used for production releases.
* `beta`: branch is used for beta testing. It is gathering all the code from bug fixes and new features.
* `chore/*`: documentation updates, and maintenance tasks.
* `feature/*`: new features.
* `fix/*`: bug fixes.

## Versioning

We use semantic versioning.

### Beta versions

Before we release a new version, we first release one or more series of `beta` versions.

For example if the current production version is 1.0.1, and we want to move on with releasing 1.0.2, first we release 1.0.2-beta.1, 1.0.2-beta.2, etc. until we are confident that the new version is stable.

To release a beta:
1. Update the CHANGELOG.md file with the latest beta version and release date of the version.
2. bump the version in `package.json>version` with `yarn bump:beta`
3. Push the changes to the `beta` branch.
4. Then release by triggering the GitHub Actions workflow `Publish Beta Package` on the `beta` branch.

## Production releases

When we are confident that the beta version is stable, we release a production version.

1. In `beta` branch bump the version in `package.json>version` to the new version with `yarn bump:release` (or manually).
2. Update the CHANGELOG.md file with the new version and release date of the version. The changes that were previously in beta should be moved to the new version.
3. Push the changes to beta.
4. Create a PR and merge `beta` to `main`.
5. Then release by triggering the Github action `Publish Production Package` on `main` branch.


> Note: The Github actions need approval to be launched. If you're part of the admins team, you can do it yourself.

28 changes: 5 additions & 23 deletions build/withWatermelon.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ function settingGradle(gradleConfig) {
if (!mod.modResults.contents.includes(':watermelondb-jsi')) {
mod.modResults.contents += `
include ':watermelondb-jsi'
project(':watermelondb-jsi').projectDir =
new File(rootProject.projectDir, '../node_modules/@nozbe/watermelondb/native/android-jsi')
project(':watermelondb-jsi').projectDir = new File([
"node", "--print",
"require.resolve('@nozbe/watermelondb/package.json')"
].execute(null, rootProject.projectDir).text.trim(), "../native/android-jsi")
`;
}
return mod;
Expand All @@ -49,23 +51,6 @@ function buildGradle(config) {
return mod;
});
}
const cocoaPods = (config) => {
return (0, config_plugins_1.withDangerousMod)(config, [
"ios",
async (config) => {
const filePath = path_1.default.join(config.modRequest.platformProjectRoot, "Podfile");
const contents = await fs.readFile(filePath, "utf-8");
const newContents = contents.replace('post_install do |installer|', `
# WatermelonDB dependency
pod 'simdjson', path: '../node_modules/@nozbe/simdjson', modular_headers: true
post_install do |installer|`);
await fs.writeFile(filePath, newContents);
return config;
},
]);
};
function mainApplication(config) {
return (0, config_plugins_1.withMainApplication)(config, (mod) => {
mod.modResults['contents'] = mod.modResults.contents.replace('import android.app.Application', `
Expand Down Expand Up @@ -166,9 +151,7 @@ const withCocoaPods = (config) => {
const patchKey = "post_install";
const slicedContent = contents.split(patchKey);
slicedContent[0] += `\n
pod 'WatermelonDB', :path => '../node_modules/@nozbe/watermelondb'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi', :modular_headers => true
pod 'simdjson', path: '../node_modules/@nozbe/simdjson', :modular_headers => true\n\n `;
pod 'simdjson', path: File.join(File.dirname(\`node --print "require.resolve('@nozbe/simdjson/package.json')"\`)), :modular_headers => true \n\n `;
await fs.writeFile(filePath, slicedContent.join(patchKey));
}
else {
Expand Down Expand Up @@ -270,7 +253,6 @@ function withSDK50(options) {
currentConfig = mainApplication(currentConfig);
}
// iOS
currentConfig = setWmelonBridgingHeader(currentConfig);
currentConfig = withCocoaPods(currentConfig);
if (options?.excludeSimArch === true) {
currentConfig = withExcludedSimulatorArchitectures(currentConfig);
Expand Down
16 changes: 10 additions & 6 deletions example/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"fallbackToCacheTimeout": 0,
"url": "https://u.expo.dev/e2f5f187-c189-4364-9a79-c21671fa2618"
},
"assetBundlePatterns": ["**/*"],
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.wmlDB.app"
Expand All @@ -31,16 +33,18 @@
},
"plugins": [
[
"@morrowdigital/watermelondb-expo-plugin",
{
"databases": ["morrow.db"]
}
"@morrowdigital/watermelondb-expo-plugin"
],
[
"expo-build-properties",
{
"android": {
"kotlinVersion": "1.6.10"
"kotlinVersion": "1.6.10",
"packagingOptions": {
"pickFirst": [
"**/libc++_shared.so"
]
}
}
}
]
Expand Down
28 changes: 14 additions & 14 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@
"eject": "expo eject"
},
"dependencies": {
"@morrowdigital/watermelondb-expo-plugin": "^2.1.2",
"@morrowdigital/watermelondb-expo-plugin": "^2.3.1",
"@nozbe/watermelondb": "^0.26.0",
"expo": "^49.0.0",
"expo-build-properties": "~0.8.3",
"expo-splash-screen": "~0.20.4",
"expo-status-bar": "~1.6.0",
"expo-updates": "~0.18.8",
"expo": "^50.0.0",
"expo-build-properties": "~0.11.1",
"expo-splash-screen": "~0.26.4",
"expo-status-bar": "~1.11.1",
"expo-updates": "~0.24.11",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.72.1",
"react-native-gesture-handler": "~2.12.0",
"react-native-reanimated": "~3.3.0",
"react-native-safe-area-context": "4.6.3",
"react-native-screens": "~3.22.0",
"react-native": "0.73.4",
"react-native-gesture-handler": "~2.14.0",
"react-native-reanimated": "~3.6.2",
"react-native-safe-area-context": "4.8.2",
"react-native-screens": "~3.29.0",
"react-native-web": "~0.19.6",
"resolve-from": "^5.0.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@types/react": "~18.2.14",
"@types/react": "~18.2.45",
"@types/react-native": "~0.70.6",
"jest-expo": "^48.0.0",
"jest-expo": "~50.0.2",
"react-test-renderer": "17.0.1",
"typescript": "^5.1.3"
"typescript": "^5.3.0"
},
"private": true,
"name": "wmlDB",
Expand Down
Loading

0 comments on commit 9972e43

Please sign in to comment.