0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-02-17 22:04:19 -05:00

refactor(cli): fix default download url with current package version

This commit is contained in:
Gao Sun 2022-12-30 13:45:24 +08:00
parent bf3774d234
commit 2f42f746a4
No known key found for this signature in database
GPG key ID: 13EBE123E4773688

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;
};