@decaf-ts/utils 0.4.5 → 0.4.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/README.md +2 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js +2 -0
- package/dist/utils.js.map +1 -0
- package/lib/cli/commands/build-scripts.cjs +20 -2
- package/lib/cli/commands/build-scripts.js.map +1 -1
- package/lib/esm/cli/commands/build-scripts.js +21 -3
- package/lib/esm/cli/commands/build-scripts.js.map +1 -1
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/utils/fs.d.ts +1 -0
- package/lib/esm/utils/fs.js +43 -0
- package/lib/esm/utils/fs.js.map +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/utils/fs.cjs +44 -0
- package/lib/utils/fs.d.ts +1 -0
- package/lib/utils/fs.js.map +1 -1
- package/package.json +2 -2
- package/dist/utils.esm.cjs +0 -2
- package/dist/utils.esm.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -28,6 +28,8 @@ A comprehensive TypeScript utility library providing robust tools for command-li
|
|
|
28
28
|
|
|
29
29
|
Documentation available [here](https://decaf-ts.github.io/utils/)
|
|
30
30
|
|
|
31
|
+
Minimal size: 13.5 KB kb gzipped
|
|
32
|
+
|
|
31
33
|
### Description
|
|
32
34
|
|
|
33
35
|
The Decaf Utils module is a comprehensive TypeScript utility library designed to standardize APIs across repositories and provide a robust foundation for building command-line interface (CLI) applications. The library is organized into several key components:
|
package/dist/utils.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e,t;e=this,t=function(e,t,o,a,s,n,r,i,l,c,d,g,f,u,h,p){"use strict";function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function S(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(o=>{if("default"!==o){var a=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,a.get?a:{enumerable:!0,get:()=>e[o]})}}),t.default=e,Object.freeze(t)}var y=m(t),w=m(s),T=m(n),b=m(l),C=m(d),v=m(g),D=m(u),k=S(p);class ${static{this.logger=a.Logging.for($)}constructor(e){this.type="text",this.name=e}setType(e){return $.logger.verbose("Setting type to: "+e),this.type=e,this}setMessage(e){return $.logger.verbose("Setting message to: "+e),this.message=e,this}setInitial(e){return $.logger.verbose("Setting initial value to: "+e),this.initial=e,this}setStyle(e){return $.logger.verbose("Setting style to: "+e),this.style=e,this}setFormat(e){return $.logger.verbose("Setting format function"),this.format=e,this}setValidate(e){return $.logger.verbose("Setting validate function"),this.validate=e,this}setOnState(e){return $.logger.verbose("Setting onState callback"),this.onState=e,this}setMin(e){return $.logger.verbose("Setting min value to: "+e),this.min=e,this}setMax(e){return $.logger.verbose("Setting max value to: "+e),this.max=e,this}setFloat(e){return $.logger.verbose("Setting float to: "+e),this.float=e,this}setRound(e){return $.logger.verbose("Setting round to: "+e),this.round=e,this}setInstructions(e){return $.logger.verbose("Setting instructions to: "+e),this.instructions=e,this}setIncrement(e){return $.logger.verbose("Setting increment to: "+e),this.increment=e,this}setSeparator(e){return $.logger.verbose("Setting separator to: "+e),this.separator=e,this}setActive(e){return $.logger.verbose("Setting active style to: "+e),this.active=e,this}setInactive(e){return $.logger.verbose("Setting inactive style to: "+e),this.inactive=e,this}setChoices(e){return $.logger.verbose("Setting choices: "+JSON.stringify(e)),this.choices=e,this}setHint(e){return $.logger.verbose("Setting hint to: "+e),this.hint=e,this}setWarn(e){return $.logger.verbose("Setting warn to: "+e),this.warn=e,this}setSuggest(e){return $.logger.verbose("Setting suggest function"),this.suggest=e,this}setLimit(e){return $.logger.verbose("Setting limit to: "+e),this.limit=e,this}setMask(e){return $.logger.verbose("Setting mask to: "+e),this.mask=e,this}setStdout(e){return $.logger.verbose("Setting stdout stream"),this.stdout=e,this}setStdin(e){return this.stdin=e,this}async ask(){return(await $.ask(this))[this.name]}static async ask(e){const t=$.logger.for(this.ask);let o;Array.isArray(e)||(e=[e]);try{t.verbose("Asking questions: "+e.map(e=>e.name).join(", ")),o=await y.default(e),t.verbose("Received answers: "+JSON.stringify(o,null,2))}catch(e){throw Error("Error while getting input: "+e)}return o}static async askNumber(e,t,o,a,s){$.logger.for(this.askNumber).verbose(`Asking number input: undefined, question: ${t}, min: ${o}, max: ${a}, initial: ${s}`);const n=new $(e).setMessage(t).setType("number");return"number"==typeof o&&n.setMin(o),"number"==typeof a&&n.setMax(a),"number"==typeof s&&n.setInitial(s),(await this.ask(n))[e]}static async askText(e,t,o=void 0,a){$.logger.for(this.askText).verbose(`Asking text input: undefined, question: ${t}, mask: ${o}, initial: ${a}`);const s=new $(e).setMessage(t);return o&&s.setMask(o),"string"==typeof a&&s.setInitial(a),(await this.ask(s))[e]}static async askConfirmation(e,t,o){$.logger.for(this.askConfirmation).verbose(`Asking confirmation input: undefined, question: ${t}, initial: ${o}`);const a=new $(e).setMessage(t).setType("confirm");return void 0!==o&&a.setInitial(o),(await this.ask(a))[e]}static async insist(e,t,o,a=1){const s=$.logger.for(this.insist);let n;s.verbose(`Insisting on input: ${e.name}, test: ${t.toString()}, defaultConfirmation: ${o}, limit: ${a}`);let r,i=0;try{do{n=(await $.ask(e))[e.name],t(n)?(r=await $.askConfirmation(e.name+"-confirm",`Is the ${e.type} correct?`,o),r||(n=void 0)):n=void 0}while(void 0===n&&a>1&&i++<a)}catch(e){throw s.error("Error while insisting: "+e),e}return void 0===n&&s.info("no selection..."),n}static async insistForText(e,t,o,a=void 0,s,n=!1,r=-1){$.logger.for(this.insistForText).verbose(`Insisting for text input: undefined, question: ${t}, test: ${o.toString()}, mask: ${a}, initial: ${s}, defaultConfirmation: ${n}, limit: ${r}`);const i=new $(e).setMessage(t);return a&&i.setMask(a),"string"==typeof s&&i.setInitial(s),await this.insist(i,o,n,r)}static async insistForNumber(e,t,o,a,s,n,r=!1,i=-1){$.logger.for(this.insistForNumber).verbose(`Insisting for number input: undefined, question: ${t}, test: ${o.toString()}, min: ${a}, max: ${s}, initial: ${n}, defaultConfirmation: ${r}, limit: ${i}`);const l=new $(e).setMessage(t).setType("number");return"number"==typeof a&&l.setMin(a),"number"==typeof s&&l.setMax(s),"number"==typeof n&&l.setInitial(n),await this.insist(l,o,r,i)}static parseArgs(e){const t=$.logger.for(this.parseArgs),a={args:process.argv.slice(2),options:e};t.debug("Parsing arguments: "+JSON.stringify(a,null,2));try{return o.parseArgs(a)}catch(o){throw t.debug(`Error while parsing arguments:\n${JSON.stringify(a,null,2)}\n | options\n${JSON.stringify(e,null,2)}\n | ${o}`),Error("Error while parsing arguments: "+o)}}}const E={verbose:{type:"boolean",short:"V",default:void 0},version:{type:"boolean",short:"v",default:void 0},help:{type:"boolean",short:"h",default:!1},logLevel:{type:"string",default:"info"},logStyle:{type:"boolean",default:!0},timestamp:{type:"boolean",default:!0},banner:{type:"boolean",default:!0}},I=Object.keys(E).reduce((e,t)=>(e[t]=E[t].default,e),{}),F="utf-8",j=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z])))/g;var x;e.SemVersion=void 0,(x=e.SemVersion||(e.SemVersion={})).PATCH="patch",x.MINOR="minor",x.MAJOR="major";const A="-no-ci",N="postinstall";var P;e.Tokens=void 0,(P=e.Tokens||(e.Tokens={})).GIT=".token",P.NPM=".npmtoken",P.DOCKER=".dockertoken",P.CONFLUENCE=".confluence-token";const O="Aborted";class B{constructor(e,t,...o){this.cmd=e,this.lock=t,this.logger=a.Logging.for(this.cmd)}log(e,t){t=Buffer.isBuffer(t)?t.toString(F):t;const o="stderr"===e?i.style(t).red.text:t;this.logger.info(o)}data(e){this.log("stdout",e+"")}error(e){this.log("stderr",e+"")}errors(e){this.log("stderr","Error executing command exited : "+e)}exit(e,t){this.log("stdout","command exited code : "+(0===e?i.style(e.toString()).green.text:i.style(null===e?"null":e.toString()).red.text)),0===e?this.resolve(t.map(e=>e.trim()).join("\n")):this.reject(Error(t.length?t.join("\n"):e.toString()))}parseCommand(e){return e="string"==typeof e?e.split(" "):e,this.cmd=e.join(" "),[e[0],e.slice(1)]}resolve(e){this.log("stdout",`${this.cmd} executed successfully: ${i.style(e?"ran to completion":e).green}`),this.lock.resolve(e)}reject(e){e instanceof Error||(e=Error("number"==typeof e?"Exit code "+e:e)),this.log("stderr",`${this.cmd} failed to execute: ${i.style(e.message).red}`),this.lock.reject(e)}}function L(e,...t){let o,a;if(e instanceof AbortSignal?(a=new AbortController,o=[e,...t]):(a=e,o=t),a.signal.aborted)return a;const s=()=>a.abort();for(const e of o){if(e.aborted){a.abort();break}e.addEventListener("abort",s,{once:!0,signal:a.signal})}return a}function M(e,t,o,a,s){function n(t,a){const[n,i]=e.parseCommand(t);s.info("Running command: "+n),s.debug("with args: "+i.join(" "));const l=r.spawn(n,i,{...o,cwd:o.cwd||process.cwd(),env:Object.assign({},process.env,o.env,{PATH:process.env.PATH}),shell:o.shell||!1,signal:a.signal});return s.verbose("pid : "+l.pid),l}const i=t.match(/[<>$#]/g);if(i)throw Error(`Invalid command: ${t}. contains invalid characters: ${i}`);if(t.includes(" | ")){const e=t.split(" | "),o=[],s=Array(e.length);s[0]=a;for(let t=0;t<e.length;t++)0!==t&&(s[t]=L(s[t-1].signal)),o.push(n(e[t],s[t])),0!==t&&o[t-1].stdout.pipe(o[t].stdin);return o[e.length-1]}return n(t,a)}function U(e,t={},o=B,...s){const n=a.Logging.for(U),r=new AbortController,i={abort:r,command:e,logs:[],errs:[]},l=new Promise((a,l)=>{let c;try{c=new o(e,{resolve:a,reject:l},...s),i.cmd=M(c,e,t,r,n)}catch(t){return l(Error(`Error running command ${e}: ${t}`))}i.cmd.stdout.setEncoding("utf8"),i.cmd.stdout.on("data",e=>{e=e.toString(),i.logs.push(e),c.data(e)}),i.cmd.stderr.on("data",e=>{e=e.toString(),i.errs.push(e),c.error(e)}),i.cmd.once("error",e=>{c.exit(e.message,i.errs)}),i.cmd.once("exit",(e=0)=>{r.signal.aborted&&null===e&&(e=O),c.exit(e,0===e?i.logs:i.errs)})});return Object.assign(i,{promise:l,pipe:async t=>{const o=n.for("pipe");try{o.verbose(`Executing pipe function ${e}...`);const a=await l;return o.verbose(`Piping output to ${t.name}: ${a}`),t(a)}catch(e){throw o.error("Error piping command output: "+e),e}}}),i}const R=a.Logging.for("fs");function J(e,t){const o=R.for(J);if(!w.default.existsSync(e))throw Error(`File not found at path "${e}".`);let s=V(e);try{o.verbose(`Patching file "${e}"...`),o.debug("with value: "+JSON.stringify(t)),s=a.patchString(s,t)}catch(e){throw Error("Error patching file: "+e)}_(e,s)}function V(e){const t=R.for(V);try{return t.verbose(`Reading file "${e}"...`),w.default.readFileSync(e,"utf8")}catch(o){throw t.verbose(`Error reading file "${e}": ${o}`),Error(`Error reading file "${e}": ${o}`)}}function _(e,t){const o=R.for(_);try{o.verbose(`Writing file "${e} with ${t.length} bytes...`),w.default.writeFileSync(e,t,"utf8")}catch(t){throw o.verbose(`Error writing file "${e}": ${t}`),Error(`Error writing file "${e}": ${t}`)}}function q(e,t){const o=R.for(q),a=[];try{return o.verbose(`Retrieving all files from "${e}"...`),w.default.readdirSync(e).forEach(t=>{const o=T.default.join(e,t),s=w.default.statSync(o);s.isFile()?a.push(o):s.isDirectory()&&a.push(...q(o))}),t?a.filter(t):a}catch(t){throw o.verbose(`Error retrieving files from "${e}": ${t}`),Error(`Error retrieving files from "${e}": ${t}`)}}async function G(e,t){const o=R.for(G);let a,s;try{a=w.default.statSync(e)}catch(t){throw o.verbose(`Source path "${e}" does not exist: ${t}`),Error(`Source path "${e}" does not exist: ${t}`)}try{s=w.default.statSync(t)}catch(e){}if(s)throw o.verbose(`Destination path "${t}" already exists`),Error(`Destination path "${t}" already exists`);try{o.verbose(`Renaming ${a.isFile()?"file":"directory"} "${e}" to "${t}...`),w.default.renameSync(e,t),o.verbose(`Successfully renamed to "${t}"`)}catch(s){throw o.verbose(`Error renaming ${a.isFile()?"file":"directory"} "${e}" to "${t}": ${s}`),Error(`Error renaming ${a.isFile()?"file":"directory"} "${e}" to "${t}": ${s}`)}}function W(e,t){const o=R.for(W);let a,s;try{a=w.default.statSync(e)}catch(t){throw o.verbose(`Source path "${e}" does not exist: ${t}`),Error(`Source path "${e}" does not exist: ${t}`)}try{s=w.default.statSync(t)}catch(e){a.isDirectory()&&(o.verbose(`Dest path "${t}" does not exist. creating`),w.default.mkdirSync(t,{recursive:!0}))}try{o.verbose(`Copying ${a.isFile()?"file":"directory"} "${e}" to "${t}...`),w.default.cpSync(e,t,{recursive:!0})}catch(s){throw o.verbose(`Error copying ${a.isFile()?"file":"directory"} "${e}" to "${t}: ${s}`),Error(`Error copying ${a.isFile()?"file":"directory"} "${e}" to "${t}: ${s}`)}}function X(e){const t=R.for(X);try{const o=w.default.statSync(e);o.isFile()?(t.verbose(`Deleting file "${e}...`),w.default.rmSync(e,{recursive:!0,force:!0})):o.isDirectory()&&w.default.rmSync(e,{recursive:!0,force:!0})}catch(o){throw t.verbose(`Error Deleting "${e}": ${o}`),Error(`Error Deleting "${e}": ${o}`)}}function H(e=process.cwd(),t){let o;try{o=JSON.parse(V(T.default.join(e,"package.json")))}catch(e){throw Error('Failed to retrieve package information" '+e)}if(t){if(!(t in o))throw Error(`Property "${t}" not found in package.json`);return o[t]}return o}function K(e,t,o=process.cwd()){const a=H(o);a[e]=t,_(T.default.join(o,"package.json"),JSON.stringify(a,null,2))}function z(e=process.cwd()){return H(e,"version")}async function Y(e=process.cwd()){let t;try{t=JSON.parse(await U("npm ls --json",{cwd:e}).promise)}catch(e){throw Error("Failed to retrieve dependencies: "+e)}const o=(e,t)=>({name:e[0],version:e[1].version});return{prod:Object.entries(t.dependencies||{}).map(o),dev:Object.entries(t.devDependencies||{}).map(o),peer:Object.entries(t.peerDependencies||{}).map(o)}}async function Z(e){const t=R.for(Z),o=e.prod||[],a=e.dev||[],s=e.peer||[];o.length&&(t.info(`Installing dependencies ${o.join(", ")}...`),await U("npm install "+o.join(" "),{cwd:process.cwd()}).promise),a.length&&(t.info(`Installing devDependencies ${a.join(", ")}...`),await U("npm install --save-dev "+a.join(" "),{cwd:process.cwd()}).promise),s.length&&(t.info(`Installing peerDependencies ${s.join(", ")}...`),await U("npm install --save-peer "+s.join(" "),{cwd:process.cwd()}).promise)}const Q=[{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That's Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That\u2019s Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That\u2019s Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That\u2019s Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That\u2019s Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That\u2019s Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That\u2019s Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That\u2019s Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That\u2019s Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That\u2019s Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"Decaf-TS: Where smart contracts meet smart interfaces.",Tags:"Blockchain, Smart Contracts, Tech"},{Slogan:"Ship dApps without the stress.",Tags:"Blockchain, Cheerful, Developer"},{Slogan:"No CRUD, no problem \u2014 Decaf your data.",Tags:"Data, No-CRUD, Chill"},{Slogan:"From DID to UI, without breaking a sweat.",Tags:"DID, SSI, UI, Calm"},{Slogan:"Decaf-TS: Your frontend already understands your smart contract.",Tags:"Smart Contracts, DX, Magic"},{Slogan:"Self-sovereign by design. Productive by default.",Tags:"SSI, Developer, Calm"},{Slogan:"Build once. Deploy everywhere. Decentralized and delightful.",Tags:"Blockchain, Multi-platform, Happy"},{Slogan:"Data that defines its own destiny.",Tags:"SSI, Data-driven, Empowerment"},{Slogan:"Goodbye CRUD, hello intent-based interfaces.",Tags:"No-CRUD, UI, Technical"},{Slogan:"The smoothest path from DID to done.",Tags:"DID, Workflow, Chill"},{Slogan:"Because your dApp deserves more than boilerplate.",Tags:"Blockchain, DevX, Efficiency"},{Slogan:"Own your data. Own your flow.",Tags:"SSI, Control, Ownership"},{Slogan:"Write logic like it belongs with the data \u2014 because it does.",Tags:"Data Logic, Developer, Smart"},{Slogan:"From smart contracts to smarter frontends.",Tags:"Smart Contracts, UI, DX"},{Slogan:"No caffeine. No CRUD. Just the future.",Tags:"No-CRUD, Coffee-themed, Futuristic"},{Slogan:"The future of web3 UX is Decaf.",Tags:"Blockchain, UX, Vision"},{Slogan:"Code with confidence. Govern with clarity.",Tags:"Blockchain, Governance, Calm"},{Slogan:"Interfaces that obey the data, not the other way around.",Tags:"UI, Data Logic, Self-aware"},{Slogan:"Brew business logic right into your bytes.",Tags:"Data Logic, Coffee-themed, Fun"},{Slogan:"DIDs done differently \u2014 and delightfully.",Tags:"DID, Self-Sovereign, Playful"},{Slogan:"Decaf-TS-TS: Where blockchain contracts meet smart interfaces.",Tags:"Blockchain, Smart Contracts, Tech"},{Slogan:"Ship dApps without the stress.",Tags:"Blockchain, Cheerful, Developer"},{Slogan:"No boilerplate, no problem \u2014 Decaf-TS your data.",Tags:"Data, No-CRUD, Chill"},{Slogan:"From DID to UI, without breaking a sweat.",Tags:"DID, SSI, UI, Calm"},{Slogan:"Decaf-TS-TS: Your frontend already understands your blockchain contract.",Tags:"Smart Contracts, DX, Magic"},{Slogan:"Self-sovereign by design. Productive by default.",Tags:"SSI, Developer, Calm"},{Slogan:"Build once. Deploy everywhere. Decentralized and delightful.",Tags:"Blockchain, Multi-platform, Happy"},{Slogan:"Data that defines its own destiny.",Tags:"SSI, Data-driven, Empowerment"},{Slogan:"Goodbye boilerplate, hello intent-based interfaces.",Tags:"No-CRUD, UI, Technical"},{Slogan:"The smoothest path from DID to done.",Tags:"DID, Workflow, Chill"},{Slogan:"Because your dApp deserves more than boilerplate.",Tags:"Blockchain, DevX, Efficiency"},{Slogan:"Own your data. Own your flow.",Tags:"SSI, Control, Ownership"},{Slogan:"Write logic like it belongs with the data \u2014 because it does.",Tags:"Data Logic, Developer, Smart"},{Slogan:"From blockchain contracts to smarter frontends.",Tags:"Smart Contracts, UI, DX"},{Slogan:"No caffeine. No boilerplate. Just the future.",Tags:"No-CRUD, Coffee-themed, Futuristic"},{Slogan:"The future of web3 UX is Decaf-TS.",Tags:"Blockchain, UX, Vision"},{Slogan:"Code with confidence. Govern with clarity.",Tags:"Blockchain, Governance, Calm"},{Slogan:"Interfaces that obey the data, not the other way around.",Tags:"UI, Data Logic, Self-aware"},{Slogan:"Brew business logic right into your bytes.",Tags:"Data Logic, Coffee-themed, Fun"},{Slogan:"DIDs done differently \u2014 and delightfully.",Tags:"DID, Self-Sovereign, Playful"},{Slogan:"Decaf-TS-TS: Where blockchain contracts meet smart interfaces.",Tags:"Blockchain, Smart Contracts, Tech"},{Slogan:"Ship dApps without the stress.",Tags:"Blockchain, Cheerful, Developer"},{Slogan:"No boilerplate, no problem \u2014 Decaf-TS your data.",Tags:"Data, No-CRUD, Chill"},{Slogan:"From DID to UI, without breaking a sweat.",Tags:"DID, SSI, UI, Calm"},{Slogan:"Decaf-TS-TS: Your frontend already understands your blockchain contract.",Tags:"Smart Contracts, DX, Magic"},{Slogan:"Self-sovereign by design. Productive by default.",Tags:"SSI, Developer, Calm"},{Slogan:"Build once. Deploy everywhere. Decentralized and delightful.",Tags:"Blockchain, Multi-platform, Happy"},{Slogan:"Data that defines its own destiny.",Tags:"SSI, Data-driven, Empowerment"},{Slogan:"Goodbye boilerplate, hello intent-based interfaces.",Tags:"No-CRUD, UI, Technical"},{Slogan:"The smoothest path from DID to done.",Tags:"DID, Workflow, Chill"},{Slogan:"Because your dApp deserves more than boilerplate.",Tags:"Blockchain, DevX, Efficiency"},{Slogan:"Own your data. Own your flow.",Tags:"SSI, Control, Ownership"},{Slogan:"Write logic like it belongs with the data \u2014 because it does.",Tags:"Data Logic, Developer, Smart"},{Slogan:"From blockchain contracts to smarter frontends.",Tags:"Smart Contracts, UI, DX"},{Slogan:"No caffeine. No boilerplate. Just the future.",Tags:"No-CRUD, Coffee-themed, Futuristic"},{Slogan:"The future of web3 UX is Decaf-TS.",Tags:"Blockchain, UX, Vision"},{Slogan:"Code with confidence. Govern with clarity.",Tags:"Blockchain, Governance, Calm"},{Slogan:"Interfaces that obey the data, not the other way around.",Tags:"UI, Data Logic, Self-aware"},{Slogan:"Brew business logic right into your bytes.",Tags:"Data Logic, Coffee-themed, Fun"},{Slogan:"DIDs done differently \u2014 and delightfully.",Tags:"DID, Self-Sovereign, Playful"},{Slogan:"Decaf-TS-TS: Where blockchain contracts meet smart interfaces.",Tags:"Blockchain, Smart Contracts, Tech"},{Slogan:"Ship dApps without the stress.",Tags:"Blockchain, Cheerful, Developer"},{Slogan:"No boilerplate, no problem \u2014 Decaf-TS your data.",Tags:"Data, No-CRUD, Chill"},{Slogan:"From DID to UI, without breaking a sweat.",Tags:"DID, SSI, UI, Calm"},{Slogan:"Decaf-TS-TS: Your frontend already understands your blockchain contract.",Tags:"Smart Contracts, DX, Magic"},{Slogan:"Self-sovereign by design. Productive by default.",Tags:"SSI, Developer, Calm"},{Slogan:"Build once. Deploy everywhere. Decentralized and delightful.",Tags:"Blockchain, Multi-platform, Happy"},{Slogan:"Data that defines its own destiny.",Tags:"SSI, Data-driven, Empowerment"},{Slogan:"Goodbye boilerplate, hello intent-based interfaces.",Tags:"No-CRUD, UI, Technical"},{Slogan:"The smoothest path from DID to done.",Tags:"DID, Workflow, Chill"},{Slogan:"Because your dApp deserves more than boilerplate.",Tags:"Blockchain, DevX, Efficiency"},{Slogan:"Own your data. Own your flow.",Tags:"SSI, Control, Ownership"},{Slogan:"Write logic like it belongs with the data \u2014 because it does.",Tags:"Data Logic, Developer, Smart"},{Slogan:"From blockchain contracts to smarter frontends.",Tags:"Smart Contracts, UI, DX"},{Slogan:"No caffeine. No boilerplate. Just the future.",Tags:"No-CRUD, Coffee-themed, Futuristic"},{Slogan:"The future of web3 UX is Decaf-TS.",Tags:"Blockchain, UX, Vision"},{Slogan:"Code with confidence. Govern with clarity.",Tags:"Blockchain, Governance, Calm"},{Slogan:"Interfaces that obey the data, not the other way around.",Tags:"UI, Data Logic, Self-aware"},{Slogan:"Brew business logic right into your bytes.",Tags:"Data Logic, Coffee-themed, Fun"},{Slogan:"DIDs done differently \u2014 and delightfully.",Tags:"DID, Self-Sovereign, Playful"},{Slogan:"Decaf-TS-TS: Where blockchain contracts meet smart interfaces.",Tags:"Blockchain, Smart Contracts, Tech"},{Slogan:"Ship dApps without the stress.",Tags:"Blockchain, Cheerful, Developer"},{Slogan:"No boilerplate, no problem \u2014 Decaf-TS your data.",Tags:"Data, No-CRUD, Chill"},{Slogan:"From DID to UI, without breaking a sweat.",Tags:"DID, SSI, UI, Calm"},{Slogan:"Decaf-TS-TS: Your frontend already understands your blockchain contract.",Tags:"Smart Contracts, DX, Magic"},{Slogan:"Self-sovereign by design. Productive by default.",Tags:"SSI, Developer, Calm"},{Slogan:"Build once. Deploy everywhere. Decentralized and delightful.",Tags:"Blockchain, Multi-platform, Happy"},{Slogan:"Data that defines its own destiny.",Tags:"SSI, Data-driven, Empowerment"},{Slogan:"Goodbye boilerplate, hello intent-based interfaces.",Tags:"No-CRUD, UI, Technical"},{Slogan:"The smoothest path from DID to done.",Tags:"DID, Workflow, Chill"},{Slogan:"Because your dApp deserves more than boilerplate.",Tags:"Blockchain, DevX, Efficiency"},{Slogan:"Own your data. Own your flow.",Tags:"SSI, Control, Ownership"},{Slogan:"Write logic like it belongs with the data \u2014 because it does.",Tags:"Data Logic, Developer, Smart"},{Slogan:"From blockchain contracts to smarter frontends.",Tags:"Smart Contracts, UI, DX"},{Slogan:"No caffeine. No boilerplate. Just the future.",Tags:"No-CRUD, Coffee-themed, Futuristic"},{Slogan:"The future of web3 UX is Decaf-TS.",Tags:"Blockchain, UX, Vision"},{Slogan:"Code with confidence. Govern with clarity.",Tags:"Blockchain, Governance, Calm"},{Slogan:"Interfaces that obey the data, not the other way around.",Tags:"UI, Data Logic, Self-aware"},{Slogan:"Brew business logic right into your bytes.",Tags:"Data Logic, Coffee-themed, Fun"},{Slogan:"DIDs done differently \u2014 and delightfully.",Tags:"DID, Self-Sovereign, Playful"}],ee=["\x1b[38;5;215m","\x1b[38;5;209m","\x1b[38;5;205m","\x1b[38;5;210m","\x1b[38;5;217m","\x1b[38;5;216m","\x1b[38;5;224m","\x1b[38;5;230m","\x1b[38;5;230m"];function te(e){const t=oe(),o="# \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \n# ( ( \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \n# ) ) \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \n# [=======] \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \n# `-----\xb4 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \n# \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \n# \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \n#".split("\n"),a=o.reduce((e,t)=>Math.max(e,t.length),0);o.push("# "+t.padStart(a-3)),o.forEach((t,o)=>{(e?e.info.bind(e):(()=>{}).bind())(i.style(t||"").raw(ee[o]).text)})}function oe(e){try{return e=void 0===e?Math.floor(Math.random()*Q.length):e,Q[e].Slogan}catch(e){throw Error("Failed to retrieve slogans: "+e)}}class ae extends a.LoggedClass{constructor(e,t={},o=[]){super(),this.name=e,this.inputs=t,this.requirements=o,ae.log||Object.defineProperty(ae,"log",{writable:!1,value:a.Logging.for(ae.name)}),this.inputs=Object.assign({},E,t)}async checkRequirements(){const{prod:e,dev:t,peer:o}=await Y(),a=[],s=Array.from(new Set([...e,...t,...o]).values()).map(e=>e.name);for(const e of this.requirements)s.includes(e)||a.push(e);a.length}help(e){return this.log.info("This is help. I'm no use because I should have been overridden.")}async execute(){const e=$.parseArgs(this.inputs),t=a.LoggedEnvironment.accumulate(I).accumulate(e.values),{version:o,help:s,banner:n}=t;if(o)return z();if(s)return this.help(e);let r;n&&te(this.log.for(te,{timestamp:!1,style:!1,context:!1,logLevel:!1}));try{r=await this.run(t)}catch(e){throw e}return r}}class se{static{this.log=a.Logging.for(se)}static async downloadFile(e){return new Promise((t,o)=>{!function e(a){a=encodeURI(a),b.default.get(a,s=>{if(301===s.statusCode||307===s.statusCode)return e(s.headers.location);if(200!==s.statusCode)return se.log.error(`Failed to fetch ${a} (status: ${s.statusCode})`),o(Error("Failed to fetch "+a));let n="";s.on("data",e=>{n+=e}),s.on("error",e=>{o(e)}),s.on("end",()=>{t(n)})})}(e)})}}function ne(e){return e?Array.isArray(e)?e.map(e=>(""+e).trim()).filter(Boolean):(""+e).split(",").map(e=>e.trim()).filter(Boolean):[]}function re(e){return e.replace(/^@/,"").split(/[/\-_.]+/).filter(Boolean).map((e,t)=>0===t?e.replace(/[^a-zA-Z0-9]/g,""):`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join("")}function ie(){let e;try{e=H(process.cwd())}catch{e=void 0}try{if(!e||!(Object.keys(e.dependencies||{}).length>0||Object.keys(e.devDependencies||{}).length>0||Object.keys(e.peerDependencies||{}).length>0)){const t=T.default.resolve(__dirname,"../../..");try{e=H(t)}catch{}}}catch{}const t=Object.keys(e&&e.dependencies||{}),o=Object.keys(e&&e.peerDependencies||{}),a=Object.keys(e&&e.devDependencies||{});return Array.from(new Set([...t,...o,...a]))}var le,ce;(e=>{e.CJS="commonjs",e.ESM="es2022"})(le||(le={})),(e=>{e.BUILD="build",e.BUNDLE="bundle",e.ALL="all"})(ce||(ce={}));const de={prod:{type:"boolean",default:!1},dev:{type:"boolean",default:!1},buildMode:{type:"string",default:ce.ALL},includes:{type:"string",default:""},externals:{type:"string",default:""},docs:{type:"boolean",default:!1},commands:{type:"boolean",default:!1},banner:{type:"boolean",default:!1}},ge=(e=".cjs")=>{const t=fe.log.for(ge),o=new Map;return a=>s=>{const n=T.default.dirname(s.fileName);function r(a){const s=JSON.stringify([n,a]),r=o.get(s);if(null!=r)return r;let i,l=a;try{l=T.default.resolve(n,l+".ts")}catch(e){throw Error(`Failed to resolve path ${a}: ${e}`)}try{i=w.default.statSync(l)}catch(e){try{t.verbose(`Testing existence of path ${l} as a folder defaulting to index file`),i=w.default.statSync(l.replace(/\.ts$/gm,""))}catch(t){throw Error(`Failed to resolve path ${a}: ${e}, ${t}`)}}if(i.isDirectory()&&(l=l.replace(/\.ts$/gm,"/index.ts")),T.default.isAbsolute(l)){const t=(/\.tsx?$/.exec(T.default.basename(l))||[])[0]||void 0;l="./"+T.default.relative(n,T.default.resolve(T.default.dirname(l),T.default.basename(l,t)+e))}return o.set(s,l),l}return k.visitNode(s,function e(t){if((e=>!(!k.isImportDeclaration(e)&&!k.isExportDeclaration(e)||void 0===e.moduleSpecifier||!k.isStringLiteral(e.moduleSpecifier)||!e.moduleSpecifier.text.startsWith("./")&&!e.moduleSpecifier.text.startsWith("../")||""!==T.default.extname(e.moduleSpecifier.text)))(t)){if(k.isImportDeclaration(t)){const e=r(t.moduleSpecifier.text),o=a.factory.createStringLiteral(e);return a.factory.updateImportDeclaration(t,t.modifiers,t.importClause,o,void 0)}if(k.isExportDeclaration(t)){const e=r(t.moduleSpecifier.text),o=a.factory.createStringLiteral(e);return a.factory.updateExportDeclaration(t,t.modifiers,t.isTypeOnly,t.exportClause,o,void 0)}}return k.visitEachChild(t,e,a)})}};class fe extends ae{constructor(){super("BuildScripts",Object.assign({},E,de)),this.replacements={};const e=H(),{name:t,version:o}=e;this.pkgName=t.includes("@")?t.split("/")[1]:t,this.pkgVersion=o,this.replacements["0.4.4"]=this.pkgVersion,this.replacements["@decaf-ts/utils"]=t}patchFiles(e){const t=this.log.for(this.patchFiles),{name:o,version:a}=H();t.info(`Patching ${o} ${a} module in ${e}...`),w.default.statSync(e).isDirectory()&&w.default.readdirSync(e,{withFileTypes:!0,recursive:!0}).filter(e=>e.isFile()).forEach(e=>J(T.default.join(e.parentPath,e.name),this.replacements)),t.verbose(`Module ${o} ${a} patched in ${e}...`)}reportDiagnostics(e,t){const o=this.formatDiagnostics(e);try{this.log[t](o)}catch(e){throw e}return o}formatDiagnostics(e){return e.map(e=>{let t="";if(e.file&&e.start){const{line:o,character:a}=e.file.getLineAndCharacterOfPosition(e.start);t+=`${e.file.fileName} (${o+1},${a+1})`}return t+=": "+k.flattenDiagnosticMessageText(e.messageText,"\n"),t}).join("\n")}readConfigFile(e){const t=w.default.readFileSync(e).toString(),o=k.parseConfigFileTextToJson(e,t),s=o.config;s||this.reportDiagnostics([o.error],a.LogLevel.error);const n=k.parseJsonConfigFileContent(s,k.sys,T.default.dirname(e));return n.errors.length>0&&this.reportDiagnostics(n.errors,a.LogLevel.error),n}evalDiagnostics(e){if(e&&e.length>0){const t=e.filter(e=>e.category===k.DiagnosticCategory.Error),o=e.filter(e=>e.category===k.DiagnosticCategory.Warning),s=e.filter(e=>e.category===k.DiagnosticCategory.Suggestion),n=e.filter(e=>e.category===k.DiagnosticCategory.Message);if(o.length&&this.reportDiagnostics(o,a.LogLevel.warn),t.length)throw this.reportDiagnostics(e,a.LogLevel.error),Error(`TypeScript reported ${e.length} diagnostic(s) during check; aborting.`);s.length&&this.reportDiagnostics(s,a.LogLevel.info),n.length&&this.reportDiagnostics(n,a.LogLevel.info)}}preCheckDiagnostics(e){const t=k.getPreEmitDiagnostics(e);this.evalDiagnostics(t)}async checkTsDiagnostics(e,t,o=!1){const a=this.log.for(this.checkTsDiagnostics);let s;try{s=this.readConfigFile("./tsconfig.json")}catch(e){throw Error("Failed to parse tsconfig.json: "+e)}o?(s.options.module=p.ModuleKind.AMD,s.options.outDir="dist",s.options.isolatedModules=!1,s.options.outFile=this.pkgName):(s.options.outDir="lib"+(t===le.ESM?"/esm":""),s.options.module=t===le.ESM?p.ModuleKind.ES2022:p.ModuleKind.CommonJS),s.options.inlineSourceMap=!1,s.options.inlineSources=!1,s.options.sourceMap=!0;const n=k.createProgram(s.fileNames,s.options);this.preCheckDiagnostics(n),a.verbose(`TypeScript checks passed (${o?"bundle":"normal"} mode).`)}async buildTs(e,t,o=!1){let a;this.log.for(this.buildTs).info(`Building ${this.pkgName} ${this.pkgVersion} module (${t}) in ${e?"dev":"prod"} mode...`);try{a=this.readConfigFile("./tsconfig.json")}catch(e){throw Error("Failed to parse tsconfig.json: "+e)}o?(a.options.module=p.ModuleKind.AMD,a.options.outDir="dist",a.options.isolatedModules=!1,a.options.outFile=this.pkgName):(a.options.outDir="lib"+(t===le.ESM?"/esm":""),a.options.module=t===le.ESM?p.ModuleKind.ES2022:p.ModuleKind.CommonJS),e?(a.options.inlineSourceMap=!0,a.options.inlineSources=!0,a.options.sourceMap=!1):(a.options.inlineSourceMap=!1,a.options.inlineSources=!1,a.options.sourceMap=!0);const s=k.createProgram(a.fileNames,a.options),n={};t===le.CJS?n.before=[ge(".cjs")]:t===le.ESM&&(n.before=[ge(".js")]);const r=s.emit(void 0,void 0,void 0,void 0,n),i=k.getPreEmitDiagnostics(s).concat(r.diagnostics);this.evalDiagnostics(i)}async build(e,t,o=!1){const a=this.log.for(this.build);if(await this.buildTs(e,t,o),a.verbose(`Module ${this.pkgName} ${this.pkgVersion} (${t}) built in ${e?"dev":"prod"} mode...`),t===le.CJS&&!o){const e=q("lib",e=>e.endsWith(".js")&&!e.includes("/esm/"));for(const t of e){a.verbose(`Patching ${t}'s cjs imports...`);const e=t.replace(".js",".cjs");await G(t,e)}}}copyAssets(e){const t=this.log.for(this.copyAssets);let o=!1;try{o=w.default.statSync("./src/assets").isDirectory()}catch(e){return t.verbose("No assets found in ./src/assets to copy")}o&&W("./src/assets",`./${e===le.CJS?"lib":"dist"}/assets`)}async bundle(e,t,o,a="src/index.ts",s=this.pkgName,n,r=["prompts","styled-string-builder","typed-object-accumulator","@decaf-ts/logging"]){await this.checkTsDiagnostics(t,e,!0);const i=e===le.ESM,l=this.pkgName,d=this.log,g=Array.from(new Set([...ne(r)]));let u=ne(n);0===u.length&&(u=ie());const p=Array.from(new Set([...(()=>{try{return Array.isArray(h.builtinModules)?h.builtinModules:[]}catch{return["fs","path","process","child_process","util","https","http","os","stream","crypto","zlib","net","tls","url","querystring","assert","events","tty","dns","querystring"]}})(),...u])),m=!t||"inline",S=[C.default({compilerOptions:{module:"esnext",declaration:!1,outDir:o?"bin":"dist",sourceMap:!t,inlineSourceMap:!!t,inlineSources:!!t},include:["src/**/*.ts"],exclude:["node_modules","**/*.spec.ts"],tsconfig:"./tsconfig.json"}),D.default()];o&&S.push(v.default({include:[],exclude:u}),f.nodeResolve({resolveOnly:g}));try{const b=await import("@rollup/plugin-terser"),k=b&&b.terser||b.default||b,$={parse:{ecma:2020},compress:!1,mangle:!1,format:{comments:!1,beautify:!0}},E={parse:{ecma:2020},compress:{ecma:2020,passes:5,drop_console:!0,drop_debugger:!0,toplevel:!0,module:i,unsafe:!0,unsafe_arrows:!0,unsafe_comps:!0,collapse_vars:!0,reduce_funcs:!0,reduce_vars:!0},mangle:{toplevel:!0},format:{comments:!1,ascii_only:!0},toplevel:!0};S.push(k(t?$:E))}catch{}const y={input:a,plugins:S,external:p,onwarn:void 0,treeshake:!t},w={};p.forEach(e=>{w[e]=re(e)});const T=[{file:`${o?"bin/":"dist/"}${s||".bundle."+(t?"":"min")}${i?".esm":""}.cjs`,format:o?"cjs":i?"esm":"umd",name:l,esModule:i,sourcemap:m,globals:w,exports:"auto"}];try{const I=await c.rollup(y);async function F(e){for(const t of T)await e.write(t)}d.verbose(I.watchFiles),await F(I)}catch(j){throw Error("Failed to bundle: "+j)}}async buildByEnv(e,t=ce.ALL,o,a){try{X("lib")}catch(e){}try{X("dist")}catch(e){}w.default.mkdirSync("lib"),w.default.mkdirSync("dist"),[ce.ALL,ce.BUILD].includes(t)&&(await this.build(e,le.ESM),await this.build(e,le.CJS),this.patchFiles("lib")),[ce.ALL,ce.BUNDLE].includes(t)&&(await this.bundle(le.ESM,e,!1,"src/index.ts",this.pkgName,a,o),await this.bundle(le.CJS,e,!1,"src/index.ts",this.pkgName,a,o),this.patchFiles("dist")),this.copyAssets(le.CJS),this.copyAssets(le.ESM)}async buildDev(e=ce.ALL,t,o){return this.buildByEnv(!0,e,t,o)}async buildProd(e=ce.ALL,t,o){return this.buildByEnv(!1,e,t,o)}async buildDocs(){await U("npm install better-docs taffydb").promise,await U("npx markdown-include ./workdocs/readme-md.json").promise,await U("npx jsdoc -c ./workdocs/jsdocs.json -t ./node_modules/better-docs").promise,await U("npm remove better-docs taffydb").promise,[{src:"workdocs/assets",dest:"./docs/workdocs/assets"},{src:"workdocs/reports/coverage",dest:"./docs/workdocs/reports/coverage"},{src:"workdocs/reports/html",dest:"./docs/workdocs/reports/html"},{src:"workdocs/resources",dest:"./docs/workdocs/resources"},{src:"LICENSE.md",dest:"./docs/LICENSE.md"}].forEach(e=>{const{src:t,dest:o}=e;W(t,o)})}async run(e){const{dev:t,prod:o,docs:a,buildMode:s,includes:n,externals:r}=e;return t?await this.buildDev(s,n,r):o?await this.buildProd(s,n,r):a?await this.buildDocs():void 0}}const ue={ci:{type:"boolean",default:!0},message:{type:"string",short:"m"},tag:{type:"string",short:"t",default:void 0}},he="https://raw.githubusercontent.com/decaf-ts/ts-workspace/master",pe={templates:[".github/ISSUE_TEMPLATE/bug_report.md",".github/ISSUE_TEMPLATE/feature_request.md",".github/FUNDING.yml"],workflows:[".github/workflows/codeql-analysis.yml",".github/workflows/jest-coverage.yaml",".github/workflows/nodejs-build-prod.yaml",".github/workflows/pages.yaml",".github/workflows/publish-on-release.yaml",".github/workflows/release-on-tag.yaml",".github/workflows/snyk-analysis.yaml"],ide:[".idea/runConfigurations/All Tests.run.xml",".idea/runConfigurations/build.run.xml",".idea/runConfigurations/build_prod.run.xml",".idea/runConfigurations/coverage.run.xml",".idea/runConfigurations/docs.run.xml",".idea/runConfigurations/drawings.run.xml",".idea/runConfigurations/flash-forward.run.xml",".idea/runConfigurations/Integration_Tests.run.xml",".idea/runConfigurations/Bundling_Tests.run.xml",".idea/runConfigurations/lint-fix.run.xml",".idea/runConfigurations/release.run.xml",".idea/runConfigurations/test_circular.run.xml",".idea/runConfigurations/uml.run.xml",".idea/runConfigurations/Unit Tests.run.xml",".idea/runConfigurations/update-scripts.run.xml"],docs:["workdocs/tutorials/Contributing.md","workdocs/tutorials/Documentation.md","workdocs/tutorials/For Developers.md","workdocs/2-Badges.md","workdocs/jsdocs.json","workdocs/readme-md.json"],styles:[".prettierrc","eslint.config.js"],scripts:["bin/update-scripts.cjs","bin/tag-release.cjs","bin/build-scripts.cjs"],tests:["jest.config.ts","workdocs/reports/jest.coverage.config.ts"],typescript:["tsconfig.json"],docker:["Dockerfile"],automation:["workdocs/confluence/Continuous Integration-Deployment/GitHub.md","workdocs/confluence/Continuous Integration-Deployment/Jira.md","workdocs/confluence/Continuous Integration-Deployment/Teams.md"]},me={boot:{type:"boolean"},org:{type:"string",short:"o"},name:{type:"string",short:"n",default:void 0},author:{type:"string",short:"a",default:void 0},all:{type:"boolean"},license:{type:"string",message:"Pick the license"},scripts:{type:"boolean"},styles:{type:"boolean"},docs:{type:"boolean"},ide:{type:"boolean"},workflows:{type:"boolean"},templates:{type:"boolean"},typescript:{type:"boolean"},docker:{type:"boolean"},pkg:{type:"boolean"},dependencies:{type:"boolean"},tests:{type:"boolean"},automation:{type:"boolean"}};e.AbortCode=O,e.BuildScripts=fe,e.Command=ae,e.DefaultCommandOptions=E,e.DefaultCommandValues=I,e.Encoding=F,e.HttpClient=se,e.NoCIFLag=A,e.PACKAGE_NAME="@decaf-ts/utils",e.RegexpOutputWriter=class extends B{constructor(e,t,o,a="g"){super(e,t);try{this.regexp="string"==typeof o?RegExp(o,a):o}catch(e){throw Error("Invalid regular expression: "+e)}}test(e){let t;this.regexp.lastIndex=0;try{t=this.regexp.exec(e)}catch(e){return}return t}testAndResolve(e){const t=this.test(e);t&&this.resolve(t[0])}testAndReject(e){const t=this.test(e);t&&this.reject(t[0])}data(e){super.data(e),this.testAndResolve(e+"")}error(e){super.error(e),this.testAndReject(e+"")}},e.ReleaseScript=class extends ae{constructor(){super("ReleaseScript",ue)}async prepareVersion(e){const t=this.log.for(this.prepareVersion);return(e=this.testVersion(e||""))||(t.verbose("No release message provided. Prompting for one:"),t.info("Listing latest git tags:"),await U("git tag --sort=-taggerdate | head -n 5").promise,await $.insistForText("tag","Enter the new tag number (accepts v*.*.*[-...])",e=>!!e.toString().match(/^v[0-9]+\.[0-9]+.[0-9]+(-[0-9a-zA-Z-]+)?$/)))}testVersion(t){const o=this.log.for(this.testVersion);switch(t=t.trim().toLowerCase()){case e.SemVersion.PATCH:case e.SemVersion.MINOR:case e.SemVersion.MAJOR:return o.verbose("Using provided SemVer update: "+t,1),t;default:return o.verbose("Testing provided version for SemVer compatibility: "+t,1),RegExp(j).test(t)?(o.verbose("version approved: "+t,1),t):void o.debug("Invalid version number: "+t)}}async prepareMessage(e){const t=this.log.for(this.prepareMessage);return e||(t.verbose("No release message provided. Prompting for one"),await $.insistForText("message","What should be the release message/ticket?",e=>!!e&&e.toString().length>5))}async run(e){let t;const{ci:o}=e;let{tag:a,message:s}=e;a=await this.prepareVersion(a),s=await this.prepareMessage(s),t=await U(`npm run prepare-release -- ${a} ${s}`,{cwd:process.cwd()}).promise,t=await U("git status --porcelain").promise,await t,t.logs.length&&await $.askConfirmation("git-changes","Do you want to push the changes to the remote repository?",!0)&&(await U("git add .").promise,await U(`git commit -m "${a} - ${s} - after release preparation${o?"":A}"`).promise),await U(`npm version "${a}" -m "${s}${o?"":A}"`).promise,await U("git push --follow-tags").promise,o||await U("NPM_TOKEN=$(cat .npmtoken) npm publish --access public").promise}},e.SemVersionRegex=j,e.SetupScriptKey=N,e.StandardOutputWriter=B,e.TemplateSync=class extends ae{constructor(){super("TemplateSync",me),this.replacements={},this.getStyles=()=>this.downloadOption("styles"),this.getTemplates=()=>this.downloadOption("templates"),this.getWorkflows=()=>this.downloadOption("workflows"),this.getDocs=()=>this.downloadOption("docs"),this.getTypescript=()=>this.downloadOption("typescript"),this.getAutomation=()=>this.downloadOption("automation"),this.getTests=()=>this.downloadOption("tests"),this.getDocker=()=>this.downloadOption("docker")}loadValuesFromPackage(){const e=process.cwd(),t=H(e,"author");let o,a=H(e,"name");if(a.startsWith("@")){const e=a.split("/");a=e[1],o=e[0].replace("@","")}["Tiago Venceslau","TiagoVenceslau","${author}"].forEach(e=>this.replacements[e]=t),["TS-Workspace","ts-workspace","${name}"].forEach(e=>this.replacements[e]=a),["decaf-ts","${org}"].forEach(e=>this.replacements[e]=o||'""'),this.replacements["${org_or_owner}"]=o||a}async downloadOption(e){if(!(e in pe))throw Error(`Option "${e}" not found in options`);const t=pe[e];for(const e of t){this.log.info("Downloading "+e);let t=await se.downloadFile(`${he}/${e}`);t=a.patchString(t,this.replacements),_(T.default.join(process.cwd(),e),t)}}async getLicense(e){this.log.info(`Downloading ${e} license`);const t=`${he}/workdocs/licenses/${e}.md`;let o=await se.downloadFile(t);o=a.patchString(o,this.replacements),_(T.default.join(process.cwd(),"LICENSE.md"),o),K("license",e)}async getIde(){w.default.mkdirSync(T.default.join(process.cwd(),".idea","runConfigurations"),{recursive:!0}),await this.downloadOption("ide")}async getScripts(){await this.downloadOption("scripts"),this.log.info("please re-run the command"),process.exit(0)}async initPackage(e,t,o){try{const a=H();delete a[N],a.name=e,a.version="0.0.1",a.author=t,a.license=o,w.default.writeFileSync("package.json",JSON.stringify(a,null,2))}catch(e){throw Error("Error fixing package.json: "+e)}}async updatePackageScrips(){try{const e=JSON.parse(await se.downloadFile(he+"/package.json")),{scripts:t}=e,o=H();Object.keys(o.scripts).forEach(e=>{if(e in t){const s=a.patchString(t[e],this.replacements);s!==t[e]&&(o.scripts[e]=s)}}),o.exports.require=e.exports.require,o.exports.import=e.exports.import,o.types=e.types,w.default.writeFileSync("package.json",JSON.stringify(o,null,2))}catch(e){throw Error("Error fixing package.json scripts: "+e)}}async createTokenFiles(){const t=this.log.for(this.createTokenFiles),o=await $.insistForText("token","please input your github token",e=>!!e.match(/^ghp_[0-9a-zA-Z]{36}$/g));Object.values(e.Tokens).forEach(e=>{try{let a;try{a=w.default.existsSync(e)}catch(a){return t.info(`Token file ${e} not found. Creating a new one...`),void w.default.writeFileSync(e,".token"===e?o:"")}a||w.default.writeFileSync(e,".token"===e?o:"")}catch(t){throw Error(`Error creating token file ${e}: ${t}`)}})}async getOrg(){const e=await $.askText("Organization","Enter the organization name (will be used to scope your npm project. leave blank to create a unscoped project):");return await $.askConfirmation("Confirm organization","Is this organization correct?",!0)?e:this.getOrg()}async auditFix(){return await U("npm audit fix --force").promise}patchFiles(){const e=[...w.default.readdirSync(T.default.join(process.cwd(),"src"),{recursive:!0,withFileTypes:!0}).filter(e=>e.isFile()).map(e=>T.default.join(e.parentPath,e.name)),...w.default.readdirSync(T.default.join(process.cwd(),"workdocs"),{recursive:!0,withFileTypes:!0}).filter(e=>e.isFile()&&e.name.endsWith(".md")).map(e=>T.default.join(e.parentPath,e.name)),T.default.join(process.cwd(),".gitlab-ci.yml"),T.default.join(process.cwd(),"workdocs","jsdocs.json")];for(const t of e)J(t,this.replacements)}async updateDependencies(){try{const e=JSON.parse(await se.downloadFile(he+"/package.json")),{devDependencies:t}=e,o=H();Object.keys(o.scripts).forEach(e=>{if(e in t){const a=t[e];a!==t[e]&&(o.devDependencies=o.devDependencies||{},o.devDependencies[e]=a)}}),w.default.writeFileSync("package.json",JSON.stringify(o,null,2)),await U("npm install").promise}catch(e){throw Error("Error fixing package.json dependencies: "+e)}}async run(e){let{license:t}=e;const{boot:o}=e;let{all:a,scripts:s,styles:n,docs:r,ide:i,workflows:l,templates:c,docker:d,typescript:g,dependencies:f,tests:u,automation:h,pkg:p}=e;if((s||n||r||i||l||c||d||g||h||f||u||p)&&(a=!1),o){const e=await this.getOrg(),o=await $.insistForText("Project name","Enter the project name:",e=>e.length>1),a=await $.insistForText("Author","Enter the author name:",e=>e.length>1),s=e?`@${e}/${o}`:o;await this.initPackage(s,a,t),await this.createTokenFiles(),await this.auditFix(),this.patchFiles()}a&&(s=!1,n=!0,r=!0,i=!0,l=!0,c=!0,d=!0,g=!0,p=!0,f=!0,u=!0,h=!1),void 0===s&&(s=await $.askConfirmation("scripts","Do you want to get scripts?",!0)),s&&await this.getScripts(),this.loadValuesFromPackage(),a||void 0!==t||await $.askConfirmation("license","Do you want to set a license?",!0)&&(t=await $.insistForText("license","Enter the desired License (MIT|GPL|Apache|LGPL|AGPL):",e=>!!e&&!!e.match(/^(MIT|GPL|Apache|LGPL|AGPL)$/g))),void 0!==t&&await this.getLicense(t),void 0===i&&(i=await $.askConfirmation("ide","Do you want to get ide configs?",!0)),i&&await this.getIde(),void 0===g&&(g=await $.askConfirmation("typescript","Do you want to get typescript configs?",!0)),g&&await this.getTypescript(),void 0===d&&(d=await $.askConfirmation("docker","Do you want to get docker configs?",!0)),d&&await this.getDocker(),void 0===h&&(h=await $.askConfirmation("automation","Do you want to get automation configs?",!0)),h&&await this.getAutomation(),void 0===n&&(n=await $.askConfirmation("styles","Do you want to get styles?",!0)),n&&await this.getStyles(),void 0===r&&(r=await $.askConfirmation("docs","Do you want to get docs?",!0)),r&&await this.getDocs(),void 0===l&&(l=await $.askConfirmation("workflows","Do you want to get workflows?",!0)),l&&await this.getWorkflows(),void 0===c&&(c=await $.askConfirmation("templates","Do you want to get templates?",!0)),c&&await this.getTemplates(),void 0===p&&(p=await $.askConfirmation("pkg","Do you want to update your package.json scripts?",!0)),p&&await this.updatePackageScrips(),void 0===u&&(u=await $.askConfirmation("pkg","Do you want to update your test configs?",!0)),u&&await this.getTests(),void 0===f&&(f=await $.askConfirmation("pkg","Do you want to update dev dependencies?",!0)),f&&await this.updateDependencies()}},e.UserInput=$,e.VERSION="0.4.4",e.chainAbortController=L,e.copyFile=W,e.deletePath=X,e.getAllFiles=q,e.getDependencies=Y,e.getPackage=H,e.getPackageDependencies=ie,e.getPackageVersion=z,e.getSlogan=oe,e.installDependencies=Z,e.installIfNotAvailable=async(e,t)=>{if(!t){const e=await Y();t={prod:e.prod?.map(e=>e.name)||[],dev:e.dev?.map(e=>e.name)||[],peer:e.peer?.map(e=>e.name)||[]}}const{prod:o,dev:a,peer:s}=t,n=Array.from(new Set([...o||[],...a||[],...s||[]])),r=(e="string"==typeof e?[e]:e).filter(e=>!n.includes(e));return r.length&&await Z({dev:r}),t.dev=t.dev||[],t.dev.push(...r),t},e.lockify=e=>{let t=Promise.resolve();return(...o)=>{const a=t.then(()=>e(...o));return t=a.catch(()=>{}),a}},e.normalizeImport=async e=>e.then(e=>e.default||e),e.packageToGlobal=re,e.parseList=ne,e.patchFile=J,e.printBanner=te,e.pushToGit=async function e(){const t=R.for(e),o=await U("git config user.name").promise,a=await U("git config user.email").promise;t.verbose(`cached git id: ${o}/${a}. changing to automation`),await U('git config user.email "automation@decaf.ts"').promise,await U('git config user.name "decaf"').promise,t.info("Pushing changes to git..."),await U("git add .").promise,await U('git commit -m "refs #1 - after repo setup"').promise,await U("git push").promise,await U(`git config user.email "${a}"`).promise,await U(`git config user.name "${o}"`).promise,t.verbose(`reverted to git id: ${o}/${a}`)},e.readFile=V,e.renameFile=G,e.runCommand=U,e.setPackageAttribute=K,e.spawnCommand=M,e.updateDependencies=async function e(){const t=R.for(e);t.info("checking for updates..."),await U("npx npm-check-updates -u").promise,t.info("updating..."),await U("npx npm run do-install").promise},e.writeFile=_},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("prompts"),require("util"),require("@decaf-ts/logging"),require("fs"),require("path"),require("child_process"),require("styled-string-builder"),require("https"),require("rollup"),require("@rollup/plugin-typescript"),require("@rollup/plugin-commonjs"),require("@rollup/plugin-node-resolve"),require("@rollup/plugin-json"),require("module"),require("typescript")):"function"==typeof define&&define.amd?define(["exports","prompts","util","@decaf-ts/logging","fs","path","child_process","styled-string-builder","https","rollup","@rollup/plugin-typescript","@rollup/plugin-commonjs","@rollup/plugin-node-resolve","@rollup/plugin-json","module","typescript"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).utils={},e.prompts,e.util,e.decafTsLogging,e.fs,e.path,e.childProcess,e.styledStringBuilder,e.https,e.rollup,e.rollupPluginTypescript,e.rollupPluginCommonjs,e.rollupPluginNodeResolve,e.rollupPluginJson,e.module,e.typescript);
|
|
1
|
+
var e,t;e=this,t=function(e,t,o,a,s,n,i,r,l,c,d,g,f,u,h,p,m){"use strict";function S(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function y(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(o=>{if("default"!==o){var a=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,a.get?a:{enumerable:!0,get:()=>e[o]})}}),t.default=e,Object.freeze(t)}var w=S(t),T=S(s),b=S(n),C=S(l),v=S(c),D=S(g),k=S(f),$=S(h),E=y(m);class F{static{this.logger=a.Logging.for(F)}constructor(e){this.type="text",this.name=e}setType(e){return F.logger.verbose("Setting type to: "+e),this.type=e,this}setMessage(e){return F.logger.verbose("Setting message to: "+e),this.message=e,this}setInitial(e){return F.logger.verbose("Setting initial value to: "+e),this.initial=e,this}setStyle(e){return F.logger.verbose("Setting style to: "+e),this.style=e,this}setFormat(e){return F.logger.verbose("Setting format function"),this.format=e,this}setValidate(e){return F.logger.verbose("Setting validate function"),this.validate=e,this}setOnState(e){return F.logger.verbose("Setting onState callback"),this.onState=e,this}setMin(e){return F.logger.verbose("Setting min value to: "+e),this.min=e,this}setMax(e){return F.logger.verbose("Setting max value to: "+e),this.max=e,this}setFloat(e){return F.logger.verbose("Setting float to: "+e),this.float=e,this}setRound(e){return F.logger.verbose("Setting round to: "+e),this.round=e,this}setInstructions(e){return F.logger.verbose("Setting instructions to: "+e),this.instructions=e,this}setIncrement(e){return F.logger.verbose("Setting increment to: "+e),this.increment=e,this}setSeparator(e){return F.logger.verbose("Setting separator to: "+e),this.separator=e,this}setActive(e){return F.logger.verbose("Setting active style to: "+e),this.active=e,this}setInactive(e){return F.logger.verbose("Setting inactive style to: "+e),this.inactive=e,this}setChoices(e){return F.logger.verbose("Setting choices: "+JSON.stringify(e)),this.choices=e,this}setHint(e){return F.logger.verbose("Setting hint to: "+e),this.hint=e,this}setWarn(e){return F.logger.verbose("Setting warn to: "+e),this.warn=e,this}setSuggest(e){return F.logger.verbose("Setting suggest function"),this.suggest=e,this}setLimit(e){return F.logger.verbose("Setting limit to: "+e),this.limit=e,this}setMask(e){return F.logger.verbose("Setting mask to: "+e),this.mask=e,this}setStdout(e){return F.logger.verbose("Setting stdout stream"),this.stdout=e,this}setStdin(e){return this.stdin=e,this}async ask(){return(await F.ask(this))[this.name]}static async ask(e){const t=F.logger.for(this.ask);let o;Array.isArray(e)||(e=[e]);try{t.verbose("Asking questions: "+e.map(e=>e.name).join(", ")),o=await w.default(e),t.verbose("Received answers: "+JSON.stringify(o,null,2))}catch(e){throw Error("Error while getting input: "+e)}return o}static async askNumber(e,t,o,a,s){F.logger.for(this.askNumber).verbose(`Asking number input: undefined, question: ${t}, min: ${o}, max: ${a}, initial: ${s}`);const n=new F(e).setMessage(t).setType("number");return"number"==typeof o&&n.setMin(o),"number"==typeof a&&n.setMax(a),"number"==typeof s&&n.setInitial(s),(await this.ask(n))[e]}static async askText(e,t,o=void 0,a){F.logger.for(this.askText).verbose(`Asking text input: undefined, question: ${t}, mask: ${o}, initial: ${a}`);const s=new F(e).setMessage(t);return o&&s.setMask(o),"string"==typeof a&&s.setInitial(a),(await this.ask(s))[e]}static async askConfirmation(e,t,o){F.logger.for(this.askConfirmation).verbose(`Asking confirmation input: undefined, question: ${t}, initial: ${o}`);const a=new F(e).setMessage(t).setType("confirm");return void 0!==o&&a.setInitial(o),(await this.ask(a))[e]}static async insist(e,t,o,a=1){const s=F.logger.for(this.insist);let n;s.verbose(`Insisting on input: ${e.name}, test: ${t.toString()}, defaultConfirmation: ${o}, limit: ${a}`);let i,r=0;try{do{n=(await F.ask(e))[e.name],t(n)?(i=await F.askConfirmation(e.name+"-confirm",`Is the ${e.type} correct?`,o),i||(n=void 0)):n=void 0}while(void 0===n&&a>1&&r++<a)}catch(e){throw s.error("Error while insisting: "+e),e}return void 0===n&&s.info("no selection..."),n}static async insistForText(e,t,o,a=void 0,s,n=!1,i=-1){F.logger.for(this.insistForText).verbose(`Insisting for text input: undefined, question: ${t}, test: ${o.toString()}, mask: ${a}, initial: ${s}, defaultConfirmation: ${n}, limit: ${i}`);const r=new F(e).setMessage(t);return a&&r.setMask(a),"string"==typeof s&&r.setInitial(s),await this.insist(r,o,n,i)}static async insistForNumber(e,t,o,a,s,n,i=!1,r=-1){F.logger.for(this.insistForNumber).verbose(`Insisting for number input: undefined, question: ${t}, test: ${o.toString()}, min: ${a}, max: ${s}, initial: ${n}, defaultConfirmation: ${i}, limit: ${r}`);const l=new F(e).setMessage(t).setType("number");return"number"==typeof a&&l.setMin(a),"number"==typeof s&&l.setMax(s),"number"==typeof n&&l.setInitial(n),await this.insist(l,o,i,r)}static parseArgs(e){const t=F.logger.for(this.parseArgs),a={args:process.argv.slice(2),options:e};t.debug("Parsing arguments: "+JSON.stringify(a,null,2));try{return o.parseArgs(a)}catch(o){throw t.debug(`Error while parsing arguments:\n${JSON.stringify(a,null,2)}\n | options\n${JSON.stringify(e,null,2)}\n | ${o}`),Error("Error while parsing arguments: "+o)}}}const I={verbose:{type:"boolean",short:"V",default:void 0},version:{type:"boolean",short:"v",default:void 0},help:{type:"boolean",short:"h",default:!1},logLevel:{type:"string",default:"info"},logStyle:{type:"boolean",default:!0},timestamp:{type:"boolean",default:!0},banner:{type:"boolean",default:!0}},j=Object.keys(I).reduce((e,t)=>(e[t]=I[t].default,e),{}),x="utf-8",A=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z])))/g;var N;e.SemVersion=void 0,(N=e.SemVersion||(e.SemVersion={})).PATCH="patch",N.MINOR="minor",N.MAJOR="major";const P="-no-ci",O="postinstall";var B;e.Tokens=void 0,(B=e.Tokens||(e.Tokens={})).GIT=".token",B.NPM=".npmtoken",B.DOCKER=".dockertoken",B.CONFLUENCE=".confluence-token";const L="Aborted";class M{constructor(e,t,...o){this.cmd=e,this.lock=t,this.logger=a.Logging.for(this.cmd)}log(e,t){t=Buffer.isBuffer(t)?t.toString(x):t;const o="stderr"===e?r.style(t).red.text:t;this.logger.info(o)}data(e){this.log("stdout",e+"")}error(e){this.log("stderr",e+"")}errors(e){this.log("stderr","Error executing command exited : "+e)}exit(e,t){this.log("stdout","command exited code : "+(0===e?r.style(e.toString()).green.text:r.style(null===e?"null":e.toString()).red.text)),0===e?this.resolve(t.map(e=>e.trim()).join("\n")):this.reject(Error(t.length?t.join("\n"):e.toString()))}parseCommand(e){return e="string"==typeof e?e.split(" "):e,this.cmd=e.join(" "),[e[0],e.slice(1)]}resolve(e){this.log("stdout",`${this.cmd} executed successfully: ${r.style(e?"ran to completion":e).green}`),this.lock.resolve(e)}reject(e){e instanceof Error||(e=Error("number"==typeof e?"Exit code "+e:e)),this.log("stderr",`${this.cmd} failed to execute: ${r.style(e.message).red}`),this.lock.reject(e)}}function U(e,...t){let o,a;if(e instanceof AbortSignal?(a=new AbortController,o=[e,...t]):(a=e,o=t),a.signal.aborted)return a;const s=()=>a.abort();for(const e of o){if(e.aborted){a.abort();break}e.addEventListener("abort",s,{once:!0,signal:a.signal})}return a}function R(e,t,o,a,s){function n(t,a){const[n,r]=e.parseCommand(t);s.info("Running command: "+n),s.debug("with args: "+r.join(" "));const l=i.spawn(n,r,{...o,cwd:o.cwd||process.cwd(),env:Object.assign({},process.env,o.env,{PATH:process.env.PATH}),shell:o.shell||!1,signal:a.signal});return s.verbose("pid : "+l.pid),l}const r=t.match(/[<>$#]/g);if(r)throw Error(`Invalid command: ${t}. contains invalid characters: ${r}`);if(t.includes(" | ")){const e=t.split(" | "),o=[],s=Array(e.length);s[0]=a;for(let t=0;t<e.length;t++)0!==t&&(s[t]=U(s[t-1].signal)),o.push(n(e[t],s[t])),0!==t&&o[t-1].stdout.pipe(o[t].stdin);return o[e.length-1]}return n(t,a)}function J(e,t={},o=M,...s){const n=a.Logging.for(J),i=new AbortController,r={abort:i,command:e,logs:[],errs:[]},l=new Promise((a,l)=>{let c;try{c=new o(e,{resolve:a,reject:l},...s),r.cmd=R(c,e,t,i,n)}catch(t){return l(Error(`Error running command ${e}: ${t}`))}r.cmd.stdout.setEncoding("utf8"),r.cmd.stdout.on("data",e=>{e=e.toString(),r.logs.push(e),c.data(e)}),r.cmd.stderr.on("data",e=>{e=e.toString(),r.errs.push(e),c.error(e)}),r.cmd.once("error",e=>{c.exit(e.message,r.errs)}),r.cmd.once("exit",(e=0)=>{i.signal.aborted&&null===e&&(e=L),c.exit(e,0===e?r.logs:r.errs)})});return Object.assign(r,{promise:l,pipe:async t=>{const o=n.for("pipe");try{o.verbose(`Executing pipe function ${e}...`);const a=await l;return o.verbose(`Piping output to ${t.name}: ${a}`),t(a)}catch(e){throw o.error("Error piping command output: "+e),e}}}),r}const V=a.Logging.for("fs");function W(e,t){const o=V.for(W);if(!T.default.existsSync(e))throw Error(`File not found at path "${e}".`);let s=_(e);try{o.verbose(`Patching file "${e}"...`),o.debug("with value: "+JSON.stringify(t)),s=a.patchString(s,t)}catch(e){throw Error("Error patching file: "+e)}q(e,s)}function _(e){const t=V.for(_);try{return t.verbose(`Reading file "${e}"...`),T.default.readFileSync(e,"utf8")}catch(o){throw t.verbose(`Error reading file "${e}": ${o}`),Error(`Error reading file "${e}": ${o}`)}}function q(e,t){const o=V.for(q);try{o.verbose(`Writing file "${e} with ${t.length} bytes...`),T.default.writeFileSync(e,t,"utf8")}catch(t){throw o.verbose(`Error writing file "${e}": ${t}`),Error(`Error writing file "${e}": ${t}`)}}function G(e,t){const o=V.for(G),a=[];try{return o.verbose(`Retrieving all files from "${e}"...`),T.default.readdirSync(e).forEach(t=>{const o=b.default.join(e,t),s=T.default.statSync(o);s.isFile()?a.push(o):s.isDirectory()&&a.push(...G(o))}),t?a.filter(t):a}catch(t){throw o.verbose(`Error retrieving files from "${e}": ${t}`),Error(`Error retrieving files from "${e}": ${t}`)}}async function z(e,t){const o=V.for(z);let a,s;try{a=T.default.statSync(e)}catch(t){throw o.verbose(`Source path "${e}" does not exist: ${t}`),Error(`Source path "${e}" does not exist: ${t}`)}try{s=T.default.statSync(t)}catch(e){}if(s)throw o.verbose(`Destination path "${t}" already exists`),Error(`Destination path "${t}" already exists`);try{o.verbose(`Renaming ${a.isFile()?"file":"directory"} "${e}" to "${t}...`),T.default.renameSync(e,t),o.verbose(`Successfully renamed to "${t}"`)}catch(s){throw o.verbose(`Error renaming ${a.isFile()?"file":"directory"} "${e}" to "${t}": ${s}`),Error(`Error renaming ${a.isFile()?"file":"directory"} "${e}" to "${t}": ${s}`)}}function K(e,t){const o=V.for(K);let a,s;try{a=T.default.statSync(e)}catch(t){throw o.verbose(`Source path "${e}" does not exist: ${t}`),Error(`Source path "${e}" does not exist: ${t}`)}try{s=T.default.statSync(t)}catch(e){a.isDirectory()&&(o.verbose(`Dest path "${t}" does not exist. creating`),T.default.mkdirSync(t,{recursive:!0}))}try{o.verbose(`Copying ${a.isFile()?"file":"directory"} "${e}" to "${t}...`),T.default.cpSync(e,t,{recursive:!0})}catch(s){throw o.verbose(`Error copying ${a.isFile()?"file":"directory"} "${e}" to "${t}: ${s}`),Error(`Error copying ${a.isFile()?"file":"directory"} "${e}" to "${t}: ${s}`)}}function X(e){const t=V.for(X);try{const o=T.default.statSync(e);o.isFile()?(t.verbose(`Deleting file "${e}...`),T.default.rmSync(e,{recursive:!0,force:!0})):o.isDirectory()&&T.default.rmSync(e,{recursive:!0,force:!0})}catch(o){throw t.verbose(`Error Deleting "${e}": ${o}`),Error(`Error Deleting "${e}": ${o}`)}}function H(e=process.cwd(),t){let o;try{o=JSON.parse(_(b.default.join(e,"package.json")))}catch(e){throw Error('Failed to retrieve package information" '+e)}if(t){if(!(t in o))throw Error(`Property "${t}" not found in package.json`);return o[t]}return o}function Y(e,t,o=process.cwd()){const a=H(o);a[e]=t,q(b.default.join(o,"package.json"),JSON.stringify(a,null,2))}function Z(e=process.cwd()){return H(e,"version")}async function Q(e=process.cwd()){let t;try{t=JSON.parse(await J("npm ls --json",{cwd:e}).promise)}catch(e){throw Error("Failed to retrieve dependencies: "+e)}const o=(e,t)=>({name:e[0],version:e[1].version});return{prod:Object.entries(t.dependencies||{}).map(o),dev:Object.entries(t.devDependencies||{}).map(o),peer:Object.entries(t.peerDependencies||{}).map(o)}}async function ee(e){const t=V.for(ee),o=e.prod||[],a=e.dev||[],s=e.peer||[];o.length&&(t.info(`Installing dependencies ${o.join(", ")}...`),await J("npm install "+o.join(" "),{cwd:process.cwd()}).promise),a.length&&(t.info(`Installing devDependencies ${a.join(", ")}...`),await J("npm install --save-dev "+a.join(" "),{cwd:process.cwd()}).promise),s.length&&(t.info(`Installing peerDependencies ${s.join(", ")}...`),await J("npm install --save-peer "+s.join(" "),{cwd:process.cwd()}).promise)}async function te(e){const t=V.for(te);try{const o=T.default.readdirSync(e).map(t=>b.default.join(e,t)).filter(e=>{try{return T.default.statSync(e).isFile()&&(e.endsWith(".js")||e.endsWith(".cjs")||e.endsWith(".mjs"))}catch{return!1}});if(0===o.length)throw Error("No JS files found in directory "+e);let a=o[0],s=T.default.statSync(a).size;for(const e of o.slice(1)){const t=T.default.statSync(e).size;s>t&&(a=e,s=t)}t.verbose(`Selected smallest bundle: ${a} (${s} bytes)`);const n=T.default.readFileSync(a),i=C.default.gzipSync(n),r=Number((i.length/1024).toFixed(1));return t.verbose(`Gzipped size: ${i.length} bytes (${r} KB)`),r}catch(o){throw t.verbose(`Failed to compute gzipped size for ${e}: ${o}`),o}}const oe=[{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That's Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That\u2019s Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That\u2019s Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That\u2019s Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That\u2019s Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That\u2019s Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That\u2019s Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That\u2019s Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That\u2019s Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"No caffeine, no chaos. Just clean code.",Tags:"Coffee-themed, Calm, Tech"},{Slogan:"Full flavor, no jitters. That\u2019s Decaf-TS.",Tags:"Coffee-themed, Cheerful"},{Slogan:"Chill fullstack. Powered by Decaf.",Tags:"Coffee-themed, Fun, Tech"},{Slogan:"Decaf-TS: Brewed for calm code.",Tags:"Coffee-themed, Branding"},{Slogan:"Smooth as your morning Decaf.",Tags:"Coffee-themed, Chill"},{Slogan:"All the kick, none of the crash.",Tags:"Coffee-themed, Energetic"},{Slogan:"Sip back and ship faster.",Tags:"Coffee-themed, Fun"},{Slogan:"Keep calm and code Decaf.",Tags:"Coffee-themed, Playful"},{Slogan:"Code without the caffeine shakes.",Tags:"Coffee-themed, Humorous"},{Slogan:"Your fullstack, decaffeinated.",Tags:"Coffee-themed, Technical"},{Slogan:"Decaf-TS: Where smart contracts meet smart interfaces.",Tags:"Blockchain, Smart Contracts, Tech"},{Slogan:"Ship dApps without the stress.",Tags:"Blockchain, Cheerful, Developer"},{Slogan:"No CRUD, no problem \u2014 Decaf your data.",Tags:"Data, No-CRUD, Chill"},{Slogan:"From DID to UI, without breaking a sweat.",Tags:"DID, SSI, UI, Calm"},{Slogan:"Decaf-TS: Your frontend already understands your smart contract.",Tags:"Smart Contracts, DX, Magic"},{Slogan:"Self-sovereign by design. Productive by default.",Tags:"SSI, Developer, Calm"},{Slogan:"Build once. Deploy everywhere. Decentralized and delightful.",Tags:"Blockchain, Multi-platform, Happy"},{Slogan:"Data that defines its own destiny.",Tags:"SSI, Data-driven, Empowerment"},{Slogan:"Goodbye CRUD, hello intent-based interfaces.",Tags:"No-CRUD, UI, Technical"},{Slogan:"The smoothest path from DID to done.",Tags:"DID, Workflow, Chill"},{Slogan:"Because your dApp deserves more than boilerplate.",Tags:"Blockchain, DevX, Efficiency"},{Slogan:"Own your data. Own your flow.",Tags:"SSI, Control, Ownership"},{Slogan:"Write logic like it belongs with the data \u2014 because it does.",Tags:"Data Logic, Developer, Smart"},{Slogan:"From smart contracts to smarter frontends.",Tags:"Smart Contracts, UI, DX"},{Slogan:"No caffeine. No CRUD. Just the future.",Tags:"No-CRUD, Coffee-themed, Futuristic"},{Slogan:"The future of web3 UX is Decaf.",Tags:"Blockchain, UX, Vision"},{Slogan:"Code with confidence. Govern with clarity.",Tags:"Blockchain, Governance, Calm"},{Slogan:"Interfaces that obey the data, not the other way around.",Tags:"UI, Data Logic, Self-aware"},{Slogan:"Brew business logic right into your bytes.",Tags:"Data Logic, Coffee-themed, Fun"},{Slogan:"DIDs done differently \u2014 and delightfully.",Tags:"DID, Self-Sovereign, Playful"},{Slogan:"Decaf-TS-TS: Where blockchain contracts meet smart interfaces.",Tags:"Blockchain, Smart Contracts, Tech"},{Slogan:"Ship dApps without the stress.",Tags:"Blockchain, Cheerful, Developer"},{Slogan:"No boilerplate, no problem \u2014 Decaf-TS your data.",Tags:"Data, No-CRUD, Chill"},{Slogan:"From DID to UI, without breaking a sweat.",Tags:"DID, SSI, UI, Calm"},{Slogan:"Decaf-TS-TS: Your frontend already understands your blockchain contract.",Tags:"Smart Contracts, DX, Magic"},{Slogan:"Self-sovereign by design. Productive by default.",Tags:"SSI, Developer, Calm"},{Slogan:"Build once. Deploy everywhere. Decentralized and delightful.",Tags:"Blockchain, Multi-platform, Happy"},{Slogan:"Data that defines its own destiny.",Tags:"SSI, Data-driven, Empowerment"},{Slogan:"Goodbye boilerplate, hello intent-based interfaces.",Tags:"No-CRUD, UI, Technical"},{Slogan:"The smoothest path from DID to done.",Tags:"DID, Workflow, Chill"},{Slogan:"Because your dApp deserves more than boilerplate.",Tags:"Blockchain, DevX, Efficiency"},{Slogan:"Own your data. Own your flow.",Tags:"SSI, Control, Ownership"},{Slogan:"Write logic like it belongs with the data \u2014 because it does.",Tags:"Data Logic, Developer, Smart"},{Slogan:"From blockchain contracts to smarter frontends.",Tags:"Smart Contracts, UI, DX"},{Slogan:"No caffeine. No boilerplate. Just the future.",Tags:"No-CRUD, Coffee-themed, Futuristic"},{Slogan:"The future of web3 UX is Decaf-TS.",Tags:"Blockchain, UX, Vision"},{Slogan:"Code with confidence. Govern with clarity.",Tags:"Blockchain, Governance, Calm"},{Slogan:"Interfaces that obey the data, not the other way around.",Tags:"UI, Data Logic, Self-aware"},{Slogan:"Brew business logic right into your bytes.",Tags:"Data Logic, Coffee-themed, Fun"},{Slogan:"DIDs done differently \u2014 and delightfully.",Tags:"DID, Self-Sovereign, Playful"},{Slogan:"Decaf-TS-TS: Where blockchain contracts meet smart interfaces.",Tags:"Blockchain, Smart Contracts, Tech"},{Slogan:"Ship dApps without the stress.",Tags:"Blockchain, Cheerful, Developer"},{Slogan:"No boilerplate, no problem \u2014 Decaf-TS your data.",Tags:"Data, No-CRUD, Chill"},{Slogan:"From DID to UI, without breaking a sweat.",Tags:"DID, SSI, UI, Calm"},{Slogan:"Decaf-TS-TS: Your frontend already understands your blockchain contract.",Tags:"Smart Contracts, DX, Magic"},{Slogan:"Self-sovereign by design. Productive by default.",Tags:"SSI, Developer, Calm"},{Slogan:"Build once. Deploy everywhere. Decentralized and delightful.",Tags:"Blockchain, Multi-platform, Happy"},{Slogan:"Data that defines its own destiny.",Tags:"SSI, Data-driven, Empowerment"},{Slogan:"Goodbye boilerplate, hello intent-based interfaces.",Tags:"No-CRUD, UI, Technical"},{Slogan:"The smoothest path from DID to done.",Tags:"DID, Workflow, Chill"},{Slogan:"Because your dApp deserves more than boilerplate.",Tags:"Blockchain, DevX, Efficiency"},{Slogan:"Own your data. Own your flow.",Tags:"SSI, Control, Ownership"},{Slogan:"Write logic like it belongs with the data \u2014 because it does.",Tags:"Data Logic, Developer, Smart"},{Slogan:"From blockchain contracts to smarter frontends.",Tags:"Smart Contracts, UI, DX"},{Slogan:"No caffeine. No boilerplate. Just the future.",Tags:"No-CRUD, Coffee-themed, Futuristic"},{Slogan:"The future of web3 UX is Decaf-TS.",Tags:"Blockchain, UX, Vision"},{Slogan:"Code with confidence. Govern with clarity.",Tags:"Blockchain, Governance, Calm"},{Slogan:"Interfaces that obey the data, not the other way around.",Tags:"UI, Data Logic, Self-aware"},{Slogan:"Brew business logic right into your bytes.",Tags:"Data Logic, Coffee-themed, Fun"},{Slogan:"DIDs done differently \u2014 and delightfully.",Tags:"DID, Self-Sovereign, Playful"},{Slogan:"Decaf-TS-TS: Where blockchain contracts meet smart interfaces.",Tags:"Blockchain, Smart Contracts, Tech"},{Slogan:"Ship dApps without the stress.",Tags:"Blockchain, Cheerful, Developer"},{Slogan:"No boilerplate, no problem \u2014 Decaf-TS your data.",Tags:"Data, No-CRUD, Chill"},{Slogan:"From DID to UI, without breaking a sweat.",Tags:"DID, SSI, UI, Calm"},{Slogan:"Decaf-TS-TS: Your frontend already understands your blockchain contract.",Tags:"Smart Contracts, DX, Magic"},{Slogan:"Self-sovereign by design. Productive by default.",Tags:"SSI, Developer, Calm"},{Slogan:"Build once. Deploy everywhere. Decentralized and delightful.",Tags:"Blockchain, Multi-platform, Happy"},{Slogan:"Data that defines its own destiny.",Tags:"SSI, Data-driven, Empowerment"},{Slogan:"Goodbye boilerplate, hello intent-based interfaces.",Tags:"No-CRUD, UI, Technical"},{Slogan:"The smoothest path from DID to done.",Tags:"DID, Workflow, Chill"},{Slogan:"Because your dApp deserves more than boilerplate.",Tags:"Blockchain, DevX, Efficiency"},{Slogan:"Own your data. Own your flow.",Tags:"SSI, Control, Ownership"},{Slogan:"Write logic like it belongs with the data \u2014 because it does.",Tags:"Data Logic, Developer, Smart"},{Slogan:"From blockchain contracts to smarter frontends.",Tags:"Smart Contracts, UI, DX"},{Slogan:"No caffeine. No boilerplate. Just the future.",Tags:"No-CRUD, Coffee-themed, Futuristic"},{Slogan:"The future of web3 UX is Decaf-TS.",Tags:"Blockchain, UX, Vision"},{Slogan:"Code with confidence. Govern with clarity.",Tags:"Blockchain, Governance, Calm"},{Slogan:"Interfaces that obey the data, not the other way around.",Tags:"UI, Data Logic, Self-aware"},{Slogan:"Brew business logic right into your bytes.",Tags:"Data Logic, Coffee-themed, Fun"},{Slogan:"DIDs done differently \u2014 and delightfully.",Tags:"DID, Self-Sovereign, Playful"},{Slogan:"Decaf-TS-TS: Where blockchain contracts meet smart interfaces.",Tags:"Blockchain, Smart Contracts, Tech"},{Slogan:"Ship dApps without the stress.",Tags:"Blockchain, Cheerful, Developer"},{Slogan:"No boilerplate, no problem \u2014 Decaf-TS your data.",Tags:"Data, No-CRUD, Chill"},{Slogan:"From DID to UI, without breaking a sweat.",Tags:"DID, SSI, UI, Calm"},{Slogan:"Decaf-TS-TS: Your frontend already understands your blockchain contract.",Tags:"Smart Contracts, DX, Magic"},{Slogan:"Self-sovereign by design. Productive by default.",Tags:"SSI, Developer, Calm"},{Slogan:"Build once. Deploy everywhere. Decentralized and delightful.",Tags:"Blockchain, Multi-platform, Happy"},{Slogan:"Data that defines its own destiny.",Tags:"SSI, Data-driven, Empowerment"},{Slogan:"Goodbye boilerplate, hello intent-based interfaces.",Tags:"No-CRUD, UI, Technical"},{Slogan:"The smoothest path from DID to done.",Tags:"DID, Workflow, Chill"},{Slogan:"Because your dApp deserves more than boilerplate.",Tags:"Blockchain, DevX, Efficiency"},{Slogan:"Own your data. Own your flow.",Tags:"SSI, Control, Ownership"},{Slogan:"Write logic like it belongs with the data \u2014 because it does.",Tags:"Data Logic, Developer, Smart"},{Slogan:"From blockchain contracts to smarter frontends.",Tags:"Smart Contracts, UI, DX"},{Slogan:"No caffeine. No boilerplate. Just the future.",Tags:"No-CRUD, Coffee-themed, Futuristic"},{Slogan:"The future of web3 UX is Decaf-TS.",Tags:"Blockchain, UX, Vision"},{Slogan:"Code with confidence. Govern with clarity.",Tags:"Blockchain, Governance, Calm"},{Slogan:"Interfaces that obey the data, not the other way around.",Tags:"UI, Data Logic, Self-aware"},{Slogan:"Brew business logic right into your bytes.",Tags:"Data Logic, Coffee-themed, Fun"},{Slogan:"DIDs done differently \u2014 and delightfully.",Tags:"DID, Self-Sovereign, Playful"}],ae=["\x1b[38;5;215m","\x1b[38;5;209m","\x1b[38;5;205m","\x1b[38;5;210m","\x1b[38;5;217m","\x1b[38;5;216m","\x1b[38;5;224m","\x1b[38;5;230m","\x1b[38;5;230m"];function se(e){const t=ne(),o="# \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \n# ( ( \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \n# ) ) \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \n# [=======] \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \n# `-----\xb4 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \n# \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \n# \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591 \n#".split("\n"),a=o.reduce((e,t)=>Math.max(e,t.length),0);o.push("# "+t.padStart(a-3)),o.forEach((t,o)=>{(e?e.info.bind(e):(()=>{}).bind())(r.style(t||"").raw(ae[o]).text)})}function ne(e){try{return e=void 0===e?Math.floor(Math.random()*oe.length):e,oe[e].Slogan}catch(e){throw Error("Failed to retrieve slogans: "+e)}}class ie extends a.LoggedClass{constructor(e,t={},o=[]){super(),this.name=e,this.inputs=t,this.requirements=o,ie.log||Object.defineProperty(ie,"log",{writable:!1,value:a.Logging.for(ie.name)}),this.inputs=Object.assign({},I,t)}async checkRequirements(){const{prod:e,dev:t,peer:o}=await Q(),a=[],s=Array.from(new Set([...e,...t,...o]).values()).map(e=>e.name);for(const e of this.requirements)s.includes(e)||a.push(e);a.length}help(e){return this.log.info("This is help. I'm no use because I should have been overridden.")}async execute(){const e=F.parseArgs(this.inputs),t=a.LoggedEnvironment.accumulate(j).accumulate(e.values),{version:o,help:s,banner:n}=t;if(o)return Z();if(s)return this.help(e);let i;n&&se(this.log.for(se,{timestamp:!1,style:!1,context:!1,logLevel:!1}));try{i=await this.run(t)}catch(e){throw e}return i}}class re{static{this.log=a.Logging.for(re)}static async downloadFile(e){return new Promise((t,o)=>{!function e(a){a=encodeURI(a),v.default.get(a,s=>{if(301===s.statusCode||307===s.statusCode)return e(s.headers.location);if(200!==s.statusCode)return re.log.error(`Failed to fetch ${a} (status: ${s.statusCode})`),o(Error("Failed to fetch "+a));let n="";s.on("data",e=>{n+=e}),s.on("error",e=>{o(e)}),s.on("end",()=>{t(n)})})}(e)})}}function le(e){return e?Array.isArray(e)?e.map(e=>(""+e).trim()).filter(Boolean):(""+e).split(",").map(e=>e.trim()).filter(Boolean):[]}function ce(e){return e.replace(/^@/,"").split(/[/\-_.]+/).filter(Boolean).map((e,t)=>0===t?e.replace(/[^a-zA-Z0-9]/g,""):`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join("")}function de(){let e;try{e=H(process.cwd())}catch{e=void 0}try{if(!e||!(Object.keys(e.dependencies||{}).length>0||Object.keys(e.devDependencies||{}).length>0||Object.keys(e.peerDependencies||{}).length>0)){const t=b.default.resolve(__dirname,"../../..");try{e=H(t)}catch{}}}catch{}const t=Object.keys(e&&e.dependencies||{}),o=Object.keys(e&&e.peerDependencies||{}),a=Object.keys(e&&e.devDependencies||{});return Array.from(new Set([...t,...o,...a]))}const ge="##PACKAGE_SIZE##";var fe,ue;(e=>{e.CJS="commonjs",e.ESM="es2022"})(fe||(fe={})),(e=>{e.BUILD="build",e.BUNDLE="bundle",e.ALL="all"})(ue||(ue={}));const he={prod:{type:"boolean",default:!1},dev:{type:"boolean",default:!1},buildMode:{type:"string",default:ue.ALL},includes:{type:"string",default:""},externals:{type:"string",default:""},docs:{type:"boolean",default:!1},commands:{type:"boolean",default:!1},banner:{type:"boolean",default:!1}},pe=(e=".cjs")=>{const t=me.log.for(pe),o=new Map;return a=>s=>{const n=b.default.dirname(s.fileName);function i(a){const s=JSON.stringify([n,a]),i=o.get(s);if(null!=i)return i;let r,l=a;try{l=b.default.resolve(n,l+".ts")}catch(e){throw Error(`Failed to resolve path ${a}: ${e}`)}try{r=T.default.statSync(l)}catch(e){try{t.verbose(`Testing existence of path ${l} as a folder defaulting to index file`),r=T.default.statSync(l.replace(/\.ts$/gm,""))}catch(t){throw Error(`Failed to resolve path ${a}: ${e}, ${t}`)}}if(r.isDirectory()&&(l=l.replace(/\.ts$/gm,"/index.ts")),b.default.isAbsolute(l)){const t=(/\.tsx?$/.exec(b.default.basename(l))||[])[0]||void 0;l="./"+b.default.relative(n,b.default.resolve(b.default.dirname(l),b.default.basename(l,t)+e))}return o.set(s,l),l}return E.visitNode(s,function e(t){if((e=>!(!E.isImportDeclaration(e)&&!E.isExportDeclaration(e)||void 0===e.moduleSpecifier||!E.isStringLiteral(e.moduleSpecifier)||!e.moduleSpecifier.text.startsWith("./")&&!e.moduleSpecifier.text.startsWith("../")||""!==b.default.extname(e.moduleSpecifier.text)))(t)){if(E.isImportDeclaration(t)){const e=i(t.moduleSpecifier.text),o=a.factory.createStringLiteral(e);return a.factory.updateImportDeclaration(t,t.modifiers,t.importClause,o,void 0)}if(E.isExportDeclaration(t)){const e=i(t.moduleSpecifier.text),o=a.factory.createStringLiteral(e);return a.factory.updateExportDeclaration(t,t.modifiers,t.isTypeOnly,t.exportClause,o,void 0)}}return E.visitEachChild(t,e,a)})}};class me extends ie{constructor(){super("BuildScripts",Object.assign({},I,he)),this.replacements={};const e=H(),{name:t,version:o}=e;this.pkgName=t.includes("@")?t.split("/")[1]:t,this.pkgVersion=o,this.replacements["0.4.5"]=this.pkgVersion,this.replacements["@decaf-ts/utils"]=t}patchFiles(e){const t=this.log.for(this.patchFiles),{name:o,version:a}=H();t.info(`Patching ${o} ${a} module in ${e}...`),T.default.statSync(e).isDirectory()&&T.default.readdirSync(e,{withFileTypes:!0,recursive:!0}).filter(e=>e.isFile()).forEach(e=>W(b.default.join(e.parentPath,e.name),this.replacements)),t.verbose(`Module ${o} ${a} patched in ${e}...`)}reportDiagnostics(e,t){const o=this.formatDiagnostics(e);try{this.log[t](o)}catch(e){throw e}return o}formatDiagnostics(e){return e.map(e=>{let t="";if(e.file&&e.start){const{line:o,character:a}=e.file.getLineAndCharacterOfPosition(e.start);t+=`${e.file.fileName} (${o+1},${a+1})`}return t+=": "+E.flattenDiagnosticMessageText(e.messageText,"\n"),t}).join("\n")}readConfigFile(e){const t=T.default.readFileSync(e).toString(),o=E.parseConfigFileTextToJson(e,t),s=o.config;s||this.reportDiagnostics([o.error],a.LogLevel.error);const n=E.parseJsonConfigFileContent(s,E.sys,b.default.dirname(e));return n.errors.length>0&&this.reportDiagnostics(n.errors,a.LogLevel.error),n}evalDiagnostics(e){if(e&&e.length>0){const t=e.filter(e=>e.category===E.DiagnosticCategory.Error),o=e.filter(e=>e.category===E.DiagnosticCategory.Warning),s=e.filter(e=>e.category===E.DiagnosticCategory.Suggestion),n=e.filter(e=>e.category===E.DiagnosticCategory.Message);if(o.length&&this.reportDiagnostics(o,a.LogLevel.warn),t.length)throw this.reportDiagnostics(e,a.LogLevel.error),Error(`TypeScript reported ${e.length} diagnostic(s) during check; aborting.`);s.length&&this.reportDiagnostics(s,a.LogLevel.info),n.length&&this.reportDiagnostics(n,a.LogLevel.info)}}preCheckDiagnostics(e){const t=E.getPreEmitDiagnostics(e);this.evalDiagnostics(t)}async checkTsDiagnostics(e,t,o=!1){const a=this.log.for(this.checkTsDiagnostics);let s;try{s=this.readConfigFile("./tsconfig.json")}catch(e){throw Error("Failed to parse tsconfig.json: "+e)}o?(s.options.module=m.ModuleKind.AMD,s.options.outDir="dist",s.options.isolatedModules=!1,s.options.outFile=this.pkgName):(s.options.outDir="lib"+(t===fe.ESM?"/esm":""),s.options.module=t===fe.ESM?m.ModuleKind.ES2022:m.ModuleKind.CommonJS),s.options.inlineSourceMap=!1,s.options.inlineSources=!1,s.options.sourceMap=!0;const n=E.createProgram(s.fileNames,s.options);this.preCheckDiagnostics(n),a.verbose(`TypeScript checks passed (${o?"bundle":"normal"} mode).`)}async buildTs(e,t,o=!1){let a;this.log.for(this.buildTs).info(`Building ${this.pkgName} ${this.pkgVersion} module (${t}) in ${e?"dev":"prod"} mode...`);try{a=this.readConfigFile("./tsconfig.json")}catch(e){throw Error("Failed to parse tsconfig.json: "+e)}o?(a.options.module=m.ModuleKind.AMD,a.options.outDir="dist",a.options.isolatedModules=!1,a.options.outFile=this.pkgName):(a.options.outDir="lib"+(t===fe.ESM?"/esm":""),a.options.module=t===fe.ESM?m.ModuleKind.ES2022:m.ModuleKind.CommonJS),e?(a.options.inlineSourceMap=!0,a.options.inlineSources=!0,a.options.sourceMap=!1):(a.options.inlineSourceMap=!1,a.options.inlineSources=!1,a.options.sourceMap=!0);const s=E.createProgram(a.fileNames,a.options),n={};t===fe.CJS?n.before=[pe(".cjs")]:t===fe.ESM&&(n.before=[pe(".js")]);const i=s.emit(void 0,void 0,void 0,void 0,n),r=E.getPreEmitDiagnostics(s).concat(i.diagnostics);this.evalDiagnostics(r)}async build(e,t,o=!1){const a=this.log.for(this.build);if(await this.buildTs(e,t,o),a.verbose(`Module ${this.pkgName} ${this.pkgVersion} (${t}) built in ${e?"dev":"prod"} mode...`),t===fe.CJS&&!o){const e=G("lib",e=>e.endsWith(".js")&&!e.includes("/esm/"));for(const t of e){a.verbose(`Patching ${t}'s cjs imports...`);const e=t.replace(".js",".cjs");await z(t,e)}}}copyAssets(e){const t=this.log.for(this.copyAssets);let o=!1;try{o=T.default.statSync("./src/assets").isDirectory()}catch(e){return t.verbose("No assets found in ./src/assets to copy")}o&&K("./src/assets",`./${e===fe.CJS?"lib":"dist"}/assets`)}async bundle(e,t,o,a="src/index.ts",s=this.pkgName,n,i=["prompts","styled-string-builder","typed-object-accumulator","@decaf-ts/logging"]){await this.checkTsDiagnostics(t,e,!0);const r=e===fe.ESM,l=this.pkgName,c=this.log,g=Array.from(new Set([...le(i)]));let f=le(n);0===f.length&&(f=de());const h=Array.from(new Set([...(()=>{try{return Array.isArray(p.builtinModules)?p.builtinModules:[]}catch{return["fs","path","process","child_process","util","https","http","os","stream","crypto","zlib","net","tls","url","querystring","assert","events","tty","dns","querystring"]}})(),...f])),m=!t||"inline",S=[D.default({compilerOptions:{module:"esnext",declaration:!1,outDir:o?"bin":"dist",sourceMap:!t,inlineSourceMap:!!t,inlineSources:!!t},include:["src/**/*.ts"],exclude:["node_modules","**/*.spec.ts"],tsconfig:"./tsconfig.json"}),$.default()];o&&S.push(k.default({include:[],exclude:f}),u.nodeResolve({resolveOnly:g}));try{const b=await import("@rollup/plugin-terser"),C=b&&b.terser||b.default||b,v={parse:{ecma:2020},compress:!1,mangle:!1,format:{comments:!1,beautify:!0}},E={parse:{ecma:2020},compress:{ecma:2020,passes:5,drop_console:!0,drop_debugger:!0,toplevel:!0,module:r,unsafe:!0,unsafe_arrows:!0,unsafe_comps:!0,collapse_vars:!0,reduce_funcs:!0,reduce_vars:!0},mangle:{toplevel:!0},format:{comments:!1,ascii_only:!0},toplevel:!0};S.push(C(t?v:E))}catch{}const y={input:a,plugins:S,external:h,onwarn:void 0,treeshake:!t},w={};h.forEach(e=>{w[e]=ce(e)});const T=[{file:`${o?"bin/":"dist/"}${s||".bundle."+(t?"":"min")}${r?".js":".cjs"}`,format:o?"cjs":r?"esm":"umd",name:l,esModule:r,sourcemap:m,globals:w,exports:"auto"}];try{const F=await d.rollup(y);async function I(e){for(const t of T)await e.write(t)}c.verbose(F.watchFiles),await I(F)}catch(j){throw Error("Failed to bundle: "+j)}}async buildByEnv(e,t=ue.ALL,o,a){try{X("lib")}catch(e){}try{X("dist")}catch(e){}T.default.mkdirSync("lib"),T.default.mkdirSync("dist"),[ue.ALL,ue.BUILD].includes(t)&&(await this.build(e,fe.ESM),await this.build(e,fe.CJS),this.patchFiles("lib")),[ue.ALL,ue.BUNDLE].includes(t)&&(await this.bundle(fe.ESM,e,!1,"src/index.ts",this.pkgName,a,o),await this.bundle(fe.CJS,e,!1,"src/index.ts",this.pkgName,a,o),this.patchFiles("dist")),this.copyAssets(fe.CJS),this.copyAssets(fe.ESM)}async buildDev(e=ue.ALL,t,o){return this.buildByEnv(!0,e,t,o)}async buildProd(e=ue.ALL,t,o){return this.buildByEnv(!1,e,t,o)}async buildDocs(){await J("npm install better-docs taffydb").promise,await J("npx markdown-include ./workdocs/readme-md.json").promise,await J("npx jsdoc -c ./workdocs/jsdocs.json -t ./node_modules/better-docs").promise,await J("npm remove better-docs taffydb").promise,[{src:"workdocs/assets",dest:"./docs/workdocs/assets"},{src:"workdocs/reports/coverage",dest:"./docs/workdocs/reports/coverage"},{src:"workdocs/reports/html",dest:"./docs/workdocs/reports/html"},{src:"workdocs/resources",dest:"./docs/workdocs/resources"},{src:"LICENSE.md",dest:"./docs/LICENSE.md"}].forEach(e=>{const{src:t,dest:o}=e;K(t,o)});try{const e=await te(b.default.resolve("dist"));this.replacements[ge]=e+" KB"}catch{this.replacements[ge]="unknown"}try{W("./README.md",this.replacements)}catch(e){this.log.for(this.buildDocs).verbose("Failed to patch README.md: "+e)}}async run(e){const{dev:t,prod:o,docs:a,buildMode:s,includes:n,externals:i}=e;return t?await this.buildDev(s,n,i):o?await this.buildProd(s,n,i):a?await this.buildDocs():void 0}}const Se={ci:{type:"boolean",default:!0},message:{type:"string",short:"m"},tag:{type:"string",short:"t",default:void 0}},ye="https://raw.githubusercontent.com/decaf-ts/ts-workspace/master",we={templates:[".github/ISSUE_TEMPLATE/bug_report.md",".github/ISSUE_TEMPLATE/feature_request.md",".github/FUNDING.yml"],workflows:[".github/workflows/codeql-analysis.yml",".github/workflows/jest-coverage.yaml",".github/workflows/nodejs-build-prod.yaml",".github/workflows/pages.yaml",".github/workflows/publish-on-release.yaml",".github/workflows/release-on-tag.yaml",".github/workflows/snyk-analysis.yaml"],ide:[".idea/runConfigurations/All Tests.run.xml",".idea/runConfigurations/build.run.xml",".idea/runConfigurations/build_prod.run.xml",".idea/runConfigurations/coverage.run.xml",".idea/runConfigurations/docs.run.xml",".idea/runConfigurations/drawings.run.xml",".idea/runConfigurations/flash-forward.run.xml",".idea/runConfigurations/Integration_Tests.run.xml",".idea/runConfigurations/Bundling_Tests.run.xml",".idea/runConfigurations/lint-fix.run.xml",".idea/runConfigurations/release.run.xml",".idea/runConfigurations/test_circular.run.xml",".idea/runConfigurations/uml.run.xml",".idea/runConfigurations/Unit Tests.run.xml",".idea/runConfigurations/update-scripts.run.xml"],docs:["workdocs/tutorials/Contributing.md","workdocs/tutorials/Documentation.md","workdocs/tutorials/For Developers.md","workdocs/2-Badges.md","workdocs/jsdocs.json","workdocs/readme-md.json"],styles:[".prettierrc","eslint.config.js"],scripts:["bin/update-scripts.cjs","bin/tag-release.cjs","bin/build-scripts.cjs"],tests:["jest.config.ts","workdocs/reports/jest.coverage.config.ts"],typescript:["tsconfig.json"],docker:["Dockerfile"],automation:["workdocs/confluence/Continuous Integration-Deployment/GitHub.md","workdocs/confluence/Continuous Integration-Deployment/Jira.md","workdocs/confluence/Continuous Integration-Deployment/Teams.md"]},Te={boot:{type:"boolean"},org:{type:"string",short:"o"},name:{type:"string",short:"n",default:void 0},author:{type:"string",short:"a",default:void 0},all:{type:"boolean"},license:{type:"string",message:"Pick the license"},scripts:{type:"boolean"},styles:{type:"boolean"},docs:{type:"boolean"},ide:{type:"boolean"},workflows:{type:"boolean"},templates:{type:"boolean"},typescript:{type:"boolean"},docker:{type:"boolean"},pkg:{type:"boolean"},dependencies:{type:"boolean"},tests:{type:"boolean"},automation:{type:"boolean"}};e.AbortCode=L,e.BuildScripts=me,e.Command=ie,e.DefaultCommandOptions=I,e.DefaultCommandValues=j,e.Encoding=x,e.HttpClient=re,e.NoCIFLag=P,e.PACKAGE_NAME="@decaf-ts/utils",e.RegexpOutputWriter=class extends M{constructor(e,t,o,a="g"){super(e,t);try{this.regexp="string"==typeof o?RegExp(o,a):o}catch(e){throw Error("Invalid regular expression: "+e)}}test(e){let t;this.regexp.lastIndex=0;try{t=this.regexp.exec(e)}catch(e){return}return t}testAndResolve(e){const t=this.test(e);t&&this.resolve(t[0])}testAndReject(e){const t=this.test(e);t&&this.reject(t[0])}data(e){super.data(e),this.testAndResolve(e+"")}error(e){super.error(e),this.testAndReject(e+"")}},e.ReleaseScript=class extends ie{constructor(){super("ReleaseScript",Se)}async prepareVersion(e){const t=this.log.for(this.prepareVersion);return(e=this.testVersion(e||""))||(t.verbose("No release message provided. Prompting for one:"),t.info("Listing latest git tags:"),await J("git tag --sort=-taggerdate | head -n 5").promise,await F.insistForText("tag","Enter the new tag number (accepts v*.*.*[-...])",e=>!!e.toString().match(/^v[0-9]+\.[0-9]+.[0-9]+(-[0-9a-zA-Z-]+)?$/)))}testVersion(t){const o=this.log.for(this.testVersion);switch(t=t.trim().toLowerCase()){case e.SemVersion.PATCH:case e.SemVersion.MINOR:case e.SemVersion.MAJOR:return o.verbose("Using provided SemVer update: "+t,1),t;default:return o.verbose("Testing provided version for SemVer compatibility: "+t,1),RegExp(A).test(t)?(o.verbose("version approved: "+t,1),t):void o.debug("Invalid version number: "+t)}}async prepareMessage(e){const t=this.log.for(this.prepareMessage);return e||(t.verbose("No release message provided. Prompting for one"),await F.insistForText("message","What should be the release message/ticket?",e=>!!e&&e.toString().length>5))}async run(e){let t;const{ci:o}=e;let{tag:a,message:s}=e;a=await this.prepareVersion(a),s=await this.prepareMessage(s),t=await J(`npm run prepare-release -- ${a} ${s}`,{cwd:process.cwd()}).promise,t=await J("git status --porcelain").promise,await t,t.logs.length&&await F.askConfirmation("git-changes","Do you want to push the changes to the remote repository?",!0)&&(await J("git add .").promise,await J(`git commit -m "${a} - ${s} - after release preparation${o?"":P}"`).promise),await J(`npm version "${a}" -m "${s}${o?"":P}"`).promise,await J("git push --follow-tags").promise,o||await J("NPM_TOKEN=$(cat .npmtoken) npm publish --access public").promise}},e.SemVersionRegex=A,e.SetupScriptKey=O,e.StandardOutputWriter=M,e.TemplateSync=class extends ie{constructor(){super("TemplateSync",Te),this.replacements={},this.getStyles=()=>this.downloadOption("styles"),this.getTemplates=()=>this.downloadOption("templates"),this.getWorkflows=()=>this.downloadOption("workflows"),this.getDocs=()=>this.downloadOption("docs"),this.getTypescript=()=>this.downloadOption("typescript"),this.getAutomation=()=>this.downloadOption("automation"),this.getTests=()=>this.downloadOption("tests"),this.getDocker=()=>this.downloadOption("docker")}loadValuesFromPackage(){const e=process.cwd(),t=H(e,"author");let o,a=H(e,"name");if(a.startsWith("@")){const e=a.split("/");a=e[1],o=e[0].replace("@","")}["Tiago Venceslau","TiagoVenceslau","${author}"].forEach(e=>this.replacements[e]=t),["TS-Workspace","ts-workspace","${name}"].forEach(e=>this.replacements[e]=a),["decaf-ts","${org}"].forEach(e=>this.replacements[e]=o||'""'),this.replacements["${org_or_owner}"]=o||a}async downloadOption(e){if(!(e in we))throw Error(`Option "${e}" not found in options`);const t=we[e];for(const e of t){this.log.info("Downloading "+e);let t=await re.downloadFile(`${ye}/${e}`);t=a.patchString(t,this.replacements),q(b.default.join(process.cwd(),e),t)}}async getLicense(e){this.log.info(`Downloading ${e} license`);const t=`${ye}/workdocs/licenses/${e}.md`;let o=await re.downloadFile(t);o=a.patchString(o,this.replacements),q(b.default.join(process.cwd(),"LICENSE.md"),o),Y("license",e)}async getIde(){T.default.mkdirSync(b.default.join(process.cwd(),".idea","runConfigurations"),{recursive:!0}),await this.downloadOption("ide")}async getScripts(){await this.downloadOption("scripts"),this.log.info("please re-run the command"),process.exit(0)}async initPackage(e,t,o){try{const a=H();delete a[O],a.name=e,a.version="0.0.1",a.author=t,a.license=o,T.default.writeFileSync("package.json",JSON.stringify(a,null,2))}catch(e){throw Error("Error fixing package.json: "+e)}}async updatePackageScrips(){try{const e=JSON.parse(await re.downloadFile(ye+"/package.json")),{scripts:t}=e,o=H();Object.keys(o.scripts).forEach(e=>{if(e in t){const s=a.patchString(t[e],this.replacements);s!==t[e]&&(o.scripts[e]=s)}}),o.exports.require=e.exports.require,o.exports.import=e.exports.import,o.types=e.types,T.default.writeFileSync("package.json",JSON.stringify(o,null,2))}catch(e){throw Error("Error fixing package.json scripts: "+e)}}async createTokenFiles(){const t=this.log.for(this.createTokenFiles),o=await F.insistForText("token","please input your github token",e=>!!e.match(/^ghp_[0-9a-zA-Z]{36}$/g));Object.values(e.Tokens).forEach(e=>{try{let a;try{a=T.default.existsSync(e)}catch(a){return t.info(`Token file ${e} not found. Creating a new one...`),void T.default.writeFileSync(e,".token"===e?o:"")}a||T.default.writeFileSync(e,".token"===e?o:"")}catch(t){throw Error(`Error creating token file ${e}: ${t}`)}})}async getOrg(){const e=await F.askText("Organization","Enter the organization name (will be used to scope your npm project. leave blank to create a unscoped project):");return await F.askConfirmation("Confirm organization","Is this organization correct?",!0)?e:this.getOrg()}async auditFix(){return await J("npm audit fix --force").promise}patchFiles(){const e=[...T.default.readdirSync(b.default.join(process.cwd(),"src"),{recursive:!0,withFileTypes:!0}).filter(e=>e.isFile()).map(e=>b.default.join(e.parentPath,e.name)),...T.default.readdirSync(b.default.join(process.cwd(),"workdocs"),{recursive:!0,withFileTypes:!0}).filter(e=>e.isFile()&&e.name.endsWith(".md")).map(e=>b.default.join(e.parentPath,e.name)),b.default.join(process.cwd(),".gitlab-ci.yml"),b.default.join(process.cwd(),"workdocs","jsdocs.json")];for(const t of e)W(t,this.replacements)}async updateDependencies(){try{const e=JSON.parse(await re.downloadFile(ye+"/package.json")),{devDependencies:t}=e,o=H();Object.keys(o.scripts).forEach(e=>{if(e in t){const a=t[e];a!==t[e]&&(o.devDependencies=o.devDependencies||{},o.devDependencies[e]=a)}}),T.default.writeFileSync("package.json",JSON.stringify(o,null,2)),await J("npm install").promise}catch(e){throw Error("Error fixing package.json dependencies: "+e)}}async run(e){let{license:t}=e;const{boot:o}=e;let{all:a,scripts:s,styles:n,docs:i,ide:r,workflows:l,templates:c,docker:d,typescript:g,dependencies:f,tests:u,automation:h,pkg:p}=e;if((s||n||i||r||l||c||d||g||h||f||u||p)&&(a=!1),o){const e=await this.getOrg(),o=await F.insistForText("Project name","Enter the project name:",e=>e.length>1),a=await F.insistForText("Author","Enter the author name:",e=>e.length>1),s=e?`@${e}/${o}`:o;await this.initPackage(s,a,t),await this.createTokenFiles(),await this.auditFix(),this.patchFiles()}a&&(s=!1,n=!0,i=!0,r=!0,l=!0,c=!0,d=!0,g=!0,p=!0,f=!0,u=!0,h=!1),void 0===s&&(s=await F.askConfirmation("scripts","Do you want to get scripts?",!0)),s&&await this.getScripts(),this.loadValuesFromPackage(),a||void 0!==t||await F.askConfirmation("license","Do you want to set a license?",!0)&&(t=await F.insistForText("license","Enter the desired License (MIT|GPL|Apache|LGPL|AGPL):",e=>!!e&&!!e.match(/^(MIT|GPL|Apache|LGPL|AGPL)$/g))),void 0!==t&&await this.getLicense(t),void 0===r&&(r=await F.askConfirmation("ide","Do you want to get ide configs?",!0)),r&&await this.getIde(),void 0===g&&(g=await F.askConfirmation("typescript","Do you want to get typescript configs?",!0)),g&&await this.getTypescript(),void 0===d&&(d=await F.askConfirmation("docker","Do you want to get docker configs?",!0)),d&&await this.getDocker(),void 0===h&&(h=await F.askConfirmation("automation","Do you want to get automation configs?",!0)),h&&await this.getAutomation(),void 0===n&&(n=await F.askConfirmation("styles","Do you want to get styles?",!0)),n&&await this.getStyles(),void 0===i&&(i=await F.askConfirmation("docs","Do you want to get docs?",!0)),i&&await this.getDocs(),void 0===l&&(l=await F.askConfirmation("workflows","Do you want to get workflows?",!0)),l&&await this.getWorkflows(),void 0===c&&(c=await F.askConfirmation("templates","Do you want to get templates?",!0)),c&&await this.getTemplates(),void 0===p&&(p=await F.askConfirmation("pkg","Do you want to update your package.json scripts?",!0)),p&&await this.updatePackageScrips(),void 0===u&&(u=await F.askConfirmation("pkg","Do you want to update your test configs?",!0)),u&&await this.getTests(),void 0===f&&(f=await F.askConfirmation("pkg","Do you want to update dev dependencies?",!0)),f&&await this.updateDependencies()}},e.UserInput=F,e.VERSION="0.4.5",e.chainAbortController=U,e.copyFile=K,e.deletePath=X,e.getAllFiles=G,e.getDependencies=Q,e.getFileSizeZipped=te,e.getPackage=H,e.getPackageDependencies=de,e.getPackageVersion=Z,e.getSlogan=ne,e.installDependencies=ee,e.installIfNotAvailable=async(e,t)=>{if(!t){const e=await Q();t={prod:e.prod?.map(e=>e.name)||[],dev:e.dev?.map(e=>e.name)||[],peer:e.peer?.map(e=>e.name)||[]}}const{prod:o,dev:a,peer:s}=t,n=Array.from(new Set([...o||[],...a||[],...s||[]])),i=(e="string"==typeof e?[e]:e).filter(e=>!n.includes(e));return i.length&&await ee({dev:i}),t.dev=t.dev||[],t.dev.push(...i),t},e.lockify=e=>{let t=Promise.resolve();return(...o)=>{const a=t.then(()=>e(...o));return t=a.catch(()=>{}),a}},e.normalizeImport=async e=>e.then(e=>e.default||e),e.packageToGlobal=ce,e.parseList=le,e.patchFile=W,e.printBanner=se,e.pushToGit=async function e(){const t=V.for(e),o=await J("git config user.name").promise,a=await J("git config user.email").promise;t.verbose(`cached git id: ${o}/${a}. changing to automation`),await J('git config user.email "automation@decaf.ts"').promise,await J('git config user.name "decaf"').promise,t.info("Pushing changes to git..."),await J("git add .").promise,await J('git commit -m "refs #1 - after repo setup"').promise,await J("git push").promise,await J(`git config user.email "${a}"`).promise,await J(`git config user.name "${o}"`).promise,t.verbose(`reverted to git id: ${o}/${a}`)},e.readFile=_,e.renameFile=z,e.runCommand=J,e.setPackageAttribute=Y,e.spawnCommand=R,e.updateDependencies=async function e(){const t=V.for(e);t.info("checking for updates..."),await J("npx npm-check-updates -u").promise,t.info("updating..."),await J("npx npm run do-install").promise},e.writeFile=q},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("prompts"),require("util"),require("@decaf-ts/logging"),require("fs"),require("path"),require("child_process"),require("styled-string-builder"),require("zlib"),require("https"),require("rollup"),require("@rollup/plugin-typescript"),require("@rollup/plugin-commonjs"),require("@rollup/plugin-node-resolve"),require("@rollup/plugin-json"),require("module"),require("typescript")):"function"==typeof define&&define.amd?define(["exports","prompts","util","@decaf-ts/logging","fs","path","child_process","styled-string-builder","zlib","https","rollup","@rollup/plugin-typescript","@rollup/plugin-commonjs","@rollup/plugin-node-resolve","@rollup/plugin-json","module","typescript"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).utils={},e.prompts,e.util,e.decafTsLogging,e.fs,e.path,e.childProcess,e.styledStringBuilder,e.zlib,e.https,e.rollup,e.rollupPluginTypescript,e.rollupPluginCommonjs,e.rollupPluginNodeResolve,e.rollupPluginJson,e.module,e.typescript);
|
|
2
2
|
//# sourceMappingURL=utils.cjs.map
|