@@ -3,7 +3,7 @@ import { exec } from "node:child_process";
3
3
import { parseArgs , ParseArgsConfig } from "node:util" ;
4
4
import { getOpenapiType , getAllTags , getInputFiles } from "./markdown-parser.js" ;
5
5
import { sep , dirname , join } from "path" ;
6
- import { pathExists } from "./util.js" ;
6
+ import { pathExists , getPathToDependency } from "./util.js" ;
7
7
8
8
// 64 MiB max ouptut buffers for exec
9
9
const MAX_EXEC_BUFFER = 64 * 1024 * 1024 ;
@@ -32,13 +32,6 @@ export async function main() {
32
32
type : "string" ,
33
33
short : "o" ,
34
34
} ,
35
- // TODO: Bring this in through package.json. Do not use autorest's
36
- // package manager.
37
- "lint-version" : {
38
- type : "string" ,
39
- short : "l" ,
40
- default : "2.2.3" ,
41
- } ,
42
35
} ,
43
36
strict : true ,
44
37
} ;
@@ -49,7 +42,6 @@ export async function main() {
49
42
after : afterArg ,
50
43
"changed-files-path" : changedFilesPath ,
51
44
"out-file" : outFile ,
52
- "lint-version" : lintVersion ,
53
45
} ,
54
46
} = parseArgs ( config ) ;
55
47
@@ -68,11 +60,6 @@ export async function main() {
68
60
console . log ( "--changed-files-path missing" ) ;
69
61
}
70
62
71
- if ( ! ( lintVersion as string ) . match ( / ^ \d + \. \d + \. \d + $ / ) ) {
72
- validArgs = false ;
73
- console . log ( "Invalid lint version:" , lintVersion ) ;
74
- }
75
-
76
63
if ( ! validArgs ) {
77
64
usage ( ) ;
78
65
process . exit ( 1 ) ;
@@ -92,7 +79,6 @@ export async function main() {
92
79
afterArg as string ,
93
80
changedFilesPath as string ,
94
81
outFile as string ,
95
- lintVersion as string ,
96
82
) ;
97
83
}
98
84
@@ -107,7 +93,6 @@ async function runLintDiff(
107
93
afterPath : string ,
108
94
changedFilesPath : string ,
109
95
outFile : string ,
110
- lintVersion : string ,
111
96
) {
112
97
// TODO: Should filter happen here or upstream? (probably upstream)
113
98
// TODO: NEED TO PARSE TAG CHANGES STILL
@@ -138,7 +123,7 @@ async function runLintDiff(
138
123
// return;
139
124
// }
140
125
141
- let validator = ` @microsoft.azure/openapi-validator@ ${ lintVersion } ` ;
126
+ const dependenciesDir = await getPathToDependency ( " @microsoft.azure/openapi-validator" ) ;
142
127
const changedFileAndTagsMap = new Map < string , string [ ] > ( ) ;
143
128
for ( const readmeAndTags of affectedTags ) {
144
129
const dedupedTags = await deduplicateTags (
@@ -178,7 +163,7 @@ async function runLintDiff(
178
163
`--message-format=json ` +
179
164
`--openapi-type=${ openApiType } ` +
180
165
`--openapi-subtype=${ openApiSubType } ` +
181
- `--use=${ validator } ` +
166
+ `--use=${ dependenciesDir } ` +
182
167
`${ tagArg } ` +
183
168
`${ changedFilePath } ` ;
184
169
0 commit comments