4.6.5- CoreferenceResolution Module (#631)

This commit is contained in:
Archer
2023-12-22 10:47:31 +08:00
committed by GitHub
parent 41115a96c0
commit cd682d4275
112 changed files with 4163 additions and 2700 deletions

View File

@@ -0,0 +1,25 @@
import { existsSync, readFileSync } from 'fs';
export const readConfigData = (name: string) => {
const isDev = process.env.NODE_ENV === 'development';
const splitName = name.split('.');
const devName = `${splitName[0]}.local.${splitName[1]}`;
const filename = (() => {
if (isDev) {
// check local file exists
const hasLocalFile = existsSync(`data/${devName}`);
if (hasLocalFile) {
return `data/${devName}`;
}
return `data/${name}`;
}
// production path
return `/app/data/${name}`;
})();
const content = readFileSync(filename, 'utf-8');
return content;
};