dcdx 1.2.0-next.5 → 1.2.0-next.6
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/assets/{quickreload-5.0.2.jar → quickreload-5.0.4.jar} +0 -0
- package/assets/versions.json +1 -1
- package/lib/commands/build.js +1 -1
- package/lib/commands/reset/bamboo.js +1 -1
- package/lib/commands/reset/bitbucket.js +1 -1
- package/lib/commands/reset/command.js +2 -0
- package/lib/commands/reset/confluence.js +1 -1
- package/lib/commands/reset/jira.js +1 -1
- package/lib/commands/reset.js +1 -1
- package/lib/commands/run/bamboo.js +1 -1
- package/lib/commands/run/bitbucket.js +1 -1
- package/lib/commands/run/command.js +2 -0
- package/lib/commands/run/confluence.js +1 -1
- package/lib/commands/run/jira.js +1 -1
- package/lib/commands/start.js +1 -1
- package/lib/commands/stop/bamboo.js +1 -1
- package/lib/commands/stop/bitbucket.js +1 -1
- package/lib/commands/stop/command.js +2 -0
- package/lib/commands/stop/confluence.js +1 -1
- package/lib/commands/stop/jira.js +1 -1
- package/lib/index.js +1 -1
- package/lib/types/src/commands/reset/command.d.ts +3 -0
- package/lib/types/src/commands/run/command.d.ts +3 -0
- package/lib/types/src/commands/stop/command.d.ts +3 -0
- package/package.json +1 -1
package/lib/commands/reset.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{program as e,Option as t}from"commander";import{DOMParser as a,XMLSerializer as o}from"@xmldom/xmldom";import{spawn as r}from"child_process";import{XMLParser as n}from"fast-xml-parser";import{existsSync as s,readFileSync as i}from"fs";import{cwd as c}from"process";import l from"xpath";import{hideBin as m}from"yargs/helpers";import p from"yargs/yargs";var d;!function(e){e.JIRA="jira",e.CONFLUENCE="confluence",e.BITBUCKET="bitbucket",e.BAMBOO="bamboo"}(d||(d={}));const{P:u,activeProfiles:f}=p(m(process.argv)).parseSync(),g=u||f||void 0;class AMPS{static maven;static stop(){AMPS.maven&&S.maven.kill(0)}static async build(e){return new Promise(((t,a)=>{if(AMPS.maven){AMPS.maven.kill(0)||a(new Error("Failed to terminate existing Maven process"))}AMPS.maven=r("mvn",["package",...e],{cwd:c(),stdio:"inherit"}),AMPS.maven.on("exit",(e=>{AMPS.maven=null,0===e||130===e?t():a(new Error(`Maven exited with code ${e}`))}))}))}static isAtlassianPlugin=()=>{try{return AMPS.getNodes("//*[local-name()='packaging']").some((e=>"atlassian-plugin"===e.textContent))}catch(e){return!1}};static getApplicationVersion(){const e=g?AMPS.getNodes(`//*[local-name()='profile']/*[local-name()='id' and text()='${g}']/..//*[local-name()='groupId' and text()='com.atlassian.maven.plugins']`,!0):AMPS.getNodes("//*[local-name()='groupId' and text()='com.atlassian.maven.plugins']",!0);if(e){const t=e.parentNode;if(t){const{plugin:e}=AMPS.toObject(t),a=e?.configuration?.productVersion;return a?this.doPropertyReplacement(a):void 0}}}static getApplication(){const e=AMPS.getApplications();if(1===e.length)return e[0];if(g){const e=AMPS.getApplications(g);if(1===e.length)return e[0]}return null}static getApplications(e){const t=new Set;return(e?AMPS.getNodes(`//*[local-name()='profile']/*[local-name()='id' and text()='${e}']/..//*[local-name()='groupId' and text()='com.atlassian.maven.plugins']`):AMPS.getNodes("//*[local-name()='groupId' and text()='com.atlassian.maven.plugins']")).forEach((e=>{const a=e.parentNode;if(a){const{plugin:e}=AMPS.toObject(a);e?.artifactId?.includes(d.JIRA)?t.add(d.JIRA):e?.artifactId?.includes(d.CONFLUENCE)?t.add(d.CONFLUENCE):e?.artifactId?.includes(d.BAMBOO)?t.add(d.BAMBOO):e?.artifactId?.includes(d.BITBUCKET)&&t.add(d.BITBUCKET)}})),Array.from(t)}static doPropertyReplacement(e){let t=e;const a=g?AMPS.getProperties(g):{};Object.entries(a).forEach((([e,a])=>{t=t.replaceAll(`\${${e}}`,a)}));const o=AMPS.getProperties();return Object.entries(o).forEach((([e,a])=>{t=t.replaceAll(`\${${e}}`,a)})),t}static getProperties(e){const t={};return(e?AMPS.getNodes(`//*[local-name()='profile']/*[local-name()='id' and text()='${e}']/..//*[local-name()='properties']`):AMPS.getNodes("//*[local-name()='properties']")).forEach((e=>{const{properties:a}=AMPS.toObject(e);Object.entries(a).forEach((([e,a])=>t[e]=a))})),t}static getNodes(e,t){if(s("./pom.xml")){const o=i("./pom.xml","utf8"),r=(new a).parseFromString(o,"text/xml"),n=t?l.select(e,r,!0):l.select(e,r,!1);return Array.isArray(n)||t?n:[]}return[]}static toObject(e){try{return(new n).parse((new o).serializeToString(e))}catch(e){return null}}}if(!process.argv.some((e=>Object.values(d).includes(e)))){const e=AMPS.getApplication();if(e){const t=[e,...process.argv.splice(2)];process.argv=[...process.argv.slice(0,2),...t]}}e.name("dcdx reset").addOption(new t("-P, --activate-profiles <arg>","Comma-delimited list of profiles to activate")).command("bamboo","Remove all data (incl. database) for Atlassian Bamboo (standalone)",{executableFile:"./reset
|
|
2
|
+
import{program as e,Option as t}from"commander";import{DOMParser as a,XMLSerializer as o}from"@xmldom/xmldom";import{spawn as r}from"child_process";import{XMLParser as n}from"fast-xml-parser";import{existsSync as s,readFileSync as i}from"fs";import{cwd as c}from"process";import l from"xpath";import{hideBin as m}from"yargs/helpers";import p from"yargs/yargs";var d;!function(e){e.JIRA="jira",e.CONFLUENCE="confluence",e.BITBUCKET="bitbucket",e.BAMBOO="bamboo"}(d||(d={}));const{P:u,activeProfiles:f}=p(m(process.argv)).parseSync(),g=u||f||void 0;class AMPS{static maven;static stop(){AMPS.maven&&S.maven.kill(0)}static async build(e){return new Promise(((t,a)=>{if(AMPS.maven){AMPS.maven.kill(0)||a(new Error("Failed to terminate existing Maven process"))}AMPS.maven=r("mvn",["package",...e],{cwd:c(),stdio:"inherit"}),AMPS.maven.on("exit",(e=>{AMPS.maven=null,0===e||130===e?t():a(new Error(`Maven exited with code ${e}`))}))}))}static isAtlassianPlugin=()=>{try{return AMPS.getNodes("//*[local-name()='packaging']").some((e=>"atlassian-plugin"===e.textContent))}catch(e){return!1}};static getApplicationVersion(){const e=g?AMPS.getNodes(`//*[local-name()='profile']/*[local-name()='id' and text()='${g}']/..//*[local-name()='groupId' and text()='com.atlassian.maven.plugins']`,!0):AMPS.getNodes("//*[local-name()='groupId' and text()='com.atlassian.maven.plugins']",!0);if(e){const t=e.parentNode;if(t){const{plugin:e}=AMPS.toObject(t),a=e?.configuration?.productVersion;return a?this.doPropertyReplacement(a):void 0}}}static getApplication(){const e=AMPS.getApplications();if(1===e.length)return e[0];if(g){const e=AMPS.getApplications(g);if(1===e.length)return e[0]}return null}static getApplications(e){const t=new Set;return(e?AMPS.getNodes(`//*[local-name()='profile']/*[local-name()='id' and text()='${e}']/..//*[local-name()='groupId' and text()='com.atlassian.maven.plugins']`):AMPS.getNodes("//*[local-name()='groupId' and text()='com.atlassian.maven.plugins']")).forEach((e=>{const a=e.parentNode;if(a){const{plugin:e}=AMPS.toObject(a);e?.artifactId?.includes(d.JIRA)?t.add(d.JIRA):e?.artifactId?.includes(d.CONFLUENCE)?t.add(d.CONFLUENCE):e?.artifactId?.includes(d.BAMBOO)?t.add(d.BAMBOO):e?.artifactId?.includes(d.BITBUCKET)&&t.add(d.BITBUCKET)}})),Array.from(t)}static doPropertyReplacement(e){let t=e;const a=g?AMPS.getProperties(g):{};Object.entries(a).forEach((([e,a])=>{t=t.replaceAll(`\${${e}}`,a)}));const o=AMPS.getProperties();return Object.entries(o).forEach((([e,a])=>{t=t.replaceAll(`\${${e}}`,a)})),t}static getProperties(e){const t={};return(e?AMPS.getNodes(`//*[local-name()='profile']/*[local-name()='id' and text()='${e}']/..//*[local-name()='properties']`):AMPS.getNodes("//*[local-name()='properties']")).forEach((e=>{const{properties:a}=AMPS.toObject(e);Object.entries(a).forEach((([e,a])=>t[e]=a))})),t}static getNodes(e,t){if(s("./pom.xml")){const o=i("./pom.xml","utf8"),r=(new a).parseFromString(o,"text/xml"),n=t?l.select(e,r,!0):l.select(e,r,!1);return Array.isArray(n)||t?n:[]}return[]}static toObject(e){try{return(new n).parse((new o).serializeToString(e))}catch(e){return null}}}if(!process.argv.some((e=>Object.values(d).includes(e)))){const e=AMPS.getApplication();if(e){const t=[e,...process.argv.splice(2)];process.argv=[...process.argv.slice(0,2),...t]}}e.name("dcdx reset").addOption(new t("-P, --activate-profiles <arg>","Comma-delimited list of profiles to activate")).command("bamboo","Remove all data (incl. database) for Atlassian Bamboo (standalone)",{executableFile:"./reset/bamboo.js"}).command("bitbucket","Remove all data (incl. database) for Atlassian Bitbucket (standalone)",{executableFile:"./reset/bitbucket.js"}).command("confluence","Remove all data (incl. database) for Atlassian Confluence (standalone)",{executableFile:"./reset/confluence.js"}).command("jira","Remove all data (incl. database) for Atlassian Jira (standalone)",{executableFile:"./reset/jira.js"}).showHelpAfterError(!0),e.parse(process.argv);
|