0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-30 20:33:54 -05:00

feat(cli): export add connectors utils (#3926)

export add connectors utils
This commit is contained in:
simeng-li 2023-05-30 14:16:10 +08:00 committed by GitHub
parent 11cb34f7ae
commit 93e995aa83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -132,9 +132,7 @@ export const getLocalConnectorPackages = async (instancePath: string) => {
return packages.map(({ name }) => [name, path.join(directory, name)] as const);
};
export const addConnectors = async (instancePath: string, packageNames: string[]) => {
const cwd = getConnectorDirectory(instancePath);
export const addConnectorsToPath = async (cwd: string, packageNames: string[]) => {
if (!existsSync(cwd)) {
await fs.mkdir(cwd, { recursive: true });
}
@ -195,11 +193,17 @@ export const addConnectors = async (instancePath: string, packageNames: string[]
}
};
export const addConnectors = async (instancePath: string, packageNames: string[]) => {
const cwd = getConnectorDirectory(instancePath);
await addConnectorsToPath(cwd, packageNames);
};
const officialConnectorPrefix = '@logto/connector-';
type PackageMeta = { name: string; scope: string; version: string };
const fetchOfficialConnectorList = async (includingCloudConnectors = false) => {
export const fetchOfficialConnectorList = async (includingCloudConnectors = false) => {
// See https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md#get-v1search
type FetchResult = {
objects: Array<{