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

Merge pull request #2781 from logto-io/gao-remove-connector-inquiry

refactor(cli): remove official connectors inquiry
This commit is contained in:
Gao Sun 2022-12-31 18:01:48 +08:00 committed by GitHub
commit bd693fe4d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 35 deletions

View file

@ -4,13 +4,12 @@
"commit": false,
"//": "CAUTION: When updating the fields below, you should also update README accordingly.",
"fixed": [[
"@logto/cli",
"@logto/create"
], [
"@logto/core",
"@logto/console",
"@logto/integration-tests",
"@logto/ui"
"@logto/ui",
"@logto/cli",
"@logto/create"
]],
"linked": [[
"@logto/schemas",

View file

@ -3,7 +3,6 @@ import type { CommandModule } from 'yargs';
import { getDatabaseUrlFromConfig } from '../../database.js';
import { log } from '../../utilities.js';
import { addOfficialConnectors } from '../connector/utils.js';
import {
validateNodeVersion,
inquireInstancePath,
@ -13,7 +12,6 @@ import {
createEnv,
logFinale,
decompress,
inquireOfficialConnectors,
isUrl,
} from './utils.js';
@ -52,16 +50,6 @@ const installLogto = async ({ path, skipSeed, officialConnectors, downloadUrl }:
// Save to dot env
await createEnv(instancePath, await getDatabaseUrlFromConfig());
// Add official connectors
if (await inquireOfficialConnectors(officialConnectors)) {
await addOfficialConnectors(instancePath);
} else {
log.info(
'Skipped adding official connectors.\n\n' +
` You can use the ${chalk.green('connector add')} command to add connectors at any time.\n`
);
}
// Finale
logFinale(instancePath);
};

View file

@ -11,6 +11,7 @@ import * as semver from 'semver';
import tar from 'tar';
import { createPoolAndDatabaseIfNeeded } from '../../database.js';
import { packageJson } from '../../package-json.js';
import {
cliConfig,
ConfigKey,
@ -101,12 +102,13 @@ export const validateDatabase = async () => {
export const downloadRelease = async (url?: string) => {
const tarFilePath = path.resolve(os.tmpdir(), './logto.tar.gz');
const from =
url ??
`https://github.com/logto-io/logto/releases/download/v${packageJson.version}/logto.tar.gz`;
log.info(`Download Logto to ${tarFilePath}`);
await downloadFile(
url ?? 'https://github.com/logto-io/logto/releases/latest/download/logto.tar.gz',
tarFilePath
);
log.info(`Download Logto from ${from}`);
log.info(`Target ${tarFilePath}`);
await downloadFile(from, tarFilePath);
return tarFilePath;
};
@ -166,20 +168,6 @@ export const logFinale = (instancePath: string) => {
);
};
export const inquireOfficialConnectors = async (initialAnswer?: boolean) => {
const { value } = await inquirer.prompt<{ value: boolean }>(
{
name: 'value',
message: 'Do you want to add official connectors?',
type: 'confirm',
default: true,
},
{ value: initialAnswer }
);
return value;
};
export const isUrl = (string: string) => {
try {
// On purpose to test