Skip to content

Commit

Permalink
Refactored binding wrapper (#6820)
Browse files Browse the repository at this point in the history
* Refactored typescript template into a "wrapper" template

* Extracted the promisify utility

* Extracted native and polyfilled bigint support

* Adding exports to signal injection

* Adding implementation to the wrapper

* Deleting old wrapper templates

* Updated relative imports of binding

* Injecting WeakRef

* Adopted @realm/babel-plugin to the other changes

* Removing console.log

* Moved build of tests to the root "bundle" script

* Renamed root "bundle" to "build"

* Apply suggestions from code review

Co-authored-by: LJ <[email protected]>

* Adding "undefined" as possible value in TEMPLATE_MAPPING

* Refacoted Int64 to use a class

---------

Co-authored-by: LJ <[email protected]>
  • Loading branch information
kraenhansen and elle-j authored Aug 14, 2024
1 parent f8eefce commit 211f623
Show file tree
Hide file tree
Showing 82 changed files with 758 additions and 832 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pr-realm-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ jobs:
- name: Install dependencies
# Ignoring scripts to prevent a prebuilt from getting fetched / built
run: npm ci --ignore-scripts
- name: Bundle all packages
run: npm run bundle
- name: Build / bundle all packages
run: npm run build
- name: Upload dist artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,11 @@ coverage/
# Generated artifacts
/packages/realm/bindgen/vendor/bindgen-lib/generated/
/packages/realm/generated/
/packages/realm/binding/generated
/packages/realm/binding/jsi/jsi_init.cpp
/packages/realm/src/**/*.generated.ts

# Build artifacts
/packages/realm/dist/
/packages/realm/binding/dist/
/packages/realm/binding/build/
/packages/realm/binding/android/build/
/packages/realm/binding/node/build/
Expand Down
7 changes: 2 additions & 5 deletions integration-tests/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,12 @@
},
"wireit": {
"lint": {
"command": "eslint --ext .js,.ts . && tsc --noEmit",
"dependencies": [
"build-dependencies"
]
"command": "eslint --ext .js,.ts ."
},
"build": {
"command": "tsc --build .",
"dependencies": [
"build-dependencies"
"../../packages/realm:build:ts"
]
},
"start": {
Expand Down
10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"homepage": "https://www.mongodb.com/docs/realm/",
"scripts": {
"build": "wireit",
"bundle": "wireit",
"lint": "wireit",
"lint:fix": "wireit",
"clean": "git clean -fdx -e node_modules -e .env",
Expand All @@ -15,19 +14,14 @@
},
"wireit": {
"build": {
"dependencies": [
"bundle",
"./packages/realm:build:ts"
]
},
"bundle": {
"dependencies": [
"./packages/realm:build:ts",
"./packages/babel-plugin:bundle",
"./packages/mocha-reporter:bundle",
"./packages/realm-react:bundle",
"./packages/realm-web:bundle",
"./packages/realm-tools:build"
"./packages/realm-tools:build",
"./integration-tests/tests:build"
]
},
"lint": {
Expand Down
3 changes: 1 addition & 2 deletions packages/babel-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"test": {
"command": "jest",
"dependencies": [
"../realm:build:ts",
"../realm:bindgen:build:typescript"
"../realm:build:ts"
]
}
},
Expand Down
162 changes: 0 additions & 162 deletions packages/realm/bindgen/src/templates/base-wrapper.ts

This file was deleted.

51 changes: 0 additions & 51 deletions packages/realm/bindgen/src/templates/node-wrapper.ts

This file was deleted.

76 changes: 0 additions & 76 deletions packages/realm/bindgen/src/templates/react-native-wrapper.ts

This file was deleted.

Loading

0 comments on commit 211f623

Please sign in to comment.