Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = (conf, { kktrc, ...optionConf }, webpack) => {
if (kktrc && kktrc.config && typeof kktrc.config === 'function') {
conf = kktrc.config(conf, optionConf, webpack) || conf;
} else if (kktrc && kktrc.config) {
console.log(color.yellow('Check for .kkt.conf.js file, kktrc.config is not a function.')); // eslint-disable-line
}
if (kktrc && kktrc.plugins && kktrc.plugins.length > 0) {
kktrc.plugins.forEach((item) => {
const plugin = require(item); // eslint-disable-line
conf = plugin(conf, optionConf, webpack) || conf;
});
}
return conf;
};
#!/usr/bin/env node
const path = require('path');
const prepareUrls = require('local-ip-url/prepareUrls');
const detect = require('detect-port');
const color = require('colors-cli/safe');
const express = require('express');
const apiMocker = require('../');
if (!process.argv.slice(2).length) {
console.log(color.red('Error: Need to pass parameters!'));
console.log(`E.g: ${color.yellow('mocker ')}\n`);
return;
}
let mockpath = process.argv[2];
mockpath = require.resolve(path.resolve(mockpath));
(async () => {
const HOST = process.env.HOST || '0.0.0.0';
let DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3721;
const PORT = await detect(DEFAULT_PORT);
if (DEFAULT_PORT !== PORT) {
DEFAULT_PORT = PORT;
}
process.env.PORT = DEFAULT_PORT;
const app = express();
.action((cmd) => {
program.outputHelp()
logs(` ` + colors.red(`Unknown command ${colors.yellow(cmd)}.`))
logs()
})