Skip to content

Commit

Permalink
fix: missing xhr-sync-worker.js in jsdom (#121)
Browse files Browse the repository at this point in the history
* chore(deps): update jsdom and sanitize-url

* chore: add skipNodeModulesBundle

* chore: add changeset

* ci: add check for node.js and test if ci fails with fix removed

* chore: bring back the fix

* chore: add jsdom to peerDependencies and mark it as optional
  • Loading branch information
jpedroschmitz authored Jan 31, 2024
1 parent 6b7fa10 commit fa2b896
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 117 deletions.
5 changes: 5 additions & 0 deletions .changeset/ten-carpets-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphcms/html-to-slate-ast': patch
---

Fix jsdom being bundled with the package
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ jobs:

- name: Test
run: yarn test --ci --coverage --maxWorkers=2

- name: Run Node.js Environment Test for @graphcms/html-to-slate-ast
run: yarn test:node
working-directory: ./packages/html-to-slate-ast
2 changes: 2 additions & 0 deletions packages/html-to-slate-ast/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ HTML to Slate AST converter for the Hygraph's RichTextAST format.
## ⚡ Usage

> Note: If you're using this package with Node.js, you'll need to use version 18 or higher.
### 1. Install

This package needs to have the packages `slate` and `slate-hyperscript` installed, and `jsdom` as well if you need to run the converter in Node.js.
Expand Down
5 changes: 4 additions & 1 deletion packages/html-to-slate-ast/examples/node-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ async function main() {

main()
.then(() => process.exit(0))
.catch(e => console.error(e));
.catch(e => {
console.error(e);
process.exit(1);
});
17 changes: 12 additions & 5 deletions packages/html-to-slate-ast/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,22 @@
"test": "tsdx test --passWithNoTests",
"test:watch": "tsdx test --watch --passWithNoTests",
"lint": "tsdx lint",
"prepublish": "npm run build"
"prepublish": "npm run build",
"test:node": "node examples/node-script.js"
},
"peerDependencies": {
"slate": "^0.66.1",
"slate-hyperscript": "^0.67.0"
"slate-hyperscript": "^0.67.0",
"jsdom": "^24.0.0"
},
"peerDependenciesMeta": {
"jsdom": {
"optional": true
}
},
"devDependencies": {
"@types/jsdom": "^21.1.5",
"jsdom": "^22.1.0",
"@types/jsdom": "^21.1.6",
"jsdom": "^24.0.0",
"slate": "^0.66.1",
"slate-hyperscript": "^0.67.0",
"tsup": "^8.0.1"
Expand Down Expand Up @@ -45,7 +52,7 @@
],
"jest": {},
"dependencies": {
"@braintree/sanitize-url": "^6.0.4",
"@braintree/sanitize-url": "^7.0.0",
"@graphcms/rich-text-types": "^0.5.0"
}
}
1 change: 1 addition & 0 deletions packages/html-to-slate-ast/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export default defineConfig(options => ({
treeshake: true,
clean: true,
format: ['esm', 'cjs'],
skipNodeModulesBundle: true,
}));
Loading

0 comments on commit fa2b896

Please sign in to comment.