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:
parent
11cb34f7ae
commit
93e995aa83
1 changed files with 8 additions and 4 deletions
|
@ -132,9 +132,7 @@ export const getLocalConnectorPackages = async (instancePath: string) => {
|
||||||
return packages.map(({ name }) => [name, path.join(directory, name)] as const);
|
return packages.map(({ name }) => [name, path.join(directory, name)] as const);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const addConnectors = async (instancePath: string, packageNames: string[]) => {
|
export const addConnectorsToPath = async (cwd: string, packageNames: string[]) => {
|
||||||
const cwd = getConnectorDirectory(instancePath);
|
|
||||||
|
|
||||||
if (!existsSync(cwd)) {
|
if (!existsSync(cwd)) {
|
||||||
await fs.mkdir(cwd, { recursive: true });
|
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-';
|
const officialConnectorPrefix = '@logto/connector-';
|
||||||
|
|
||||||
type PackageMeta = { name: string; scope: string; version: string };
|
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
|
// See https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md#get-v1search
|
||||||
type FetchResult = {
|
type FetchResult = {
|
||||||
objects: Array<{
|
objects: Array<{
|
||||||
|
|
Loading…
Reference in a new issue