@atlassian/wrm-troubleshooting 0.6.6 → 0.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics/analytics.js +74 -0
- package/dist/analytics/analytics.js.map +1 -0
- package/dist/analytics/events.js +27 -0
- package/dist/analytics/events.js.map +1 -0
- package/dist/applicationUrls.js +39 -0
- package/dist/applicationUrls.js.map +1 -0
- package/dist/atlassianPluginXml.js +69 -0
- package/dist/atlassianPluginXml.js.map +1 -0
- package/dist/checkForUpdate.js +58 -0
- package/dist/checkForUpdate.js.map +1 -0
- package/dist/cli.js +76 -0
- package/dist/cli.js.map +1 -0
- package/dist/cliUtils.js +21 -0
- package/dist/cliUtils.js.map +1 -0
- package/dist/globWithOptions.js +18 -0
- package/dist/globWithOptions.js.map +1 -0
- package/dist/maven/MavenError.js +14 -0
- package/dist/maven/MavenError.js.map +1 -0
- package/dist/paths.js +12 -0
- package/dist/paths.js.map +1 -0
- package/dist/pom.js +147 -0
- package/dist/pom.js.map +1 -0
- package/dist/steps/getEffectivePomConfig.js +94 -0
- package/dist/steps/getEffectivePomConfig.js.map +1 -0
- package/dist/steps/getEffectiveWebpackConfig.js +35 -0
- package/dist/steps/getEffectiveWebpackConfig.js.map +1 -0
- package/dist/steps/getWrmWebpackPlugin.js +22 -0
- package/dist/steps/getWrmWebpackPlugin.js.map +1 -0
- package/dist/steps/index.js +27 -0
- package/dist/steps/index.js.map +1 -0
- package/dist/steps/locatePomFile.js +30 -0
- package/dist/steps/locatePomFile.js.map +1 -0
- package/dist/steps/locateWebpackConfigFile.js +32 -0
- package/dist/steps/locateWebpackConfigFile.js.map +1 -0
- package/dist/steps/types.js +48 -0
- package/dist/steps/types.js.map +1 -0
- package/dist/steps/validateOptions.js +21 -0
- package/dist/steps/validateOptions.js.map +1 -0
- package/dist/steps/verifyPomConfigIsValid.js +22 -0
- package/dist/steps/verifyPomConfigIsValid.js.map +1 -0
- package/dist/steps/verifyWebpackBundle.js +26 -0
- package/dist/steps/verifyWebpackBundle.js.map +1 -0
- package/dist/steps/verifyWrmPluginHasValidConfig.js +28 -0
- package/dist/steps/verifyWrmPluginHasValidConfig.js.map +1 -0
- package/dist/steps/verifyWrmPluginScanFolders.js +15 -0
- package/dist/steps/verifyWrmPluginScanFolders.js.map +1 -0
- package/dist/steps/verifyWrmRuntime.js +139 -0
- package/dist/steps/verifyWrmRuntime.js.map +1 -0
- package/dist/troubleshooting.js +219 -0
- package/dist/troubleshooting.js.map +1 -0
- package/dist/troubleshootingOptions.js +12 -0
- package/dist/troubleshootingOptions.js.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/webpack/webpack.js +149 -0
- package/dist/webpack/webpack.js.map +1 -0
- package/dist/webpack/webpackCli.js +167 -0
- package/dist/webpack/webpackCli.js.map +1 -0
- package/dist/webpack/webpackCliV3.js +33 -0
- package/dist/webpack/webpackCliV3.js.map +1 -0
- package/dist/webpack/webpackCliV4.js +33 -0
- package/dist/webpack/webpackCliV4.js.map +1 -0
- package/dist/webpack/webpackError.js +14 -0
- package/dist/webpack/webpackError.js.map +1 -0
- package/dist/webpackPlugin/WebpackRetrieveConfigPlugin.js +61 -0
- package/dist/webpackPlugin/WebpackRetrieveConfigPlugin.js.map +1 -0
- package/dist/webpackPlugin/webpack.config.js +10 -0
- package/dist/webpackPlugin/webpack.config.js.map +1 -0
- package/dist/webpackWrmPlugin.js +62 -0
- package/dist/webpackWrmPlugin.js.map +1 -0
- package/dist/wrm/fetchWithTimeout.js +23 -0
- package/dist/wrm/fetchWithTimeout.js.map +1 -0
- package/dist/wrm/wrmRestApi.js +93 -0
- package/dist/wrm/wrmRestApi.js.map +1 -0
- package/dist/wrm/wrmTypes.js +3 -0
- package/dist/wrm/wrmTypes.js.map +1 -0
- package/dist/xmlParser.js +42 -0
- package/dist/xmlParser.js.map +1 -0
- package/dist/yargsHelper.js +22 -0
- package/dist/yargsHelper.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.trackEvent = void 0;
|
|
26
|
+
const Amplitude = __importStar(require("@amplitude/node"));
|
|
27
|
+
const fs_1 = require("fs");
|
|
28
|
+
const os_1 = __importDefault(require("os"));
|
|
29
|
+
const path_1 = __importDefault(require("path"));
|
|
30
|
+
// Unique ID for WRM Troubleshooting Tool
|
|
31
|
+
const AMP_CLIENT_ID = '490d4e87c5c2b9c250de24d48ce09303';
|
|
32
|
+
// TODO: Fix me and detect local mode when we are running tool without installing it from NPM
|
|
33
|
+
const IS_DEV_MODE = process.env.NODE_ENV === 'test';
|
|
34
|
+
// Configure Amplitude
|
|
35
|
+
const client = Amplitude.init(AMP_CLIENT_ID);
|
|
36
|
+
const isObject = (value) => Object.prototype.toString.call(value) === '[object Object]';
|
|
37
|
+
let pkgVersion;
|
|
38
|
+
async function trackEvent(eventName, customProperties = null) {
|
|
39
|
+
// Don't send the analytics from within a dev mode
|
|
40
|
+
if (IS_DEV_MODE) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (!pkgVersion) {
|
|
44
|
+
// We need to read the package.json file manually. We can't import the package.json file using ESM syntax since if we do that
|
|
45
|
+
// TSC would copy the package.json file into "dist" directory.
|
|
46
|
+
// Having a copy of package.json file under "dist" directory would mess-up with the package distribution.
|
|
47
|
+
try {
|
|
48
|
+
const pkg = await fs_1.promises.readFile(path_1.default.join(__dirname, '../../package.json'));
|
|
49
|
+
const { version } = JSON.parse(pkg.toString());
|
|
50
|
+
pkgVersion = version;
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
// eslint-disable-next-line no-empty
|
|
54
|
+
pkgVersion = 'unknown';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
let eventProperties;
|
|
58
|
+
if (isObject(customProperties)) {
|
|
59
|
+
eventProperties = Object.assign({}, customProperties);
|
|
60
|
+
}
|
|
61
|
+
await client.logEvent({
|
|
62
|
+
event_type: eventName,
|
|
63
|
+
device_id: 'required-but-not-used',
|
|
64
|
+
event_properties: eventProperties,
|
|
65
|
+
// Non-required properties
|
|
66
|
+
// https://developers.amplitude.com/docs/http-api-v2
|
|
67
|
+
app_version: pkgVersion,
|
|
68
|
+
platform: os_1.default.platform(),
|
|
69
|
+
os_name: os_1.default.type(),
|
|
70
|
+
os_version: os_1.default.release(),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
exports.trackEvent = trackEvent;
|
|
74
|
+
//# sourceMappingURL=analytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../src/analytics/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AAE,SAAS;QACrB,SAAS,EAAE,uBAAuB;QAClC,gBAAgB,EAAE,eAAe;QAEjC,0BAA0B;QAC1B,oDAAoD;QACpD,WAAW,EAAE,UAAU;QACvB,QAAQ,EAAE,YAAE,CAAC,QAAQ,EAAE;QACvB,OAAO,EAAE,YAAE,CAAC,IAAI,EAAE;QAClB,UAAU,EAAE,YAAE,CAAC,OAAO,EAAE;KACzB,CAAC,CAAC;AACL,CAAC;AAvCD,gCAuCC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trackVerificationStepEvent = exports.TROUBLESHOOTING_COMMAND_PASSED = exports.TROUBLESHOOTING_COMMAND_RUN = void 0;
|
|
4
|
+
const steps_1 = require("../steps");
|
|
5
|
+
const analytics_1 = require("./analytics");
|
|
6
|
+
exports.TROUBLESHOOTING_COMMAND_RUN = 'TROUBLESHOOTING_COMMAND_RUN';
|
|
7
|
+
exports.TROUBLESHOOTING_COMMAND_PASSED = 'TROUBLESHOOTING_COMMAND_PASSED';
|
|
8
|
+
const VERIFICATION_STEP = 'VERIFICATION_STEP';
|
|
9
|
+
async function trackVerificationStepEvent(stepName, validationResult) {
|
|
10
|
+
const eventData = {
|
|
11
|
+
stepName,
|
|
12
|
+
};
|
|
13
|
+
if ((0, steps_1.didFail)(validationResult)) {
|
|
14
|
+
Object.assign(eventData, {
|
|
15
|
+
stepResult: 'FAILED',
|
|
16
|
+
stepError: validationResult.error,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
Object.assign(eventData, {
|
|
21
|
+
stepResult: 'PASSED',
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
await (0, analytics_1.trackEvent)(VERIFICATION_STEP, eventData);
|
|
25
|
+
}
|
|
26
|
+
exports.trackVerificationStepEvent = trackVerificationStepEvent;
|
|
27
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/analytics/events.ts"],"names":[],"mappings":";;;AAAA,oCAAmC;AAEnC,2CAAyC;AAE5B,QAAA,2BAA2B,GAAG,6BAA6B,CAAC;AAC5D,QAAA,8BAA8B,GAAG,gCAAgC,CAAC;AAE/E,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAEvC,KAAK,UAAU,0BAA0B,CAC9C,QAAgB,EAChB,gBAAsE;IAEtE,MAAM,SAAS,GAAG;QAChB,QAAQ;KACT,CAAC;IAEF,IAAI,IAAA,eAAO,EAAC,gBAAgB,CAAC,EAAE;QAC7B,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE;YACvB,UAAU,EAAE,QAAQ;YACpB,SAAS,EAAE,gBAAgB,CAAC,KAAK;SAClC,CAAC,CAAC;KACJ;SAAM;QACL,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE;YACvB,UAAU,EAAE,QAAQ;SACrB,CAAC,CAAC;KACJ;IAED,MAAM,IAAA,sBAAU,EAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;AACjD,CAAC;AApBD,gEAoBC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applicationUrls = void 0;
|
|
4
|
+
// https://developer.atlassian.com/server/framework/atlassian-sdk/working-with-the-sdk/#supported-atlassian-applications-and-default-ports
|
|
5
|
+
exports.applicationUrls = [
|
|
6
|
+
{
|
|
7
|
+
product: 'Bamboo',
|
|
8
|
+
defaultUrl: 'http://localhost:6990/bamboo',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
product: 'Bitbucket',
|
|
12
|
+
defaultUrl: 'http://localhost:7990/bitbucket',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
product: 'Confluence',
|
|
16
|
+
defaultUrl: 'http://localhost:1990/confluence',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
product: 'Crowd',
|
|
20
|
+
defaultUrl: 'http://localhost:4990/crowd',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
product: 'Crucible',
|
|
24
|
+
defaultUrl: 'http://localhost:3990/fecru',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
product: 'FishEye',
|
|
28
|
+
defaultUrl: 'http://localhost:3990/fecru',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
product: 'Jira',
|
|
32
|
+
defaultUrl: 'http://localhost:2990/jira',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
product: 'RefApp',
|
|
36
|
+
defaultUrl: 'http://localhost:5990/refapp',
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
//# sourceMappingURL=applicationUrls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applicationUrls.js","sourceRoot":"","sources":["../src/applicationUrls.ts"],"names":[],"mappings":";;;AAAA,2IAA2I;AAC9H,QAAA,eAAe,GAAuD;IACjF;QACE,OAAO,EAAE,QAAQ;QACjB,UAAU,EAAE,8BAA8B;KAC3C;IACD;QACE,OAAO,EAAE,WAAW;QACpB,UAAU,EAAE,iCAAiC;KAC9C;IACD;QACE,OAAO,EAAE,YAAY;QACrB,UAAU,EAAE,kCAAkC;KAC/C;IACD;QACE,OAAO,EAAE,OAAO;QAChB,UAAU,EAAE,6BAA6B;KAC1C;IACD;QACE,OAAO,EAAE,UAAU;QACnB,UAAU,EAAE,6BAA6B;KAC1C;IACD;QACE,OAAO,EAAE,SAAS;QAClB,UAAU,EAAE,6BAA6B;KAC1C;IACD;QACE,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,4BAA4B;KACzC;IACD;QACE,OAAO,EAAE,QAAQ;QACjB,UAAU,EAAE,8BAA8B;KAC3C;CACO,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFullWebResourceKey = exports.removeOldModuleDescriptors = exports.getGeneratedModuleDescriptorPaths = exports.getPluginWebResourceDefinitions = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const globWithOptions_1 = require("./globWithOptions");
|
|
6
|
+
const pom_1 = require("./pom");
|
|
7
|
+
const xmlParser_1 = require("./xmlParser");
|
|
8
|
+
async function getPluginWebResourceDefinitions(pomFile, pomXml) {
|
|
9
|
+
const generatedXmlPaths = await getGeneratedModuleDescriptorPaths(pomFile, pomXml);
|
|
10
|
+
const wrmWebResources = [];
|
|
11
|
+
for (const xmlFile of generatedXmlPaths) {
|
|
12
|
+
const webResources = await getWebResourcesFromFile(xmlFile);
|
|
13
|
+
if (webResources instanceof Error) {
|
|
14
|
+
return webResources;
|
|
15
|
+
}
|
|
16
|
+
wrmWebResources.push(...webResources);
|
|
17
|
+
}
|
|
18
|
+
return wrmWebResources.sort((a, b) => a.key.localeCompare(b.key));
|
|
19
|
+
}
|
|
20
|
+
exports.getPluginWebResourceDefinitions = getPluginWebResourceDefinitions;
|
|
21
|
+
const WEB_RESOURCE_XML_KEY = 'web-resource';
|
|
22
|
+
async function getWebResourcesFromFile(xmlFile) {
|
|
23
|
+
const xml = await (0, xmlParser_1.parseXmlFromFile)(xmlFile);
|
|
24
|
+
if (xml instanceof Error) {
|
|
25
|
+
return xml;
|
|
26
|
+
}
|
|
27
|
+
const rootKey = Object.keys(xml)[0];
|
|
28
|
+
const project = xml[rootKey][0];
|
|
29
|
+
if (!(WEB_RESOURCE_XML_KEY in project)) {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
const webResourcesXml = project[WEB_RESOURCE_XML_KEY];
|
|
33
|
+
return webResourcesXml.map((webResourceXml) => {
|
|
34
|
+
const webResource = {
|
|
35
|
+
key: webResourceXml.attrs.key,
|
|
36
|
+
};
|
|
37
|
+
return webResource;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async function getGeneratedModuleDescriptorPaths(pomFile, pomXml) {
|
|
41
|
+
const pomScanFolders = (0, pom_1.getAbsoluteScanFoldersConfig)(pomXml, pomFile);
|
|
42
|
+
return getXmlFilesFromDirectory(pomScanFolders);
|
|
43
|
+
}
|
|
44
|
+
exports.getGeneratedModuleDescriptorPaths = getGeneratedModuleDescriptorPaths;
|
|
45
|
+
async function removeOldModuleDescriptors(pomFile, pomXml) {
|
|
46
|
+
const generatedXmlPaths = await getGeneratedModuleDescriptorPaths(pomFile, pomXml);
|
|
47
|
+
// Delete files in parallel
|
|
48
|
+
await Promise.all(generatedXmlPaths.map((filePath) => silentlyDeleteFile(filePath)));
|
|
49
|
+
}
|
|
50
|
+
exports.removeOldModuleDescriptors = removeOldModuleDescriptors;
|
|
51
|
+
async function silentlyDeleteFile(filePath) {
|
|
52
|
+
try {
|
|
53
|
+
await fs_1.promises.unlink(filePath);
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
// gracefully skip the error
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async function getXmlFilesFromDirectory(directory) {
|
|
60
|
+
return await (0, globWithOptions_1.globWithOptions)('**/*.xml', {
|
|
61
|
+
cwd: directory,
|
|
62
|
+
ignore: [], // Remove default ignored directories so we can scan within "target" directory
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function getFullWebResourceKey(pluginKey, webResourceKey) {
|
|
66
|
+
return `${pluginKey}:${webResourceKey}`;
|
|
67
|
+
}
|
|
68
|
+
exports.getFullWebResourceKey = getFullWebResourceKey;
|
|
69
|
+
//# sourceMappingURL=atlassianPluginXml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atlassianPluginXml.js","sourceRoot":"","sources":["../src/atlassianPluginXml.ts"],"names":[],"mappings":";;;AAAA,2BAAoC;AAEpC,uDAAoD;AACpD,+BAAqD;AAErD,2CAA+C;AAMxC,KAAK,UAAU,+BAA+B,CACnD,OAAe,E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C,CAAC,CAAC;AACL,CAAC;AAEM,KAAK,UAAU,iCAAiC,CAAC,OAAe,EAAE,MAAc;IACrF,MAAM,cAAc,GAAG,IAAA,kCAA4B,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAErE,OAAO,wBAAwB,CAAC,cAAc,CAAC,CAAC;AAClD,CAAC;AAJD,8EAIC;AAEM,KAAK,UAAU,0BAA0B,CAAC,OAAe,EAAE,MAAc;IAC9E,MAAM,iBAAiB,GAAG,MAAM,iCAAiC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAEnF,2BAA2B;IAC3B,MAAM,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAgB,CAAC,QAAQ,EAAE,EAAE,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACtG,CAAC;AALD,gEAKC;AAED,KAAK,UAAU,kBAAkB,CAAC,QAAgB;IAChD,IAAI;QACF,MAAM,aAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;KAC3B;IAAC,OAAO,CAAC,EAAE;QACV,4BAA4B;KAC7B;AACH,CAAC;AAED,KAAK,UAAU,wBAAwB,CAAC,SAAiB;IACvD,OAAO,MAAM,IAAA,iCAAe,EAAC,UAAU,EAAE;QACvC,GAAG,EAAE,SAAS;QACd,MAAM,EAAE,EAAE,EAAE,8EAA8E;KAC3F,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,qBAAqB,CAAC,SAAiB,EAAE,cAAsB;IAC7E,OAAO,GAAG,SAAS,IAAI,cAAc,EAAE,CAAC;AAC1C,CAAC;AAFD,sDAEC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.checkForUpdate = void 0;
|
|
26
|
+
const fs = __importStar(require("fs"));
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
const update_notifier_1 = __importDefault(require("update-notifier"));
|
|
29
|
+
function checkForUpdate() {
|
|
30
|
+
if (process.env.NODE_ENV === 'test') {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
let packageVersion = null;
|
|
34
|
+
let packageName = null;
|
|
35
|
+
try {
|
|
36
|
+
const pkg = fs.readFileSync(path.join(__dirname, '../package.json'));
|
|
37
|
+
const { name, version } = JSON.parse(pkg.toString());
|
|
38
|
+
packageVersion = version;
|
|
39
|
+
packageName = name;
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
console.log(e);
|
|
43
|
+
// eslint-disable-next-line no-empty
|
|
44
|
+
}
|
|
45
|
+
if (!packageName || !packageVersion) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const notifier = (0, update_notifier_1.default)({
|
|
49
|
+
packageName,
|
|
50
|
+
packageVersion,
|
|
51
|
+
updateCheckInterval: 0,
|
|
52
|
+
});
|
|
53
|
+
notifier.notify({
|
|
54
|
+
defer: true,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
exports.checkForUpdate = checkForUpdate;
|
|
58
|
+
//# sourceMappingURL=checkForUpdate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkForUpdate.js","sourceRoot":"","sources":["../src/checkForUpdate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,sEAA6C;AAE7C,SAAgB,cAAc;IAC5B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE;QACnC,OAAO;KACR;IAED,IAAI,cAAc,GAAkB,IAAI,CAAC;IACzC,IAAI,WAAW,GAAkB,IAAI,CAAC;IAEtC,IAAI;QACF,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC,CAAC;QACrE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAY,CAAC;QAEhE,cAAc,GAAG,OAAO,CAAC;QACzB,WAAW,GAAG,IAAI,CAAC;KACpB;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACf,oCAAoC;KACrC;IAED,IAAI,CAAC,WAAW,IAAI,CAAC,cAAc,EAAE;QACnC,OAAO;KACR;IAED,MAAM,QAAQ,GAAG,IAAA,yBAAc,EAAC;QAC9B,WAAW;QACX,cAAc;QACd,mBAAmB,EAAE,CAAC;KACvB,CAAC,CAAC;IACH,QAAQ,CAAC,MAAM,CAAC;QACd,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC;AACL,CAAC;AA/BD,wCA+BC"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
/* eslint-disable node/shebang */
|
|
8
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
9
|
+
const checkForUpdate_1 = require("./checkForUpdate");
|
|
10
|
+
const troubleshooting_1 = require("./troubleshooting");
|
|
11
|
+
const troubleshootingOptions_1 = require("./troubleshootingOptions");
|
|
12
|
+
const yargsHelper_1 = require("./yargsHelper");
|
|
13
|
+
// Check for a new version
|
|
14
|
+
(0, checkForUpdate_1.checkForUpdate)();
|
|
15
|
+
yargs_1.default
|
|
16
|
+
.command({
|
|
17
|
+
command: '$0 [options]',
|
|
18
|
+
// @ts-expect-error Yargs throws type errors here
|
|
19
|
+
desc: 'Run troubleshooting for webpack WRM plugin.',
|
|
20
|
+
builder: (yargs) => yargs
|
|
21
|
+
.option('webpack', {
|
|
22
|
+
describe: 'The path to webpack configuration file\ne.g. ./webpack.config.js',
|
|
23
|
+
type: 'string',
|
|
24
|
+
alias: 'w',
|
|
25
|
+
})
|
|
26
|
+
.option('pom', {
|
|
27
|
+
describe: 'The path to pom.xml file\ne.g. ./pom.xml',
|
|
28
|
+
type: 'string',
|
|
29
|
+
alias: 'p',
|
|
30
|
+
})
|
|
31
|
+
.option('applicationUrl', {
|
|
32
|
+
describe: 'Full application URL we will use to verify WRM runtime\ne.g. http://localhost:2990/jira',
|
|
33
|
+
type: 'string',
|
|
34
|
+
alias: 'u',
|
|
35
|
+
})
|
|
36
|
+
.option('resourceKey', {
|
|
37
|
+
describe: 'A web-resource key we will use to verify WRM runtime\ne.g. name-of-my-web-resource-key',
|
|
38
|
+
type: 'string',
|
|
39
|
+
alias: 'r',
|
|
40
|
+
})
|
|
41
|
+
.option('noWrm', {
|
|
42
|
+
describe: 'Skip running in-app WRM check',
|
|
43
|
+
type: 'boolean',
|
|
44
|
+
alias: 'nw',
|
|
45
|
+
default: false,
|
|
46
|
+
})
|
|
47
|
+
.option('yes', {
|
|
48
|
+
describe: 'Skip confirmation and run troubleshooting immediately',
|
|
49
|
+
type: 'boolean',
|
|
50
|
+
alias: 'y',
|
|
51
|
+
default: false,
|
|
52
|
+
})
|
|
53
|
+
.option('verbose', {
|
|
54
|
+
describe: 'Display verbose output',
|
|
55
|
+
type: 'boolean',
|
|
56
|
+
alias: 'v',
|
|
57
|
+
default: false,
|
|
58
|
+
})
|
|
59
|
+
.option('timeout', {
|
|
60
|
+
describe: 'A timeout in seconds for executing external commands.',
|
|
61
|
+
type: 'number',
|
|
62
|
+
alias: 't',
|
|
63
|
+
default: troubleshootingOptions_1.DEFAULT_TIMEOUT,
|
|
64
|
+
// Convert the seconds to milliseconds
|
|
65
|
+
coerce(seconds) {
|
|
66
|
+
if (!seconds || Number.isNaN(seconds) || seconds < 1) {
|
|
67
|
+
seconds = troubleshootingOptions_1.DEFAULT_TIMEOUT;
|
|
68
|
+
}
|
|
69
|
+
return seconds * 1000;
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
handler: (0, yargsHelper_1.getAsyncHandler)(troubleshooting_1.troubleshootingCommand),
|
|
73
|
+
})
|
|
74
|
+
.strict()
|
|
75
|
+
.help().argv; // for --help and -h to work
|
|
76
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;AACA,iCAAiC;AACjC,kDAA0B;AAE1B,qDAAkD;AAElD,uDAA2D;AAC3D,qEAA2D;AAC3D,+CAAgD;AAEhD,0BAA0B;AAC1B,IAAA,+BAAc,GAAE,CAAC;AAEjB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K,CAAC,OAAO,CAAC,IAAI,OAAO,GAAG,CAAC,EAAE;gBACpD,OAAO,GAAG,wCAAe,CAAC;aAC3B;YAED,OAAO,OAAO,GAAG,IAAI,CAAC;QACxB,CAAC;KACF,CAAC;IACN,OAAO,EAAE,IAAA,6BAAe,EAAyB,wCAAsB,CAAC;CACzE,CAAC;KACD,MAAM,EAAE;KACR,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,4BAA4B"}
|
package/dist/cliUtils.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.cliLink = void 0;
|
|
7
|
+
const cli_truncate_1 = __importDefault(require("cli-truncate"));
|
|
8
|
+
const terminal_link_1 = __importDefault(require("terminal-link"));
|
|
9
|
+
// Decrease the output size by 10% to avoid spanning the url link across full terminal width.
|
|
10
|
+
// We do that because a) the URLs can be quite long b) we indent the URLs when we display them in the terminal.
|
|
11
|
+
const maxColumns = process.stdout.columns - Math.floor(process.stdout.columns / 10);
|
|
12
|
+
function cliLink(url, label = url) {
|
|
13
|
+
const shortLabel = (0, cli_truncate_1.default)(label, maxColumns, { position: 'middle' });
|
|
14
|
+
return (0, terminal_link_1.default)(shortLabel, url, {
|
|
15
|
+
fallback(text, url) {
|
|
16
|
+
return url;
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
exports.cliLink = cliLink;
|
|
21
|
+
//# sourceMappingURL=cliUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliUtils.js","sourceRoot":"","sources":["../src/cliUtils.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAuC;AACvC,kEAAyC;AAEzC,6FAA6F;AAC7F,+GAA+G;AAC/G,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;AAEpF,SAAgB,OAAO,CAAC,GAAW,EAAE,QAAgB,GAAG;IACtD,MAAM,UAAU,GAAG,IAAA,sBAAW,EAAC,KAAK,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;IAE1E,OAAO,IAAA,uBAAY,EAAC,UAAU,EAAE,GAAG,EAAE;QACnC,QAAQ,CAAC,IAAI,EAAE,GAAG;YAChB,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AARD,0BAQC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.globWithOptions = void 0;
|
|
7
|
+
const glob_promise_1 = __importDefault(require("glob-promise"));
|
|
8
|
+
const DEFAULT_IGNORED = ['**/node_modules/**', '**/target/**', '**/dist/**'];
|
|
9
|
+
async function globWithOptions(pattern, options = {}) {
|
|
10
|
+
return (0, glob_promise_1.default)(pattern, {
|
|
11
|
+
nodir: true,
|
|
12
|
+
ignore: DEFAULT_IGNORED,
|
|
13
|
+
absolute: true,
|
|
14
|
+
...options,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
exports.globWithOptions = globWithOptions;
|
|
18
|
+
//# sourceMappingURL=globWithOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globWithOptions.js","sourceRoot":"","sources":["../src/globWithOptions.ts"],"names":[],"mappings":";;;;;;AACA,gEAAgC;AAEhC,MAAM,eAAe,GAAG,CAAC,oBAAoB,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;AAEtE,KAAK,UAAU,eAAe,CAAC,OAAe,EAAE,UAAoB,EAAE;IAC3E,OAAO,IAAA,sBAAI,EAAC,OAAO,EAAE;QACnB,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,eAAe;QACvB,QAAQ,EAAE,IAAI;QACd,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC;AAPD,0CAOC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MavenError = void 0;
|
|
4
|
+
class MavenError extends Error {
|
|
5
|
+
constructor(message, mavenOutput) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.mavenOutput = mavenOutput;
|
|
8
|
+
}
|
|
9
|
+
getMavenOutput() {
|
|
10
|
+
return this.mavenOutput;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.MavenError = MavenError;
|
|
14
|
+
//# sourceMappingURL=MavenError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MavenError.js","sourceRoot":"","sources":["../../src/maven/MavenError.ts"],"names":[],"mappings":";;;AAAA,MAAa,UAAW,SAAQ,KAAK;IAGnC,YAAY,OAAe,EAAE,WAAmB;QAC9C,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF;AAZD,gCAYC"}
|
package/dist/paths.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSubDirectory = exports.getRelativePath = void 0;
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const getRelativePath = (location) => path.relative(process.cwd(), location);
|
|
6
|
+
exports.getRelativePath = getRelativePath;
|
|
7
|
+
const isSubDirectory = (parent, child) => {
|
|
8
|
+
const relative = path.relative(parent, child);
|
|
9
|
+
return Boolean(relative && !relative.startsWith('..') && !path.isAbsolute(relative));
|
|
10
|
+
};
|
|
11
|
+
exports.isSubDirectory = isSubDirectory;
|
|
12
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":";;;AAAA,6BAA8B;AAEvB,MAAM,eAAe,GAAG,CAAC,QAAgB,EAAU,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;AAAvF,QAAA,eAAe,mBAAwE;AAE7F,MAAM,cAAc,GAAG,CAAC,MAAc,EAAE,KAAa,EAAW,EAAE;IACvE,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAE9C,OAAO,OAAO,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;AACvF,CAAC,CAAC;AAJW,QAAA,cAAc,kBAIzB"}
|
package/dist/pom.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getAtlassianPluginKeyFromPom = exports.getAbsoluteScanFoldersConfig = exports.getScanFoldersConfig = exports.getPomXml = exports.askForPomXmlFile = exports.confirmRootPomFile = exports.findRootPomXmlFile = exports.SCAN_FOLDERS_KEY = void 0;
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
11
|
+
const inquirer_autocomplete_prompt_1 = __importDefault(require("inquirer-autocomplete-prompt"));
|
|
12
|
+
const lodash_get_1 = __importDefault(require("lodash.get"));
|
|
13
|
+
const globWithOptions_1 = require("./globWithOptions");
|
|
14
|
+
const paths_1 = require("./paths");
|
|
15
|
+
const xmlParser_1 = require("./xmlParser");
|
|
16
|
+
inquirer_1.default.registerPrompt('autocomplete', inquirer_autocomplete_prompt_1.default);
|
|
17
|
+
const POM_FILE_PATTERN = 'pom.xml';
|
|
18
|
+
const POM_FILE_GLOB_PATTERN = `**/${POM_FILE_PATTERN}`;
|
|
19
|
+
exports.SCAN_FOLDERS_KEY = 'Atlassian-Scan-Folders';
|
|
20
|
+
async function findRootPomXmlFile() {
|
|
21
|
+
const [rootPomFile] = await (0, globWithOptions_1.globWithOptions)(POM_FILE_PATTERN);
|
|
22
|
+
return rootPomFile;
|
|
23
|
+
}
|
|
24
|
+
exports.findRootPomXmlFile = findRootPomXmlFile;
|
|
25
|
+
async function confirmRootPomFile(pomFile, rootPomFileFound) {
|
|
26
|
+
const answers = await inquirer_1.default.prompt({
|
|
27
|
+
type: 'confirm',
|
|
28
|
+
name: 'confirmRootPomFile',
|
|
29
|
+
message: `We have found ${rootPomFileFound ? 'a root ' : ''}pom file at "${chalk_1.default.green((0, paths_1.getRelativePath)(pomFile))}". Is it the file we should be using now?`,
|
|
30
|
+
});
|
|
31
|
+
if (answers.confirmRootPomFile) {
|
|
32
|
+
return pomFile;
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
exports.confirmRootPomFile = confirmRootPomFile;
|
|
37
|
+
async function askToSelectPomFile(fileLocations) {
|
|
38
|
+
const answers = await inquirer_1.default.prompt({
|
|
39
|
+
// @ts-expect-error We are using inquirer plugin that is causing TS error
|
|
40
|
+
type: 'autocomplete',
|
|
41
|
+
name: 'pomLocation',
|
|
42
|
+
message: 'Select a pom.xml file you want to use:',
|
|
43
|
+
source: (answersSoFar, input) => {
|
|
44
|
+
const userInput = input || '';
|
|
45
|
+
return fileLocations
|
|
46
|
+
.filter((fileLocation) => fileLocation.match(new RegExp(userInput, 'i')))
|
|
47
|
+
.map((fileLocation) => ({
|
|
48
|
+
name: (0, paths_1.getRelativePath)(fileLocation),
|
|
49
|
+
value: fileLocation,
|
|
50
|
+
}));
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
return answers.pomLocation;
|
|
54
|
+
}
|
|
55
|
+
async function askForPomFileLocation() {
|
|
56
|
+
const hasPomFileAnswers = await inquirer_1.default.prompt({
|
|
57
|
+
type: 'confirm',
|
|
58
|
+
name: 'hasPomFile',
|
|
59
|
+
message: 'Have you correctly set up and configured the Java project?',
|
|
60
|
+
});
|
|
61
|
+
if (!hasPomFileAnswers.hasPomFile) {
|
|
62
|
+
return new Error("The Java project wasn't configured.");
|
|
63
|
+
}
|
|
64
|
+
const answers = await inquirer_1.default.prompt({
|
|
65
|
+
type: 'input',
|
|
66
|
+
name: 'pomLocation',
|
|
67
|
+
message: 'Please provide a path to a pom config file you want to use:',
|
|
68
|
+
async validate(input) {
|
|
69
|
+
try {
|
|
70
|
+
await fs_1.promises.access(input);
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
// eslint-disable-next-line no-empty
|
|
75
|
+
}
|
|
76
|
+
return 'Cannot find or read the file from provided path. Please correct the file path.';
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
return answers.pomLocation;
|
|
80
|
+
}
|
|
81
|
+
async function askForPomXmlFile(rooPomFileFound) {
|
|
82
|
+
if (!rooPomFileFound) {
|
|
83
|
+
console.log("We couldn't find a pom.xml file in root directory of your project. ");
|
|
84
|
+
}
|
|
85
|
+
let pomLocation;
|
|
86
|
+
console.log('We are now looking for the pom.xml files in your project...');
|
|
87
|
+
const fileLocations = await (0, globWithOptions_1.globWithOptions)(POM_FILE_GLOB_PATTERN);
|
|
88
|
+
// We have found some files that are looking like potential pom files
|
|
89
|
+
if (fileLocations.length) {
|
|
90
|
+
pomLocation = await askToSelectPomFile(fileLocations);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
console.log("We couldn't locate any files that look like pom.xml files in this project.");
|
|
94
|
+
pomLocation = await askForPomFileLocation();
|
|
95
|
+
}
|
|
96
|
+
return pomLocation;
|
|
97
|
+
}
|
|
98
|
+
exports.askForPomXmlFile = askForPomXmlFile;
|
|
99
|
+
function getPomXml(pomContent) {
|
|
100
|
+
const xml = (0, xmlParser_1.parseXmlContent)(pomContent);
|
|
101
|
+
if (xml instanceof Error) {
|
|
102
|
+
return xml;
|
|
103
|
+
}
|
|
104
|
+
return xml;
|
|
105
|
+
}
|
|
106
|
+
exports.getPomXml = getPomXml;
|
|
107
|
+
function getScanFoldersConfig(pomXml) {
|
|
108
|
+
const pluginsPath = ['project', 'build', 'plugins'];
|
|
109
|
+
const InstructionsPath = ['configuration', 'instructions'];
|
|
110
|
+
// We are using the above JSON Paths to access the XML nodes from the POM file. The "0" is pointing to the first element in the array.
|
|
111
|
+
// This convention is enforced by the structure of the parsed XML file.
|
|
112
|
+
const buildPluginsXmlPath = pluginsPath.flatMap((key) => [key, '0']);
|
|
113
|
+
const instructionsXmlPath = InstructionsPath.flatMap((key) => [key, '0']);
|
|
114
|
+
// Get array of build plugins
|
|
115
|
+
const buildPlugins = (0, lodash_get_1.default)(pomXml, buildPluginsXmlPath).plugin;
|
|
116
|
+
// Check if the build plugin contains scan folders setting
|
|
117
|
+
const scanFoldersValues = buildPlugins
|
|
118
|
+
.map((buildPlugin) => {
|
|
119
|
+
const instructions = (0, lodash_get_1.default)(buildPlugin, instructionsXmlPath);
|
|
120
|
+
return instructions ? instructions[exports.SCAN_FOLDERS_KEY] : undefined;
|
|
121
|
+
})
|
|
122
|
+
.filter(notEmpty);
|
|
123
|
+
// TODO: We are going to assume we have a single value here. yolo.
|
|
124
|
+
return Array.isArray(scanFoldersValues) && scanFoldersValues.length ? scanFoldersValues[0] : null;
|
|
125
|
+
}
|
|
126
|
+
exports.getScanFoldersConfig = getScanFoldersConfig;
|
|
127
|
+
function getAbsoluteScanFoldersConfig(pomXml, pomFile) {
|
|
128
|
+
const scanFolders = getScanFoldersConfig(pomXml);
|
|
129
|
+
const projectDir = path.resolve(path.dirname(pomFile));
|
|
130
|
+
// @ts-expect-error We should handle the null value
|
|
131
|
+
return path.join(projectDir, 'target', 'classes', scanFolders);
|
|
132
|
+
}
|
|
133
|
+
exports.getAbsoluteScanFoldersConfig = getAbsoluteScanFoldersConfig;
|
|
134
|
+
const getProject = (pomXml) => {
|
|
135
|
+
const project = pomXml['project'];
|
|
136
|
+
return project[0];
|
|
137
|
+
};
|
|
138
|
+
const getAtlassianPluginKeyFromPom = (pomXml) => {
|
|
139
|
+
// Naively construct the full plugin key
|
|
140
|
+
const { artifactId, groupId } = getProject(pomXml);
|
|
141
|
+
return `${groupId}.${artifactId}`;
|
|
142
|
+
};
|
|
143
|
+
exports.getAtlassianPluginKeyFromPom = getAtlassianPluginKeyFromPom;
|
|
144
|
+
function notEmpty(value) {
|
|
145
|
+
return value !== null && value !== undefined;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=pom.js.map
|
package/dist/pom.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pom.js","sourceRoot":"","sources":["../src/pom.ts"],"names":[],"mappings":";;;;;;AAAA,6BAA8B;AAC9B,kDAA0B;AAC1B,2BAAoC;AACpC,wDAAgC;AAChC,gGAAsE;AACtE,4DAA6B;AAE7B,uDAAoD;AACpD,mCAA0C;AAE1C,2CAA8C;AAE9C,kBAAQ,CAAC,cAAc,CAAC,cAAc,EAAE,sCAA0B,CAAC,CAAC;AAEpE,MAAM,gBAAgB,GAAG,SAAS,CAAC;AACnC,MAAM,qBAAqB,GAAG,MAAM,gBAAgB,EAAE,CAAC;AAE1C,QAAA,gBA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