From f4cf89fb8deee7472d8e9bdbcb7ae7364ced1f74 Mon Sep 17 00:00:00 2001 From: wangsijie Date: Fri, 23 Sep 2022 15:38:31 +0800 Subject: [PATCH] fix(core): filter out connector-kit (#1987) --- packages/core/src/connectors/add-connectors.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/core/src/connectors/add-connectors.ts b/packages/core/src/connectors/add-connectors.ts index 490a65d50..1c5936897 100644 --- a/packages/core/src/connectors/add-connectors.ts +++ b/packages/core/src/connectors/add-connectors.ts @@ -13,12 +13,18 @@ import { npmPackResultGuard } from './types'; const execPromise = promisify(exec); const npmConnectorFilter = '@logto/connector-'; +const excludedPackages = new Set([ + '@logto/connector-kit', + '@logto/connector-mock-sms', + '@logto/connector-mock-social', + '@logto/connector-mock-email', +]); const fetchOfficialConnectorList = async () => { const { stdout } = await execPromise(`npm search ${npmConnectorFilter} --json`); const packages = z.object({ name: z.string() }).array().parse(JSON.parse(stdout)); - return packages.filter(({ name }) => !name.includes('mock') && !name.includes('core')); + return packages.filter(({ name }) => !excludedPackages.has(name)); }; export const addConnector = async (packageName: string, cwd: string) => {