@atlassian/wrm-troubleshooting
Version:
A tool that can help you with troubleshooting the configuration of webpack and Atlassian P2 project.
76 lines • 2.66 kB
JavaScript
#!/usr/bin/env node
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable n/shebang */
const yargs_1 = __importDefault(require("yargs"));
const checkForUpdate_1 = require("./checkForUpdate");
const troubleshooting_1 = require("./troubleshooting");
const troubleshootingOptions_1 = require("./troubleshootingOptions");
const yargsHelper_1 = require("./yargsHelper");
// Check for a new version
(0, checkForUpdate_1.checkForUpdate)();
yargs_1.default
.command({
command: '$0 [options]',
// @ts-expect-error Yargs throws type errors here
desc: 'Run troubleshooting for webpack WRM plugin.',
builder: (yargs) => yargs
.option('webpack', {
describe: 'The path to webpack configuration file\ne.g. ./webpack.config.js',
type: 'string',
alias: 'w',
})
.option('pom', {
describe: 'The path to pom.xml file\ne.g. ./pom.xml',
type: 'string',
alias: 'p',
})
.option('applicationUrl', {
describe: 'Full application URL we will use to verify WRM runtime\ne.g. http://localhost:2990/jira',
type: 'string',
alias: 'u',
})
.option('resourceKey', {
describe: 'A web-resource key we will use to verify WRM runtime\ne.g. name-of-my-web-resource-key',
type: 'string',
alias: 'r',
})
.option('noWrm', {
describe: 'Skip running in-app WRM check',
type: 'boolean',
alias: 'nw',
default: false,
})
.option('yes', {
describe: 'Skip confirmation and run troubleshooting immediately',
type: 'boolean',
alias: 'y',
default: false,
})
.option('verbose', {
describe: 'Display verbose output',
type: 'boolean',
alias: 'v',
default: false,
})
.option('timeout', {
describe: 'A timeout in seconds for executing external commands.',
type: 'number',
alias: 't',
default: troubleshootingOptions_1.DEFAULT_TIMEOUT,
// Convert the seconds to milliseconds
coerce(seconds) {
if (!seconds || Number.isNaN(seconds) || seconds < 1) {
seconds = troubleshootingOptions_1.DEFAULT_TIMEOUT;
}
return seconds * 1000;
},
}),
handler: (0, yargsHelper_1.getAsyncHandler)(troubleshooting_1.troubleshootingCommand),
})
.strict()
.help().argv; // for --help and -h to work
//# sourceMappingURL=cli.js.map