@seeka-labs/cli-apps 1.0.1
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/LICENSE +19 -0
- package/README.md +1 -0
- package/dist/index.js +47 -0
- package/dist/init-templates/aws-lambda/.env.example +15 -0
- package/dist/init-templates/aws-lambda/.eslintrc.cjs +10 -0
- package/dist/init-templates/aws-lambda/.example.gitignore +49 -0
- package/dist/init-templates/aws-lambda/.gitlab-ci.yml +37 -0
- package/dist/init-templates/aws-lambda/.vscode/extensions.json +5 -0
- package/dist/init-templates/aws-lambda/.vscode/launch.json +20 -0
- package/dist/init-templates/aws-lambda/.vscode/settings.json +3 -0
- package/dist/init-templates/aws-lambda/.vscode/tasks.json +12 -0
- package/dist/init-templates/aws-lambda/README.md +75 -0
- package/dist/init-templates/aws-lambda/package.json +51 -0
- package/dist/init-templates/aws-lambda/scripts/ngrok.js +28 -0
- package/dist/init-templates/aws-lambda/src/index.ts +33 -0
- package/dist/init-templates/aws-lambda/src/lib/logging/index.ts +88 -0
- package/dist/init-templates/aws-lambda/src/lib/services/index.ts +41 -0
- package/dist/init-templates/aws-lambda/src/lib/state/redis/index.ts +64 -0
- package/dist/init-templates/aws-lambda/src/lib/state/seeka/installations.ts +67 -0
- package/dist/init-templates/aws-lambda/src/routes/seekaAppWebhook.ts +170 -0
- package/dist/init-templates/aws-lambda/tsconfig.json +31 -0
- package/dist/init-templates/azure-function/.eslintrc.cjs +10 -0
- package/dist/init-templates/azure-function/.example.gitignore +48 -0
- package/dist/init-templates/azure-function/.funcignore +17 -0
- package/dist/init-templates/azure-function/.gitlab-ci.yml +33 -0
- package/dist/init-templates/azure-function/.vscode/extensions.json +7 -0
- package/dist/init-templates/azure-function/.vscode/launch.json +13 -0
- package/dist/init-templates/azure-function/.vscode/settings.json +9 -0
- package/dist/init-templates/azure-function/.vscode/tasks.json +39 -0
- package/dist/init-templates/azure-function/README.md +102 -0
- package/dist/init-templates/azure-function/host.json +20 -0
- package/dist/init-templates/azure-function/local.settings.example.json +23 -0
- package/dist/init-templates/azure-function/package.json +44 -0
- package/dist/init-templates/azure-function/scripts/ngrok.js +28 -0
- package/dist/init-templates/azure-function/src/functions/pollingExample.ts +39 -0
- package/dist/init-templates/azure-function/src/functions/queueExample.ts +33 -0
- package/dist/init-templates/azure-function/src/functions/seekaAppWebhook.ts +200 -0
- package/dist/init-templates/azure-function/src/lib/jobs/index.ts +54 -0
- package/dist/init-templates/azure-function/src/lib/logging/index.ts +93 -0
- package/dist/init-templates/azure-function/src/lib/services/index.ts +41 -0
- package/dist/init-templates/azure-function/src/lib/state/redis/index.ts +64 -0
- package/dist/init-templates/azure-function/src/lib/state/seeka/installations.ts +67 -0
- package/dist/init-templates/azure-function/tsconfig.json +22 -0
- package/dist/init-templates/netlify-function/.env.example +18 -0
- package/dist/init-templates/netlify-function/.eslintrc.cjs +7 -0
- package/dist/init-templates/netlify-function/.example.gitignore +36 -0
- package/dist/init-templates/netlify-function/.vscode/launch.json +45 -0
- package/dist/init-templates/netlify-function/README.md +60 -0
- package/dist/init-templates/netlify-function/netlify.toml +7 -0
- package/dist/init-templates/netlify-function/package.json +38 -0
- package/dist/init-templates/netlify-function/src/api/example-job-background/index.ts +52 -0
- package/dist/init-templates/netlify-function/src/api/polling-example-job-scheduled/index.ts +46 -0
- package/dist/init-templates/netlify-function/src/api/seeka-app-webhook/index.ts +185 -0
- package/dist/init-templates/netlify-function/src/lib/jobs/index.ts +68 -0
- package/dist/init-templates/netlify-function/src/lib/logging/index.ts +91 -0
- package/dist/init-templates/netlify-function/src/lib/services/index.ts +41 -0
- package/dist/init-templates/netlify-function/src/lib/state/redis/index.ts +64 -0
- package/dist/init-templates/netlify-function/src/lib/state/seeka/installations.ts +67 -0
- package/dist/init-templates/netlify-function/tsconfig.json +25 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Seeka Apps CLI
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
"use strict";var Ot=Object.create;var oe=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var yt=Object.getOwnPropertyNames;var wt=Object.getPrototypeOf,Ct=Object.prototype.hasOwnProperty;var _=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var At=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of yt(e))!Ct.call(s,i)&&i!==t&&oe(s,i,{get:()=>e[i],enumerable:!(n=bt(e,i))||n.enumerable});return s};var A=(s,e,t)=>(t=s!=null?Ot(wt(s)):{},At(e||!s||!s.__esModule?oe(t,"default",{value:s,enumerable:!0}):t,s));var k=_(q=>{var V=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},T=class extends V{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};q.CommanderError=V;q.InvalidArgumentError=T});var H=_(I=>{var{InvalidArgumentError:Et}=k(),D=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new Et(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function vt(s){let e=s.name()+(s.variadic===!0?"...":"");return s.required?"<"+e+">":"["+e+"]"}I.Argument=D;I.humanReadableArgName=vt});var M=_(ae=>{var{humanReadableArgName:xt}=H(),F=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((i,r)=>i.name().localeCompare(r.name())),t}compareOptions(e,t){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),r=n.long&&e._findOption(n.long);!i&&!r?t.push(n):n.long&&!r?t.push(e.createOption(n.long,n.description)):n.short&&!i&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(r=>!r.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(n=>xt(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((n,i)=>Math.max(n,t.subcommandTerm(i).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,i)=>Math.max(n,t.optionTerm(i).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,t.optionTerm(i).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,i)=>Math.max(n,t.argumentTerm(i).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatHelp(e,t){let n=t.padWidth(e,t),i=t.helpWidth||80,r=2,m=2;function a(p,b){if(b){let S=`${p.padEnd(n+m)}${b}`;return t.wrap(S,i-r,n+m)}return p}function o(p){return p.join(`
|
|
3
|
+
`).replace(/^/gm," ".repeat(r))}let l=[`Usage: ${t.commandUsage(e)}`,""],c=t.commandDescription(e);c.length>0&&(l=l.concat([t.wrap(c,i,0),""]));let u=t.visibleArguments(e).map(p=>a(t.argumentTerm(p),t.argumentDescription(p)));u.length>0&&(l=l.concat(["Arguments:",o(u),""]));let h=t.visibleOptions(e).map(p=>a(t.optionTerm(p),t.optionDescription(p)));if(h.length>0&&(l=l.concat(["Options:",o(h),""])),this.showGlobalOptions){let p=t.visibleGlobalOptions(e).map(b=>a(t.optionTerm(b),t.optionDescription(b)));p.length>0&&(l=l.concat(["Global Options:",o(p),""]))}let O=t.visibleCommands(e).map(p=>a(t.subcommandTerm(p),t.subcommandDescription(p)));return O.length>0&&(l=l.concat(["Commands:",o(O),""])),l.join(`
|
|
4
|
+
`)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,n,i=40){let r=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",m=new RegExp(`[\\n][${r}]+`);if(e.match(m))return e;let a=t-n;if(a<i)return e;let o=e.slice(0,n),l=e.slice(n).replace(`\r
|
|
5
|
+
`,`
|
|
6
|
+
`),c=" ".repeat(n),h="\\s\u200B",O=new RegExp(`
|
|
7
|
+
|.{1,${a-1}}([${h}]|$)|[^${h}]+?([${h}]|$)`,"g"),p=l.match(O)||[];return o+p.map((b,S)=>b===`
|
|
8
|
+
`?"":(S>0?c:"")+b.trimEnd()).join(`
|
|
9
|
+
`)}};ae.Help=F});var U=_(R=>{var{InvalidArgumentError:St}=k(),W=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=$t(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new St(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return kt(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},L=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,r=i!==void 0?i:!1;return t.negate===(r===e)}};function kt(s){return s.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function $t(s){let e,t,n=s.split(/[ |,]+/);return n.length>1&&!/^[[<]/.test(n[1])&&(e=n.shift()),t=n.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}R.Option=W;R.DualOptions=L});var ce=_(le=>{function Vt(s,e){if(Math.abs(s.length-e.length)>3)return Math.max(s.length,e.length);let t=[];for(let n=0;n<=s.length;n++)t[n]=[n];for(let n=0;n<=e.length;n++)t[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=s.length;i++){let r=1;s[i-1]===e[n-1]?r=0:r=1,t[i][n]=Math.min(t[i-1][n]+1,t[i][n-1]+1,t[i-1][n-1]+r),i>1&&n>1&&s[i-1]===e[n-2]&&s[i-2]===e[n-1]&&(t[i][n]=Math.min(t[i][n],t[i-2][n-2]+1))}return t[s.length][e.length]}function Ht(s,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=s.startsWith("--");t&&(s=s.slice(2),e=e.map(m=>m.slice(2)));let n=[],i=3,r=.4;return e.forEach(m=>{if(m.length<=1)return;let a=Vt(s,m),o=Math.max(s.length,m.length);(o-a)/o>r&&(a<i?(i=a,n=[m]):a===i&&n.push(m))}),n.sort((m,a)=>m.localeCompare(a)),t&&(n=n.map(m=>`--${m}`)),n.length>1?`
|
|
10
|
+
(Did you mean one of ${n.join(", ")}?)`:n.length===1?`
|
|
11
|
+
(Did you mean ${n[0]}?)`:""}le.suggestSimilar=Ht});var fe=_(de=>{var Nt=require("events").EventEmitter,G=require("child_process"),w=require("path"),B=require("fs"),g=require("process"),{Argument:Pt,humanReadableArgName:jt}=H(),{CommanderError:z}=k(),{Help:Tt}=M(),{Option:ue,DualOptions:qt}=U(),{suggestSimilar:he}=ce(),J=class s extends Nt{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>g.stdout.write(t),writeErr:t=>g.stderr.write(t),getOutHelpWidth:()=>g.stdout.isTTY?g.stdout.columns:void 0,getErrHelpWidth:()=>g.stderr.isTTY?g.stderr.columns:void 0,outputError:(t,n)=>n(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let i=t,r=n;typeof i=="object"&&i!==null&&(r=i,i=null),r=r||{};let[,m,a]=e.match(/([^ ]+) *(.*)/),o=this.createCommand(m);return i&&(o.description(i),o._executableHandler=!0),r.isDefault&&(this._defaultCommandName=o._name),o._hidden=!!(r.noHelp||r.hidden),o._executableFile=r.executableFile||null,a&&o.arguments(a),this._registerCommand(o),o.parent=this,o.copyInheritedSettings(this),i?this:o}createCommand(e){return new s(e)}createHelp(){return Object.assign(new Tt,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
12
|
+
- specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new Pt(e,t)}argument(e,t,n,i){let r=this.createArgument(e,t);return typeof n=="function"?r.default(i).argParser(n):r.default(n),this.addArgument(r),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,n,i]=e.match(/([^ ]+) *(.*)/),r=t??"display help for command",m=this.createCommand(n);return m.helpOption(!1),i&&m.arguments(i),r&&m.description(r),this._addImplicitHelpCommand=!0,this._helpCommand=m,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
|
|
13
|
+
Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new z(e,t,n)),g.exit(e)}action(e){let t=n=>{let i=this.registeredArguments.length,r=n.slice(0,i);return this._storeOptionsAsProperties?r[i]=this:r[i]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new ue(e,t)}_callParseArg(e,t,n,i){try{return e.parseArg(t,n)}catch(r){if(r.code==="commander.invalidArgument"){let m=`${i} ${r.message}`;this.error(m,{exitCode:r.exitCode,code:r.code})}throw r}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
|
|
14
|
+
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=i=>[i.name()].concat(i.aliases()),n=t(e).find(i=>this._findCommand(i));if(n){let i=t(this._findCommand(n)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${i}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let r=e.long.replace(/^--no-/,"--");this._findOption(r)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(r,m,a)=>{r==null&&e.presetArg!==void 0&&(r=e.presetArg);let o=this.getOptionValue(n);r!==null&&e.parseArg?r=this._callParseArg(e,r,o,m):r!==null&&e.variadic&&(r=e._concatValue(r,o)),r==null&&(e.negate?r=!1:e.isBoolean()||e.optional?r=!0:r=""),this.setOptionValueWithSource(n,r,a)};return this.on("option:"+t,r=>{let m=`error: option '${e.flags}' argument '${r}' is invalid.`;i(r,m,"cli")}),e.envVar&&this.on("optionEnv:"+t,r=>{let m=`error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;i(r,m,"env")}),this}_optionEx(e,t,n,i,r){if(typeof t=="object"&&t instanceof ue)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let m=this.createOption(t,n);if(m.makeOptionMandatory(!!e.mandatory),typeof i=="function")m.default(r).argParser(i);else if(i instanceof RegExp){let a=i;i=(o,l)=>{let c=a.exec(o);return c?c[0]:l},m.default(r).argParser(i)}else m.default(i);return this.addOption(m)}option(e,t,n,i){return this._optionEx({},e,t,n,i)}requiredOption(e,t,n,i){return this._optionEx({mandatory:!0},e,t,n,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");t=t||{},e===void 0&&(e=g.argv,g.versions&&g.versions.electron&&(t.from="electron")),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":g.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,t){let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_executeSubCommand(e,t){t=t.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function r(c,u){let h=w.resolve(c,u);if(B.existsSync(h))return h;if(i.includes(w.extname(u)))return;let O=i.find(p=>B.existsSync(`${h}${p}`));if(O)return`${h}${O}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let m=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let c;try{c=B.realpathSync(this._scriptPath)}catch{c=this._scriptPath}a=w.resolve(w.dirname(c),a)}if(a){let c=r(a,m);if(!c&&!e._executableFile&&this._scriptPath){let u=w.basename(this._scriptPath,w.extname(this._scriptPath));u!==this._name&&(c=r(a,`${u}-${e._name}`))}m=c||m}n=i.includes(w.extname(m));let o;g.platform!=="win32"?n?(t.unshift(m),t=pe(g.execArgv).concat(t),o=G.spawn(g.argv[0],t,{stdio:"inherit"})):o=G.spawn(m,t,{stdio:"inherit"}):(t.unshift(m),t=pe(g.execArgv).concat(t),o=G.spawn(g.execPath,t,{stdio:"inherit"})),o.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(u=>{g.on(u,()=>{o.killed===!1&&o.exitCode===null&&o.kill(u)})});let l=this._exitCallback;o.on("close",(c,u)=>{c=c??1,l?l(new z(c,"commander.executeSubCommandAsync","(close)")):g.exit(c)}),o.on("error",c=>{if(c.code==="ENOENT"){let u=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",h=`'${m}' does not exist
|
|
15
|
+
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
16
|
+
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
17
|
+
- ${u}`;throw new Error(h)}else if(c.code==="EACCES")throw new Error(`'${m}' not executable`);if(!l)g.exit(1);else{let u=new z(1,"commander.executeSubCommandAsync","(error)");u.nestedError=c,l(u)}}),this.runningCommand=o}_dispatchSubcommand(e,t,n){let i=this._findCommand(e);i||this.help({error:!0});let r;return r=this._chainOrCallSubCommandHook(r,i,"preSubcommand"),r=this._chainOrCall(r,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(n));else return i._parseCommand(t,n)}),r}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,i,r)=>{let m=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;m=this._callParseArg(n,i,r,a)}return m};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,i)=>{let r=n.defaultValue;n.variadic?i<this.args.length?(r=this.args.slice(i),n.parseArg&&(r=r.reduce((m,a)=>e(n,a,m),n.defaultValue))):r===void 0&&(r=[]):i<this.args.length&&(r=this.args[i],n.parseArg&&(r=e(n,r,n.defaultValue))),t[i]=r}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(r=>r._lifeCycleHooks[t]!==void 0).forEach(r=>{r._lifeCycleHooks[t].forEach(m=>{i.push({hookedCommand:r,callback:m})})}),t==="postAction"&&i.reverse(),i.forEach(r=>{n=this._chainOrCall(n,()=>r.callback(r.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(r=>{i=this._chainOrCall(i,()=>r(this,t))}),i}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let m;return m=this._chainOrCallHooks(m,"preAction"),m=this._chainOrCall(m,()=>this._actionHandler(this.processedArgs)),this.parent&&(m=this._chainOrCall(m,()=>{this.parent.emit(r,e,t)})),m=this._chainOrCallHooks(m,"postAction"),m}if(this.parent&&this.parent.listenerCount(r))i(),this._processArguments(),this.parent.emit(r,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(r=>n.conflictsWith.includes(r.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],i=t,r=e.slice();function m(o){return o.length>1&&o[0]==="-"}let a=null;for(;r.length;){let o=r.shift();if(o==="--"){i===n&&i.push(o),i.push(...r);break}if(a&&!m(o)){this.emit(`option:${a.name()}`,o);continue}if(a=null,m(o)){let l=this._findOption(o);if(l){if(l.required){let c=r.shift();c===void 0&&this.optionMissingArgument(l),this.emit(`option:${l.name()}`,c)}else if(l.optional){let c=null;r.length>0&&!m(r[0])&&(c=r.shift()),this.emit(`option:${l.name()}`,c)}else this.emit(`option:${l.name()}`);a=l.variadic?l:null;continue}}if(o.length>2&&o[0]==="-"&&o[1]!=="-"){let l=this._findOption(`-${o[1]}`);if(l){l.required||l.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${l.name()}`,o.slice(2)):(this.emit(`option:${l.name()}`),r.unshift(`-${o.slice(2)}`));continue}}if(/^--[^=]+=/.test(o)){let l=o.indexOf("="),c=this._findOption(o.slice(0,l));if(c&&(c.required||c.optional)){this.emit(`option:${c.name()}`,o.slice(l+1));continue}}if(m(o)&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(o)){t.push(o),r.length>0&&n.push(...r);break}else if(this._getHelpCommand()&&o===this._getHelpCommand().name()){t.push(o),r.length>0&&t.push(...r);break}else if(this._defaultCommandName){n.push(o),r.length>0&&n.push(...r);break}}if(this._passThroughOptions){i.push(o),r.length>0&&i.push(...r);break}i.push(o)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let i=this.options[n].attributeName();e[i]=i===this._versionOptionName?this._version:this[i]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
|
|
18
|
+
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
19
|
+
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
20
|
+
`),this.outputHelp({error:!0}));let n=t||{},i=n.exitCode||1,r=n.code||"commander.error";this._exit(i,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in g.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,g.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new qt(this.options),t=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let n=m=>{let a=m.attributeName(),o=this.getOptionValue(a),l=this.options.find(u=>u.negate&&a===u.attributeName()),c=this.options.find(u=>!u.negate&&a===u.attributeName());return l&&(l.presetArg===void 0&&o===!1||l.presetArg!==void 0&&o===l.presetArg)?l:c||m},i=m=>{let a=n(m),o=a.attributeName();return this.getOptionValueSource(o)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},r=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],r=this;do{let m=r.createHelp().visibleOptions(r).filter(a=>a.long).map(a=>a.long);i=i.concat(m),r=r.parent}while(r&&!r._enablePositionalOptions);t=he(e,i)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(r=>{i.push(r.name()),r.alias()&&i.push(r.alias())}),t=he(e,i)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:"commander.unknownCommand"})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",n=n||"output the version number";let i=this.createOption(t,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
21
|
+
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(n=>jt(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=w.basename(e,w.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},n;return t.error?n=i=>this._outputConfiguration.writeErr(i):n=i=>this._outputConfiguration.writeOut(i),t.write=e.write||n,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let n=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(r=>r.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let i=this.helpInformation(n);if(t&&(i=t(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(r=>r.emit("afterAllHelp",n))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=g.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
22
|
+
Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,r=>{let m;typeof t=="function"?m=t({error:r.error,command:r.command}):m=t,m&&r.write(`${m}
|
|
23
|
+
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function pe(s){return s.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",i="9229",r;return(r=e.match(/^(--inspect(-brk)?)$/))!==null?t=r[1]:(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=r[1],/^\d+$/.test(r[3])?i=r[3]:n=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],n=r[3],i=r[4]),t&&i!=="0"?`${t}=${n}:${parseInt(i)+1}`:e})}de.Command=J});var be=_(y=>{var{Argument:ge}=H(),{Command:K}=fe(),{CommanderError:Dt,InvalidArgumentError:_e}=k(),{Help:It}=M(),{Option:Oe}=U();y.program=new K;y.createCommand=s=>new K(s);y.createOption=(s,e)=>new Oe(s,e);y.createArgument=(s,e)=>new ge(s,e);y.Command=K;y.Option=Oe;y.Argument=ge;y.Help=It;y.CommanderError=Dt;y.InvalidArgumentError=_e;y.InvalidOptionArgumentError=_e});var xe=_((Dn,ve)=>{ve.exports=Ee;Ee.sync=Mt;var Ce=require("fs");function Ft(s,e){var t=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var n=0;n<t.length;n++){var i=t[n].toLowerCase();if(i&&s.substr(-i.length).toLowerCase()===i)return!0}return!1}function Ae(s,e,t){return!s.isSymbolicLink()&&!s.isFile()?!1:Ft(e,t)}function Ee(s,e,t){Ce.stat(s,function(n,i){t(n,n?!1:Ae(i,s,e))})}function Mt(s,e){return Ae(Ce.statSync(s),s,e)}});var He=_((In,Ve)=>{Ve.exports=ke;ke.sync=Wt;var Se=require("fs");function ke(s,e,t){Se.stat(s,function(n,i){t(n,n?!1:$e(i,e))})}function Wt(s,e){return $e(Se.statSync(s),e)}function $e(s,e){return s.isFile()&&Lt(s,e)}function Lt(s,e){var t=s.mode,n=s.uid,i=s.gid,r=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),m=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),o=parseInt("010",8),l=parseInt("001",8),c=a|o,u=t&l||t&o&&i===m||t&a&&n===r||t&c&&r===0;return u}});var Pe=_((Mn,Ne)=>{var Fn=require("fs"),N;process.platform==="win32"||global.TESTING_WINDOWS?N=xe():N=He();Ne.exports=Y;Y.sync=Rt;function Y(s,e,t){if(typeof e=="function"&&(t=e,e={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){Y(s,e||{},function(r,m){r?i(r):n(m)})})}N(s,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),t(n,i)})}function Rt(s,e){try{return N.sync(s,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var Me=_((Wn,Fe)=>{var E=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",je=require("path"),Ut=E?";":":",Te=Pe(),qe=s=>Object.assign(new Error(`not found: ${s}`),{code:"ENOENT"}),De=(s,e)=>{let t=e.colon||Ut,n=s.match(/\//)||E&&s.match(/\\/)?[""]:[...E?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(t)],i=E?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",r=E?i.split(t):[""];return E&&s.indexOf(".")!==-1&&r[0]!==""&&r.unshift(""),{pathEnv:n,pathExt:r,pathExtExe:i}},Ie=(s,e,t)=>{typeof e=="function"&&(t=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:r}=De(s,e),m=[],a=l=>new Promise((c,u)=>{if(l===n.length)return e.all&&m.length?c(m):u(qe(s));let h=n[l],O=/^".*"$/.test(h)?h.slice(1,-1):h,p=je.join(O,s),b=!O&&/^\.[\\\/]/.test(s)?s.slice(0,2)+p:p;c(o(b,l,0))}),o=(l,c,u)=>new Promise((h,O)=>{if(u===i.length)return h(a(c+1));let p=i[u];Te(l+p,{pathExt:r},(b,S)=>{if(!b&&S)if(e.all)m.push(l+p);else return h(l+p);return h(o(l,c,u+1))})});return t?a(0).then(l=>t(null,l),t):a(0)},Gt=(s,e)=>{e=e||{};let{pathEnv:t,pathExt:n,pathExtExe:i}=De(s,e),r=[];for(let m=0;m<t.length;m++){let a=t[m],o=/^".*"$/.test(a)?a.slice(1,-1):a,l=je.join(o,s),c=!o&&/^\.[\\\/]/.test(s)?s.slice(0,2)+l:l;for(let u=0;u<n.length;u++){let h=c+n[u];try{if(Te.sync(h,{pathExt:i}))if(e.all)r.push(h);else return h}catch{}}}if(e.all&&r.length)return r;if(e.nothrow)return null;throw qe(s)};Fe.exports=Ie;Ie.sync=Gt});var Le=_((Ln,X)=>{"use strict";var We=(s={})=>{let e=s.env||process.env;return(s.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};X.exports=We;X.exports.default=We});var Be=_((Rn,Ge)=>{"use strict";var Re=require("path"),Bt=Me(),zt=Le();function Ue(s,e){let t=s.options.env||process.env,n=process.cwd(),i=s.options.cwd!=null,r=i&&process.chdir!==void 0&&!process.chdir.disabled;if(r)try{process.chdir(s.options.cwd)}catch{}let m;try{m=Bt.sync(s.command,{path:t[zt({env:t})],pathExt:e?Re.delimiter:void 0})}catch{}finally{r&&process.chdir(n)}return m&&(m=Re.resolve(i?s.options.cwd:"",m)),m}function Jt(s){return Ue(s)||Ue(s,!0)}Ge.exports=Jt});var ze=_((Un,Q)=>{"use strict";var Z=/([()\][%!^"`<>&|;, *?])/g;function Kt(s){return s=s.replace(Z,"^$1"),s}function Yt(s,e){return s=`${s}`,s=s.replace(/(\\*)"/g,'$1$1\\"'),s=s.replace(/(\\*)$/,"$1$1"),s=`"${s}"`,s=s.replace(Z,"^$1"),e&&(s=s.replace(Z,"^$1")),s}Q.exports.command=Kt;Q.exports.argument=Yt});var Ke=_((Gn,Je)=>{"use strict";Je.exports=/^#!(.*)/});var Xe=_((Bn,Ye)=>{"use strict";var Xt=Ke();Ye.exports=(s="")=>{let e=s.match(Xt);if(!e)return null;let[t,n]=e[0].replace(/#! ?/,"").split(" "),i=t.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var Qe=_((zn,Ze)=>{"use strict";var ee=require("fs"),Zt=Xe();function Qt(s){let t=Buffer.alloc(150),n;try{n=ee.openSync(s,"r"),ee.readSync(n,t,0,150,0),ee.closeSync(n)}catch{}return Zt(t.toString())}Ze.exports=Qt});var it=_((Jn,nt)=>{"use strict";var en=require("path"),et=Be(),tt=ze(),tn=Qe(),nn=process.platform==="win32",sn=/\.(?:com|exe)$/i,rn=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function mn(s){s.file=et(s);let e=s.file&&tn(s.file);return e?(s.args.unshift(s.file),s.command=e,et(s)):s.file}function on(s){if(!nn)return s;let e=mn(s),t=!sn.test(e);if(s.options.forceShell||t){let n=rn.test(e);s.command=en.normalize(s.command),s.command=tt.command(s.command),s.args=s.args.map(r=>tt.argument(r,n));let i=[s.command].concat(s.args).join(" ");s.args=["/d","/s","/c",`"${i}"`],s.command=process.env.comspec||"cmd.exe",s.options.windowsVerbatimArguments=!0}return s}function an(s,e,t){e&&!Array.isArray(e)&&(t=e,e=null),e=e?e.slice(0):[],t=Object.assign({},t);let n={command:s,args:e,options:t,file:void 0,original:{command:s,args:e}};return t.shell?n:on(n)}nt.exports=an});var mt=_((Kn,rt)=>{"use strict";var te=process.platform==="win32";function ne(s,e){return Object.assign(new Error(`${e} ${s.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${s.command}`,path:s.command,spawnargs:s.args})}function ln(s,e){if(!te)return;let t=s.emit;s.emit=function(n,i){if(n==="exit"){let r=st(i,e,"spawn");if(r)return t.call(s,"error",r)}return t.apply(s,arguments)}}function st(s,e){return te&&s===1&&!e.file?ne(e.original,"spawn"):null}function cn(s,e){return te&&s===1&&!e.file?ne(e.original,"spawnSync"):null}rt.exports={hookChildProcess:ln,verifyENOENT:st,verifyENOENTSync:cn,notFoundError:ne}});var lt=_((Yn,v)=>{"use strict";var ot=require("child_process"),ie=it(),se=mt();function at(s,e,t){let n=ie(s,e,t),i=ot.spawn(n.command,n.args,n.options);return se.hookChildProcess(i,n),i}function un(s,e,t){let n=ie(s,e,t),i=ot.spawnSync(n.command,n.args,n.options);return i.error=i.error||se.verifyENOENTSync(i.status,n),i}v.exports=at;v.exports.spawn=at;v.exports.sync=un;v.exports._parse=ie;v.exports._enoent=se});var ye=A(be(),1),{program:Sn,createCommand:kn,createArgument:$n,createOption:Vn,CommanderError:Hn,InvalidArgumentError:Nn,InvalidOptionArgumentError:Pn,Command:we,Argument:jn,Option:C,Help:Tn}=ye.default;var j=A(lt()),d=A(require("fs")),gt=A(require("os")),f=A(require("path"));var P="1.0.1";var ut=()=>{$(),console.log(`
|
|
24
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
25
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
26
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
27
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
28
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m&\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
29
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
30
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
31
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;m*\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
32
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
33
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;m/\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
34
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m,\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
35
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;019m*\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
36
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
37
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
38
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
39
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
40
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m*\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
41
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
42
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
43
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
44
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
45
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m/\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
46
|
+
\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
|
|
47
|
+
\x1B[0m`),console.log(""),console.log("---------------------- Seeka Apps CLI ----------------------"),console.log(`-------------------------- v${P} -------------------------`),console.log(""),console.log("https://developers.seeka.co"),console.log("for help: npx @seeka-labs/cli-apps@latest --help"),console.log("for scaffolding help: npx @seeka-labs/cli-apps@latest init --help"),$()},$=()=>{console.log(""),console.log("------------------------------------------------------------"),console.log("")};var x=A(require("fs")),ht=require("os"),pt=s=>/^[a-zA-Z0-9-]+$/.test(s);function dt(s){try{let e=x.opendirSync(s),t=e.readSync();return e.closeSync(),t===null}catch{return!1}}function ft(s){let e={};return!s||s.length===0||s.forEach(t=>{let n=t.indexOf("=");if(n===-1){e[t]="";return}let i=t.substring(0,n),r=t.substring(n+1);e[i]=r}),e}var pn=s=>x.readFileSync(s,"utf-8").split(ht.EOL);var dn=(s,e,t)=>{let n=pn(s),i=n.find(r=>r.split("=")[0]===e);if(i!==void 0){let r=n.indexOf(i);n.splice(r,1,`${e}="${t}"`)}else n.push(`${e}="${t}"`);x.writeFileSync(s,n.join(ht.EOL))},re=(s,e)=>{e&&Object.keys(e).forEach(t=>{dn(s,t,e[t])})};var _t=s=>{if(!pt(s.appName)){console.error("App name must be alphanumeric and hyphens only");return}if(!s.appName.startsWith("seeka-app-")){console.error("App name must start with seeka-app-");return}let e=s.appName,t=f.resolve(s.outputDirectory,s.directoryName||e);console.log(`Creating new ${s.template.replace(/-/g," ")} Seeka app in ${t}`),console.log("");let n=f.resolve(t,".git"),i=d.existsSync(n),r=f.resolve(gt.default.tmpdir(),".seeka-app-init-git-"+new Date().getTime());if(d.existsSync(t)&&dt(t)===!1)if(s.force)console.log("--force was used and destination directory is not empty. Clearing out the directory"),i&&(console.info(".git directory found in directory, I will preserve it and remove all other files and directories to prepare for the app creation"),d.cpSync(n,r,{recursive:!0})),d.rmSync(t,{recursive:!0,force:!0});else{console.error("Directory is not empty. Use --force to create app in non-empty directory");return}d.mkdirSync(t,{recursive:!0}),i&&(d.cpSync(r,n,{recursive:!0}),d.rmSync(r,{recursive:!0}),console.info("Restored .git directory"));let m=f.resolve(__dirname,"init-templates",s.template);d.cpSync(m,t,{recursive:!0}),d.renameSync(f.join(t,".example.gitignore"),f.join(t,".gitignore"));let a=require(f.join(t,"package.json"));a.name=s.appName,a.version=P,a.description=`Seeka app ${s.appName}`,a.author=`${s.developerName} <${s.developerEmail}>`,a.scripts.deploy=a.scripts.deploy.replace(/seeka-app-example-name/i,s.appName),a.scripts.tunnel=a.scripts.tunnel.replace(/seeka-app-example-name/i,s.appName);let o=f.join(t,"README.md"),l=d.readFileSync(o,"utf8");l=l.replace(/seeka-app-example-name/g,s.appName),d.writeFileSync(o,l);let c=f.join(t,".gitlab-ci.yml"),u=d.readFileSync(c,"utf8");switch(u=u.replace(/seeka-app-example-name/g,s.appName),d.writeFileSync(c,u),s.template){case"aws-lambda":On(s,t,a);break;case"azure-function":gn(s,t,a);break;case"netlify-function":_n(s,t,a);break}if(fn(s,a),d.writeFileSync(f.join(t,"package.json"),JSON.stringify(a,null,2)),console.info("Scaffolded package.json"),console.log(""),s.installDependencies)switch(console.info("Installing dependencies with "+s.packageManager),s.packageManager){case"npm":j.sync("npm",["install"],{stdio:"inherit",cwd:t});break;case"pnpm":j.sync("pnpm",["install"],{stdio:"inherit",cwd:t});break;case"yarn":j.sync("yarn",["install"],{stdio:"inherit",cwd:t});break;default:console.error("Invalid package manager");return}$(),console.log(`Created ${e} in ${t}`),console.log("Boom! Your new Seeka app is ready!"),$();let h=f.relative(process.cwd(),t);console.log(`Run "cd ${h}" to change to your apps directory and start creating some magic!`),console.log(""),console.log("")},fn=(s,e)=>{let t;switch(s.packageManager){case"npm":t="npm run";break;case"pnpm":t="pnpm run";break;case"yarn":t="yarn";break;default:console.error("Invalid package manager");return}for(let n in e.scripts)e.scripts[n]=e.scripts[n].replace(/<packageManagerRunPrefix>/g,t);e.dependencies&&e.dependencies["@seeka-labs/sdk-apps-server"]&&(e.dependencies["@seeka-labs/sdk-apps-server"]="^"+e.version)},gn=(s,e,t)=>{if(d.renameSync(f.join(e,"local.settings.example.json"),f.join(e,"local.settings.json")),s.environmentVariables&&Object.keys(s.environmentVariables).length>0){let n=require(f.join(e,"local.settings.json"));n.Values={...n.Values,...s.environmentVariables},d.writeFileSync(f.join(e,"local.settings.json"),JSON.stringify(n,null,2))}console.info("Scaffolded Azure function")},_n=(s,e,t)=>{d.renameSync(f.join(e,".env.example"),f.join(e,".env")),s.environmentVariables&&Object.keys(s.environmentVariables).length>0&&re(f.join(e,".env"),s.environmentVariables),console.info("Scaffolded Netlify function")},On=(s,e,t)=>{d.renameSync(f.join(e,".env.example"),f.join(e,".env")),s.environmentVariables&&Object.keys(s.environmentVariables).length>0&&re(f.join(e,".env"),s.environmentVariables),console.info("Scaffolded AWS lambda function")};var me=new we;ut();me.command("init").description("initialises a new Seeka app").argument("<name>",'name of your app. alphanumeric and hyphens only and must start with "seeka-app-"').addOption(new C("--template <template>","app template").choices(["azure-function","aws-lambda","netlify-function"]).makeOptionMandatory()).addOption(new C("--developer <developer>","app developer name or company").makeOptionMandatory()).addOption(new C("--email <email>","app developer email").makeOptionMandatory()).addOption(new C("--outName [outName]","directory name of the app. a new directory will be created with this name to contain the app.")).addOption(new C("--outDir [outDir]","output directory to create the app in. a new directory will be created here that contains the app.").default("","current working dir")).addOption(new C("--packageManager [packageManager]","package manager").choices(["yarn","npm","pnpm"]).default("yarn")).option("--noDependencies","skip installing dependencies").option("--force","force creation of app in non-empty directory").option("--env [env...]","sets environment variables for the app. Use format of --env KEY1=VALUE1 KEY2=VALUE2").action((s,e)=>{let t={appName:s,template:e.template,outputDirectory:e.outDir||process.cwd(),directoryName:e.outName||void 0,packageManager:e.packageManager,developerEmail:e.email,developerName:e.developer,installDependencies:!e.noDependencies,force:e.force,environmentVariables:ft(e.env)};_t(t)}).showHelpAfterError(!0);me.showHelpAfterError(!0);me.parse();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
SEEKA_APP_ID=
|
|
2
|
+
SEEKA_APP_SECRET=
|
|
3
|
+
SEEKA_DEBUG_ENABLED=true
|
|
4
|
+
SEEKA_INGEST_URL=
|
|
5
|
+
SEEKA_ISSUER_URL=
|
|
6
|
+
NODE_TLS_REJECT_UNAUTHORIZED=1
|
|
7
|
+
REDIS_CONNECTION_USER=default
|
|
8
|
+
REDIS_CONNECTION_PASSWORD=
|
|
9
|
+
REDIS_CONNECTION_TLS=true
|
|
10
|
+
REDIS_CONNECTION_HOST=
|
|
11
|
+
REDIS_CONNECTION_PORT=
|
|
12
|
+
LOGGING_SEQ_SERVERURL=
|
|
13
|
+
LOGGING_SEQ_APIKEY=
|
|
14
|
+
LOGGING_LEVEL=silly
|
|
15
|
+
NODE_OPTIONS=--enable-source-maps
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* eslint-env node */
|
|
2
|
+
module.exports = {
|
|
3
|
+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
|
|
4
|
+
parser: '@typescript-eslint/parser',
|
|
5
|
+
plugins: ['@typescript-eslint'],
|
|
6
|
+
root: true,
|
|
7
|
+
rules: {
|
|
8
|
+
"@typescript-eslint/no-unused-vars": "warn"
|
|
9
|
+
}
|
|
10
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
bin
|
|
2
|
+
obj
|
|
3
|
+
csx
|
|
4
|
+
.vs
|
|
5
|
+
edge
|
|
6
|
+
Publish
|
|
7
|
+
deploy.zip
|
|
8
|
+
|
|
9
|
+
*.user
|
|
10
|
+
*.suo
|
|
11
|
+
*.cscfg
|
|
12
|
+
*.Cache
|
|
13
|
+
project.lock.json
|
|
14
|
+
|
|
15
|
+
/packages
|
|
16
|
+
/TestResults
|
|
17
|
+
|
|
18
|
+
/tools/NuGet.exe
|
|
19
|
+
/App_Data
|
|
20
|
+
/secrets
|
|
21
|
+
/data
|
|
22
|
+
.secrets
|
|
23
|
+
appsettings.json
|
|
24
|
+
local.settings.json
|
|
25
|
+
|
|
26
|
+
node_modules
|
|
27
|
+
dist
|
|
28
|
+
|
|
29
|
+
# Local python packages
|
|
30
|
+
.python_packages/
|
|
31
|
+
|
|
32
|
+
# Python Environments
|
|
33
|
+
.env
|
|
34
|
+
.venv
|
|
35
|
+
env/
|
|
36
|
+
venv/
|
|
37
|
+
ENV/
|
|
38
|
+
env.bak/
|
|
39
|
+
venv.bak/
|
|
40
|
+
|
|
41
|
+
# Byte-compiled / optimized / DLL files
|
|
42
|
+
__pycache__/
|
|
43
|
+
*.py[cod]
|
|
44
|
+
*$py.class
|
|
45
|
+
|
|
46
|
+
# Azurite artifacts
|
|
47
|
+
__blobstorage__
|
|
48
|
+
__queuestorage__
|
|
49
|
+
__azurite_db*__.json
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
stages:
|
|
2
|
+
- deploy
|
|
3
|
+
|
|
4
|
+
variables:
|
|
5
|
+
LAMBDA_FUNC_RESOURCE_NAME: seeka-app-example-name
|
|
6
|
+
CI_DEBUG_TRACE: "true"
|
|
7
|
+
|
|
8
|
+
workflow:
|
|
9
|
+
rules:
|
|
10
|
+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
11
|
+
when: never
|
|
12
|
+
- if: '$CI_COMMIT_BRANCH == "main" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
|
|
13
|
+
when: always
|
|
14
|
+
- if: '$CI_COMMIT_BRANCH == "staging" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
|
|
15
|
+
when: always
|
|
16
|
+
|
|
17
|
+
deploy:
|
|
18
|
+
stage: deploy
|
|
19
|
+
image: node:18-bullseye
|
|
20
|
+
before_script:
|
|
21
|
+
- echo "installing aws cli"
|
|
22
|
+
- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
|
|
23
|
+
- unzip awscliv2.zip
|
|
24
|
+
- ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update
|
|
25
|
+
- ls -l /usr/local/bin/aws
|
|
26
|
+
- aws --version
|
|
27
|
+
- echo "using environment variables AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_DEFAULT_REGION for accessing the AWS CLI"
|
|
28
|
+
- echo "installing zip"
|
|
29
|
+
- apt-get update
|
|
30
|
+
- apt-get install zip
|
|
31
|
+
script:
|
|
32
|
+
- echo "deploying AWS lambda func $LAMBDA_FUNC_RESOURCE_NAME from branch $CI_COMMIT_BRANCH"
|
|
33
|
+
- yarn install --production=false
|
|
34
|
+
- yarn deploy
|
|
35
|
+
only:
|
|
36
|
+
- main
|
|
37
|
+
- staging
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2.0",
|
|
3
|
+
"configurations": [
|
|
4
|
+
{
|
|
5
|
+
"name": "Debug Seeka app",
|
|
6
|
+
"type": "node",
|
|
7
|
+
"request": "attach",
|
|
8
|
+
"restart": true,
|
|
9
|
+
"port": 5858,
|
|
10
|
+
"outFiles": [],
|
|
11
|
+
"sourceMaps": true,
|
|
12
|
+
"resolveSourceMapLocations": [
|
|
13
|
+
"${workspaceFolder}/**",
|
|
14
|
+
"!**/node_modules/**",
|
|
15
|
+
"node_modules/@seeka-labs/**/*.js",
|
|
16
|
+
],
|
|
17
|
+
"preLaunchTask": "yarn watch and debug",
|
|
18
|
+
},
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Seeka app - AWS lambda
|
|
2
|
+
|
|
3
|
+
## Development
|
|
4
|
+
- `yarn install`
|
|
5
|
+
- `yarn watch:debug` or use VsCode debugging for "Debug Seeka App" configuration
|
|
6
|
+
|
|
7
|
+
### Debugging
|
|
8
|
+
Supports VSCode debugging via the debugger and utilisation of breakpoints.
|
|
9
|
+
Use "Debug Seeka App" configuration to compile, watch and start app.
|
|
10
|
+
This is only tested on Linux but may work on Windows.
|
|
11
|
+
If using Windows, WSL coupled with an Ubuntu distro will provide support for attaching the VS code debugger.
|
|
12
|
+
|
|
13
|
+
### Live urls
|
|
14
|
+
You can expose your app locally to the internet via Ngrok to test your app before deploying.
|
|
15
|
+
|
|
16
|
+
#### Setup
|
|
17
|
+
1. Sign up for a Ngrok account
|
|
18
|
+
2. Get your auth token
|
|
19
|
+
3. `yarn ngrok config add-authtoken [auth token here]` replacing `[auth token]` with the auth token retrieved from your Ngrok dashboard
|
|
20
|
+
|
|
21
|
+
#### Running
|
|
22
|
+
1. `yarn start` OR start debugging in VSCode
|
|
23
|
+
2. In separate terminal window run `yarn tunnel` and observe the log entry that starts with `Live url exposed`.
|
|
24
|
+
3. Input the URL into your Seeka app configuration as the "Webook URL" via the Seeka UI.
|
|
25
|
+
|
|
26
|
+
## Logging
|
|
27
|
+
Centralised logging handled by [Winston](https://www.npmjs.com/package/winston). Winston is installed in this template and is also used in the Seeka SDK NPM packages.
|
|
28
|
+
|
|
29
|
+
[Seq](https://datalust.co/seq) Winston transport is installed in this template (optional).
|
|
30
|
+
|
|
31
|
+
To configure Seq options, see `_SEQ_` environment variables.
|
|
32
|
+
|
|
33
|
+
To install Seq on your development machine
|
|
34
|
+
1. Run `docker run --name seq -d --restart=always -e ACCEPT_EULA=Y -p 5341:80 datalust/seq:2024.2`
|
|
35
|
+
2. Update your `LOGGING_SEQ_SERVERURL` environment variable to `http://localhost:5341` or `http://[YOUR MACHINE NAME].local:5341` if using WSL.
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## State management
|
|
39
|
+
Installations of your app and other state required for your app to function is stored in Redis. Another state provider can be swapped out for Redis, see `src/lib/state/seeka/installations.ts` for the file that manages the state of the installations.
|
|
40
|
+
|
|
41
|
+
### Upstash (optional)
|
|
42
|
+
If you dont want to use Upstash for Redis then you can swap out the connection strings with your Redis instance.
|
|
43
|
+
|
|
44
|
+
> If using Upstash then create a database before following the below guide to deploying your AWS lambda function.
|
|
45
|
+
|
|
46
|
+
> When choosing a region, consider the AWS region that the lambda function is running from to reduce latency between the function and the Redis database.
|
|
47
|
+
|
|
48
|
+
## Deployment
|
|
49
|
+
1. [Install the aws lambda CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html#getting-started-install-instructions)
|
|
50
|
+
1. Create a function via the AWS console with following settings
|
|
51
|
+
- Mode: Author from scratch
|
|
52
|
+
- function name: `seeka-app-example-name`
|
|
53
|
+
- runtime: `Node.js 18.x`
|
|
54
|
+
- architecture: `arm64`
|
|
55
|
+
- Advanced settings:
|
|
56
|
+
- Enable code signing: unchecked
|
|
57
|
+
- Enable function URL: checked
|
|
58
|
+
- Auth type: `NONE` - Calls to your function from Seeka will be verified by SHA256 signatures
|
|
59
|
+
- Invoke mode: Buffered
|
|
60
|
+
- Configure cross-origin resource sharing: unchecked
|
|
61
|
+
- Enable VPC: unchecked
|
|
62
|
+
- All other settings leave as defaults
|
|
63
|
+
3. Add environment variables to the function in AWS by clicking 'Configuration' and then 'Environment varables'. Use the `.env` file in this project as a reference to what variables are required by to be set in the AWS Lambda.
|
|
64
|
+
4. [Authenticate the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-authentication-short-term.html)
|
|
65
|
+
2. `yarn deploy`
|
|
66
|
+
|
|
67
|
+
> At this point you may wish to [configure concurrency](https://docs.aws.amazon.com/lambda/latest/dg/scaling-behavior.html) of the AWS lambda function depending on the amount of concurrent requests you forecast your function handling.
|
|
68
|
+
|
|
69
|
+
6. Update your `Webhook URL` in you Seeka app configuration to point to the AWS Lambda function URL. This URL can be found in your viewing your Lambda via the AWS console and copying the "Function URL". It should look something like `https://prragnghaaupodlqte6hkvo446acc.lambda-url.ap-southeast-2.on.aws/`. Ensure to append `api/webhook/seeka/app` onto this URL so the complete example to update your Seeka app configuration with will look like `https://prragnghaaupodlqte6hkvo446acc.lambda-url.ap-southeast-2.on.aws/api/webhook/seeka/app`
|
|
70
|
+
|
|
71
|
+
### Continuous delivery
|
|
72
|
+
This template includes a GitLab CD pipeline that can be used to trigger deployments of your app when changes are pushed to your Git repository.
|
|
73
|
+
|
|
74
|
+
## References
|
|
75
|
+
- https://awscli.amazonaws.com/v2/documentation/api/latest/reference/lambda/index.html#available-commands
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "seeka-app-example-name",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Seeka example app for hosting on AWS lambda functions",
|
|
5
|
+
"author": "Seeka <platform@seeka.co>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "./index.js",
|
|
8
|
+
"private": true,
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=18.14.0"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"lint": "eslint",
|
|
14
|
+
"build": "esbuild src/index.ts --bundle --minify --sourcemap --platform=node --target=node18 --outfile=dist/index.js",
|
|
15
|
+
"watch": "tsc -w",
|
|
16
|
+
"clean": "<packageManagerRunPrefix> rimraf dist && <packageManagerRunPrefix> rimraf deploy.zip",
|
|
17
|
+
"start": "node --require dotenv/config dist/index.js",
|
|
18
|
+
"dev": "<packageManagerRunPrefix> clean && <packageManagerRunPrefix> build && node --require dotenv/config dist/index.js",
|
|
19
|
+
"tunnel": "node scripts/ngrok.js seeka-app-example-name-localdev",
|
|
20
|
+
"build:aws": "<packageManagerRunPrefix> clean && <packageManagerRunPrefix> build && cd dist && zip -r ../deploy.zip . && cd ..",
|
|
21
|
+
"deploy": "<packageManagerRunPrefix> build:aws && aws lambda update-function-code --function-name seeka-app-example-name --zip-file fileb://deploy.zip && rm deploy.zip",
|
|
22
|
+
"watch:debug": "nodemon --inspect=5858 -e ts --exec node -r ts-node/register --require dotenv/config ./src/index.ts"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@datalust/winston-seq": "^2.0.0",
|
|
26
|
+
"@seeka-labs/sdk-apps-server": "^1.0.1",
|
|
27
|
+
"axios": "^1.6.7",
|
|
28
|
+
"express": "^4.18.2",
|
|
29
|
+
"lodash-es": "^4.17.21",
|
|
30
|
+
"openid-client": "^5.6.4",
|
|
31
|
+
"redis": "^4.6.12",
|
|
32
|
+
"serverless-http": "^3.2.0",
|
|
33
|
+
"winston": "^3.11.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/aws-lambda": "^8.10.133",
|
|
37
|
+
"@types/express": "^4.17.21",
|
|
38
|
+
"@types/lodash-es": "^4.17.12",
|
|
39
|
+
"@types/node": "^18",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^6.19.1",
|
|
41
|
+
"@typescript-eslint/parser": "^6.19.1",
|
|
42
|
+
"dotenv": "^16.4.4",
|
|
43
|
+
"esbuild": "^0.20.0",
|
|
44
|
+
"eslint": "^8",
|
|
45
|
+
"ngrok": "^5.0.0-beta.2",
|
|
46
|
+
"nodemon": "^3.0.3",
|
|
47
|
+
"rimraf": "^5.0.0",
|
|
48
|
+
"ts-node": "^10.9.2",
|
|
49
|
+
"typescript": "^5.4.2"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* eslint-disable no-undef */
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
3
|
+
const ngrok = require('ngrok');
|
|
4
|
+
(async function () {
|
|
5
|
+
const url = await ngrok.connect({
|
|
6
|
+
proto: 'http',
|
|
7
|
+
web_addr: 'localhost:4041',
|
|
8
|
+
addr: 4041,
|
|
9
|
+
subdomain: process.argv[2],
|
|
10
|
+
onLogEvent: (event) => {
|
|
11
|
+
console.log('Ngrok - ', event);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
console.log('')
|
|
16
|
+
console.log('')
|
|
17
|
+
console.log('------------------------------------------')
|
|
18
|
+
console.log('')
|
|
19
|
+
console.info(`Public URL for Seeka app is exposed by Ngrok`)
|
|
20
|
+
console.log('')
|
|
21
|
+
console.info(`${url}/api/webhook/seeka/app`)
|
|
22
|
+
console.log('')
|
|
23
|
+
console.info(`Use this URL in your Seeka app configuration for testing`)
|
|
24
|
+
console.log('')
|
|
25
|
+
console.log('------------------------------------------')
|
|
26
|
+
console.log('')
|
|
27
|
+
console.log('')
|
|
28
|
+
})();
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Context, Handler } from 'aws-lambda';
|
|
2
|
+
import bodyParser from 'body-parser';
|
|
3
|
+
import express from 'express';
|
|
4
|
+
import serverless from 'serverless-http';
|
|
5
|
+
|
|
6
|
+
import { seekaAppWebhook } from './routes/seekaAppWebhook';
|
|
7
|
+
|
|
8
|
+
const app = express();
|
|
9
|
+
|
|
10
|
+
app.post('/api/webhook/seeka/app', bodyParser.text({ type: '*/*' }), async (req, res) => {
|
|
11
|
+
await seekaAppWebhook(req, res, {} as Context);
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
app.get('/api/webhook/seeka/app', async (req, res) => {
|
|
15
|
+
res.status(404).json({ error: "Must use POST" }).send();
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const serverlessHandler = serverless(app, {
|
|
19
|
+
provider: 'aws'
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const startServer = async () => {
|
|
23
|
+
app.listen(4041, () => {
|
|
24
|
+
console.log("listening on port 4041!");
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
startServer();
|
|
29
|
+
|
|
30
|
+
export const handler: Handler = async (event, context) => {
|
|
31
|
+
const response = serverlessHandler(event, context);
|
|
32
|
+
return response;
|
|
33
|
+
};
|