mirror of
https://github.com/pysunday/rs-reverse.git
synced 2025-04-19 09:19:46 +08:00
13 lines
542 B
JavaScript
13 lines
542 B
JavaScript
const paths = require('@utils/paths');
|
||
const fs = require('fs');
|
||
const { init } = require('@src/handler/parser/');
|
||
const logger = require('./logger');
|
||
|
||
module.exports = function(filepath) {
|
||
if (!filepath) filepath = paths.exampleResolve('codes', "1-$_ts-full.json")
|
||
if (!fs.existsSync(filepath)) throw new Error(`输入文件不存在: ${filepath}`);
|
||
logger.debug(`初始化GlobalVarible变量,$_ts配置文件:${filepath}`);
|
||
init(JSON.parse(fs.readFileSync(filepath, 'utf8')));
|
||
return require('@src/handler/globalVarible');
|
||
};
|