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:
parent
9696060997
commit
8c73067b48
4 changed files with 16 additions and 6 deletions
|
@ -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"
|
||||
|
|
|
@ -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.`);
|
||||
};
|
||||
|
|
|
@ -76,7 +76,9 @@ function createEnvSet() {
|
|||
|
||||
return pool;
|
||||
},
|
||||
|
||||
get poolSafe() {
|
||||
return pool;
|
||||
},
|
||||
load: async () => {
|
||||
values = await loadEnvValues();
|
||||
pool = await createPoolByEnv(values.isTest);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
})();
|
||||
|
|
Loading…
Add table
Reference in a new issue