mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -05:00
Merge pull request #2781 from logto-io/gao-remove-connector-inquiry
refactor(cli): remove official connectors inquiry
This commit is contained in:
commit
bd693fe4d9
3 changed files with 10 additions and 35 deletions
|
@ -4,13 +4,12 @@
|
||||||
"commit": false,
|
"commit": false,
|
||||||
"//": "CAUTION: When updating the fields below, you should also update README accordingly.",
|
"//": "CAUTION: When updating the fields below, you should also update README accordingly.",
|
||||||
"fixed": [[
|
"fixed": [[
|
||||||
"@logto/cli",
|
|
||||||
"@logto/create"
|
|
||||||
], [
|
|
||||||
"@logto/core",
|
"@logto/core",
|
||||||
"@logto/console",
|
"@logto/console",
|
||||||
"@logto/integration-tests",
|
"@logto/integration-tests",
|
||||||
"@logto/ui"
|
"@logto/ui",
|
||||||
|
"@logto/cli",
|
||||||
|
"@logto/create"
|
||||||
]],
|
]],
|
||||||
"linked": [[
|
"linked": [[
|
||||||
"@logto/schemas",
|
"@logto/schemas",
|
||||||
|
|
|
@ -3,7 +3,6 @@ import type { CommandModule } from 'yargs';
|
||||||
|
|
||||||
import { getDatabaseUrlFromConfig } from '../../database.js';
|
import { getDatabaseUrlFromConfig } from '../../database.js';
|
||||||
import { log } from '../../utilities.js';
|
import { log } from '../../utilities.js';
|
||||||
import { addOfficialConnectors } from '../connector/utils.js';
|
|
||||||
import {
|
import {
|
||||||
validateNodeVersion,
|
validateNodeVersion,
|
||||||
inquireInstancePath,
|
inquireInstancePath,
|
||||||
|
@ -13,7 +12,6 @@ import {
|
||||||
createEnv,
|
createEnv,
|
||||||
logFinale,
|
logFinale,
|
||||||
decompress,
|
decompress,
|
||||||
inquireOfficialConnectors,
|
|
||||||
isUrl,
|
isUrl,
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
|
|
||||||
|
@ -52,16 +50,6 @@ const installLogto = async ({ path, skipSeed, officialConnectors, downloadUrl }:
|
||||||
// Save to dot env
|
// Save to dot env
|
||||||
await createEnv(instancePath, await getDatabaseUrlFromConfig());
|
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
|
// Finale
|
||||||
logFinale(instancePath);
|
logFinale(instancePath);
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,6 +11,7 @@ import * as semver from 'semver';
|
||||||
import tar from 'tar';
|
import tar from 'tar';
|
||||||
|
|
||||||
import { createPoolAndDatabaseIfNeeded } from '../../database.js';
|
import { createPoolAndDatabaseIfNeeded } from '../../database.js';
|
||||||
|
import { packageJson } from '../../package-json.js';
|
||||||
import {
|
import {
|
||||||
cliConfig,
|
cliConfig,
|
||||||
ConfigKey,
|
ConfigKey,
|
||||||
|
@ -101,12 +102,13 @@ export const validateDatabase = async () => {
|
||||||
|
|
||||||
export const downloadRelease = async (url?: string) => {
|
export const downloadRelease = async (url?: string) => {
|
||||||
const tarFilePath = path.resolve(os.tmpdir(), './logto.tar.gz');
|
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}`);
|
log.info(`Download Logto from ${from}`);
|
||||||
await downloadFile(
|
log.info(`Target ${tarFilePath}`);
|
||||||
url ?? 'https://github.com/logto-io/logto/releases/latest/download/logto.tar.gz',
|
await downloadFile(from, tarFilePath);
|
||||||
tarFilePath
|
|
||||||
);
|
|
||||||
|
|
||||||
return 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) => {
|
export const isUrl = (string: string) => {
|
||||||
try {
|
try {
|
||||||
// On purpose to test
|
// On purpose to test
|
||||||
|
|
Loading…
Reference in a new issue