Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions scripts/pre-gen/setHostsOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ type AdditionalProperties = Partial<{
}>;

async function setHostsOptions(): Promise<void> {
const openapitoolsPath = path.join(__dirname, '../../openapitools.json');
const openapitoolsPath = path.join(process.cwd(), '../openapitools.json');
if (!(await stat(openapitoolsPath))) {
throw new Error(
`File not found ${openapitoolsPath}.\nMake sure your run scripts from the root directory using yarn workspace.`
);
}
const openapitools = JSON.parse(await readFile(openapitoolsPath, 'utf-8'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add the same check as L48, with a similar mention to make sure to use workspaces to run the script


const [language, client] = process.argv.slice(2);
Expand All @@ -43,10 +48,12 @@ async function setHostsOptions(): Promise<void> {
throw new Error(`Generator not found: ${generator}`);
}

const specPath = path.join(__dirname, `../../specs/bundled/${client}.yml`);
const specPath = path.join(process.cwd(), `../specs/bundled/${client}.yml`);

if (!(await stat(specPath))) {
throw new Error(`File not found ${specPath}`);
throw new Error(
`File not found ${specPath}.\nMake sure your run scripts from the root directory using yarn workspace.`
);
}

try {
Expand Down