Skip to content

Commit

Permalink
feat/slack update pnpm lock
Browse files Browse the repository at this point in the history
  • Loading branch information
anabellabuckvar committed Nov 12, 2024
1 parent ff916a3 commit 473f814
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 22 deletions.
32 changes: 32 additions & 0 deletions libs/util/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import {
import type z from 'zod';
import type { DbConfig } from './databaseConnection/types';
import { getDbConfig } from './assertDbEnvVars';
import {
EdgeFunctionsOptions,
FunctionsOptions,
} from '@netlify/sdk/dist/extension/types';

type BuildHookWithEnvVars<
DbConfig,
Expand Down Expand Up @@ -88,4 +92,32 @@ export class Extension<
},
);
};

addFunctions = async (
path: string,
options: FunctionsOptions,
): Promise<void> => {
super.addFunctions(path, {
prefix: options.prefix,
shouldInjectFunction: () => {
try {
if (!process.env.SLACK_ENABLED) {
return false;
}

if (options?.shouldInjectFunction) {
return options.shouldInjectFunction({
name: options.shouldInjectFunction.name,
});
}
return true;
} catch (e) {
console.info(
`Function injection did not complete successfully. Errored with error: ${e}`,
);
return false;
}
},
});
};
}
124 changes: 102 additions & 22 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 473f814

Please sign in to comment.