Replace mkdirp with native fs.mkdir
Prior to this change, Signal-Desktop was using a rather ancient version of `mkdirp`, which was meant for Node.js versions without native support for this kind of functionality. Starting with Node v10, `fs.mkdir()` can perform recursive directory creation. Since Signal-Desktop doesn't utilize any advantages of using such an old version of `mkdirp` [1] (let alone any version of `mkdirp`), we can replace it with the native methods of `fs` (or `fs/promises`). This transition slightly reduces the amount of packages needed to be downloaded and included in the final app since it now relies on the built-in API of Node.js.
This commit is contained in:
parent
16c9c17cc2
commit
7cd566726f
6 changed files with 16 additions and 53 deletions
|
@ -3,8 +3,8 @@
|
|||
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
import { mkdirSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
import mkdirp from 'mkdirp';
|
||||
import rimraf from 'rimraf';
|
||||
import { randomBytes } from 'crypto';
|
||||
import type { Database, Statement } from 'better-sqlite3';
|
||||
|
@ -524,7 +524,7 @@ async function initialize({
|
|||
indexedDBPath = join(configDir, 'IndexedDB');
|
||||
|
||||
const dbDir = join(configDir, 'sql');
|
||||
mkdirp.sync(dbDir);
|
||||
mkdirSync(dbDir, { recursive: true });
|
||||
|
||||
databaseFilePath = join(dbDir, 'db.sqlite');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue