Skip to content

Commit b6b7183

Browse files
authored
Migrate library to TS (Base) (#905)
* refactor(vite): Rename vite.config.js to vite.config.ts. Include Vite Config in Intellisense tsconfig.json for type checking Signed-off-by: Drew Hoener <[email protected]> * refactor(vite): Use correct `defineConfig` from vitest for vitest configuration. Remove deprecated config. Vitest provides its own defineConfig that should be used when creating test configuration in `vite.config.js`. Convert `environmentMatchGlobs` to `projects`, since the former has been deprecated Signed-off-by: Drew Hoener <[email protected]> * refactor(src): Rename index files and RosLib main file to TS. Easy refactor since they only have exports defined, and helps prep for converting Signed-off-by: Drew Hoener <[email protected]> --------- Signed-off-by: Drew Hoener <[email protected]>
1 parent 258ea6d commit b6b7183

File tree

9 files changed

+12
-6
lines changed

9 files changed

+12
-6
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"noEmit": true
55
},
66
"include": [
7+
"vite.config.ts",
78
"./src"
89
]
910
}

vite.config.js renamed to vite.config.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { resolve } from 'path'
2-
import { defineConfig } from 'vite'
2+
import { defineConfig } from 'vitest/config'
33
import dts from 'vite-plugin-dts';
44
import checker from 'vite-plugin-checker';
55

@@ -22,7 +22,7 @@ export default defineConfig({
2222
build: {
2323
lib: {
2424
// Could also be a dictionary or array of multiple entry points
25-
entry: resolve(__dirname, 'src/RosLib.js'),
25+
entry: resolve(__dirname, 'src/RosLib.ts'),
2626
name: 'ROSLIB',
2727
// the proper extensions will be added
2828
fileName: 'RosLib',
@@ -38,13 +38,18 @@ export default defineConfig({
3838
},
3939
test: {
4040
include: [
41-
'{src,test}/**\/*.{test,spec}.?(c|m)[jt]s?(x)',
41+
'{src,test}/**/*.{test,spec}.?(c|m)[jt]s?(x)',
4242
'./test/examples/*.js',
4343
],
4444
exclude: ['dist'],
45-
environmentMatchGlobs: [
46-
// React example requires DOM emulation
47-
['examples/react-example/**', 'jsdom']
45+
projects: [
46+
{
47+
extends: true,
48+
test: {
49+
environment: 'jsdom',
50+
name: 'jsdom',
51+
},
52+
},
4853
]
4954
}
5055
})

0 commit comments

Comments
 (0)