Infer webhooks should use webhooks path relative to manifest API route

This commit is contained in:
Tomasz Magulski 2022-05-27 14:52:05 +02:00
parent 38a5c33bd4
commit 8cf9aab987

View file

@ -8,10 +8,10 @@ const capitalize = (value: string) =>
const dropFileExtension = (filename: string) => path.parse(filename).name;
export const inferWebhooks = async (baseURL: string, generatedGraphQL: any) => {
export const inferWebhooks = async (baseURL: string, webhooksPath: string, generatedGraphQL: any) => {
let entries;
if (process.env.NODE_ENV === "production") {
entries = await fg(["*.js"], { cwd: `${__dirname}/webhooks` });
entries = await fg(["*.js"], { cwd: webhooksPath });
} else {
entries = await fg(["*.ts"], { cwd: `pages/api/webhooks` });
}