File tree Expand file tree Collapse file tree 7 files changed +753
-71
lines changed Expand file tree Collapse file tree 7 files changed +753
-71
lines changed Original file line number Diff line number Diff line change 2
2
"name" : " @ftrack/api" ,
3
3
"description" : " JavaScript API for ftrack." ,
4
4
"scripts" : {
5
- "lint" : " eslint . && prettier -c ." ,
5
+ "lint" : " tsc && eslint . && prettier -c ." ,
6
6
"test" : " vitest --run test && yarn lint" ,
7
7
"build" : " vite build" ,
8
8
"prepack" : " yarn build" ,
31
31
"msw" : " ^1.0.0" ,
32
32
"prettier" : " ^2.8.3" ,
33
33
"typescript" : " ^4.9.5" ,
34
- "vite" : " ^4.0.4" ,
35
- "vitest" : " ^0.28.3"
34
+ "vite" : " ^4.1.1" ,
35
+ "vite-plugin-dts" : " ^1.7.2" ,
36
+ "vitest" : " ^0.28.4"
36
37
},
37
38
"repository" : {
38
39
"type" : " git" ,
Original file line number Diff line number Diff line change 1
1
// :copyright: Copyright (c) 2016 ftrack
2
- /**
3
- * Error namespace
4
- * @namespace error
5
- */
6
2
7
3
/**
8
4
*
12
8
* @param {string } name name of error class
13
9
* @return {CustomError } Custom error object
14
10
*/
15
- function errorFactory ( name ) {
16
- function CustomError ( message , errorCode ) {
17
- this . name = name ;
18
- this . message = message ;
19
- this . errorCode = errorCode ;
20
- this . stack = new Error ( ) . stack ;
21
- }
11
+ function errorFactory ( name : string ) {
12
+ class CustomError extends Error {
13
+ errorCode ?: string ;
22
14
23
- CustomError . prototype = new Error ( ) ;
15
+ constructor ( message : string , errorCode ?: string ) {
16
+ super ( message ) ;
17
+ this . name = name ;
18
+ this . errorCode = errorCode ;
19
+ }
20
+ }
24
21
25
22
return CustomError ;
26
23
}
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ export function connect ( serverUrl : string , options : any ) : void ;
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change 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" ;
4
6
5
- module . exports = defineConfig ( {
7
+ interface VitestConfigExport extends UserConfig {
8
+ test : InlineConfig ;
9
+ }
10
+
11
+ export default defineConfig ( {
6
12
build : {
7
13
minify : false ,
8
14
sourcemap : true ,
9
15
lib : {
10
- entry : path . resolve ( __dirname , "source/index.js " ) ,
16
+ entry : path . resolve ( __dirname , "source/index.ts " ) ,
11
17
name : "ftrack-javascript-api" ,
12
18
fileName : ( format ) => `ftrack-javascript-api.${ format } .js` ,
13
19
} ,
@@ -26,6 +32,7 @@ module.exports = defineConfig({
26
32
plugins : [ commonjs ( { include : "./source/socket.io-websocket-only.cjs" } ) ] ,
27
33
} ,
28
34
} ,
35
+ plugins : [ dts ( ) ] ,
29
36
test : {
30
37
environment : "jsdom" ,
31
38
globals : true ,
@@ -34,4 +41,4 @@ module.exports = defineConfig({
34
41
fallbackCJS : true ,
35
42
} ,
36
43
} ,
37
- } ) ;
44
+ } as VitestConfigExport ) ;
You can’t perform that action at this time.
0 commit comments