Skip to content

Commit a9d0246

Browse files
authored
fix(package): resolveJsonModule + import from ../package.json (#233)
Import of a json file located outside the src folder result in a different dist tructure that does match the main/types defined in package.json ``` dist/ ├── package.json └── src ├── client.d.ts ├── client.js ├── dintero.d.ts ├── dintero.js ├── middleware.d.ts ├── middleware.js ├── types.d.ts └── types.js ``` > We expect no package.json or src folder in the dist Rel: Dintero/shopify-service#115
1 parent 7b60328 commit a9d0246

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/middleware.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import type { Client, Middleware } from "openapi-fetch";
2-
import { version } from "../package.json";
2+
33
import type { CorePaths } from "./types";
44
import type { ClientOptions } from "./types";
55

6+
const pkg = require("../package.json");
7+
68
export const extractAccountId = (audience: string): string => {
79
if (!audience || !audience.includes("://")) {
810
throw new Error(
@@ -81,7 +83,7 @@ export const createDefaultHeadersMiddleware = (): Middleware => ({
8183
if (!request.headers.get("User-Agent")) {
8284
request.headers.set(
8385
"User-Agent",
84-
`Dintero.Node.SDK/${version} (+https://github.com/Dintero/Dintero.Node.SDK)`,
86+
`Dintero.Node.SDK/${pkg.version} (+https://github.com/Dintero/Dintero.Node.SDK)`,
8587
);
8688
}
8789
},

tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"strict": true,
1010
"baseUrl": "./",
1111
"types": ["jest", "node"],
12-
"resolveJsonModule": true,
1312
"noUnusedLocals": true,
1413
"skipLibCheck": true,
1514
"noUncheckedIndexedAccess": true,

0 commit comments

Comments
 (0)