@elo/elo-cli 1.0.2

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.
@@ -0,0 +1,5 @@
1
+ "use strict";const C=require("node:crypto"),m=require("node:fs"),L=require("node:fs/promises"),w=require("path"),S=10,H=(t=0)=>e=>`\x1B[${e+t}m`,I=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,F=(t=0)=>(e,n,r)=>`\x1B[${38+t};2;${e};${n};${r}m`,l={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(l.modifier);const k=Object.keys(l.color),_=Object.keys(l.bgColor);[...k,..._];function D(){const t=new Map;for(const[e,n]of Object.entries(l)){for(const[r,i]of Object.entries(n))l[r]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[r]=l[r],t.set(i[0],i[1]);Object.defineProperty(l,e,{value:n,enumerable:!1})}return Object.defineProperty(l,"codes",{value:t,enumerable:!1}),l.color.close="\x1B[39m",l.bgColor.close="\x1B[49m",l.color.ansi=H(),l.color.ansi256=I(),l.color.ansi16m=F(),l.bgColor.ansi=H(S),l.bgColor.ansi256=I(S),l.bgColor.ansi16m=F(S),Object.defineProperties(l,{rgbToAnsi256:{value(e,n,r){return e===n&&n===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},enumerable:!1},hexToRgb:{value(e){const n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!n)return[0,0,0];let[r]=n;r.length===3&&(r=[...r].map(a=>a+a).join(""));const i=Number.parseInt(r,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>l.rgbToAnsi256(...l.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let n,r,i;if(e>=232)n=((e-232)*10+8)/255,r=n,i=n;else{e-=16;const B=e%36;n=Math.floor(e/36)/5,r=Math.floor(B/6)/5,i=B%6/5}const a=Math.max(n,r,i)*2;if(a===0)return 30;let h=30+(Math.round(i)<<2|Math.round(r)<<1|Math.round(n));return a===2&&(h+=60),h},enumerable:!1},rgbToAnsi:{value:(e,n,r)=>l.ansi256ToAnsi(l.rgbToAnsi256(e,n,r)),enumerable:!1},hexToAnsi:{value:e=>l.ansi256ToAnsi(l.hexToAnsi256(e)),enumerable:!1}}),l}const c=D(),$=(()=>{if(!("navigator"in globalThis))return 0;if(globalThis.navigator.userAgentData){const t=navigator.userAgentData.brands.find(({brand:e})=>e==="Chromium");if(t&&t.version>93)return 3}return/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)?1:0})(),j=$!==0&&{level:$},q={stdout:j,stderr:j};function K(t,e,n){let r=t.indexOf(e);if(r===-1)return t;const i=e.length;let a=0,h="";do h+=t.slice(a,r)+e+n,a=r+i,r=t.indexOf(e,a);while(r!==-1);return h+=t.slice(a),h}function X(t,e,n,r){let i=0,a="";do{const h=t[r-1]==="\r";a+=t.slice(i,h?r-1:r)+e+(h?`\r
2
+ `:`
3
+ `)+n,i=r+1,r=t.indexOf(`
4
+ `,i)}while(r!==-1);return a+=t.slice(i),a}const{stdout:U,stderr:M}=q,N=Symbol("GENERATOR"),d=Symbol("STYLER"),E=Symbol("IS_EMPTY"),W=["ansi","ansi","ansi256","ansi16m"],g=Object.create(null),V=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const n=U?U.level:0;t.level=e.level===void 0?n:e.level},Z=t=>{const e=(...n)=>n.join(" ");return V(e,t),Object.setPrototypeOf(e,p.prototype),e};function p(t){return Z(t)}Object.setPrototypeOf(p.prototype,Function.prototype);for(const[t,e]of Object.entries(c))g[t]={get(){const n=T(this,x(e.open,e.close,this[d]),this[E]);return Object.defineProperty(this,t,{value:n}),n}};g.visible={get(){const t=T(this,this[d],!0);return Object.defineProperty(this,"visible",{value:t}),t}};const P=(t,e,n,...r)=>t==="rgb"?e==="ansi16m"?c[n].ansi16m(...r):e==="ansi256"?c[n].ansi256(c.rgbToAnsi256(...r)):c[n].ansi(c.rgbToAnsi(...r)):t==="hex"?P("rgb",e,n,...c.hexToRgb(...r)):c[n][t](...r),Q=["rgb","hex","ansi256"];for(const t of Q){g[t]={get(){const{level:n}=this;return function(...r){const i=x(P(t,W[n],"color",...r),c.color.close,this[d]);return T(this,i,this[E])}}};const e="bg"+t[0].toUpperCase()+t.slice(1);g[e]={get(){const{level:n}=this;return function(...r){const i=x(P(t,W[n],"bgColor",...r),c.bgColor.close,this[d]);return T(this,i,this[E])}}}}const ee=Object.defineProperties(()=>{},{...g,level:{enumerable:!0,get(){return this[N].level},set(t){this[N].level=t}}}),x=(t,e,n)=>{let r,i;return n===void 0?(r=t,i=e):(r=n.openAll+t,i=e+n.closeAll),{open:t,close:e,openAll:r,closeAll:i,parent:n}},T=(t,e,n)=>{const r=(...i)=>te(r,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(r,ee),r[N]=t,r[d]=e,r[E]=n,r},te=(t,e)=>{if(t.level<=0||!e)return t[E]?"":e;let n=t[d];if(n===void 0)return e;const{openAll:r,closeAll:i}=n;if(e.includes("\x1B"))for(;n!==void 0;)e=K(e,n.close,n.open),n=n.parent;const a=e.indexOf(`
5
+ `);return a!==-1&&(e=X(e,i,r,a)),r+e+i};Object.defineProperties(p.prototype,g);const v=p();p({level:M?M.level:0});const f={HELPER:{CRYPTKEY:"NW7jFhExSLRtwtZWvMq9HKGb3yZTPS89d4ebEbR7mmWHcuVNYfU9XqJrbBw6Ms2uNTePNBBp67WV7KTe6FeVZNr7rdvGY3ZyjBYTWdNpxuVBKtDEfZRYm7Lqn8BHpNSsQp3tAqEuhva4wKwyTHwdEhx7qSwCAw7qaGxKdSYNqQeRuCCrKzDjX4URvAFmreTtruVrj88EBznS4CPeDHqnCsF6YAg2sSm9JyRgtCTwgGaQ6uFgvH8WZ6X4Hefvj8nZ",DEPRECATED_ENCRYPTION:"The settings file uses an old, deprecated encryption. Please update the settings file using 'elo setup'.",EMPTYPATH:"The file could not be located in the specified path.",NOPATH:"The specified path does not exist.",PATH_NOT_EXIST:"%s does not exist!"}};var o=(t=>(t.INFO="INFO",t.WARN="WARN",t.ERROR="ERROR",t.DEFAULT="",t))(o||{});const ne=1;process.env.ELOBUILDSETTINGSPATH=`${process.env[process.platform==="win32"?"USERPROFILE":"HOME"]}/.elo-cli-settings.json`;const u=process.env.ELOBUILDSETTINGSPATH,re=f.HELPER.CRYPTKEY;function A(t=""){return t.replace(/\\+/g,"/")}function s(t,e,...n){switch(t){case o.INFO:console.log(v.cyan(` [${t}] ${e}`),...n);break;case o.WARN:console.log(v.yellow(` [${t}] ${e}`),...n);break;case o.ERROR:console.log(v.red(` [${t}] ${e}`),...n);break;case o.DEFAULT:default:console.log(` ${e}`,...n)}}function b(t,e,...n){console.log(v.red(` [${o.ERROR}] ${t}`),...n),e||process.exit(ne)}function ie(t){if(t&&t.value==="4c9cd7706a"&&t.alg==="aes-256-ctr")return s(o.WARN,f.HELPER.DEPRECATED_ENCRYPTION),"elo";const e=C.createHash("sha256").update(re).digest(),n=C.createDecipheriv("aes-256-ctr",e,Buffer.from(t.iv,"hex"));return Buffer.concat([n.update(Buffer.from(t.content,"hex")),n.final()]).toString("utf8")}function Y(t){let e;if(O(t)){if(e=String(J(t)),e!=="")return e;s(o.WARN,f.HELPER.EMPTYPATH)}else s(o.WARN,f.HELPER.NOPATH)}async function G(t){let e;if(await y(t)){if(e=await z(t),e!=="")return e;s(o.WARN,f.HELPER.EMPTYPATH)}else s(o.WARN,f.HELPER.NOPATH)}async function oe(){try{const t=w.resolve(".elo-repository"),e=await be(t);return e.length===0?"NONE":(e.length>1&&s(o.WARN,"Multiple repositories found in .elo-repository. Using the first one found."),e[0].replace(".json",""))}catch(t){return s(o.WARN,`Can not reading .elo-repository directory: ${t}`),"NONE"}}function se(){try{const t=w.resolve(".elo-repository"),e=Re(t);return e.length===0?"NONE":(e.length>1&&s(o.WARN,"Multiple repositories found in .elo-repository. Using the first one found."),String(e[0]).replace(".json",""))}catch(t){return s(o.WARN,`Can not reading .elo-repository directory: ${t}`),"NONE"}}async function le(t){if(t===void 0||t===""){const e="./.elo-current-repository";await y(e)?(t=await G(e),s(o.INFO,`Using archive from file .elo-current-repository: ${t}`)):t=await oe()}return t?.trim()??"ELO_GLOBAL"}function ae(t){if(t===void 0||t===""){const e=w.resolve(".elo-current-repository");O(e)?(t=Y(e),s(o.INFO,`Using archive from file .elo-current-repository: ${t}`)):t=se()}return t?.trim()??"ELO_GLOBAL"}function ce(t){return t=ae(t),s(o.INFO,`testhelpers.init:${t}`),t==="ELO_GLOBAL"?fe():de(t,!0)}async function ue(t){return t=await le(t),s(o.INFO,`testhelpers.init:${t}`),t==="ELO_GLOBAL"?await he():await ge(t,!0)}function fe(t=!1){let e={manifest:{},ixLogin:{adminName:"",adminPw:{content:"",iv:""}}};return O(u)?(s(o.INFO,`path: ${u}`),e=JSON.parse(String(J(u)))):t&&b(f.HELPER.PATH_NOT_EXIST,!1,A(u)),e}async function he(t=!1){let e={manifest:{},ixLogin:{adminName:"",adminPw:{content:"",iv:""}}};return await y(u)?(s(o.INFO,`path: ${u}`),e=JSON.parse(await z(u))):t&&b(f.HELPER.PATH_NOT_EXIST,!1,A(u)),e}function de(t,e=!1){let n={};const r=`./.elo-repository/${t}.json`;return s(o.INFO,`helpers.getArchiveJson:${t}`),O(r)?n=O(r)?JSON.parse(Y(r)):void 0:e&&s(o.ERROR,f.HELPER.PATH_NOT_EXIST,A(u)),n}async function ge(t,e=!1){let n={};const r=`./.elo-repository/${t}.json`;return s(o.INFO,`helpers.getArchiveJson:${t}`),await y(r)?n=await y(r)?JSON.parse(await G(r)):void 0:e&&s(o.ERROR,f.HELPER.PATH_NOT_EXIST,A(u)),n}async function y(t){try{return await L.access(t),!0}catch(e){if(e.code==="ENOENT")return!1;b(e,!0)}return!1}function O(t){try{return m.accessSync(t),!0}catch(e){if(e.code==="ENOENT")return!1;b(e,!0)}return!1}async function z(t){const e=w.resolve(t);return await L.readFile(e,"utf8")}function J(t){return m.readFileSync(t)}async function be(t){return await L.readdir(t,{recursive:!0})}function Re(t){return m.readdirSync(t,{recursive:!0})}let R;class Ee{constructor(e){this.initialized=e?.initialized??!1,this.user=e?.user??"",this.pw=e?.pw?{content:e.pw.content,iv:e.pw.iv}:{content:"",iv:""},this.eloWfUrl=e?.eloWfUrl??"",this.ixUrl=e?.ixUrl??"",this.ixContext=e?.ixContext??"",this.ixServer=e?.ixServer??"",typeof window<"u"&&(window.elo=Object.assign({},window.elo,{data:{server:{}}}))}init(e){return R=ce(e),this.innerInit(R)}async asyncInit(e){return R=await ue(e),this.innerInit(R)}innerInit(e){e||b("No settings available",!1);try{this.eloWfUrl=e.manifest.wfUrl,this.ixUrl=e.ixUrl,this.user=e.ixLogin.adminName,this.pw={content:e.ixLogin.adminPw.content,iv:e.ixLogin.adminPw.iv,alg:e.ixLogin.adminPw.alg,value:e.ixLogin.adminPw.value};const n=new URL(this.ixUrl),r=n.pathname.split("/").filter(Boolean);return this.ixContext=`/${r[0]}`,this.ixServer=`${n.protocol}//${n.hostname}${n.port?":"+n.port:""}`,this.initialized=!0,s(o.INFO,"TestHelper initialized"),e}catch(n){s(o.ERROR,"Error reading settings"),b(n,!0)}}initLang(e){typeof window<"u"&&(window.elo=Object.assign({},window.elo,{data:{server:{}}}),window.elo.data.server.language=e||R.manifest.defaultLanguage||"de")}getUser(){return this.initialized?this.user:(s(o.ERROR,"testHelper not initialized!"),"")}getPw(){return this.initialized?ie(this.pw):(s(o.ERROR,"testHelper not initialized!"),"")}getIxUrl(){return this.initialized?this.ixUrl:(s(o.ERROR,"testHelper not initialized!"),"")}getIxContext(){return this.initialized?this.ixContext:(s(o.ERROR,"testHelper not initialized!"),"")}getIxServer(){return this.initialized?this.ixServer:(s(o.ERROR,"testHelper not initialized!"),"")}getWfUrl(){return this.initialized?this.eloWfUrl:(s(o.ERROR,"testHelper not initialized!"),"")}}const ye=new Ee;module.exports=ye;
@@ -0,0 +1,145 @@
1
+ declare interface CryptObj {
2
+ iv: string;
3
+ content: string;
4
+ value?: string;
5
+ alg?: string;
6
+ }
7
+
8
+ declare const _default: TestHelpers;
9
+ export default _default;
10
+
11
+ declare interface ManifestData {
12
+ wfUrl?: string;
13
+ id?: string;
14
+ name?: string;
15
+ version?: string;
16
+ licenseMap?: Map<string, string>;
17
+ status?: number;
18
+ sordTypeIcons?: boolean;
19
+ archiveIcons?: boolean;
20
+ src?: string;
21
+ dist?: string;
22
+ indexHtmlPath?: string;
23
+ useEloSession?: boolean;
24
+ devRedirect?: boolean;
25
+ supportedLocales?: string[];
26
+ defaultLanguage?: string;
27
+ build?: number;
28
+ indexHtml?: string;
29
+ namespace?: string;
30
+ [key: string]: any;
31
+ }
32
+
33
+ export declare interface SettingsData {
34
+ manifest?: ManifestData;
35
+ ixLogin?: {
36
+ adminName: string;
37
+ adminPw: CryptObj;
38
+ };
39
+ ixUrl?: string;
40
+ [key: string]: any;
41
+ }
42
+
43
+ export declare interface TestHelperOptions {
44
+ initialized: boolean;
45
+ /**
46
+ * The user from the settings.
47
+ */
48
+ user: string;
49
+ /**
50
+ * The password from the settings.
51
+ */
52
+ pw: CryptObj;
53
+ /**
54
+ * The eloWfUrl from the settings.
55
+ */
56
+ eloWfUrl: string;
57
+ /**
58
+ * The ixUrl from the settings.
59
+ */
60
+ ixUrl: string;
61
+ /**
62
+ * The ixContext derived from the ixUrl.
63
+ */
64
+ ixContext: string;
65
+ /**
66
+ * The ixServer derived from the ixUrl.
67
+ */
68
+ ixServer: string;
69
+ }
70
+
71
+ declare class TestHelpers {
72
+ initialized: boolean;
73
+ user: string;
74
+ pw: CryptObj;
75
+ eloWfUrl: string | undefined;
76
+ ixUrl: string | undefined;
77
+ ixContext: string;
78
+ ixServer: string;
79
+ constructor(options?: TestHelperOptions);
80
+ /**
81
+ * Initializes the test helper by reading the settings.json file.
82
+ * This method used synchronous file reading.
83
+ * @param repoName Optional repository name to read settings from.
84
+ * @returns The settings data.
85
+ */
86
+ init(repoName?: string): SettingsData | undefined;
87
+ /**
88
+ * Initializes the test helper by reading the settings.json file.
89
+ * This method uses asynchronous file reading.
90
+ * @param repoName Optional repository name to read settings from.
91
+ * @returns A promise that resolves to the settings data.
92
+ */
93
+ asyncInit(repoName?: string): Promise<SettingsData | undefined>;
94
+ /**
95
+ * Extract the settings data and compute the urls.
96
+ * @param settings The settings data.
97
+ * @private
98
+ * @returns The settings data.
99
+ */
100
+ private innerInit;
101
+ /**
102
+ * Sets the default language.
103
+ *
104
+ * @param language default language
105
+ */
106
+ initLang(language: string): void;
107
+ /**
108
+ * EVLIB-1138: returns the user after class variables are initialized
109
+ * with "init()" or "asyncInit()"
110
+ * @returns user
111
+ */
112
+ getUser(): string;
113
+ /**
114
+ * EVLIB-1138: returns the pw after class variables are initialized
115
+ * with "init()" or "asyncInit()"
116
+ * @returns password
117
+ */
118
+ getPw(): string;
119
+ /**
120
+ * Returns the indexserver url (ixUrl) after class variables are initialized
121
+ * with "init()" or "asyncInit()"
122
+ * @returns url
123
+ */
124
+ getIxUrl(): string | undefined;
125
+ /**
126
+ * Returns the ixContext after class variables are initialized
127
+ * with "init()" or "asyncInit()"
128
+ * @returns ixContext
129
+ */
130
+ getIxContext(): string;
131
+ /**
132
+ * Returns the ixServer after class variables are initialized
133
+ * with "init()" or "asyncInit()"
134
+ * @returns ixServer
135
+ */
136
+ getIxServer(): string;
137
+ /**
138
+ * Returns the eloWfUrl after class variables are initialized
139
+ * with "init()" or "asyncInit()"
140
+ * @returns url
141
+ */
142
+ getWfUrl(): string | undefined;
143
+ }
144
+
145
+ export { }
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "@elo/elo-cli",
3
+ "publishConfig": {
4
+ "access": "public"
5
+ },
6
+ "version": "1.0.2",
7
+ "description": "ELO Apps command line build system for Node.js.",
8
+ "keywords": [
9
+ "@elo/elo-cli",
10
+ "@elo/ix-client-typescript"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git@git.elo.dev:client/neon/elo-cli.git"
15
+ },
16
+ "license": "MIT",
17
+ "author": "ELO Digital Office GmbH",
18
+ "type": "module",
19
+ "main": "dist/testHelper/testHelper.cjs",
20
+ "types": "dist/testHelper/testHelper.d.cts",
21
+ "bin": {
22
+ "elo": "dist/index.js"
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "LICENSE.txt",
27
+ "3rdpartylicenses.txt",
28
+ "sbom.json",
29
+ "versionhistory.txt",
30
+ "README.md",
31
+ "package.json"
32
+ ],
33
+ "scripts": {
34
+ "audit": "npm audit --omit=dev --json",
35
+ "build": "npm run build:cli && npm run build:testHelper",
36
+ "build:testHelper": "vite build --config vite.config.ts",
37
+ "build:cli": "vite build --config vite.config.cli.ts",
38
+ "license": "elo license --path ../3rdpartylicenses",
39
+ "dev": "node ./dist/index.js",
40
+ "lint": "eslint . && prettier src/ --check",
41
+ "lint:fix": "eslint --fix . && prettier --write src/",
42
+ "type-check": "tsc --noEmit --project tsconfig.app.json",
43
+ "test": "vitest run --coverage",
44
+ "update-dependencies": "npx npm-check-updates -i --dep prod",
45
+ "sbom": "cdxgen --required-only --no-composer -o sbom.json",
46
+ "new-vh": "npx elo-vh",
47
+ "create-vh": "npx elo-vh create --create-config ./elo-vh.env --no-release-date --no-release-version"
48
+ },
49
+ "dependencies": {
50
+ "@elo/ix-client-typescript": "master",
51
+ "archiver": "7.0.1",
52
+ "axios": "1.13.6",
53
+ "axios-cookiejar-support": "6.0.5",
54
+ "chalk": "5.6.2",
55
+ "commander": "14.0.3",
56
+ "fast-glob": "3.3.3",
57
+ "jsdom": "28.1.0",
58
+ "prompts": "2.4.2"
59
+ },
60
+ "devDependencies": {
61
+ "@cyclonedx/cdxgen": "12.1.1",
62
+ "@elo/neon-common-settings": "master",
63
+ "@elo/vh-cli": "latest",
64
+ "@tsconfig/node22": "22.0.5",
65
+ "@types/archiver": "7.0.0",
66
+ "@types/jsdom": "28.0.0",
67
+ "@types/node": "24.10.0",
68
+ "@types/prompts": "2.4.9",
69
+ "@vitest/coverage-istanbul": "4.0.18",
70
+ "msw": "2.12.10",
71
+ "npm-check-updates": "19.6.3",
72
+ "typescript": "5.9.3",
73
+ "vite": "7.3.1",
74
+ "vite-plugin-dts": "4.5.4",
75
+ "vitest": "4.0.18"
76
+ },
77
+ "overrides": {
78
+ "minimatch": "^10.2.4",
79
+ "tar": "^7.5.9"
80
+ }
81
+ }