@dfeidao/send-msg
Version:
消息总线
60 lines (59 loc) • 1.53 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = require("fs");
const path_1 = require("path");
const global_1 = __importDefault(require("./utils/global"));
// tslint:disable-next-line:no-var-requires
const config = require((0, path_1.join)(process.cwd(), 'feidao.json'));
const { debug, cwd } = (() => {
const path = (0, path_1.join)(process.cwd(), 'node_modules', '@feidao-works');
if ((0, fs_1.existsSync)(path)) {
const paths = (0, fs_1.readdirSync)(path);
if (paths.length === 1) {
const project = paths[0];
return {
cwd: (0, path_1.join)(path, project),
debug: false
};
}
else {
return {
cwd: process.cwd(),
debug: true
};
}
}
else {
return {
cwd: process.cwd(),
debug: true
};
}
})();
// tslint:disable-next-line:no-var-requires
const proj = require((0, path_1.join)(cwd, 'feidao.json'));
if (debug) {
proj.acao = '*';
proj.acma = 150000;
}
else {
if (proj.acao) {
delete proj.acao;
}
if (proj.acma) {
delete proj.acma;
}
}
const conf = {
...proj,
...config,
...{
cwd,
debug
}
};
global_1.default.mqtt_uri = conf.mqtt;
exports.default = conf;
;