wip
This commit is contained in:
parent
d3c4c064f3
commit
96c98ccb62
|
|
@ -17,7 +17,7 @@ const _filename = fileURLToPath(import.meta.url);
|
||||||
const _dirname = dirname(_filename);
|
const _dirname = dirname(_filename);
|
||||||
|
|
||||||
const configDir = resolve(_dirname, '../../../.config');
|
const configDir = resolve(_dirname, '../../../.config');
|
||||||
const OUTPUT_PATH = resolve(configDir, '.config.json');
|
const OUTPUT_PATH = resolve(_dirname, '../built/.config.json');
|
||||||
|
|
||||||
// TODO: yamlのパースに失敗したときのエラーハンドリング
|
// TODO: yamlのパースに失敗したときのエラーハンドリング
|
||||||
|
|
||||||
|
|
@ -35,6 +35,9 @@ function yamlToJson(ymlPath) {
|
||||||
|
|
||||||
const yamlContent = fs.readFileSync(ymlPath, 'utf-8');
|
const yamlContent = fs.readFileSync(ymlPath, 'utf-8');
|
||||||
const jsonContent = yaml.load(yamlContent);
|
const jsonContent = yaml.load(yamlContent);
|
||||||
|
if (!fs.existsSync(dirname(OUTPUT_PATH))) {
|
||||||
|
fs.mkdirSync(dirname(OUTPUT_PATH), { recursive: true });
|
||||||
|
}
|
||||||
fs.writeFileSync(OUTPUT_PATH, JSON.stringify({
|
fs.writeFileSync(OUTPUT_PATH, JSON.stringify({
|
||||||
'_NOTE_': 'This file is auto-generated from YAML file. DO NOT EDIT.',
|
'_NOTE_': 'This file is auto-generated from YAML file. DO NOT EDIT.',
|
||||||
...jsonContent,
|
...jsonContent,
|
||||||
|
|
|
||||||
|
|
@ -217,9 +217,7 @@ export type FulltextSearchProvider = 'sqlLike' | 'sqlPgroonga' | 'meilisearch';
|
||||||
const _filename = fileURLToPath(import.meta.url);
|
const _filename = fileURLToPath(import.meta.url);
|
||||||
const _dirname = dirname(_filename);
|
const _dirname = dirname(_filename);
|
||||||
|
|
||||||
const configDir = `${_dirname}/../../../.config`;
|
export const compiledConfigFilePath = resolve(_dirname, '.config.json');
|
||||||
|
|
||||||
export const compiledConfigFilePath = resolve(configDir, '.config.json');
|
|
||||||
|
|
||||||
export function loadConfig(): Config {
|
export function loadConfig(): Config {
|
||||||
if (!fs.existsSync(compiledConfigFilePath)) {
|
if (!fs.existsSync(compiledConfigFilePath)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue