Skip to content

Commit 5fe9485

Browse files
authored
chore: move to native ESM during dev + jsdoc TS (#20)
1 parent ee6c8d9 commit 5fe9485

File tree

19 files changed

+283
-323
lines changed

19 files changed

+283
-323
lines changed

.github/workflows/validate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
if: ${{ !contains(github.head_ref, 'all-contributors') }}
1717
strategy:
1818
matrix:
19-
node: [12, 14, 15]
19+
node: [12, 14]
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: 🛑 Cancel Previous Runs

.huskyrc.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

client.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

client.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

client/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '../dist/client'

client/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('../dist/client')

client/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "commonjs",
3+
"main": "./index.js",
4+
"types": "./index.d.ts"
5+
}

jest.config.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

other/cjs-ify.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import fs from 'fs'
2+
import url from 'url'
3+
import path from 'path'
4+
5+
const __dirname = path.dirname(url.fileURLToPath(import.meta.url))
6+
const pkgPath = path.join(__dirname, '../dist/package.json')
7+
8+
const cjsPkgInfo = {
9+
type: 'commonjs',
10+
main: './index.js',
11+
types: './index.d.ts',
12+
}
13+
fs.writeFileSync(pkgPath, JSON.stringify(cjsPkgInfo))

package.json

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "Compile and bundle your MDX files and their dependencies. FAST.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
7+
"type": "module",
78
"keywords": [
89
"mdx",
910
"bundler",
@@ -27,44 +28,45 @@
2728
"homepage": "https://github.com/kentcdodds/mdx-bundler#readme",
2829
"files": [
2930
"dist",
30-
"client.js",
31-
"client.d.ts"
31+
"client"
3232
],
3333
"scripts": {
3434
"build": "kcd-scripts build",
35+
"postbuild": "node ./other/cjs-ify.js",
3536
"lint": "kcd-scripts lint",
3637
"setup": "npm install && npm run validate -s",
37-
"test": "kcd-scripts test",
38-
"test:update": "npm test -- --updateSnapshot --coverage",
38+
"test": "uvu -i setup-tests.js src/__tests__",
3939
"typecheck": "kcd-scripts typecheck",
4040
"validate": "kcd-scripts validate"
4141
},
4242
"dependencies": {
4343
"@babel/runtime": "^7.13.10",
44-
"@esbuild-plugins/node-resolve": "0.0.15",
44+
"@esbuild-plugins/node-resolve": "0.1.4",
4545
"@fal-works/esbuild-plugin-global-externals": "^2.1.1",
46-
"esbuild": "^0.10.0",
46+
"esbuild": "^0.11.6",
4747
"gray-matter": "^4.0.2",
48+
"jsdom": "^16.5.2",
4849
"remark-frontmatter": "^3.0.0",
49-
"remark-mdx-frontmatter": "^1.0.0",
50+
"remark-mdx-frontmatter": "^1.0.1",
51+
"uvu": "^0.5.1",
5052
"xdm": "^1.6.0"
5153
},
5254
"devDependencies": {
53-
"@testing-library/react": "^11.2.5",
54-
"@types/jest": "^26.0.20",
55+
"@testing-library/react": "^11.2.6",
56+
"@types/jsdom": "^16.2.10",
5557
"@types/react": "^17.0.3",
5658
"@types/react-dom": "^17.0.3",
57-
"jest-environment-jsdom": "^26.6.2",
58-
"jest-module-field-resolver": "0.0.1",
59-
"kcd-scripts": "^8.1.0",
59+
"cross-env": "^7.0.3",
60+
"kcd-scripts": "^8.2.1",
6061
"left-pad": "^1.3.0",
6162
"react": "^17.0.2",
6263
"react-dom": "^17.0.2",
63-
"typescript": "^4.2.3"
64+
"typescript": "^4.2.4"
6465
},
6566
"eslintConfig": {
6667
"extends": "./node_modules/kcd-scripts/eslint.js",
6768
"rules": {
69+
"import/extensions": "off",
6870
"@typescript-eslint/no-unsafe-assignment": "off"
6971
}
7072
},

0 commit comments

Comments
 (0)