New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@dendronhq/common-server

Package Overview
Dependencies
Maintainers
1
Versions
438
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dendronhq/common-server - npm Package Compare versions

Comparing version

to
0.102.0

2

lib/filesv2.d.ts

@@ -52,3 +52,3 @@ /// <reference types="node" />

}): import("@dendronhq/common-all").DNodeProps<any, any>;
export declare function file2Note(fpath: string, vault: DVault, toLowercase?: boolean): NoteProps;
export declare function file2Note(fpath: string, vault: DVault, toLowercase?: boolean): RespV3<NoteProps>;
/** Read the contents of a note from the filesystem.

@@ -55,0 +55,0 @@ *

@@ -158,6 +158,19 @@ "use strict";

function file2Note(fpath, vault, toLowercase) {
const content = fs_extra_1.default.readFileSync(fpath, { encoding: "utf8" });
const { name } = path_1.default.parse(fpath);
const fname = toLowercase ? name.toLowerCase() : name;
return string2Note({ content, fname, vault });
if (!fs_extra_1.default.existsSync(fpath)) {
const error = common_all_1.DendronError.createFromStatus({
status: common_all_1.ERROR_STATUS.INVALID_STATE,
message: `${fpath} does not exist`,
});
return {
error,
};
}
else {
const content = fs_extra_1.default.readFileSync(fpath, { encoding: "utf8" });
const { name } = path_1.default.parse(fpath);
const fname = toLowercase ? name.toLowerCase() : name;
return {
data: string2Note({ content, fname, vault }),
};
}
}

@@ -164,0 +177,0 @@ exports.file2Note = file2Note;

@@ -31,2 +31,4 @@ "use strict";

const CURRENT_MONTH = currentDate.toFormat("LL");
const CURRENT_MONTH_NAME = currentDate.toFormat("LLLL");
const CURRENT_MONTH_NAME_SHORT = currentDate.toFormat("LLL");
const CURRENT_WEEK = currentDate.toFormat("WW");

@@ -38,5 +40,8 @@ const CURRENT_DAY = currentDate.toFormat("dd");

const CURRENT_DAY_OF_WEEK = currentDate.toJSDate().getDay();
const CURRENT_QUARTER = currentDate.toFormat("q");
return {
CURRENT_YEAR,
CURRENT_MONTH,
CURRENT_MONTH_NAME,
CURRENT_MONTH_NAME_SHORT,
CURRENT_WEEK,

@@ -48,2 +53,4 @@ CURRENT_DAY,

CURRENT_DAY_OF_WEEK,
CURRENT_QUARTER,
TITLE: targetNote.title,
FNAME: targetNote.fname,

@@ -199,2 +206,4 @@ DESC: targetNote.desc,

targetNote.body = targetNote.body.replace(/<%=\s*CURRENT_MONTH\s*%>/g, currentDate.toFormat("LL"));
targetNote.body = targetNote.body.replace(/<%=\s*CURRENT_MONTH_NAME\s*%>/g, currentDate.toFormat("LLLL"));
targetNote.body = targetNote.body.replace(/<%=\s*CURRENT_MONTH_NAME_SHORT\s*%>/g, currentDate.toFormat("LLL"));
targetNote.body = targetNote.body.replace(/<%=\s*CURRENT_WEEK\s*%>/g, currentDate.toFormat("WW"));

@@ -201,0 +210,0 @@ targetNote.body = targetNote.body.replace(/<%=\s*CURRENT_DAY\s*%>/g, currentDate.toFormat("dd"));

{
"name": "@dendronhq/common-server",
"version": "0.101.0",
"version": "0.102.0",
"description": "common-server",

@@ -40,3 +40,3 @@ "license": "GPLv3",

"dependencies": {
"@dendronhq/common-all": "^0.101.0",
"@dendronhq/common-all": "^0.102.0",
"@sentry/integrations": "^6.13.3",

@@ -90,3 +90,3 @@ "@sentry/node": "^6.13.3",

},
"gitHead": "ebe807957fed7ea42ad7cb3fb4bf4a1ca8adb3e2"
"gitHead": "0f3572e48cda09be8e0a187ab85a9bfc90898663"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet