piral-cli
Version:
The standard CLI for creating and building a Piral instance or a Pilet.
57 lines • 1.8 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.notifyServerOnline = notifyServerOnline;
exports.createInitialKrasConfig = createInitialKrasConfig;
const path_1 = require("path");
const emoji_1 = require("./emoji");
const log_1 = require("./log");
const external_1 = require("../external");
function notifyServerOnline(path, api) {
return (svc) => {
(0, log_1.log)('generalDebug_0003', `The kras server for debugging is online!`);
const address = `${svc.protocol}://localhost:${external_1.chalk.green(svc.port)}`;
(0, log_1.logInfo)(`${emoji_1.liveIcon} Running at ${external_1.chalk.bold(address + path)}`);
(0, log_1.logInfo)(`${emoji_1.settingsIcon} Manage via ${external_1.chalk.bold(address + api)}`);
(0, log_1.logReset)();
};
}
function createInitialKrasConfig(directory, sources = [], map = {}, feed = []) {
return {
api: '/manage-mock-server',
directory,
map: {
'/': '',
...map,
},
ssl: undefined,
sources,
injectorDirs: [(0, path_1.resolve)(__dirname, '../injectors')],
injectors: {
script: {
active: true,
},
har: {
active: true,
delay: false,
},
json: {
active: true,
randomize: true,
},
piral: {
active: true,
headers: {},
},
pilet: {
active: true,
meta: 'debug-meta.json',
headers: {},
feed,
},
proxy: {
active: true,
},
},
};
}
//# sourceMappingURL=injectors.js.map