From 76c6efabbb6092b86f8603d9eda073ba6e406b4e Mon Sep 17 00:00:00 2001 From: "Rasamoelina, Haja Onjatiana" <26148770+rhahao@users.noreply.github.com> Date: Thu, 7 Apr 2022 19:33:07 +0300 Subject: [PATCH] fix(module): force version bumping --- README.md | 14 +++++++++- package-lock.json | 37 +++++++++++++------------ package.json | 2 +- test/{index.test.cjs => index.test.mjs} | 8 ++---- 4 files changed, 37 insertions(+), 24 deletions(-) rename test/{index.test.cjs => index.test.mjs} (85%) diff --git a/README.md b/README.md index 3e9a05c8..88eec8e8 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,20 @@ npm i jw-epub-parser import { loadEPUB } from 'jw-epub-parser'; const epubJW = await loadEPUB('/path/to/file.epub'); +``` + +If you want to use this module in a node apps, first do the following: + +- Install jsdom and global-jsdom + +```js +npm i jsdom global-jsdom +``` -console.log('epub schedule content:', epubJW); +- Enables DOM in Node.js using global-jsdom + +```js +import 'global-jsdom/register'; ``` ### loadEPUB(epubData) diff --git a/package-lock.json b/package-lock.json index 5fb47496..59790087 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,8 +20,8 @@ "@semantic-release/exec": "^6.0.3", "@semantic-release/git": "^10.0.1", "chai": "^4.3.6", + "global-jsdom": "^8.4.0", "jsdom": "^19.0.0", - "jsdom-global": "^3.0.2", "mocha": "^9.2.0", "rollup": "^2.69.0" } @@ -3659,6 +3659,18 @@ "node": ">= 6" } }, + "node_modules/global-jsdom": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/global-jsdom/-/global-jsdom-8.4.0.tgz", + "integrity": "sha512-0wBpSA/uTbPwMUldVKvPkJmQ30PZacTY8LzXSnTYlptZl6c5OFAVXSb24o1vdvjUNAmIksj+BAJb/c/KSPlLCQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "jsdom": ">=10.0.0 || <20" + } + }, "node_modules/globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -4253,15 +4265,6 @@ } } }, - "node_modules/jsdom-global": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/jsdom-global/-/jsdom-global-3.0.2.tgz", - "integrity": "sha1-a9KZwTsMRiay2iwDk81DhdYGrLk=", - "dev": true, - "peerDependencies": { - "jsdom": ">=10.0.0" - } - }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -12368,6 +12371,13 @@ "is-glob": "^4.0.1" } }, + "global-jsdom": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/global-jsdom/-/global-jsdom-8.4.0.tgz", + "integrity": "sha512-0wBpSA/uTbPwMUldVKvPkJmQ30PZacTY8LzXSnTYlptZl6c5OFAVXSb24o1vdvjUNAmIksj+BAJb/c/KSPlLCQ==", + "dev": true, + "requires": {} + }, "globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -12809,13 +12819,6 @@ "xml-name-validator": "^4.0.0" } }, - "jsdom-global": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/jsdom-global/-/jsdom-global-3.0.2.tgz", - "integrity": "sha1-a9KZwTsMRiay2iwDk81DhdYGrLk=", - "dev": true, - "requires": {} - }, "jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", diff --git a/package.json b/package.json index 12a384bb..8eca91d9 100644 --- a/package.json +++ b/package.json @@ -40,8 +40,8 @@ "@semantic-release/exec": "^6.0.3", "@semantic-release/git": "^10.0.1", "chai": "^4.3.6", + "global-jsdom": "^8.4.0", "jsdom": "^19.0.0", - "jsdom-global": "^3.0.2", "mocha": "^9.2.0", "rollup": "^2.69.0" }, diff --git a/test/index.test.cjs b/test/index.test.mjs similarity index 85% rename from test/index.test.cjs rename to test/index.test.mjs index 8dcfeca4..5024cbac 100644 --- a/test/index.test.cjs +++ b/test/index.test.mjs @@ -1,8 +1,6 @@ -require('jsdom-global')(); -global.DOMParser = window.DOMParser; - -const { expect } = require('chai'); -const { loadEPUB } = require('../dist/index.cjs'); +import 'global-jsdom/register'; +import { expect } from 'chai'; +import { loadEPUB } from '../dist/index.cjs'; const expData = { mwbYear: '2021',