Skip to content

Commit

Permalink
Test against actual build output
Browse files Browse the repository at this point in the history
This removes the need for `ts-node`. This also moves the build output to
the `dist` folder and adds support for declaration maps.
  • Loading branch information
remcohaszing committed Jan 9, 2024
1 parent 5648ea3 commit f44dcc3
Show file tree
Hide file tree
Showing 57 changed files with 17 additions and 154 deletions.
1 change: 1 addition & 0 deletions .c8rc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"100": true,
"exclude": ["**/test*"],
"reporter": ["html", "lcov", "text"]
}
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ coverage/
dist/
node_modules/
test-results/
*.d.ts
*.js
*.log
*.map
*.tgz
*.tsbuildinfo
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
141 changes: 0 additions & 141 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
"name": "rehype-mermaid",
"version": "2.0.1",
"description": "A rehype plugin to render mermaid diagrams",
"exports": "./index.js",
"exports": "./dist/index.js",
"main": "./dist/index.js",
"type": "module",
"files": [
"index.d.ts",
"index.js"
"dist",
"src",
"!test*"
],
"scripts": {
"prepack": "tsc --noEmit false",
"test": "c8 ts-node-esm test/test.ts"
"prepack": "tsc --build",
"pretest": "tsc --build",
"test": "c8 node --test"
},
"author": "Remco Haszing <remcohaszing@gmail.com>",
"license": "MIT",
Expand Down Expand Up @@ -48,7 +51,6 @@
"rehype": "^13.0.0",
"remark-cli": "^11.0.0",
"remark-preset-remcohaszing": "^2.0.0",
"ts-node": "^10.0.0",
"typescript": "^5.0.0",
"unist-util-remove-position": "^5.0.0",
"vfile-message": "^4.0.0"
Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions test/test.ts → src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import { fileURLToPath } from 'node:url'
import { type Element, type Root } from 'hast'
import prettier from 'prettier'
import { rehype } from 'rehype'
import rehypeMermaid from 'rehype-mermaid'
import { removePosition } from 'unist-util-remove-position'
import { type VFile } from 'vfile'
import { VFileMessage } from 'vfile-message'

import rehypeMermaid from '../index.js'

const fixturesPath = new URL('fixtures/', import.meta.url)
const fixturesPath = new URL('../fixtures/', import.meta.url)
const fixtureNames = (await readdir(fixturesPath)).sort()

interface FixtureTest {
Expand Down
6 changes: 5 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"compilerOptions": {
"composite": true,
"declaration": true,
"declarationMap": true,
"lib": ["es2021"],
"module": "node16",
"noEmit": true,
"outDir": "dist",
"rootDir": "src",
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "es2021"
},
Expand Down

0 comments on commit f44dcc3

Please sign in to comment.