File tree 1 file changed +10
-3
lines changed 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,12 @@ type AdditionalProperties = Partial<{
32
32
} > ;
33
33
34
34
async function setHostsOptions ( ) : Promise < void > {
35
- const openapitoolsPath = path . join ( __dirname , '../../openapitools.json' ) ;
35
+ const openapitoolsPath = path . join ( process . cwd ( ) , '../openapitools.json' ) ;
36
+ if ( ! ( await stat ( openapitoolsPath ) ) ) {
37
+ throw new Error (
38
+ `File not found ${ openapitoolsPath } .\nMake sure your run scripts from the root directory using yarn workspace.`
39
+ ) ;
40
+ }
36
41
const openapitools = JSON . parse ( await readFile ( openapitoolsPath , 'utf-8' ) ) ;
37
42
38
43
const [ language , client ] = process . argv . slice ( 2 ) ;
@@ -43,10 +48,12 @@ async function setHostsOptions(): Promise<void> {
43
48
throw new Error ( `Generator not found: ${ generator } ` ) ;
44
49
}
45
50
46
- const specPath = path . join ( __dirname , `../ ../specs/bundled/${ client } .yml` ) ;
51
+ const specPath = path . join ( process . cwd ( ) , `../specs/bundled/${ client } .yml` ) ;
47
52
48
53
if ( ! ( await stat ( specPath ) ) ) {
49
- throw new Error ( `File not found ${ specPath } ` ) ;
54
+ throw new Error (
55
+ `File not found ${ specPath } .\nMake sure your run scripts from the root directory using yarn workspace.`
56
+ ) ;
50
57
}
51
58
52
59
try {
You can’t perform that action at this time.
0 commit comments