0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-10 22:22:45 -05:00

refactor: improve dx

This commit is contained in:
Gao Sun 2022-10-08 00:54:48 +08:00
parent 9696060997
commit 8c73067b48
No known key found for this signature in database
GPG key ID: 13EBE123E4773688
4 changed files with 16 additions and 6 deletions

View file

@ -6,9 +6,6 @@
"homepage": "https://github.com/logto-io/logto#readme",
"license": "MPL-2.0",
"main": "lib/index.js",
"exports": {
".": "./lib"
},
"bin": {
"logto": "bin/logto",
"lg": "bin/logto"

View file

@ -1,4 +1,5 @@
import { getUndeployedAlterations } from '@logto/cli/lib/commands/database/alteration';
import chalk from 'chalk';
import { DatabasePool } from 'slonik';
export const checkAlterationState = async (pool: DatabasePool) => {
@ -8,7 +9,16 @@ export const checkAlterationState = async (pool: DatabasePool) => {
return;
}
throw new Error(
`Found undeployed database alterations, you must deploy them first by "npm run alteration deploy" command, reference: https://docs.logto.io/docs/recipes/deployment/#database-alteration`
console.error(
`${chalk.red(
'[error]'
)} Found undeployed database alterations, you must deploy them first by ${chalk.green(
'npm run alteration deploy'
)} command.\n\n` +
` See ${chalk.blue(
'https://docs.logto.io/docs/recipes/deployment/#database-alteration'
)} for reference.\n`
);
throw new Error(`Undeployed database alterations found.`);
};

View file

@ -76,7 +76,9 @@ function createEnvSet() {
return pool;
},
get poolSafe() {
return pool;
},
load: async () => {
values = await loadEnvValues();
pool = await createPoolByEnv(values.isTest);

View file

@ -27,5 +27,6 @@ import initI18n from './i18n/init';
await initApp(app);
} catch (error: unknown) {
console.log('Error while initializing app', error);
await envSet.poolSafe?.end();
}
})();