1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00
This commit is contained in:
Laurent Cozic 2022-11-13 11:37:05 +00:00
parent cc5ead7474
commit 97e88d7983
10 changed files with 22 additions and 47 deletions

View File

@ -37,17 +37,8 @@ class Command extends BaseCommand {
];
}
static lockFile(filePath: string): Promise<Function> {
return new Promise((resolve, reject) => {
locker.lock(filePath, { stale: 1000 * 60 * 5 }, (error: any, release: any) => {
if (error) {
reject(error);
return;
}
resolve(release);
});
});
static async lockFile(filePath: string): Promise<Function> {
return locker.lock(filePath, { stale: 1000 * 60 * 5 });
}
static isLocked(filePath: string) {

View File

@ -157,7 +157,7 @@
"node-fetch": "1.7.3",
"node-notifier": "10.0.1",
"node-rsa": "1.1.1",
"pretty-bytes": "6.0.0",
"pretty-bytes": "5.6.0",
"re-resizable": "6.9.9",
"react": "16.14.0",
"react-datetime": "3.2.0",

View File

@ -114,7 +114,7 @@ class NoteTagsDialogComponent extends React.Component {
});
tagListData.sort((a, b) => {
if (a.selected === b.selected) return naturalCompare.caseInsensitive(a.title, b.title);
if (a.selected === b.selected) return naturalCompare(a.title, b.title, { caseInsensitive: true });
else if (b.selected === true) return 1;
else return -1;
});

View File

@ -1,7 +1,7 @@
import { resolve as nodeResolve } from 'path';
import FsDriverBase, { Stat } from './fs-driver-base';
import time from './time';
const md5File = require('md5-file/promise');
const md5File = require('md5-file');
const fs = require('fs-extra');
export default class FsDriverNode extends FsDriverBase {

View File

@ -82,19 +82,6 @@ async function decodeBase64File(sourceFilePath: string, destFilePath: string) {
});
}
async function md5FileAsync(filePath: string): Promise<string> {
return new Promise((resolve, reject) => {
md5File(filePath, (error: any, hash: string) => {
if (error) {
reject(error);
return;
}
resolve(hash);
});
});
}
function removeUndefinedProperties(note: NoteEntity) {
const output: any = {};
for (const n in note) {
@ -184,7 +171,7 @@ async function processNoteResource(resource: ExtractedResource) {
// If no resource ID is present, the resource ID is actually the MD5 of the data.
// This ID will match the "hash" attribute of the corresponding <en-media> tag.
// resourceId = md5(decodedData);
resource.id = await md5FileAsync(resource.dataFilePath);
resource.id = await md5File(resource.dataFilePath);
}
if (!resource.id || !resource.size) {

View File

@ -46,7 +46,7 @@
"nodemailer": "6.8.0",
"nodemon": "2.0.20",
"pg": "8.8.0",
"pretty-bytes": "6.0.0",
"pretty-bytes": "5.6.0",
"prettycron": "0.10.0",
"query-string": "7.1.1",
"rate-limiter-flexible": "2.4.1",

View File

@ -295,10 +295,14 @@ export async function migrateList(db: DbConnection, asString: boolean = true) {
// ]
// ]
const formatName = (migrationInfo: any) => {
const name = migrationInfo.file ? migrationInfo.file : migrationInfo;
const getMigrationName = (migrationInfo: any) => {
if (migrationInfo && migrationInfo.name) return migrationInfo.name;
if (migrationInfo && migrationInfo.file) return migrationInfo.file;
return migrationInfo;
};
const s = name.split('.');
const formatName = (migrationInfo: any) => {
const s = getMigrationName(migrationInfo).split('.');
s.pop();
return s.join('.');
};

View File

@ -1,6 +1,6 @@
const fs = require('fs-extra');
const { execCommand, rootDir } = require('./tool-utils.js');
const md5File = require('md5-file/promise');
const md5File = require('md5-file');
const glob = require('glob');
const clipperDir = `${rootDir}/packages/app-clipper`;

View File

@ -21,7 +21,7 @@ const buildConfig = readCredentialFileJson<BuildConfig>('website-build.json', {
const glob = require('glob');
const path = require('path');
const md5File = require('md5-file/promise');
const md5File = require('md5-file');
const docDir = `${dirname(dirname(dirname(dirname(__dirname))))}/joplin-website/docs`;
if (!pathExistsSync(docDir)) throw new Error(`Doc directory does not exist: ${docDir}`);

View File

@ -4149,7 +4149,7 @@ __metadata:
node-fetch: 1.7.3
node-notifier: 10.0.1
node-rsa: 1.1.1
pretty-bytes: 6.0.0
pretty-bytes: 5.6.0
re-resizable: 6.9.9
react: 16.14.0
react-datetime: 3.2.0
@ -4565,7 +4565,7 @@ __metadata:
nodemailer: 6.8.0
nodemon: 2.0.20
pg: 8.8.0
pretty-bytes: 6.0.0
pretty-bytes: 5.6.0
prettycron: 0.10.0
query-string: 7.1.1
rate-limiter-flexible: 2.4.1
@ -26453,10 +26453,10 @@ __metadata:
languageName: node
linkType: hard
"pretty-bytes@npm:6.0.0":
version: 6.0.0
resolution: "pretty-bytes@npm:6.0.0"
checksum: 0bb9f95e617236404b29a8392c6efd82d65805f622f5e809ecd70068102be857d4e3276c86d2a32fa2ef851cc29472e380945dab7bec83ec79bd57a19a10faf7
"pretty-bytes@npm:5.6.0, pretty-bytes@npm:^5.2.0":
version: 5.6.0
resolution: "pretty-bytes@npm:5.6.0"
checksum: 9c082500d1e93434b5b291bd651662936b8bd6204ec9fa17d563116a192d6d86b98f6d328526b4e8d783c07d5499e2614a807520249692da9ec81564b2f439cd
languageName: node
linkType: hard
@ -26467,13 +26467,6 @@ __metadata:
languageName: node
linkType: hard
"pretty-bytes@npm:^5.2.0":
version: 5.6.0
resolution: "pretty-bytes@npm:5.6.0"
checksum: 9c082500d1e93434b5b291bd651662936b8bd6204ec9fa17d563116a192d6d86b98f6d328526b4e8d783c07d5499e2614a807520249692da9ec81564b2f439cd
languageName: node
linkType: hard
"pretty-format@npm:^25.2.1, pretty-format@npm:^25.5.0":
version: 25.5.0
resolution: "pretty-format@npm:25.5.0"