@atlassian/wrm-troubleshooting
Version:
A tool that can help you with troubleshooting the configuration of webpack and Atlassian P2 project.
32 lines • 1.43 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.locateWebpackConfigFile = void 0;
const path_1 = __importDefault(require("path"));
const webpack_1 = require("../webpack/webpack");
const types_1 = require("./types");
const locateWebpackConfigFile = async (options) => {
let webpackConfigFile = options.webpack
? path_1.default.resolve(options.webpack)
: await (0, webpack_1.findRootWebpackConfigFile)();
const rootWebpackConfigFileFound = options.webpack ? false : Boolean(webpackConfigFile);
// Skip asking for webpack config file if we have a root file
if (!options.yes || !webpackConfigFile) {
if (webpackConfigFile) {
webpackConfigFile = await (0, webpack_1.confirmRootWebpackConfig)(webpackConfigFile, rootWebpackConfigFileFound);
}
if (!webpackConfigFile) {
webpackConfigFile = await (0, webpack_1.askForWebpackConfig)(rootWebpackConfigFileFound);
}
}
if (webpackConfigFile instanceof Error) {
return (0, types_1.getFailedResult)(webpackConfigFile);
}
return (0, types_1.getPassedResult)({
webpackConfigFile,
});
};
exports.locateWebpackConfigFile = locateWebpackConfigFile;
//# sourceMappingURL=locateWebpackConfigFile.js.map