File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { Project , SyntaxKind } from 'ts-morph' ;
2
2
3
+ const NO_CHECK_COMMENT = '// @ts-nocheck' ;
4
+
3
5
const project = new Project ( {
4
6
tsConfigFilePath : './tsconfig.json' ,
5
7
skipAddingFilesFromTsConfig : true ,
6
8
} ) ;
7
9
8
10
// Add all .ts files inside ./src (this includes index.ts, custom-instance.ts etc.)
9
- project . addSourceFilesAtPaths ( './src/**/*.ts' ) ;
11
+ project . addSourceFilesAtPaths ( [ './src/**/*.ts' , '!./src/index.ts' , '!./src/custom-instance.ts' ] ) ;
10
12
11
13
// We will filter out all of the extra ones (index.ts, custom-instance.ts etc.) by the number of "/"
12
14
// in the full file path. I.e. the ones we wan't to keep have one extra "/"
@@ -16,6 +18,11 @@ const maxParts = Math.max(...project.getSourceFiles().map(getNumberOfParts));
16
18
const apiName = process . argv . at ( - 1 ) ; // ! probably requires a recent NodeJS version
17
19
18
20
for ( const apiFile of project . getSourceFiles ( ) ) {
21
+ const fullText = apiFile . getFullText ( ) ;
22
+ if ( ! fullText . includes ( NO_CHECK_COMMENT ) ) {
23
+ apiFile . insertStatements ( 0 , NO_CHECK_COMMENT ) ;
24
+ }
25
+
19
26
if ( getNumberOfParts ( apiFile ) === maxParts ) {
20
27
// get all variables used
21
28
apiFile . getVariableStatements ( ) . forEach ( ( variable ) => {
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ tags.forEach((tag) => {
22
22
) ;
23
23
} catch ( err ) {
24
24
console . log (
25
- `Not created a package.json for ${ tag } . The folder might not have been created by orval.` ,
25
+ `Not created a package.json for ${ tag } . The folder might not have been created by orval. This is usually ok. ` ,
26
26
) ;
27
27
console . error ( err ) ;
28
28
}
You can’t perform that action at this time.
0 commit comments