Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,27 @@
"repository": "https://github.com/Addono/docusaurus-plugin-goatcounter",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"types": "dist/index.d.ts",
"files": [
"dist",
"src"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/docusaurus-plugin-goatcounter.esm.mjs",
"require": "./dist/index.js"
}
},
"engines": {
"node": ">=20"
},
"scripts": {
"start": "tsdx watch",
"build": "tsdx build",
"test": "tsdx test",
"lint": "tsdx lint src test",
"format": "tsdx lint src test --fix",
"test": "vitest run",
"lint": "oxlint src test",
"format": "oxlint src test --fix",
"prepare": "tsdx build && husky"
},
"peerDependencies": {},
Expand All @@ -40,16 +48,19 @@
"@semantic-release/github"
]
},
"module": "dist/docusaurus-plugin-goatcounter.esm.js",
"module": "dist/docusaurus-plugin-goatcounter.esm.mjs",
"devDependencies": {
"@docusaurus/types": "^3.9.2",
"@semantic-release/git": "^10.0.1",
"@types/node": "^24.10.2",
"bunchee": "^6.9.4",
"husky": "^9.1.7",
"oxlint": "^1.41.0",
"semantic-release": "^25.0.2",
"tsdx": "^0.14.1",
"tsdx": "^2.0.0",
"tslib": "^2.8.1",
"typescript": "^5.9.3"
"typescript": "^5.9.3",
"vitest": "^4.0.17"
},
"dependencies": {}
}
42 changes: 21 additions & 21 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('pluginGoatcounter', () => {

// Assert
expect(handler).toThrowErrorMatchingInlineSnapshot(
`"You need to specify 'goatcounter' object in 'themeConfig' with 'code' field in it to use docusaurus-plugin-goatcounter"`
`[Error: You need to specify 'goatcounter' object in 'themeConfig' with 'code' field in it to use docusaurus-plugin-goatcounter]`
);
});

Expand All @@ -39,7 +39,7 @@ describe('pluginGoatcounter', () => {

// Assert
expect(handler).toThrowErrorMatchingInlineSnapshot(
`"You specified the \`goatcounter\` object in \`themeConfig\` but the \`code\` field was missing. Please add it."`
`[Error: You specified the \`goatcounter\` object in \`themeConfig\` but the \`code\` field was missing. Please add it.]`
);
});

Expand All @@ -60,7 +60,7 @@ describe('pluginGoatcounter', () => {

// Assert
expect(handler).toThrowErrorMatchingInlineSnapshot(
`"You specified the \`goatcounter\` object in \`themeConfig\` but the \`code\` field should be a string."`
`[Error: You specified the \`goatcounter\` object in \`themeConfig\` but the \`code\` field should be a string.]`
);
});

Expand Down Expand Up @@ -128,26 +128,26 @@ describe('pluginGoatcounter', () => {
// Assert
expect(result?.injectHtmlTags?.({ content: undefined }))
.toMatchInlineSnapshot(`
Object {
"headTags": Array [
Object {
"attributes": Object {
"href": "https://foo.goatcounter.com",
"rel": "preconnect",
{
"headTags": [
{
"attributes": {
"href": "https://foo.goatcounter.com",
"rel": "preconnect",
},
"tagName": "link",
},
"tagName": "link",
},
Object {
"attributes": Object {
"async": true,
"data-goatcounter": "https://foo.goatcounter.com/count",
"src": "//gc.zgo.at/count.js",
{
"attributes": {
"async": true,
"data-goatcounter": "https://foo.goatcounter.com/count",
"src": "//gc.zgo.at/count.js",
},
"tagName": "script",
},
"tagName": "script",
},
],
}
`);
],
}
`);
expect(result.name).toBe('docusaurus-plugin-goatcounter');
});
});
Expand Down
8 changes: 8 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
globals: true,
environment: 'node',
},
});
Loading