From cf92258175c51fe6205751ad13057ca6d7e63b39 Mon Sep 17 00:00:00 2001 From: Lacy Morrow Date: Sun, 19 Nov 2023 00:06:39 -0500 Subject: [PATCH 01/15] tweak --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 1ffcd44..cad953f 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,8 @@ }, "name": "mdx-embed", "devDependencies": { - "cypress": "^5.1.0", - "lerna": "^3.22.1", - "start-server-and-test": "^1.11.3" + "cypress": "^13.5.1", + "lerna": "^7.4.2", + "start-server-and-test": "^2.0.3" } } From fcc89df4cc886ed7198b0ae2ddea74715901cf00 Mon Sep 17 00:00:00 2001 From: Lacy Morrow Date: Sun, 19 Nov 2023 00:08:05 -0500 Subject: [PATCH 02/15] update deps --- packages/mdx-embed/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/mdx-embed/package.json b/packages/mdx-embed/package.json index 6f54ab8..db2a400 100644 --- a/packages/mdx-embed/package.json +++ b/packages/mdx-embed/package.json @@ -77,8 +77,8 @@ "typescript": "^3.9.7" }, "peerDependencies": { - "@mdx-js/mdx": "^1.6.16", - "@mdx-js/react": "^1.6.16", + "@mdx-js/mdx": "^2.1.5", + "@mdx-js/react": "^2.1.5", "react": "^16.x || ^17.x || ^18.x", "react-dom": "^16.x || ^17.x || ^18.x" } From f4e221b14350b6303ea337c15b7e38ae67e38af9 Mon Sep 17 00:00:00 2001 From: Lacy Morrow Date: Sun, 19 Nov 2023 00:19:00 -0500 Subject: [PATCH 03/15] publish --- packages/mdx-embed/package.json | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/mdx-embed/package.json b/packages/mdx-embed/package.json index db2a400..5f15e67 100644 --- a/packages/mdx-embed/package.json +++ b/packages/mdx-embed/package.json @@ -1,8 +1,11 @@ { "name": "mdx-embed", - "version": "1.1.2", + "version": "2.1.5", "description": "Embed 3rd party media content in MDX - no import required", "main": "dist/index.js", + "publishConfig": { + "registry": "https://npm.pkg.github.com" + }, "types": "./dist/types/index.d.ts", "scripts": { "prettier": "prettier --config ../../.prettierrc.js --ignore-path ../../.prettierignore --write \"**/*.{json,js,ts,tsx}\"", @@ -25,14 +28,14 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/PaulieScanlon/mdx-embed.git" + "url": "git+https://github.com/lacymorrow/mdx-embed.git" }, "author": "Paul Scanlon", "license": "MIT", "bugs": { - "url": "https://github.com/PaulieScanlon/mdx-embed/issues" + "url": "https://github.com/lacymorrow/mdx-embed/issues" }, - "homepage": "https://github.com/PaulieScanlon/mdx-embed#readme", + "homepage": "https://github.com/lacymorrow/mdx-embed#readme", "keywords": [ "mdx", "mdx-embed" From ad8a3d6015dd972e7455c80b55e0328467bea900 Mon Sep 17 00:00:00 2001 From: Lacy Morrow Date: Sun, 19 Nov 2023 00:31:44 -0500 Subject: [PATCH 04/15] publish --- README.md | 18 +++++++++++++++++- lerna.json | 4 +--- package.json | 18 +++++++++--------- packages/mdx-embed/.npmrc | 1 + packages/mdx-embed/package.json | 2 +- 5 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 packages/mdx-embed/.npmrc diff --git a/README.md b/README.md index ccf77d3..3df9e7b 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,23 @@ information on the current packages: | [gatsby-plugin-mdx-embed](https://www.npmjs.com/package/gatsby-plugin-mdx-embed) | [![Known Vulnerabilities](https://snyk.io/test/npm/gatsby-plugin-mdx-embed/badge.svg)](https://snyk.io/test/npm/gatsby-plugin-mdx-embed) | | [storybook-addon-mdx-embed](https://www.npmjs.com/package/storybook-addon-mdx-embed) | [![Known Vulnerabilities](https://snyk.io/test/npm/storybook-addon-mdx-embed/badge.svg)](https://snyk.io/test/npm/storybook-addon-mdx-embed) | -
+## 📚 Development + +### publish + +```bash +# Change version in packages/mdx-embed/package.json + +npm i +npm run build +# Authenticate with npm github +# https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#publishing-a-package + +npm publish +``` + + +``` ## 🕺 Core Team diff --git a/lerna.json b/lerna.json index 2d47051..c6ef132 100644 --- a/lerna.json +++ b/lerna.json @@ -7,7 +7,5 @@ }, "postpublish": "npm run deploy" }, - "packages": [ - "packages/*" - ] + "packages": ["packages/*"] } diff --git a/package.json b/package.json index cad953f..78fbfd9 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,15 @@ { "private": true, "scripts": { - "prettier": "yarn workspace mdx-embed prettier && yarn workspace gatsby-plugin-mdx-embed prettier && yarn workspace docs prettier", - "lint": "yarn workspace mdx-embed lint", - "lint:fix": "yarn workspace mdx-embed lint:fix", - "test": "yarn workspace mdx-embed jest", - "test:watch": "yarn workspace mdx-embed test:watch", - "test:coverage": "yarn workspace mdx-embed test:coverage", - "test:codecov": "yarn workspace mdx-embed test:codecov", - "develop": "yarn workspace mdx-embed develop", - "build": "yarn workspace mdx-embed build && yarn workspace storybook-addon-mdx-embed build", + "prettier": "yarn workspace @lacymorrow/mdx-embed prettier && yarn workspace gatsby-plugin-mdx-embed prettier && yarn workspace docs prettier", + "lint": "yarn workspace @lacymorrow/mdx-embed lint", + "lint:fix": "yarn workspace @lacymorrow/mdx-embed lint:fix", + "test": "yarn workspace @lacymorrow/mdx-embed jest", + "test:watch": "yarn workspace @lacymorrow/mdx-embed test:watch", + "test:coverage": "yarn workspace @lacymorrow/mdx-embed test:coverage", + "test:codecov": "yarn workspace @lacymorrow/mdx-embed test:codecov", + "develop": "yarn workspace @lacymorrow/mdx-embed develop", + "build": "yarn workspace @lacymorrow/mdx-embed build && yarn workspace storybook-addon-mdx-embed build", "storybook": "yarn workspace docs storybook", "storybook:build": "yarn workspace docs storybook:build", "gatsby-demo:develop": "yarn workspace gatsby-demo develop", diff --git a/packages/mdx-embed/.npmrc b/packages/mdx-embed/.npmrc new file mode 100644 index 0000000..04586bd --- /dev/null +++ b/packages/mdx-embed/.npmrc @@ -0,0 +1 @@ +@lacymorrow:registry=https://npm.pkg.github.com diff --git a/packages/mdx-embed/package.json b/packages/mdx-embed/package.json index 5f15e67..716828f 100644 --- a/packages/mdx-embed/package.json +++ b/packages/mdx-embed/package.json @@ -1,5 +1,5 @@ { - "name": "mdx-embed", + "name": "@lacymorrow/mdx-embed", "version": "2.1.5", "description": "Embed 3rd party media content in MDX - no import required", "main": "dist/index.js", From 596318cbf405d470dadb3e63988d058472a1e00c Mon Sep 17 00:00:00 2001 From: Lacy Morrow Date: Sun, 19 Nov 2023 00:41:04 -0500 Subject: [PATCH 05/15] update mdx --- .npmrc | 1 + package.json | 3 +++ packages/mdx-embed/package.json | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 .npmrc diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..04586bd --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +@lacymorrow:registry=https://npm.pkg.github.com diff --git a/package.json b/package.json index 78fbfd9..7a8449a 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,8 @@ { "private": true, + "publishConfig": { + "registry": "https://npm.pkg.github.com" + }, "scripts": { "prettier": "yarn workspace @lacymorrow/mdx-embed prettier && yarn workspace gatsby-plugin-mdx-embed prettier && yarn workspace docs prettier", "lint": "yarn workspace @lacymorrow/mdx-embed lint", diff --git a/packages/mdx-embed/package.json b/packages/mdx-embed/package.json index 716828f..3ea9bb8 100644 --- a/packages/mdx-embed/package.json +++ b/packages/mdx-embed/package.json @@ -80,8 +80,8 @@ "typescript": "^3.9.7" }, "peerDependencies": { - "@mdx-js/mdx": "^2.1.5", - "@mdx-js/react": "^2.1.5", + "@mdx-js/mdx": "^3.0.0", + "@mdx-js/react": "^3.0.0", "react": "^16.x || ^17.x || ^18.x", "react-dom": "^16.x || ^17.x || ^18.x" } From 05047cfdaba7a0dd3588d4fb6125a90aea1b17c7 Mon Sep 17 00:00:00 2001 From: Lacy Morrow Date: Sun, 19 Nov 2023 00:49:14 -0500 Subject: [PATCH 06/15] bump --- packages/mdx-embed/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mdx-embed/package.json b/packages/mdx-embed/package.json index 3ea9bb8..cd1299b 100644 --- a/packages/mdx-embed/package.json +++ b/packages/mdx-embed/package.json @@ -1,6 +1,6 @@ { "name": "@lacymorrow/mdx-embed", - "version": "2.1.5", + "version": "3.0.0", "description": "Embed 3rd party media content in MDX - no import required", "main": "dist/index.js", "publishConfig": { From 85f659bf36ca7f2c22e2ba8b2e4a6fb5bc2bcf47 Mon Sep 17 00:00:00 2001 From: Lacy Morrow Date: Sun, 19 Nov 2023 23:57:29 -0500 Subject: [PATCH 07/15] p --- packages/mdx-embed/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/mdx-embed/package.json b/packages/mdx-embed/package.json index cd1299b..ad533df 100644 --- a/packages/mdx-embed/package.json +++ b/packages/mdx-embed/package.json @@ -1,6 +1,7 @@ { + "private": false, "name": "@lacymorrow/mdx-embed", - "version": "3.0.0", + "version": "3.0.1", "description": "Embed 3rd party media content in MDX - no import required", "main": "dist/index.js", "publishConfig": { From 36df1ddabb60296604276cfef81868fe09c58f2a Mon Sep 17 00:00:00 2001 From: Lacy Morrow Date: Mon, 20 Nov 2023 00:15:56 -0500 Subject: [PATCH 08/15] fix --- package.json | 18 +++++++++--------- packages/mdx-embed/package.json | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 7a8449a..b056274 100644 --- a/package.json +++ b/package.json @@ -4,15 +4,15 @@ "registry": "https://npm.pkg.github.com" }, "scripts": { - "prettier": "yarn workspace @lacymorrow/mdx-embed prettier && yarn workspace gatsby-plugin-mdx-embed prettier && yarn workspace docs prettier", - "lint": "yarn workspace @lacymorrow/mdx-embed lint", - "lint:fix": "yarn workspace @lacymorrow/mdx-embed lint:fix", - "test": "yarn workspace @lacymorrow/mdx-embed jest", - "test:watch": "yarn workspace @lacymorrow/mdx-embed test:watch", - "test:coverage": "yarn workspace @lacymorrow/mdx-embed test:coverage", - "test:codecov": "yarn workspace @lacymorrow/mdx-embed test:codecov", - "develop": "yarn workspace @lacymorrow/mdx-embed develop", - "build": "yarn workspace @lacymorrow/mdx-embed build && yarn workspace storybook-addon-mdx-embed build", + "prettier": "yarn workspace mdx-embed prettier && yarn workspace gatsby-plugin-mdx-embed prettier && yarn workspace docs prettier", + "lint": "yarn workspace mdx-embed lint", + "lint:fix": "yarn workspace mdx-embed lint:fix", + "test": "yarn workspace mdx-embed jest", + "test:watch": "yarn workspace mdx-embed test:watch", + "test:coverage": "yarn workspace mdx-embed test:coverage", + "test:codecov": "yarn workspace mdx-embed test:codecov", + "develop": "yarn workspace mdx-embed develop", + "build": "yarn workspace mdx-embed build && yarn workspace storybook-addon-mdx-embed build", "storybook": "yarn workspace docs storybook", "storybook:build": "yarn workspace docs storybook:build", "gatsby-demo:develop": "yarn workspace gatsby-demo develop", diff --git a/packages/mdx-embed/package.json b/packages/mdx-embed/package.json index ad533df..a1eba5b 100644 --- a/packages/mdx-embed/package.json +++ b/packages/mdx-embed/package.json @@ -1,6 +1,6 @@ { "private": false, - "name": "@lacymorrow/mdx-embed", + "name": "mdx-embed", "version": "3.0.1", "description": "Embed 3rd party media content in MDX - no import required", "main": "dist/index.js", From 2df81d6de1e51e9c6d4ac9d05991ff1e0d28b9c5 Mon Sep 17 00:00:00 2001 From: Lacy Morrow Date: Fri, 24 Nov 2023 22:47:50 -0500 Subject: [PATCH 09/15] update deps --- .npmrc | 1 - README.md | 17 ----------------- package.json | 3 --- packages/mdx-embed/package.json | 12 ++++-------- 4 files changed, 4 insertions(+), 29 deletions(-) delete mode 100644 .npmrc diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 04586bd..0000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -@lacymorrow:registry=https://npm.pkg.github.com diff --git a/README.md b/README.md index 3df9e7b..2872ef0 100644 --- a/README.md +++ b/README.md @@ -32,23 +32,6 @@ information on the current packages: | [gatsby-plugin-mdx-embed](https://www.npmjs.com/package/gatsby-plugin-mdx-embed) | [![Known Vulnerabilities](https://snyk.io/test/npm/gatsby-plugin-mdx-embed/badge.svg)](https://snyk.io/test/npm/gatsby-plugin-mdx-embed) | | [storybook-addon-mdx-embed](https://www.npmjs.com/package/storybook-addon-mdx-embed) | [![Known Vulnerabilities](https://snyk.io/test/npm/storybook-addon-mdx-embed/badge.svg)](https://snyk.io/test/npm/storybook-addon-mdx-embed) | -## 📚 Development - -### publish - -```bash -# Change version in packages/mdx-embed/package.json - -npm i -npm run build -# Authenticate with npm github -# https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#publishing-a-package - -npm publish -``` - - -``` ## 🕺 Core Team diff --git a/package.json b/package.json index b056274..cad953f 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,5 @@ { "private": true, - "publishConfig": { - "registry": "https://npm.pkg.github.com" - }, "scripts": { "prettier": "yarn workspace mdx-embed prettier && yarn workspace gatsby-plugin-mdx-embed prettier && yarn workspace docs prettier", "lint": "yarn workspace mdx-embed lint", diff --git a/packages/mdx-embed/package.json b/packages/mdx-embed/package.json index a1eba5b..ef9e73c 100644 --- a/packages/mdx-embed/package.json +++ b/packages/mdx-embed/package.json @@ -1,12 +1,8 @@ { - "private": false, "name": "mdx-embed", - "version": "3.0.1", + "version": "2.0.0", "description": "Embed 3rd party media content in MDX - no import required", "main": "dist/index.js", - "publishConfig": { - "registry": "https://npm.pkg.github.com" - }, "types": "./dist/types/index.d.ts", "scripts": { "prettier": "prettier --config ../../.prettierrc.js --ignore-path ../../.prettierignore --write \"**/*.{json,js,ts,tsx}\"", @@ -29,14 +25,14 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/lacymorrow/mdx-embed.git" + "url": "git+https://github.com/PaulieScanlon/mdx-embed.git" }, "author": "Paul Scanlon", "license": "MIT", "bugs": { - "url": "https://github.com/lacymorrow/mdx-embed/issues" + "url": "https://github.com/PaulieScanlon/mdx-embed/issues" }, - "homepage": "https://github.com/lacymorrow/mdx-embed#readme", + "homepage": "https://github.com/PaulieScanlon/mdx-embed#readme", "keywords": [ "mdx", "mdx-embed" From bd6d63d9c6c3b7badec54b13c1bc7e36cc644446 Mon Sep 17 00:00:00 2001 From: Lacy Morrow Date: Fri, 24 Nov 2023 22:48:08 -0500 Subject: [PATCH 10/15] update deps --- packages/mdx-embed/.npmrc | 1 - 1 file changed, 1 deletion(-) delete mode 100644 packages/mdx-embed/.npmrc diff --git a/packages/mdx-embed/.npmrc b/packages/mdx-embed/.npmrc deleted file mode 100644 index 04586bd..0000000 --- a/packages/mdx-embed/.npmrc +++ /dev/null @@ -1 +0,0 @@ -@lacymorrow:registry=https://npm.pkg.github.com From 389da71722a46aabbb12f5ba0ada5a5b0a68d9b2 Mon Sep 17 00:00:00 2001 From: Lacy Morrow Date: Thu, 8 Aug 2024 13:22:38 -0400 Subject: [PATCH 11/15] fix wikipedia load.php --- packages/gatsby-plugin-mdx-embed/package.json | 2 +- packages/mdx-embed/package.json | 166 +++++++++--------- .../general-observer/general-observer.tsx | 2 +- .../src/components/wikipedia/wikipedia.tsx | 108 ++++++------ .../storybook-addon-mdx-embed/package.json | 2 +- 5 files changed, 142 insertions(+), 138 deletions(-) diff --git a/packages/gatsby-plugin-mdx-embed/package.json b/packages/gatsby-plugin-mdx-embed/package.json index 28334bb..08b58fe 100644 --- a/packages/gatsby-plugin-mdx-embed/package.json +++ b/packages/gatsby-plugin-mdx-embed/package.json @@ -45,4 +45,4 @@ "devDependencies": { "husky": "^4.2.5" } -} +} \ No newline at end of file diff --git a/packages/mdx-embed/package.json b/packages/mdx-embed/package.json index ef9e73c..40fd079 100644 --- a/packages/mdx-embed/package.json +++ b/packages/mdx-embed/package.json @@ -1,85 +1,85 @@ { - "name": "mdx-embed", - "version": "2.0.0", - "description": "Embed 3rd party media content in MDX - no import required", - "main": "dist/index.js", - "types": "./dist/types/index.d.ts", - "scripts": { - "prettier": "prettier --config ../../.prettierrc.js --ignore-path ../../.prettierignore --write \"**/*.{json,js,ts,tsx}\"", - "lint": "eslint . --ext .ts,.tsx", - "lint:fix": "eslint . --ext .ts,.tsx --fix --quiet", - "build:types": "tsc", - "build:js": "babel -d dist src --extensions=\".ts,.tsx\"", - "build": "npm run build:types && npm run build:js", - "develop": "babel -d dist src --extensions=\".ts,.tsx\" -w", - "test": "jest", - "test:watch": "jest --watch", - "test:coverage": "jest --coverage --maxWorkers=1 --maxConcurrency=1", - "test:codecov": "npm run test:coverage && codecov -t 85dbf1e3-748b-4f9a-928d-b5eb42d26a03" - }, - "husky": { - "hooks": { - "pre-commit": "npm run lint:fix && npm run prettier && npm run test", - "pre-push": "" - } - }, - "repository": { - "type": "git", - "url": "git+https://github.com/PaulieScanlon/mdx-embed.git" - }, - "author": "Paul Scanlon", - "license": "MIT", - "bugs": { - "url": "https://github.com/PaulieScanlon/mdx-embed/issues" - }, - "homepage": "https://github.com/PaulieScanlon/mdx-embed#readme", - "keywords": [ - "mdx", - "mdx-embed" - ], - "files": [ - "dist", - "README.md" - ], - "devDependencies": { - "@babel/cli": "^7.19.3", - "@babel/core": "^7.19.6", - "@babel/plugin-proposal-class-properties": "^7.18.6", - "@babel/plugin-proposal-object-rest-spread": "^7.19.4", - "@babel/plugin-transform-modules-commonjs": "^7.19.6", - "@babel/preset-env": "^7.19.4", - "@babel/preset-react": "^7.18.6", - "@babel/preset-typescript": "^7.18.6", - "@testing-library/dom": "^8.19.0", - "@testing-library/jest-dom": "^5.16.5", - "@testing-library/react": "^13.4.0", - "@types/jest": "^27.4.0", - "@types/mdx-js__react": "^1.5.2", - "@types/node": "^17.0.15", - "@types/react": "18.0.22", - "@types/react-dom": "18.0.7", - "@types/testing-library__dom": "^7.5.0", - "@types/testing-library__jest-dom": "^5.14.5", - "@types/testing-library__react": "^10.2.0", - "@typescript-eslint/eslint-plugin": "^3.10.1", - "@typescript-eslint/parser": "^3.10.1", - "codecov": "^3.7.2", - "eslint": "^7.7.0", - "eslint-config-prettier": "^6.11.0", - "eslint-plugin-react": "^7.31.10", - "husky": "^4.2.5", - "jest": "^26.4.2", - "jest-fetch-mock": "^3.0.3", - "jest-watch-typeahead": "^0.6.1", - "prettier": "^2.1.1", - "ts-jest": "^26.3.0", - "ts-loader": "^8.0.3", - "typescript": "^3.9.7" - }, - "peerDependencies": { - "@mdx-js/mdx": "^3.0.0", - "@mdx-js/react": "^3.0.0", - "react": "^16.x || ^17.x || ^18.x", - "react-dom": "^16.x || ^17.x || ^18.x" - } + "name": "mdx-embed2", + "version": "2.0.1", + "description": "Embed 3rd party media content in MDX - no import required", + "main": "dist/index.js", + "types": "./dist/types/index.d.ts", + "scripts": { + "prettier": "prettier --config ../../.prettierrc.js --ignore-path ../../.prettierignore --write \"**/*.{json,js,ts,tsx}\"", + "lint": "eslint . --ext .ts,.tsx", + "lint:fix": "eslint . --ext .ts,.tsx --fix --quiet", + "build:types": "tsc", + "build:js": "babel -d dist src --extensions=\".ts,.tsx\"", + "build": "npm run build:types && npm run build:js", + "develop": "babel -d dist src --extensions=\".ts,.tsx\" -w", + "test": "jest", + "test:watch": "jest --watch", + "test:coverage": "jest --coverage --maxWorkers=1 --maxConcurrency=1", + "test:codecov": "npm run test:coverage && codecov -t 85dbf1e3-748b-4f9a-928d-b5eb42d26a03" + }, + "husky": { + "hooks": { + "pre-commit": "npm run lint:fix && npm run prettier && npm run test", + "pre-push": "" + } + }, + "repository": { + "type": "git", + "url": "git+https://github.com/lacymorrow/mdx-embed.git" + }, + "author": "Paul Scanlon", + "license": "MIT", + "bugs": { + "url": "https://github.com/lacymorrow/mdx-embed/issues" + }, + "homepage": "https://github.com/lacymorrow/mdx-embed#readme", + "keywords": [ + "mdx", + "mdx-embed" + ], + "files": [ + "dist", + "README.md" + ], + "devDependencies": { + "@babel/cli": "^7.19.3", + "@babel/core": "^7.19.6", + "@babel/plugin-proposal-class-properties": "^7.18.6", + "@babel/plugin-proposal-object-rest-spread": "^7.19.4", + "@babel/plugin-transform-modules-commonjs": "^7.19.6", + "@babel/preset-env": "^7.19.4", + "@babel/preset-react": "^7.18.6", + "@babel/preset-typescript": "^7.18.6", + "@testing-library/dom": "^8.19.0", + "@testing-library/jest-dom": "^5.16.5", + "@testing-library/react": "^13.4.0", + "@types/jest": "^27.4.0", + "@types/mdx-js__react": "^1.5.2", + "@types/node": "^17.0.15", + "@types/react": "^18.3.3", + "@types/react-dom": "18.0.7", + "@types/testing-library__dom": "^7.5.0", + "@types/testing-library__jest-dom": "^5.14.5", + "@types/testing-library__react": "^10.2.0", + "@typescript-eslint/eslint-plugin": "^3.10.1", + "@typescript-eslint/parser": "^3.10.1", + "codecov": "^3.7.2", + "eslint": "^7.7.0", + "eslint-config-prettier": "^6.11.0", + "eslint-plugin-react": "^7.31.10", + "husky": "^4.2.5", + "jest": "^26.4.2", + "jest-fetch-mock": "^3.0.3", + "jest-watch-typeahead": "^0.6.1", + "prettier": "^2.1.1", + "ts-jest": "^26.3.0", + "ts-loader": "^8.0.3", + "typescript": "^3.9.7" + }, + "peerDependencies": { + "@mdx-js/mdx": "^3.0.0", + "@mdx-js/react": "^3.0.0", + "react": "^16.x || ^17.x || ^18.x", + "react-dom": "^16.x || ^17.x || ^18.x" + } } diff --git a/packages/mdx-embed/src/components/general-observer/general-observer.tsx b/packages/mdx-embed/src/components/general-observer/general-observer.tsx index aede257..d997282 100644 --- a/packages/mdx-embed/src/components/general-observer/general-observer.tsx +++ b/packages/mdx-embed/src/components/general-observer/general-observer.tsx @@ -1,4 +1,4 @@ -import React, { FunctionComponent, useRef, useEffect, useState, RefObject } from 'react'; +import React, { FunctionComponent, RefObject, useEffect, useRef, useState } from 'react'; interface IGeneralObserverProps { /** React Children */ diff --git a/packages/mdx-embed/src/components/wikipedia/wikipedia.tsx b/packages/mdx-embed/src/components/wikipedia/wikipedia.tsx index ae6f31e..c2a48a4 100644 --- a/packages/mdx-embed/src/components/wikipedia/wikipedia.tsx +++ b/packages/mdx-embed/src/components/wikipedia/wikipedia.tsx @@ -1,66 +1,70 @@ import React, { FunctionComponent, useEffect, useState } from 'react'; import { GeneralObserver } from '../general-observer'; export interface IWikipediaProps { - /** Wikipedia page link */ - wikipediaLink: string; - /** Height for the iFrame */ - height?: number | string; + /** Wikipedia page link */ + wikipediaLink: string; + /** Height for the iFrame */ + height?: number | string; } interface IWikipediaState { - /** Loading status */ - isLoading: boolean; - /** Error status */ - hasError: boolean; - /** HTML response from api */ - body?: string; + /** Loading status */ + isLoading: boolean; + /** Error status */ + hasError: boolean; + /** HTML response from api */ + body?: string; } export const Wikipedia: FunctionComponent = ({ wikipediaLink, height = 600 }: IWikipediaProps) => { - const [wikiResponse, setWikiResponse] = useState({ - isLoading: true, - hasError: false, - body: '', - }); + const [wikiResponse, setWikiResponse] = useState({ + isLoading: true, + hasError: false, + body: '', + }); - const wikipediaEmbedUrl = `https://en.wikipedia.org/api/rest_v1/page/html/${wikipediaLink}`; + const wikipediaEmbedUrl = `https://en.wikipedia.org/api/rest_v1/page/html/${wikipediaLink}`; - useEffect(() => { - fetch(wikipediaEmbedUrl) - .then((response) => response.text()) - .then((response) => { - if (response) { - setWikiResponse({ - isLoading: false, - hasError: false, - body: response.replace(/ { + fetch(wikipediaEmbedUrl) + .then((response) => response.text()) + .then((response) => { + if (response) { + const body = response + .replace(/ - )} - - ); + return ( + + {!wikiResponse.isLoading && ( +