@@ -3,7 +3,12 @@ import json5 from 'json5';
3
3
import { stripIndent } from 'common-tags' ;
4
4
import { CodeStyleSetupOptions } from '@code-style/code-style/config-types' ;
5
5
6
- import { create_file , prettify , verify_missing } from '../utils.js' ;
6
+ import {
7
+ Dependencies ,
8
+ create_file ,
9
+ prettify ,
10
+ verify_missing ,
11
+ } from '../utils.js' ;
7
12
8
13
export interface LaunchJson {
9
14
configurations ?: LaunchConfiguration [ ] ;
@@ -29,7 +34,9 @@ export async function create_vscode_config({
29
34
technologies,
30
35
output_dir,
31
36
overwrite = false ,
32
- } : CreateVSCodeConfigOptions ) {
37
+ } : CreateVSCodeConfigOptions ) : Promise < Dependencies | undefined > {
38
+ const deps = new Dependencies ( ) ;
39
+
33
40
await mkdir ( '.vscode/' ) . catch ( ( ) => { } ) ;
34
41
35
42
await Promise . allSettled ( [
@@ -80,7 +87,23 @@ export async function create_vscode_config({
80
87
'typescript.format.enable' : false ,
81
88
'javascript.format.enable' : false ,
82
89
83
- 'typescript.tsdk' : './node_modules/typescript/lib' ,
90
+ 'typescript.tsdk' : `./node_modules/${ deps . d . depend ( 'typescript' ) } /lib` ,
91
+
92
+ ...( languages . includes ( 'ts' ) &&
93
+ technologies . includes ( 'jest' )
94
+ ? { }
95
+ : {
96
+ 'nodejs-testing.extensions' : [
97
+ {
98
+ extensions : [ 'mjs' , 'cjs' , 'js' ] ,
99
+ parameters : [ ] ,
100
+ } ,
101
+ {
102
+ extensions : [ 'mts' , 'cts' , 'ts' ] ,
103
+ parameters : [ `--import=${ deps . d . depend ( 'tsx' ) } ` ] ,
104
+ } ,
105
+ ] ,
106
+ } ) ,
84
107
}
85
108
: { } ) ,
86
109
...( languages . includes ( 'rb' )
@@ -188,4 +211,6 @@ export async function create_vscode_config({
188
211
) ;
189
212
} ) ,
190
213
] ) ;
214
+
215
+ return deps ;
191
216
}
0 commit comments