Skip to content
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
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ jobs:

- name: install npm dependencies
run: npm install


- name: build rxdb from source
run: bash scripts/build-rxdb.sh

- name: build code
run: npm run build

Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ jobs:
with:
path: |
~/.npm
./node_modules
key: ${{ runner.os }}-npm-core-x3-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-npm-core-x3-

- name: install npm dependencies
run: npm install

- name: build rxdb from source
run: bash scripts/build-rxdb.sh

- name: build
run: npm run build

Expand All @@ -69,13 +71,14 @@ jobs:
with:
path: |
~/.npm
./node_modules
/tmp/.buildx-cache
key: ${{ runner.os }}-npm-storage-dexie-x3-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-npm-storage-dexie-x3-

- run: npm install
- name: build rxdb from source
run: bash scripts/build-rxdb.sh
- run: npm run test:integration:init
- run: npm run test:integration:memory

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ jobs:
with:
path: |
~/.npm
./node_modules
key: ${{ runner.os }}-npm-release-x2-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-npm-release-x2-

- run: npm install
- name: build rxdb from source
run: bash scripts/build-rxdb.sh
- run: npm run build

- name: Get version
Expand Down
31 changes: 25 additions & 6 deletions .github/workflows/update-rxdb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
steps:
- uses: actions/checkout@v6

- name: Get current rxdb version from package.json
- name: Get current peer-deps rxdb version from package.json
id: current
run: |
CURRENT_VERSION=$(node -e "console.log(require('./package.json').devDependencies.rxdb)")
CURRENT_VERSION=$(node -e "console.log(require('./package.json').peerDependencies.rxdb)")
echo "version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"

- name: Get latest and next rxdb versions from npm
Expand All @@ -39,6 +39,12 @@ jobs:
echo "latest=$LATEST_VERSION" >> "$GITHUB_OUTPUT"
echo "next=$NEXT_VERSION" >> "$GITHUB_OUTPUT"

- name: Get latest commit hash from rxdb master
id: hash
run: |
COMMIT_HASH=$(git ls-remote https://github.com/pubkey/rxdb.git refs/heads/master | cut -f1)
echo "commit=$COMMIT_HASH" >> "$GITHUB_OUTPUT"

- name: Determine target version
id: target
run: |
Expand Down Expand Up @@ -66,23 +72,36 @@ jobs:
fi
echo "version=$TARGET" >> "$GITHUB_OUTPUT"

- name: Get current commit hash from package.json
id: current_hash
run: |
CURRENT_HASH=$(node -e "
const dep = require('./package.json').devDependencies.rxdb;
const match = dep.match(/\/archive\/([a-f0-9]+)\.tar\.gz$/);
console.log(match ? match[1] : '');
")
echo "commit=$CURRENT_HASH" >> "$GITHUB_OUTPUT"

- name: Update package.json
if: steps.target.outputs.changed == 'true'
if: steps.target.outputs.changed == 'true' || steps.hash.outputs.commit != steps.current_hash.outputs.commit
run: |
TARGET="${{ steps.target.outputs.version }}"
COMMIT="${{ steps.hash.outputs.commit }}"
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
pkg.devDependencies.rxdb = '$TARGET';
pkg.peerDependencies.rxdb = '$TARGET';
pkg.devDependencies.rxdb = 'https://github.com/pubkey/rxdb/archive/$COMMIT.tar.gz';
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2) + '\n', 'utf-8');
"

- name: Commit and push
if: steps.target.outputs.changed == 'true'
if: steps.target.outputs.changed == 'true' || steps.hash.outputs.commit != steps.current_hash.outputs.commit
run: |
TARGET="${{ steps.target.outputs.version }}"
COMMIT="${{ steps.hash.outputs.commit }}"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add package.json
git commit -m "chore: update rxdb to $TARGET"
git commit -m "chore: update rxdb to $TARGET (master: ${COMMIT:0:7})"
git push
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"test:integration:mongodb": "(cd test-integration && npm run transpile && npm run test:node:mongodb)"
},
"peerDependencies": {
"rxdb": "*",
"rxdb": "17.1.0",
"rxjs": "*"
},
"dependencies": {
Expand Down Expand Up @@ -131,7 +131,7 @@
"minify-all-js": "0.1.9",
"mocha": "11.7.5",
"rimraf": "6.1.3",
"rxdb": "17.1.0",
"rxdb": "https://github.com/pubkey/rxdb/archive/7a251701bbffefde18c360013c82148746dff5cb.tar.gz",
"rxjs": "7.8.2",
"ts-loader": "9.5.7",
"ts-node": "10.9.2",
Expand Down
35 changes: 35 additions & 0 deletions scripts/build-rxdb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
set -e

# When rxdb is installed from a GitHub tarball, dist/ is not included
# (it's gitignored in the rxdb repo). We install devDependencies, then build.
RXDB_DIR="node_modules/rxdb"

if [ ! -d "$RXDB_DIR" ]; then
echo "Error: $RXDB_DIR does not exist"
exit 1
fi

cd "$RXDB_DIR"

# Install all devDependencies of rxdb so the build can succeed
npm install

# Deduplicate: remove nested packages that already exist at the root
# node_modules with the same version. This prevents TypeScript from
# generating non-portable paths like 'rxdb/node_modules/mingo/types'
# during declaration emit (TS2742).
cd ..
for nested in rxdb/node_modules/*/; do
pkg=$(basename "$nested")
if [ -d "$pkg" ]; then
nested_ver=$(node -p "try{require('./rxdb/node_modules/$pkg/package.json').version}catch(e){''}" 2>/dev/null)
root_ver=$(node -p "try{require('./$pkg/package.json').version}catch(e){''}" 2>/dev/null)
if [ -n "$nested_ver" ] && [ "$nested_ver" = "$root_ver" ]; then
rm -rf "$nested"
fi
fi
done
cd rxdb

npm run build
8 changes: 1 addition & 7 deletions scripts/extract-rxdb-version.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#!/bin/bash
set -e

RXDB_VERSION=$(cat ../package.json \
| grep '"rxdb":' \
| tail -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g' \
| sed -e 's/^[[:space:]]*//'
)
RXDB_VERSION=$(node -e "console.log(require('../package.json').peerDependencies.rxdb)")
2 changes: 1 addition & 1 deletion scripts/test-integration-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ npm install
npm install rxdb@$RXDB_VERSION
npm install ./rxdb-server.tgz

(cd ./node_modules/rxdb-server/ && npm i)
(cd ./node_modules/rxdb-server/ && npm i --omit=dev)

npm run build

Expand Down
4 changes: 2 additions & 2 deletions scripts/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const fs = require('node:fs');
const packageJSON = require('../package.json');


packageJSON.version = packageJSON.devDependencies.rxdb;
packageJSON.version = packageJSON.peerDependencies.rxdb;
fs.writeFileSync('./package.json', JSON.stringify(packageJSON, null, 2), 'utf-8');

console.log(packageJSON.devDependencies.rxdb);
console.log(packageJSON.peerDependencies.rxdb);