Skip to content

Commit

Permalink
build: add patch for js-waku not found
Browse files Browse the repository at this point in the history
When running the test with `jest`, it errored with
```
Cannot find module 'js-waku' from 'node_modules/@xmtp/xmtp-js/dist/cjs/src/utils.js'
```

The problem seems to be this issue
waku-org/js-waku#770.

Until this is resolved, we use a local patch as this only occurs when running tests.
  • Loading branch information
dohaki committed Aug 2, 2022
1 parent 140a37e commit e2d3b55
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
14 changes: 4 additions & 10 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@ module.exports = {
globals: {
"ts-jest": {
tsconfig: "tsconfig.tests.json"
},
}
},
roots: [
"<rootDir>"
],
modulePaths: [
"<rootDir>"
],
moduleDirectories: [
"node_modules"
]
roots: ["<rootDir>"],
modulePaths: ["<rootDir>"],
moduleDirectories: ["node_modules"]
};
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"lint": "eslint --ignore-path .gitignore --ext .js,.ts .",
"lint:fix": "npm run lint -- --fix",
"prettier": "prettier --write .",
"test": "jest"
"test": "jest",
"postinstall": "patch-package"
},
"author": "Boson Protocol",
"license": "Apache-2.0",
Expand All @@ -38,6 +39,7 @@
"eslint-config-prettier": "^8.4.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^28.1.3",
"patch-package": "^6.4.7",
"prettier": "^2.6.2",
"rimraf": "^3.0.2",
"ts-jest": "^28.0.7",
Expand Down
14 changes: 14 additions & 0 deletions patches/js-waku+0.24.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/node_modules/js-waku/package.json b/node_modules/js-waku/package.json
index c5ade17..dfb4652 100644
--- a/node_modules/js-waku/package.json
+++ b/node_modules/js-waku/package.json
@@ -8,7 +8,8 @@
"exports": {
"node": {
"module": "./build/esm/index.js",
- "import": "./build/main/index.js"
+ "import": "./build/main/index.js",
+ "require": "./build/main/index.js"
},
"default": "./build/main/index.js"
},

0 comments on commit e2d3b55

Please sign in to comment.