Skip to content

Commit 87fa6b6

Browse files
committed
build: enable typescript
1 parent c46396a commit 87fa6b6

File tree

5 files changed

+452
-24
lines changed

5 files changed

+452
-24
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@ftrack/api",
33
"description": "JavaScript API for ftrack.",
44
"scripts": {
5-
"lint": "eslint . && prettier -c .",
5+
"lint": "tsc && eslint . && prettier -c .",
66
"test": "vitest --run test && yarn lint",
77
"build": "vite build",
88
"prepack": "yarn build",
@@ -32,6 +32,7 @@
3232
"prettier": "^2.8.3",
3333
"typescript": "^4.9.5",
3434
"vite": "^4.1.1",
35+
"vite-plugin-dts": "^1.7.2",
3536
"vitest": "^0.28.4"
3637
},
3738
"repository": {
File renamed without changes.

tsconfig.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ESNext",
4+
"useDefineForClassFields": true,
5+
"module": "ESNext",
6+
"lib": ["ESNext", "DOM"],
7+
"moduleResolution": "Node",
8+
"strict": true,
9+
"resolveJsonModule": true,
10+
"isolatedModules": true,
11+
"esModuleInterop": true,
12+
"noEmit": true,
13+
"noUnusedLocals": true,
14+
"noUnusedParameters": true,
15+
"noImplicitReturns": true,
16+
"skipLibCheck": true,
17+
"allowJs": true
18+
},
19+
"include": ["source"],
20+
"exclude": ["source/socket.io-websocket-only.cjs"]
21+
}
Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
1-
const path = require("path");
2-
const { defineConfig } = require("vite");
3-
const commonjs = require("@rollup/plugin-commonjs");
1+
import { defineConfig, UserConfig } from "vite";
2+
import { InlineConfig } from "vitest";
3+
import path from "path";
4+
import dts from "vite-plugin-dts";
5+
import commonjs from "@rollup/plugin-commonjs";
46

5-
module.exports = defineConfig({
7+
interface VitestConfigExport extends UserConfig {
8+
test: InlineConfig;
9+
}
10+
11+
export default defineConfig({
12+
test: {
13+
environment: "jsdom",
14+
globals: true,
15+
setupFiles: ["./vitest.setup.js"],
16+
deps: {
17+
fallbackCJS: true,
18+
},
19+
},
620
build: {
721
minify: false,
822
sourcemap: true,
923
lib: {
10-
entry: path.resolve(__dirname, "source/index.js"),
24+
entry: path.resolve(__dirname, "source/index.ts"),
1125
name: "ftrack-javascript-api",
1226
fileName: (format) => `ftrack-javascript-api.${format}.js`,
1327
},
@@ -26,12 +40,5 @@ module.exports = defineConfig({
2640
plugins: [commonjs({ include: "./source/socket.io-websocket-only.cjs" })],
2741
},
2842
},
29-
test: {
30-
environment: "jsdom",
31-
globals: true,
32-
setupFiles: ["./vitest.setup.js"],
33-
deps: {
34-
fallbackCJS: true,
35-
},
36-
},
37-
});
43+
plugins: [dts()],
44+
} as VitestConfigExport);

0 commit comments

Comments
 (0)