@toreda/build-tools
Version:

42 lines (41 loc) • 1.73 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Config = void 0;
const linter_1 = require("./config/linter");
const defaults_1 = require("./defaults");
const boolean_1 = require("./config/boolean");
const value_1 = require("./config/value");
class Config {
constructor(args, options, baseLog) {
this.log = baseLog.makeLog('Config');
this.buildMode = (0, value_1.configValue)('buildMode', 'prod', args, options);
this.profiler = (0, boolean_1.configBoolean)('profiler', false, args, options);
this.mocks = {
all: (0, boolean_1.configBoolean)('mockAll', false, args, options),
fileReads: (0, boolean_1.configBoolean)('mockFileReads', false, args, options),
fileWrites: (0, boolean_1.configBoolean)('mockFileWrites', false, args, options)
};
this.debugMode = (0, boolean_1.configBoolean)('debugMode', false, args, options);
this.autoMockInJest = (0, boolean_1.configBoolean)('autoMockInJest', true, args, options);
this.linter = new linter_1.ConfigLinter(options === null || options === void 0 ? void 0 : options.linter);
}
getWebpackCfgPath(options) {
if (this.buildMode === 'dev') {
if (typeof options.cfgPathDev === 'string') {
return options.cfgPathDev;
}
else {
return defaults_1.Defaults.Webpack.CfgPathDev;
}
}
else {
if (typeof options.cfgPathProd === 'string') {
return options.cfgPathProd;
}
else {
return defaults_1.Defaults.Webpack.CfgPathProd;
}
}
}
}
exports.Config = Config;