mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2025-12-15 15:10:31 -08:00
fix: docs and loggers, sqlite3 can't load and cause crash
This commit is contained in:
parent
1ae88d7005
commit
0c27989e9e
3 changed files with 16 additions and 7 deletions
|
|
@ -67,15 +67,15 @@ exports.default = async (
|
|||
// not using pnpm, because after using it, it always causing problem here, causing `Error: spawn /bin/sh ENOENT` in github actions
|
||||
// it can probably being "working directory didn't exist" in https://github.com/nodejs/node/issues/9644#issuecomment-282060923
|
||||
// await exec(`pnpm i --shamefully-hoist --prod --ignore-scripts`, { cwd: path.join(cwd, 'node_modules', 'zx'), shell });
|
||||
await exec(`npm i --legacy-building --production`, {
|
||||
await exec(`npm i --registry https://registry.npmmirror.com --legacy-building --production`, {
|
||||
cwd: path.join(cwd, 'node_modules', 'zx'),
|
||||
shell,
|
||||
});
|
||||
await exec(`npm i --legacy-building --production`, {
|
||||
await exec(`npm i --registry https://registry.npmmirror.com --legacy-building --production`, {
|
||||
cwd: path.join(cwd, 'node_modules', 'zx', 'node_modules', 'globby'),
|
||||
shell,
|
||||
});
|
||||
await exec(`npm i --legacy-building --production --ignore-scripts`, {
|
||||
await exec(`npm i --registry https://registry.npmmirror.com --legacy-building --production --ignore-scripts`, {
|
||||
cwd: path.join(
|
||||
cwd,
|
||||
'node_modules',
|
||||
|
|
|
|||
|
|
@ -32,15 +32,23 @@ export class DatabaseService implements IDatabaseService {
|
|||
await fs.ensureDir(CACHE_DATABASE_FOLDER);
|
||||
try {
|
||||
// create a database and table that adapts tiddlywiki usage
|
||||
logger.debug(`initializeForWorkspace create a sqlite database with vss and table that adapts tiddlywiki usage for workspace ${workspaceID}`);
|
||||
const database = new Sqlite3Database(':memory:', { verbose: logger.debug, nativeBinding: SQLITE_BINARY_PATH });
|
||||
logger.debug(`initializeForWorkspace create a sqlite database for workspace`, { SQLITE_BINARY_PATH, workspaceID });
|
||||
let database: Sqlite3Database.Database;
|
||||
try {
|
||||
database = new Sqlite3Database(':memory:', { verbose: logger.debug, nativeBinding: SQLITE_BINARY_PATH });
|
||||
} catch (error) {
|
||||
logger.error(`error when loading sqlite3 for workspace ${workspaceID}, skip because of error to prevent crash: ${(error as Error).message}`);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
logger.debug(`initializeForWorkspace load vss for sqlite database`, { PACKAGE_PATH_BASE, workspaceID });
|
||||
loadSqliteVss(database, PACKAGE_PATH_BASE);
|
||||
const vssVersion = database.prepare('select vss_version()').pluck().get() as string;
|
||||
logger.debug(`initializeForWorkspace using sqlite-vss version: ${vssVersion} for workspace ${workspaceID}`);
|
||||
logger.debug(`initializeForWorkspace successfully using sqlite-vss version: ${vssVersion} for workspace ${workspaceID}`);
|
||||
} catch (error) {
|
||||
logger.error(`error when loading sqlite-vss for workspace ${workspaceID}: ${(error as Error).message}`);
|
||||
}
|
||||
logger.debug(`initializeForWorkspace create a table that adapts tiddlywiki usage for workspace`, { workspaceID });
|
||||
/**
|
||||
* Create table storing most commonly used tiddler fields, other fields are stored in `fields` column as a JSON string.
|
||||
*/
|
||||
|
|
@ -57,6 +65,7 @@ export class DatabaseService implements IDatabaseService {
|
|||
modifier TEXT
|
||||
);
|
||||
`);
|
||||
logger.debug(`initializeForWorkspace table is created, start backup and close`, { workspaceID });
|
||||
createTiddlywikiTable.run();
|
||||
await database.backup(destinationFilePath);
|
||||
database.close();
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ export class LanguageModel implements ILanguageModelService {
|
|||
logger.error(
|
||||
errorMessage,
|
||||
{
|
||||
function: 'callWikiIpcServerRoute',
|
||||
function: 'getWorker',
|
||||
},
|
||||
);
|
||||
throw new Error(errorMessage);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue