File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed
custom-templates/typescript Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 6
6
- main
7
7
paths :
8
8
- ' types/codegen/schema/**'
9
- workflow_dispatch :
10
9
11
10
jobs :
12
11
validate-pr :
21
20
uses : actions/setup-node@v4
22
21
with :
23
22
node-version : ' 20.x'
24
- # should we cache: 'npm'
25
23
26
24
- name : Install root dependencies
27
25
working-directory : .
Original file line number Diff line number Diff line change 1
- /* tslint:disable */
2
- /* eslint-disable */
3
1
{ {! This is a comment. Removed the export of runtimes because we do not need
4
2
those functions. Was causing error because exported a def called ResponseError
5
3
which is also used by vscode LSP} }
Original file line number Diff line number Diff line change @@ -78,12 +78,19 @@ const importResult = processImportMappings()
78
78
// Read the generated index.ts file
79
79
let indexContent = fs . readFileSync ( indexPath , 'utf8' )
80
80
81
- // Find the position after existing imports
82
- const importEndPos = indexContent . lastIndexOf ( 'import' )
81
+ // Find the insertion position - either at top of file or after lint disable comments
83
82
let insertPos = 0
84
83
85
- if ( importEndPos !== - 1 ) {
86
- insertPos = indexContent . indexOf ( '\n' , importEndPos ) + 1
84
+ // Check if file starts with lint disable comments
85
+ const lintDisablePattern = / ^ ( \s * \/ \* \s * t s l i n t : d i s a b l e \s * \* \/ \s * \/ \* \s * e s l i n t - d i s a b l e \s * \* \/ \s * ) /
86
+ const lintDisableMatch = indexContent . match ( lintDisablePattern )
87
+
88
+ if ( lintDisableMatch ) {
89
+ // Insert after the lint disable comments
90
+ insertPos = lintDisableMatch [ 0 ] . length
91
+ } else {
92
+ // Insert at the very top of the file
93
+ insertPos = 0
87
94
}
88
95
89
96
// Insert import statements and constants after existing imports
You can’t perform that action at this time.
0 commit comments