Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 93e6f4b

Browse files
fix: update lib
1 parent 100d7d4 commit 93e6f4b

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

‎src/lib/boolean.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,12 @@ export function storageExists(): boolean {
2323
return false
2424
}
2525
}
26+
27+
/**
28+
* Check if mail is enabled
29+
*/
30+
export function mailExists(): boolean {
31+
return Boolean(
32+
env.MAIL_HOST && env.MAIL_PORT && env.MAIL_USERNAME && env.MAIL_PASSWORD && env.MAIL_FROM
33+
)
34+
}

‎src/lib/fs/read-file.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { green } from 'colorette'
2+
import fs from 'fs'
3+
import * as fsAsync from 'fs/promises'
4+
import { logger } from '~/config/logger'
5+
6+
const msgType = `${green('filesystem')}`
7+
8+
/**
9+
* Read HTML file
10+
* @param filePath - path to HTML file
11+
* @returns HTML file content
12+
*/
13+
export async function readHTMLFile(
14+
filePath: fs.PathLike | fs.promises.FileHandle
15+
): Promise<string> {
16+
try {
17+
return await fsAsync.readFile(filePath, 'utf-8')
18+
} catch (err) {
19+
logger.error(`${msgType} - invalid HTML file path: ${filePath}`)
20+
throw new Error(`invalid HTML file path: ${filePath}`)
21+
}
22+
}

‎src/lib/string.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { cwd } from 'node:process'
2+
3+
export const currentDir = cwd()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /