代码拉取完成,页面将自动刷新
const fs = require('fs');
const path = require('path');
const DEFAULT_SERVICE_PARAMS = ["appAccessMode", "appName", "comment", "displayName", "enName", "id", "templateId", "timeout"];
const DATATYPES = ["STRING", "INTEGER", "LONG", "FLOAT", "DOUBLE", "BOOLEAN"];
const DATATYPE_DEFAULT_VALUE = {
"STRING": "",
"INTEGER": "0",
"LONG": "0",
"FLOAT": "0",
"DOUBLE": "0",
"BOOLEAN": "false"
}
const SUPOS_DIR_NAME = ".supos";
const SERVICES = "services";
const CONTROLS = "controls";
const EXTENSIONS = "extensions";
function findSupOSDirectory(startPath) {
let currentDir = startPath;
// 解析当前工作目录
const parsedPath = path.parse(startPath);
const rootDir = parsedPath.root;
while (!fs.existsSync(path.join(currentDir, SUPOS_DIR_NAME))) {
if (currentDir === rootDir) {
return null;
}
currentDir = path.dirname(currentDir); // 上移一级目录
}
return currentDir; // 返回找到的目录所在的路径
}
const startingPoint = process.cwd(); // 当前工作目录作为起始点
const SUPOS_WORK_DIR = findSupOSDirectory(startingPoint);
const SUPOS_DIR = path.join(SUPOS_WORK_DIR ? SUPOS_WORK_DIR : startingPoint, SUPOS_DIR_NAME);
const SUPOS_SERVICES = path.join(SUPOS_WORK_DIR ? SUPOS_WORK_DIR : startingPoint, SERVICES);
const SUPOS_EXTENSIONS = path.join(SUPOS_WORK_DIR ? SUPOS_WORK_DIR : startingPoint, EXTENSIONS);
const ENVRC = path.join(SUPOS_WORK_DIR ? SUPOS_WORK_DIR : startingPoint, '.env');
require("dotenv").config({ override: true,path:ENVRC })
let ROOTPATH = __dirname;
module.exports = {
SUPOS_WORK_DIR,
ROOTPATH,
ENVRC,
SUPOS_DIR,
SUPOS_SERVICES,
CONTROLS,
SUPOS_EXTENSIONS,
SUPOS_DIR_NAME,
DEFAULT_SERVICE_PARAMS,
SUPOS_DIR,
DATATYPES,
DATATYPE_DEFAULT_VALUE
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。