Skip to content

Commit db18f76

Browse files
Fix using dirname in print plugin (#1310)
1 parent 310b6ef commit db18f76

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

plugins/plugin-print/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"lint": "eslint .",
88
"test": "vitest",
9-
"build": "tshy",
9+
"build": "tshy && cp -r fonts dist",
1010
"dev": "tshy --watch",
1111
"clean": "rm -rf node_modules .tshy .tshy-build dist .turbo"
1212
},
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const dirname = __dirname;

plugins/plugin-print/src/dirname.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { fileURLToPath } from "url";
2+
import path from "path";
3+
4+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
5+
// @ts-ignore Dual package
6+
export const dirname = path.dirname(fileURLToPath(import.meta.url));

plugins/plugin-print/src/fonts.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import path from "path";
2+
import { dirname } from "./dirname.js";
23

3-
const dir = path.join(__dirname, "../");
4+
const dir = path.join(dirname, "../");
45

56
export const SANS_8_BLACK = path.join(
67
dir,

0 commit comments

Comments
 (0)