@atlassian/wrm-troubleshooting
Version:
A tool that can help you with troubleshooting the configuration of webpack and Atlassian P2 project.
33 lines • 1.65 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.runWebpackBundleCliV4 = exports.runWebpackBundleWithInjectedPluginCliV4 = void 0;
const execa_1 = __importDefault(require("execa"));
const fs_1 = require("fs");
const path_1 = __importDefault(require("path"));
async function runWebpackBundleWithInjectedPluginCliV4(webpackCliInfo, webpackConfigFile, commandTimeout) {
const configPath = path_1.default.resolve(__dirname, '../webpackPlugin/webpack.config.js');
try {
await fs_1.promises.access(configPath);
}
catch (e) {
return new Error('We couldn\'t locate the "WebpackRetrieveConfigPlugin" plugin. Please try reinstalling the troubleshooting tool.');
}
// TODO: Should we pass webpack bundling modes here?
return (0, execa_1.default)('npx', ['webpack-cli', 'build', '--config', webpackConfigFile, configPath, '--merge'], {
cwd: webpackCliInfo.workingDirectory,
timeout: commandTimeout,
});
}
exports.runWebpackBundleWithInjectedPluginCliV4 = runWebpackBundleWithInjectedPluginCliV4;
function runWebpackBundleCliV4(webpackCliInfo, webpackConfigFile, commandTimeout) {
// TODO: Should we pass webpack bundling modes here?
return (0, execa_1.default)('npx', ['webpack-cli', 'bundle', '--config', webpackConfigFile], {
cwd: webpackCliInfo.workingDirectory,
timeout: commandTimeout,
});
}
exports.runWebpackBundleCliV4 = runWebpackBundleCliV4;
//# sourceMappingURL=webpackCliV4.js.map