0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

fix(core): filter out connector-kit (#1987)

This commit is contained in:
wangsijie 2022-09-23 15:38:31 +08:00 committed by GitHub
parent 214ae7e41c
commit f4cf89fb8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) => {