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 11import { Project , SyntaxKind } from 'ts-morph' ;
22
3+ const NO_CHECK_COMMENT = '// @ts-nocheck' ;
4+
35const project = new Project ( {
46 tsConfigFilePath : './tsconfig.json' ,
57 skipAddingFilesFromTsConfig : true ,
68} ) ;
79
810// 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' ] ) ;
1012
1113// We will filter out all of the extra ones (index.ts, custom-instance.ts etc.) by the number of "/"
1214// 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));
1618const apiName = process . argv . at ( - 1 ) ; // ! probably requires a recent NodeJS version
1719
1820for ( 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+
1926 if ( getNumberOfParts ( apiFile ) === maxParts ) {
2027 // get all variables used
2128 apiFile . getVariableStatements ( ) . forEach ( ( variable ) => {
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ tags.forEach((tag) => {
2222 ) ;
2323 } catch ( err ) {
2424 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. ` ,
2626 ) ;
2727 console . error ( err ) ;
2828 }
You can’t perform that action at this time.
0 commit comments