forked from FoundKeyGang/FoundKey
backend: add return types to load.ts functions
This commit is contained in:
parent
ebc4daa6c2
commit
8d5966c0bc
1 changed files with 3 additions and 3 deletions
|
@ -6,7 +6,7 @@ import * as fs from 'node:fs';
|
|||
import { fileURLToPath } from 'node:url';
|
||||
import { dirname } from 'node:path';
|
||||
import * as yaml from 'js-yaml';
|
||||
import { Source, Mixin } from './types.js';
|
||||
import { Source, Mixin, Config } from './types.js';
|
||||
|
||||
const _filename = fileURLToPath(import.meta.url);
|
||||
const _dirname = dirname(_filename);
|
||||
|
@ -23,7 +23,7 @@ const path = process.env.NODE_ENV === 'test'
|
|||
? `${dir}/test.yml`
|
||||
: `${dir}/default.yml`;
|
||||
|
||||
export default function load() {
|
||||
export default function load(): Config {
|
||||
const meta = JSON.parse(fs.readFileSync(`${_dirname}/../../../../built/meta.json`, 'utf-8'));
|
||||
const clientManifest = JSON.parse(fs.readFileSync(`${_dirname}/../../../../built/_client_dist_/manifest.json`, 'utf-8'));
|
||||
const config = yaml.load(fs.readFileSync(path, 'utf-8')) as Source;
|
||||
|
@ -55,7 +55,7 @@ export default function load() {
|
|||
return Object.assign(config, mixin);
|
||||
}
|
||||
|
||||
function tryCreateUrl(url: string) {
|
||||
function tryCreateUrl(url: string): URL {
|
||||
try {
|
||||
return new URL(url);
|
||||
} catch (e) {
|
||||
|
|
Loading…
Reference in a new issue