@wiztivi/dana-cli 0.0.14 → 0.0.15
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 +4 -0
- package/bin/dana.js +1 -1
- package/dana_completion.sh +2 -0
- package/dist/bundle.min.js +2 -0
- package/dist/commands/addComponent/config/ComponentConfig.d.ts +1 -1
- package/dist/commands/addComponent/const/defaultConfig.d.ts +1 -1
- package/dist/commands/addComponent/const/navigationConst.d.ts +1 -1
- package/dist/commands/addComponent/createComponent.d.ts +1 -1
- package/dist/commands/addComponent/helper/ComponentHelper.d.ts +1 -1
- package/dist/commands/addDevice/deviceConfig/configTypes.d.ts +0 -9
- package/dist/commands/addDevice/deviceConfig/webosConfig.d.ts +1 -29
- package/dist/commands/addModule/add-module.d.ts +2 -0
- package/dist/commands/addModule/addModuleDefinition.d.ts +3 -0
- package/dist/commands/addModule/moduleConst.d.ts +10 -0
- package/dist/commands/authentication/AuthenticationManager.d.ts +9 -10
- package/dist/commands/authentication/helper/CodeArtifactHelper.d.ts +1 -1
- package/dist/commands/authentication/helper/CredentialsHelper.d.ts +7 -0
- package/dist/commands/authentication/helper/SPM.d.ts +17 -0
- package/dist/commands/createApp/const/createAppTasks.d.ts +3 -0
- package/dist/commands/createApp/const/templateConst.d.ts +9 -0
- package/dist/commands/createApp/createApp.d.ts +4 -3
- package/dist/commands/createApp/helpers/CreateAppHelper.d.ts +10 -13
- package/dist/commands/createApp/helpers/SetupChecker.d.ts +1 -1
- package/dist/commands/hooks/checkDanaProjectHook.d.ts +2 -0
- package/dist/commands/package/package.d.ts +2 -0
- package/dist/commands/package/packageDefinition.d.ts +3 -0
- package/dist/common/const/exitCodeConst.d.ts +4 -0
- package/dist/common/helpers/CreateArchiveHelper.d.ts +1 -0
- package/dist/common/helpers/CreateFileHelper.d.ts +7 -1
- package/dist/common/helpers/InputValidator.d.ts +1 -1
- package/dist/common/helpers/InstallHelper.d.ts +1 -1
- package/dist/common/helpers/UpdateFileHelper.d.ts +10 -1
- package/dist/common/helpers/UserInputGetter.d.ts +1 -1
- package/dist/common/helpers/stringHelper.d.ts +1 -1
- package/dist/common/types/helperTypes.d.ts +3 -3
- package/package.json +24 -13
- package/dist/commands/addComponent/addMenu/add-menu.js +0 -45
- package/dist/commands/addComponent/addMenu/addMenuDefinition.js +0 -16
- package/dist/commands/addComponent/addRail/add-rail.js +0 -42
- package/dist/commands/addComponent/addRail/addRailDefinition.js +0 -26
- package/dist/commands/addComponent/addScreen/add-screen.js +0 -33
- package/dist/commands/addComponent/addScreen/addScreenDefinition.js +0 -13
- package/dist/commands/addComponent/addScrollView/add-scrollView.js +0 -31
- package/dist/commands/addComponent/addScrollView/addScrollViewDefinition.js +0 -13
- package/dist/commands/addComponent/config/ComponentConfig.js +0 -140
- package/dist/commands/addComponent/config/componentTypes.js +0 -1
- package/dist/commands/addComponent/const/componentConst.js +0 -19
- package/dist/commands/addComponent/const/defaultConfig.js +0 -24
- package/dist/commands/addComponent/const/navigationConst.js +0 -30
- package/dist/commands/addComponent/createComponent.js +0 -41
- package/dist/commands/addComponent/helper/ComponentHelper.js +0 -77
- package/dist/commands/addDevice/add-device.js +0 -90
- package/dist/commands/addDevice/addDeviceDefinition.js +0 -11
- package/dist/commands/addDevice/deviceConfig/androidtvConfig.js +0 -116
- package/dist/commands/addDevice/deviceConfig/configTypes.js +0 -12
- package/dist/commands/addDevice/deviceConfig/deviceConfig.js +0 -33
- package/dist/commands/addDevice/deviceConfig/titanosConfig.js +0 -14
- package/dist/commands/addDevice/deviceConfig/tizenConfig.js +0 -51
- package/dist/commands/addDevice/deviceConfig/tvosConfig.js +0 -45
- package/dist/commands/addDevice/deviceConfig/vidaaConfig.js +0 -14
- package/dist/commands/addDevice/deviceConfig/webosConfig.js +0 -140
- package/dist/commands/addDevice/helper/addDeviceHelper.js +0 -88
- package/dist/commands/authentication/AuthenticationManager.js +0 -167
- package/dist/commands/authentication/authDefinition.js +0 -35
- package/dist/commands/authentication/authHook.js +0 -32
- package/dist/commands/authentication/authentConst.js +0 -6
- package/dist/commands/authentication/commands/get-packages-token.js +0 -30
- package/dist/commands/authentication/commands/login.js +0 -28
- package/dist/commands/authentication/commands/logout.js +0 -20
- package/dist/commands/authentication/commands/status.js +0 -36
- package/dist/commands/authentication/helper/CodeArtifactHelper.js +0 -46
- package/dist/commands/authentication/helper/CommandHelper.js +0 -8
- package/dist/commands/authentication/helper/CredentialsHelper.js +0 -80
- package/dist/commands/commandHelp/customHelp.js +0 -26
- package/dist/commands/completion/completion.js +0 -48
- package/dist/commands/completion/completionDefinition.js +0 -12
- package/dist/commands/createApp/const/setupConst.js +0 -14
- package/dist/commands/createApp/createApp.js +0 -92
- package/dist/commands/createApp/createAppDefinition.js +0 -17
- package/dist/commands/createApp/helpers/CreateAppHelper.js +0 -114
- package/dist/commands/createApp/helpers/SetupChecker.js +0 -90
- package/dist/common/commonConst.js +0 -1
- package/dist/common/const/deviceConst.js +0 -71
- package/dist/common/const/exitCodeConst.js +0 -8
- package/dist/common/helpers/CreateFileHelper.js +0 -95
- package/dist/common/helpers/InputValidator.js +0 -52
- package/dist/common/helpers/InstallHelper.js +0 -145
- package/dist/common/helpers/UpdateFileHelper.js +0 -140
- package/dist/common/helpers/UserInputGetter.js +0 -118
- package/dist/common/helpers/handlebarsHelper.js +0 -21
- package/dist/common/helpers/stringHelper.js +0 -18
- package/dist/common/translation/en.json +0 -68
- package/dist/common/translation/translation.js +0 -3
- package/dist/common/types/helperTypes.js +0 -12
- package/dist/index.js +0 -14
- package/dist/program.js +0 -37
package/README.md
CHANGED
|
@@ -45,3 +45,7 @@ To get all available options and more information:`npx @wiztivi/dana-cli help`
|
|
|
45
45
|
## Screenshots
|
|
46
46
|
|
|
47
47
|

|
|
48
|
+
|
|
49
|
+
## Credits
|
|
50
|
+
|
|
51
|
+
Icons by [Font Awesome Free](https://fontawesome.com/), licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
package/bin/dana.js
CHANGED
package/dana_completion.sh
CHANGED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{Command as e,Option as t,Argument as n}from"commander";import o,{existsSync as r,readFileSync as i,writeFileSync as a,mkdirSync as s,cpSync as c,promises as l,readdirSync as d,appendFileSync as m}from"node:fs";import u,{resolve as f,dirname as p,join as g,sep as h}from"node:path";import*as y from"@clack/prompts";import{log as E}from"@clack/prompts";import{execSync as w,spawn as v,exec as C,spawnSync as N}from"node:child_process";import D from"@babel/parser";import I from"@babel/traverse";import*as L from"@babel/template";import*as S from"@babel/types";import A from"@babel/generator";import O from"picocolors";import{createRequire as T}from"node:module";import{fileURLToPath as _}from"node:url";import{homedir as k}from"node:os";import{CodeartifactClient as F,GetRepositoryEndpointCommand as P,ListPackageVersionsCommand as b,GetAuthorizationTokenCommand as R}from"@aws-sdk/client-codeartifact";import{maxSatisfying as U}from"semver";import{valid as x,clean as j}from"semver-ts";import $ from"handlebars";import M from"node:process";import z from"get-port";import V from"express";import B from"open";import G from"jsonwebtoken";import{findUp as H}from"find-up";import Z from"fs";import J from"path";import W from"zlib";import X from"crypto";const K="tvos",Y="tizen",q="webos",Q="androidtv",ee="css",te="lightning",ne="vidaa",oe="titanos",re=["@dana/renderer-css","@dana/renderer-lightning-html5","@dana/tools-grunt","@dana/vendor-test","@dana/engine-nodejs","@dana/vendor-components","@wiztivi/dana-templates","@dana/core","@dana/renderer-lightning","@dana/engine-html5"],ie={[Y]:{label:"Samsung",package:"@dana/vendor-tizen",dependencies:["@dana/vendor-tizen","@dana/vendor-shaka","@dana/tools-smarttv-grunt"]},[q]:{label:"LG",package:"@dana/vendor-webos",dependencies:["@dana/vendor-webos","@dana/vendor-shaka","@dana/tools-smarttv-grunt","@dana/vendor-webos-css"]},[ne]:{label:"Vidaa",package:"@dana/vendor-vidaa",dependencies:["@dana/vendor-vidaa","@dana/tools-smarttv-grunt"]},[oe]:{label:"TitanOs",package:"@dana/vendor-titanos",dependencies:["@dana/vendor-titanos"]}},ae={[K]:{label:"TV OS",package:"@dana/engine-tvos",dependencies:["@dana/engine-tvos","@dana/renderer-tvos","@dana/tools-apple-grunt"]},[Q]:{label:"Android",package:"@dana/engine-android",dependencies:["@dana/engine-android","@dana/renderer-android","@dana/tools-android-grunt"]}},se={...ie,...ae},ce=[ee,te];const le={"program.usage":"A CLI to help you build dana applications","program.help.footer":"For more information, visit https://doc.dana-framework.com or contact us.","component.creation.success":"component created successfully.","component.creation.error":"Failed to create component","command.rail.description":"Add a rail","command.component.name":"Component's name","command.component.customization":"Full or partial customization. MANDATORY to not use default configuration.","command.rail.option.navigation":"Navigation type. Default: fixed","command.rail.option.direction":"Navigation direction. Default: horizontal","command.rail.option.cyclic":"True if cyclic. Default: false","command.device.description":"Add device(s) to your Dana app","command.device.version.error":"No version found.","command.device.no_selection":"Nothing selected or no device available. Exit","help.custom.devices":"Use the CLI to add the following devices:","help.custom.commands":"Add devices and built-in components to your DANA app:","help.option.title":"Available command options:","help.option.check":"check:","command.menu.description":"Add horizontal menu","command.menu.option.itemView":"Item to be used in the menu","command.menu.option.itemMargin":"Margin between items. Default: 20","helper.git.status.error":"Git status is not clean or an error occurred. Try to commit your change.","command.auth.description":"Authenticate to Dana framework","command.auth.login.description":"Login to Dana","command.auth.logout.description":"Logout from Dana","command.auth.login.option.org":"Organization to login/logout","command.auth.login.option.remote":"Allow connexion to dana authentication stack when working on remote server. Display login url","command.auth.login.option.port":"Provide a port for login server","command.auth.remoteMode":"You are in remote mode. Verify you are forwarding the right port to the host machine.","command.auth.accessBrowserUrl":"You can complete the operation by accessing the following url in the browser.","command.auth.status.description":"Get login status","command.auth.get-packages-token.description":"Get token for packages repository","command.scrollView.description":"Add a scrollView of rails","command.scrollView.option.itemView":"Item to be used in the scrollView. Default: pre-made rail","command.scrollView.option.itemMargin":"Margin between items. Default: 550","command.screen.description":"Add a screen","command.create_app.description":"Create a new Dana app","command.create_app.name":"Project's name","command.create_app.directory":"Project directory","command.create_app.type":"Choose app type","command.create_app.template_type":"Template type","command.create_app.screen_template_type.error":"Error: A template type can only be provided with the 'templated' option","command.create_app.devices":"Add device(s) when creating the project","command.create_app.aws_profile":"Aws profile","command.create_app.aws_repository":'Aws repository provided during registration. Name is XXX in "dana-XXX-repository".',"command.package.description":"Generate an archive for a Dana app","command.package.creation.start":"Creation","command.package.creation.end":"Creation complete.","command.package.final":"Archive is complete and can be uploaded on dana cloud services platform.","task.installation.start":"Installation","task.installation.end":"Installation complete.","creation.final":"Everything is ready.","script.run.title":"Now you can just run:","git.error":"Git is not installed or not available in the PATH. You must install it to continue.","aws.cli.error":"AWS cli is not installed or not available in the PATH. You must install it to continue.","node.error":"Node version should be >=","setup.ok":"Configuration ok","setup.ko":"Prerequisite not met","device.unavailable":"Enhance your experience by adding device(s) to your subscription:","device.selection":"Press SPACE KEY to select additional device(s).","renderer.selection":"Select AT LEAST one renderer for","input.name":"What is your project's name ?","input.aws.error":"You need to have an AWS account.\nSee:https://dana-framework.com/guides/getting-started#configure-aws-connection","input.aws.profile":"Select your AWS profile","aws.login.error":"Please log to AWS before trying again","error.common.start.message":"An error occurred","command.completion.description":"Install shell completion (bash or zsh)","command.completion.argument":"Shell. Bash or zsh","command.completion.success":"Completion installed to ","login.info.token_expired":"Your token has expired.","login.info.please_login":"Please run 'dana auth login' command","login.error.not_logged":"You're not logged in.","login.info.logged":"You're currently logged in to Dana","command.hook.dana_project":"Can not execute command outside a Dana project: no '.dana' folder found.\nYou can add it to the root of your Dana project if needed","command.settings.description":"Add settings features in the Settings Screen","command.module":"Add a module","command.module.name":"Module's name"},de=class{static appConfig={};static getConfig(...e){return Promise.resolve({})}static setConfig(...e){return Promise.resolve("Device configuration done")}static updateProfileJsonWithRenderers(e,t){for(const n of t)e={...e,...this.appConfig[n]};return e}},me=class extends de{static getConfig=async()=>({renderers:[te,ee]});static setConfig=()=>Promise.resolve("Vidaa configuration done")},ue=class extends de{static getConfig=async()=>({renderers:[te,ee]});static setConfig=()=>Promise.resolve("TitanOS configuration done")},fe=class extends de{static appConfig={css:{"template-webos_css":{mixins:["default","webos"],base:{name:"Webos",vendors:["@dana/vendor-components","@dana/vendor-shaka","@dana/vendor-webos-css"]}}},lightning:{"template-webos_lightning":{mixins:["default","webos"],base:{name:"Webos",vendors:["@dana/vendor-components","@dana/vendor-shaka","@dana/vendor-webos-lightning"]}}}};static getConfig=async()=>({renderers:[ee]});static setConfig=({directory:e,config:t})=>{const n=u.join(e,"profiles","app.config.webos.json");let r=JSON.parse(o.readFileSync(n).toString());return r=this.updateProfileJsonWithRenderers(r,t.renderers),o.writeFileSync(n,JSON.stringify(r,null,4)),Promise.resolve("Webos configuration done")}},pe=class extends de{static appConfig={css:{"template-tizen_css":{mixins:["default","tizen"],base:{name:"Tizen",vendors:["@dana/renderer-css"]}}},lightning:{"template-tizen_lightning":{mixins:["default","tizen"],base:{name:"Tizen",vendors:["@dana/renderer-lightning-html5"]}}}};static getConfig=async()=>({renderers:[te]});static setConfig=({directory:e,config:t})=>{const n=u.join(e,"profiles","app.config.tizen.json");let r=JSON.parse(o.readFileSync(n).toString());return r=this.updateProfileJsonWithRenderers(r,t.renderers),o.writeFileSync(n,JSON.stringify(r,null,4)),Promise.resolve("Tizen configuration done")}},ge="wtvMenuListView",he="wtvRailListView",ye="tileView",Ee="scrollView",we="scrollItemView",ve="ButtonItemView",Ce="screen",Ne="vod",De=e=>`${e[0].toUpperCase()}${e.substring(1)}`,Ie=e=>e.map(e=>e.command).join(", "),Le=e=>`${e[0].toUpperCase()}${e.substring(1).toLowerCase()}`,Se=class{static selectionFactory=async(e,t,n)=>{t=t.map(e=>({value:e.value,label:e.label}));const o=await y.select({message:n,options:t});return Se.handleCancellation(e),o};static checkOption=(e,t,n)=>{if(!e)return"";const o=t.find(t=>t.command===e);return o?o.value:(y.log.info(`"${e}" does not match any ${n} option. Please select one below:`),"")};static normalizeFileName=(e,t)=>{const n=De(t);switch(e){case he:case ge:return`${n}ListView.js`;case ye:return`${n}ListItemView.js`;case Ee:return`${n}ScrollView.js`;case we:return`${n}ScrollItemView.js`;case Ce:case Ne:return`${n}Screen.js`;case ve:return`${n}View.js`;default:return`${n}.js`}};static handleCancellation=function(e){y.isCancel(e)&&(y.cancel("Operation cancelled."),process.exit(4))};static getTemplatePath=function(){return T(_(import.meta.url)).resolve("@wiztivi/dana-templates")}},Ae="dana",Oe="733912940672";class Te{static filePath=u.join(k(),".dana.json");static getConfig(){if(!r(this.filePath))return null;let e=JSON.parse(i(this.filePath,{encoding:"utf-8"}));const t=e.version??1;return 2!=t&&(e=Te.migrateConfig(e,t),a(this.filePath,JSON.stringify(e,null,4))),e}static migrateConfig(e,t){if(1===t){const t=e;return{lastUsedOrg:t.org,credentials:{[t.org]:{dana:t.dana,aws:t.aws}},isRemote:!1,version:2}}return e}static store(e,t,n){let o=this.getConfig();o??={lastUsedOrg:e.org,credentials:{},version:2,isRemote:!1},o.credentials??={},o.lastUsedOrg=e.org,n&&(o.port=n),o.isRemote=t,o.credentials[e.org]={aws:e.aws,dana:e.dana},a(this.filePath,JSON.stringify(o,null,4))}static get(e){const t=this.getConfig(),n=e??t?.lastUsedOrg??"public",o={org:n,isRemote:!1};return t?.credentials?.[n]?.aws&&(o.aws=t?.credentials[n]?.aws),t?.credentials?.[n]?.dana&&(o.dana=t?.credentials[n]?.dana),t?.port&&(o.port=t.port),t?.credentials?.[n]?.codeArtifact&&(o.codeArtifact=t?.credentials[n]?.codeArtifact),o.isRemote=!!t?.isRemote,o}static delete(e){const t=this.getConfig();t&&(delete t.credentials[e],a(this.filePath,JSON.stringify(t,null,4)))}static updateCodeArtifactToken(e,t){const n=this.getConfig();n?.credentials&&(n.credentials[e].codeArtifact=t,a(this.filePath,JSON.stringify(n,null,4)))}}const _e=async({organization:e,credentials:t,client:n,format:o="npm"})=>{const r=t??Te.get()?.aws;if(!r)throw new Error("No valid credentials available.");const i=n??ke(r),a=Fe(e),s=new P({domain:Ae,domainOwner:Oe,repository:a,format:o}),{repositoryEndpoint:c}=await i.send(s);if(!c)throw new Error("Repository endpoint not found");return c},ke=e=>new F({region:"eu-central-1",credentials:{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken}}),Fe=e=>`dana-${e}-repository`,Pe=class{static cleanOnError=()=>{try{w("git clean -d -f && git reset --hard head")}catch{throw new Error("Files deletion failed. Delete changes manually.")}return"Changes successfully deleted."};static getInstalledDevices=e=>{const t=u.join(e,"package.json"),n=JSON.parse(i(t).toString()),o=[];for(const e of Object.keys(n.scripts))if(e.includes("start:")){const t=e.split(":")[1];o.push(t)}return o};static getAppIcon=()=>Promise.resolve("images/dana.png");static promptTextFactory=async({errorMessage:e,promptMessage:t,validationFunction:n,placeholder:o,initialValue:r})=>{const i=await y.text({message:t,placeholder:o,initialValue:r,validate:t=>n(t,e)});return Se.handleCancellation(i),i};static getLatestPackageVersion=async({packageName:e,repository:t,format:n,namespace:o})=>{let r;try{const i=Te.get(),a=ke(i.aws),s=new b({package:e,domain:Ae,domainOwner:Oe,repository:t,format:n,namespace:o}),c=await a.send(s),l=c.versions?.map(e=>e.version).filter(Boolean);if(r=U(l,"*"),r)return r;throw new Error(le["command.device.version.error"])}catch(e){throw new Error(e.message??le["error.common.start.message"])}}},be=class extends de{static setConfig=async({directory:e})=>{const t=u.join(e,".gitignore"),n=o.readFileSync(t,{encoding:"utf8"});return o.writeFileSync(t,n+"\n# For TVOS\napp_tvos/build \napp_tvos/libs"),Promise.resolve(".gitignore updated")};static getConfig=async()=>({jscVersion:await be.getJscVersion()});static getJscVersion=async()=>await Pe.getLatestPackageVersion({packageName:"jscmodule",repository:"internal-apple-repository",format:"swift",namespace:"dana"})},Re=(e,t)=>t?.trim().length?"":e,Ue=class extends de{static _askAppId=async()=>{const e=await y.text({message:"What is the appId ?",placeholder:"com.yourname.ui",validate:e=>(e=>e.length?/^[a-zA-Z]\w*(\.[a-zA-Z]\w*)+$/.test(e)?"":"AppId should be in the following format: com.example.myapp !":"AppId is required !")(e)});return Se.handleCancellation(e),e};static _askAppName=async()=>{const e=await y.text({message:"What is the appName ?",placeholder:"Dana",validate:e=>Re("App name is required !",e)});return Se.handleCancellation(e),e};static _askAppVersion=async()=>{const e=await y.text({message:"What is the app version ?",placeholder:"1.0.0",initialValue:"1.0.0",validate:e=>(e=>e?x(j(e)??"")?"":"App version format should be x.x.x":"App version is required")(e)});return Se.handleCancellation(e),j(e)??""};static _askAppVersionCode=async()=>{const e=await y.text({message:"What is the app version code ?",placeholder:"1000",initialValue:"1000",validate:e=>(e=>e?Number.isInteger(+e)?"":"App version code has to be an Integer":"App version code is required")(e)});return Se.handleCancellation(e),Number(e)};static _getWtvAndroidVersion=async()=>await Pe.getLatestPackageVersion({packageName:"v8-runtime",repository:"internal-android-repository",format:"maven",namespace:"com.dana.androidtv"});static getConfig=async()=>{y.log.info(O.bold("Let's configure Android !"));return{device:await y.group({appId:()=>this._askAppId(),appName:()=>this._askAppName(),appVersion:()=>this._askAppVersion(),appVersionCode:()=>this._askAppVersionCode(),icon:()=>Pe.getAppIcon(),wtvAndroidVersion:()=>this._getWtvAndroidVersion()},{onCancel:()=>{y.cancel("Android configuration cancelled."),process.exit(0)}})}};static setConfig=async({directory:e,config:t})=>(await this.updateProfileJson(e,t),"Android config done");static updateProfileJson=(e,t)=>{const n=u.join(e,"profiles","app.config.androidtv.json"),r=JSON.parse(o.readFileSync(n).toString());return r["base-android"].device={...r["base-android"].device,...t.device},o.writeFileSync(n,JSON.stringify(r,null,4)),Promise.resolve("Profile.json updated")}},xe=class{static handleCancellation=function(e){y.isCancel(e)&&(y.cancel("Operation cancelled."),process.exit(0))};static askHtmlRenderers=async e=>{const t=ce.map(e=>({value:e,label:e})),n=await y.multiselect({message:`${le["renderer.selection"]} ${e}`,required:!0,options:t});return this.handleCancellation(n),n};static getDeviceConfig=e=>{switch(e){case q:return fe;case Y:return pe;case K:return be;case Q:return Ue;case ne:return me;case oe:return ue;default:return de}};static promptUnavailableDevices=e=>{y.log.warn(O.bold(O.yellow(le["device.unavailable"])+"\n"+O.magenta(e.join(", "))))};static promptSelectDevices=async(e,t=!1)=>{const n={message:le["device.selection"],options:e,required:t},o=await y.multiselect(n);return this.handleCancellation(o),o};static installation=async function(e,t){for(const n of e)(null==n.condition||n.condition)&&(t?.message(n.title),await n.task())};static printNpmCommandForUser=function(e){const t=`cd ${e.directory} && npm run`;y.log.info(O.bold("For browser:")),y.log.message(`${t} start`);for(const n of e.selectedDevices){y.log.info(O.bold(`For ${n}: `)),n!==Y&&n!==q||y.log.warn(`You MUST update app.config.${n}.json with your own parameters`);const o=e.config[n];if(o?.renderers)for(const e of o.renderers)y.log.message(`${t} start:${n}_${e}`);else y.log.message(`${t} start:${n}`)}};static setFirstRoute=async function({directory:e}){const t=u.resolve(e,"scripts","app","ui","screens","SplashScreen.js"),n=o.readFileSync(t,"utf8"),r=(0,L.default.expression)('this.route("home")'),i=D.parse(n,{sourceType:"module"});I.default(i,{Function(e){S.isObjectProperty(e.parent)&&S.isIdentifier(e.parent.key,{name:"beforeShow"})&&e.traverse({CallExpression(e){const t=e.node.callee;S.isMemberExpression(t)&&S.isIdentifier(t.object,{name:"console"})&&e.replaceWith(r())}})}});const a=A.default(i,{retainLines:!0}).code;return o.writeFileSync(t,a),Promise.resolve("first route set")}};class je{static getPrompts(e,t){return{name:()=>this.askProjectName(e),directory:({results:e})=>this.getProjectDirectory(e.name),selectedDevices:()=>this.askDevices(t)}}static async askProjectName(e){if(null!=e)return je.formatAppName(e);return e=await y.text({message:le["input.name"],placeholder:"Placeholder Name",validate:e=>Re("Project name is mandatory !",e)}),xe.handleCancellation(e),je.formatAppName(e)}static formatAppName(e){return e.trim().split(/[ /]+/).map((e,t)=>0===t?e:De(e)).join("")}static async getProjectDirectory(e){return Promise.resolve(`./${e}`)}static getAvailableDevices(){const e=[],t=[],n=y.spinner();n.start();for(const[n,o]of Object.entries(ae))try{w(`npm view ${o.package} --silent`,{encoding:"utf-8"}),e.push({value:n,label:ae[n].label})}catch{t.push(ae[n].label)}return n.stop("Available devices checked"),Promise.resolve({availableDevices:e,unavailableDevices:t})}static async askDevices(e){let t=this.getBasicDevices();if(!e)return t;const{availableDevices:n,unavailableDevices:o}=await this.getAvailableDevices();if(o.length&&xe.promptUnavailableDevices(o),n.length){const e={message:le["device.selection"],options:n,required:!1};t=t.concat(await y.multiselect(e))}return xe.handleCancellation(t),t}static getBasicDevices(){return Object.keys(ie)}static async getDevicesConfig({selectedDevices:e,awsProfile:t}){const n={};for(const o of e)n[o]=await xe.getDeviceConfig(o).getConfig(t);return n}}function $e(e,t){const n=i(e,"utf-8");return $.compile(n)(t)}var Me;$.registerHelper("ifEqTo",(e,t)=>e===t),$.registerHelper("ifNotEqTo",(e,t)=>e!==t),$.registerHelper("normalizeName",(e,t)=>`${De(e)}${t}`),$.registerHelper("capitalize",e=>De(e)),function(e){e.BARE="bare",e.TUTORIAL="tutorial",e.TEMPLATED="templated"}(Me||(Me={}));const ze={family:"fa-solid-900",path:"styles/fonts/fa-solid-900.ttf"};class Ve{static updateAppConfigFile=function({directory:e}){const t=u.join(e,"profiles"),n=u.join(e,"app.config.json"),r=o.readdirSync(t,{withFileTypes:!0}).filter(e=>!e.isDirectory()).map(e=>u.join("profiles",e.name)),i=JSON.parse(o.readFileSync(n).toString());return i.includes=r,o.writeFileSync(n,JSON.stringify(i,null,4)),Promise.resolve("Config file(s) updated")};static addModuleToAppConfig=async function({directory:e},{modules:t,shouldAddIconFont:n}){const r=u.join(e,"app.config.json");try{const e=JSON.parse(o.readFileSync(r).toString()),i=e.default;i.base??={};const a=i.base;a.modules??=[];const s=a.modules;for(const e of t)s.includes(e)||s.push(e);if(n){i.AppTheme.fonts.icons=ze}return o.writeFileSync(r,JSON.stringify(e,null,4)),Promise.resolve("App config modules updated")}catch(e){throw new Error(`Failed to parse or update app config: ${e.message}`)}};static updateAppTheme=async function({directory:e},t){const n=u.join(e,"scripts","app","theme","AppTheme.js");let r=o.readFileSync(n,"utf-8");return r=r.replace(`${t}: "`,`${t}: "${t}`),o.writeFileSync(n,r),Promise.resolve("AppTheme statics updated")};static updateNpmrcFile=async function({directory:e}){const t=Te.get(),n=await _e({organization:t.org,credentials:t?.aws,format:"npm"}),r=u.join(e,".npmrc");return o.writeFileSync(r,`@dana:registry=${n}`),"AWS profile updated"};static updatePackageJson=({name:e,directory:t,selectedDevices:n,config:r})=>{const i=u.join(t,"package.json"),a=JSON.parse(o.readFileSync(i).toString());if(e){const t=/[^A-Za-z0-9._-]/g;a.name=e.replaceAll(t,"").toLowerCase()}for(const e of n){const t=r[e];if(t?.renderers)for(const n of t.renderers){const t=`${e}_${n}`;a.scripts[`start:${t}`]=this.setScriptValue(t)}else a.scripts[`start:${e}`]=this.setScriptValue(e)}return o.writeFileSync(i,JSON.stringify(a,null,4)),Promise.resolve("Package updated")};static setDevicesConfig=async function({directory:e,config:t,selectedDevices:n,awsProfile:o}){for(const r of n){const n=t[r];await xe.getDeviceConfig(r).setConfig({directory:e,awsProfile:o,config:n})}return"Configuration done"};static setScriptValue=e=>`grunt serve --profile=template-${e}`;static applyTemplatesToFiles=function({directory:e,name:t}){const n=u.join(e,"scripts","app"),r=`${i=t,i.trim().split(/[./_\-\\ ]/g).map((e,t)=>0===t?e.toLowerCase():Le(e)).join("")}`;var i;const a=[{fromPath:u.join(n,"TemplateAppRoutes.js.hbs"),config:{appName:r},toPath:u.join(n,`${r}AppRoutes.js`)},{fromPath:u.join(n,"app.js.hbs"),config:{appName:r},toPath:u.join(n,"app.js")},{fromPath:u.join(e,"tests","unit","app","TemplateAppRoutes.js.hbs"),config:{appName:r},toPath:u.join(e,"tests","unit","app",`${r}AppRoutes.js`)}].concat(Ve.getConfigFileOutput(e));for(const e of a){const t=$e(e.fromPath,e.config);o.writeFileSync(e.toPath,t),o.unlink(e.fromPath,e=>{e&&console.error(e)})}return Promise.resolve("Files templated")};static getConfigFileOutput=function(e){const t=["gitignoreTemplate.hbs","editorconfigTemplate.hbs","eslintrc.jsonTemplate.hbs","nvmrcTemplate.hbs"],n=[];for(const o of t)n.push({fromPath:u.join(e,o),config:{},toPath:u.join(e,`.${o.replace("Template.hbs","")}`)});return n}}class Be{static installDependencies=({directory:e,selectedDevices:t,config:n})=>{const o=Be.getDependenciesList(t,n);return new Promise((t,n)=>{const r=v("npm",["i","--silent"],{shell:!0,cwd:e});r.on("close",r=>{0===r?Be.installSingleDependency(o,e).then(()=>{Be.updateSemver(e),t("Dependencies updated")}).catch(e=>{n(new Error("Dependencies update failed : "+(e.message??le["error.common.start.message"])))}):n(new Error("FAILURE during dependencies installation"))}),r.on("error",e=>{n(new Error(`FAILURE during dependency installation : ${e}`))})})};static getDependenciesList(e,t){let n=[...re];return e.length&&(n=n.concat(this.getAllDependencies(e,t))),[...new Set(n)]}static installSingleDependency=(e,t)=>new Promise((n,o)=>{const r=v("npm",["i",...e,"--save-dev","--save-exact"],{cwd:t,shell:!0});r.on("close",e=>{0===e?n():o(new Error("FAILURE during dependency installation"))}),r.on("error",e=>{o(new Error(`FAILURE during dependency installation : ${e.message}`))})});static updateSemver=e=>{const t=u.join(e,"package.json"),n=JSON.parse(o.readFileSync(t).toString());n.devDependencies=Object.entries(n.devDependencies).reduce((e,[t,n])=>(e[t]=t.includes("@dana")||t.includes("@wiztivi")?n.replace(/(\d+\.\d+\.)\d$/,"$1x"):n,e),{}),o.writeFileSync(t,JSON.stringify(n,null,4))};static getAllDependencies=function(e,t){let n=[];for(const t of e)n=n.concat(se[t].dependencies);for(const e in t)if(Object.hasOwn(t,e)){const o=t[e].renderers??[];for(const t of o)n=n.concat(se[e].renderers?.[t]??"")}return n=n.filter(e=>!!e),n};static installGrunt=function(){return new Promise(e=>{C("npm i -g grunt-cli",{},()=>{e("Grunt installed")})})};static runGitCommand(e,t){return new Promise((n,o)=>{const r=v("git",e,{cwd:t});r.on("close",t=>{0===t?n():o(new Error(`Git ${e[0]} failed`))}),r.on("error",t=>{o(new Error(`Git ${e[0]} failed: ${t.message}`))})})}static initGit=async function({directory:e}){try{return await Be.runGitCommand(["init"],e),await Be.runGitCommand(["add","."],e),await Be.runGitCommand(["commit","-m","Initial commit from Create DANA App"],e),"Git initialized"}catch(e){throw new Error("Git hasn't been initialised: "+e.message)}}}class Ge{static copyTemplate=function({directory:e}){const t=f(p(Se.getTemplatePath()),"app-template");return s(e,{recursive:!0}),c(t,e,{recursive:!0}),Promise.resolve("Template copied")};static copyForTutorial=function({directory:e}){const t=f(p(Se.getTemplatePath()),"tutorial");return c(t,e,{recursive:!0}),Promise.resolve("Tutorial files copied")};static copyForTemplatedApp=async function({directory:e},t,n){for(const o of t){const t=["images","styles"];await l.cp(g(n,o),g(e,"modules",o),{recursive:!0,filter:e=>{const r=e.replace(g(n,o),"").split(h)[1];return!t.includes(r)}});for(const i of t)r(g(n,o,i))&&await l.cp(g(n,o,i),g(e,i),{recursive:!0})}return"Modules files copied"};static copyAppConfigFiles=function({selectedDevices:e,directory:t}){const n=f(p(Se.getTemplatePath()),"profiles"),o=d(n);for(const r of o){e.includes(r.split(".")[2])&&c(g(n,r),g(t,"profiles",r))}return Promise.resolve("Config file(s) copied")};static runGruntCommand(e,t){if(0===N("grunt",e,{shell:!0,cwd:t}).status)return Promise.resolve("Grunt task(s) done");throw new Error("Grunt task(s) failed")}static executeGruntTasks=async function({directory:e,selectedDevices:t,config:n}){if(t.includes(Q)){const t=Te.get(),o=["copyProjectAndroidTv",`--appUrl=${await _e({organization:t.org,credentials:t?.aws,format:"maven"})}`,`--organization=${t.org}`],r=["appId","appName","appVersion","appVersionCode","wtvAndroidVersion"];for(const e of r)o.push(`--${e}=${n.androidtv?.device[e]}`);try{await Ge.runGruntCommand(o,e)}catch(e){throw new Error(`Failed to execute grunt tasks: ${e.message}`)}}if(t.includes(K))try{const t=["copyProjectTvos",`--jscVersion=${n.tvos?.jscVersion}`];await Ge.runGruntCommand(t,e)}catch(e){throw new Error(`Failed to execute grunt tasks: ${e.message}`)}return"Grunt task(s) done"}}const He=async()=>{y.intro(`Add device(s) to ${u.basename(M.cwd())} !`);const e=y.spinner(),t={};try{t.directory="./",t.awsProfile=Te.get().org;const{availableDevices:e,unavailableDevices:n}=await je.getAvailableDevices(),o=Pe.getInstalledDevices(t.directory),r=e.filter(e=>!o.includes(e.value));if(n.length&&xe.promptUnavailableDevices(n),r.length&&(t.selectedDevices=await xe.promptSelectDevices(r)),!t.selectedDevices?.length)return void y.outro(le["command.device.no_selection"]);t.config=await je.getDevicesConfig(t)}catch(e){const t=e instanceof Error?e.message:e;y.outro(O.red("An issue occurred :"+t)),M.exit(5)}try{e.start(le["task.installation.start"]),await xe.installation([{title:"Update package.json",task:async()=>Ve.updatePackageJson(t)},{title:"Copy app.config files",task:async()=>Ge.copyAppConfigFiles(t)},{title:"Update app.config.json",task:async()=>Ve.updateAppConfigFile(t)},{title:"Install dependencies with npm",task:async()=>Be.installDependencies(t)},{title:"Execute grunt tasks",task:async()=>Ge.executeGruntTasks(t)},{title:"Execute devices config",task:async()=>Ve.setDevicesConfig(t)}],e)}catch(t){e.stop();const n=t instanceof Error?t.message:t;y.outro(O.red(`${le["error.common.start.message"]} ${n}`)),M.exit(5)}e.stop(le["task.installation.end"]),y.outro("Everything is ready ! Don't forget to commit your change.")};class Ze{static getAPIURL(e){return`https://api.${e}.dana-framework.com`}static async login(e,t,n){const o=V();o.disable("x-powered-by");const r=new Promise((r,i)=>{const a=setTimeout(()=>{i(new Error("Login timed out."))},3e5);o.get("/callback",(o,s)=>{clearTimeout(a);try{if(o.query.error)return s.send("Login failed. Check the CLI for details."),i(new Error(o.query.error));const a=JSON.parse(o.query.token),c={aws:JSON.parse(o.query.aws),dana:a,org:e,isRemote:t,port:n};s.send("Login successful! You can close this window."),Te.store(c,t,n),r(c)}catch(e){s.send("Login failed. Check the CLI for details."),i(e)}})}),i=[10032,10064],a=n?[n].concat(i):i,s=await z({port:a}),c=o.listen(s);return t?(E.info(le["command.auth.remoteMode"]+`Port: ${s}`),E.info(le["command.auth.accessBrowserUrl"]+` ${Ze.getAPIURL(e)}/login?port=${s}`)):await B(`${Ze.getAPIURL(e)}/login?port=${s}`),r.finally(()=>{c.closeAllConnections(),c.close()})}static async logout(e,t,n){const o=new URL(`${Ze.getAPIURL(e)}/logout`);t?.id_token&&o.searchParams.append("id_token",t.id_token),t?.refresh_token&&o.searchParams.append("refresh_token",t.refresh_token),n?(E.info(le["command.auth.remoteMode"]),E.info(le["command.auth.accessBrowserUrl"]+`${o.toString()}`)):await B(o.toString()),Te.delete(e)}static async refresh(e,t,n,o){const r=await fetch(`${Ze.getAPIURL(e)}/login?refresh_token=${t}`);if(!r.ok)return Ze.login(e,n,o);const i=await r.json(),a={aws:i.aws,dana:{...i.token,refresh_token:t},org:e,isRemote:n,port:o};return Te.store(a,n,o),a}static isTokenExpired(e){const t=G.decode(e);if(!t.exp)return!0;return new Date(1e3*t.exp)<=new Date}static async loginCodeArtifact(e,t){const n=ke(t),o=new R({domain:Ae,domainOwner:Oe}),{authorizationToken:r,expiration:i}=await n.send(o);if(!r)throw new Error("Authorization token not found");const a={token:r,expiration:i};return Te.updateCodeArtifactToken(e,a),await Ze.loginNPM(e,t,a),Ze.loginGradle(e,a),"darwin"===process.platform&&await Ze.loginSPM(e,t,a),a}static async loginNPM(e,t,n){const o=ke(t),r=await _e({organization:e,credentials:t,client:o,format:"npm"});w(`npm config set @dana:registry=${r}`),w(`npm config set //${r.replace(/^https?:\/\//,"")}:_authToken=${n.token}`)}static loginGradle(e,t){const n=Fe(e);o.existsSync(u.join(process.env.HOME,".gradle"))||o.mkdirSync(u.join(process.env.HOME,".gradle"));const r=u.join(process.env.HOME,".gradle","gradle.properties"),i=o.existsSync(r)?o.readFileSync(r,{encoding:"utf-8"}):"",a=`dana.${n}.token`;let s=!1,c=0;const l=i.split("\n").reduce((e,n,o)=>(n.startsWith(a+"=")?(n=`${a}=${t.token}`,s=!0):""===n&&o>c&&(c=o),e.push(n),e),[]);s||l.splice(c,0,`${a}=${t.token}`),o.writeFileSync(r,l.join("\n"))}static async loginSPM(e,t,n){const r=function(){const e=u.join(process.env.HOME,"Library","org.swift.swiftpm","configuration"),t=u.join(process.env.HOME,".swiftpm"),n=u.join(process.env.HOME,".swiftpm","configuration","registries.json");return o.mkdirSync(e,{recursive:!0}),o.mkdirSync(t,{recursive:!0}),o.existsSync(u.join(t,"configuration"))||o.symlinkSync(e,u.join(t,"configuration")),o.existsSync(n)||o.writeFileSync(n,JSON.stringify({authentication:{},registries:{},version:1},null,2)),n}(),i=ke(t),a=await _e({organization:e,credentials:t,client:i,format:"swift"});!function(e,t,n){const r=JSON.parse(o.readFileSync(e,{encoding:"utf-8"})),i=new URL(n);r.registries[t]={supportsAvailability:!1,url:n},r.authentication[i.host]={loginAPIPath:u.join(i.pathname,"login"),type:"token"},o.writeFileSync(e,JSON.stringify(r,null,2))}(r,"dana",a),function(e,t){const n=new URL(e),o=N("security",["add-internet-password","-a","token","-l",n.host,"-r","htps","-s",n.host,"-U","-A","-w",t],{encoding:"utf-8"});if(0!==o.status)throw o.stderr.split("\n")[0].includes("User canceled the operation")?new Error("Unable to update password in keychain.\nPlease enter your keychain password when asked to update the token."):o.stderr.split("\n")[0].includes("The specified item already exists in the keychain")?new Error("Unable to update token in keychain.\nDelete current token entry for codeartifact."):new Error("Unable to update password in keychain.\n"+o.stderr.toString())}(a,n.token)}}const Je=async()=>{const e=Te.get();try{if(!e.dana?.id_token||!e.dana?.refresh_token)return void await Ze.login(e.org,e.isRemote,e?.port);(Ze.isTokenExpired(e.dana.id_token)||e.aws&&new Date(e.aws.expiration)<new Date)&&await Ze.refresh(e.org,e.dana.refresh_token,e.isRemote,e?.port),(!e.npm?.token||e.npm&&e.npm.expiration<new Date)&&await Ze.loginCodeArtifact(e.org,e.aws)}catch(e){y.log.error(e.message),process.exit(6)}},We=(e,t,n)=>{try{const o=$e(u.join(u.dirname(n),"components",`${e.type}.js.hbs`),e),r=u.resolve(t,Se.normalizeFileName(e.type,e.name));a(r,o,{encoding:"utf-8"}),y.log.success(`${e.name} ${le["component.creation.success"]}`)}catch(t){const n=`Failed to create component ${e.name}`,o=t instanceof Error?`${n}: ${t.message}`:n;y.log.error(o),process.exit(3)}},Xe=e=>{const t=process.cwd(),n=Se.getTemplatePath();for(const o of e)We(o,t,n)},Ke=[{value:"MFixedNavigationType",label:O.bold("Fixed. ")+"Focus is fixed on the left side of the list.",command:"fixed"},{value:"MLMRNavigationType",label:O.bold("Left-Middle-Right. ")+"Focus starts on the left side, then moves and stays to the middle, then goes to the right side when the list ends",command:"lmr"},{value:"MLRNavigationType",label:O.bold("Left-Right. ")+" Focus moves in the chosen direction to the edge of the list. Then the list scrolls to show the next items.",command:"lr"},{value:"MPaginateNavigationType",label:O.bold("Paginated. ")+" Focus moves to the end of the visible items. Then, all items are replaced by new ones.",command:"paginated"}],Ye=[{value:"HORIZONTAL",label:"HORIZONTAL",command:"h"},{value:"VERTICAL",label:"VERTICAL",command:"v"}],qe={navigation:"FixedNavigationType",isCyclic:!1,direction:"horizontal",name:"mockRail",itemView:"mockTile",type:he,addMock:!0},Qe={name:"mockMenu",itemMargin:20,itemView:"ButtonItem",direction:"horizontal",addMock:!0,type:ge},et={name:"mock",itemMargin:550,itemView:"Rail",type:Ee},tt=class{static askName=async(e,t)=>{if(!t){const n=`${e} name is mandatory !`;t=await y.text({message:`${e} name`,placeholder:"Placeholder Name",validate:e=>Re(n,e)}),Se.handleCancellation(t)}return t.trim()};static askNumber=async(e,t)=>{const n=`${e} should be a number`,o=`Enter a value for ${e}`,r=t&&Number.isNaN(t)?`${t} is not a number. ${o}`:o;if(!t||Number.isNaN(t)){const e=await y.text({message:r,placeholder:"00",validate:e=>((e,t)=>Number.parseInt(e,10)?"":t)(e,n)});return Se.handleCancellation(e),+e}return t};static askComponentOption=async e=>{const{componentOption:t,optionList:n,optionType:o}=e;let r=Se.checkOption(t,n,o);if(!r){const e=`${De(o)} option`;r=await Se.selectionFactory(o,n,e)}return r};static askCyclic=async e=>{if(!e.cyclic){const e=await y.confirm({message:"Cyclic list ?"});return Se.handleCancellation(e),e}return e.cyclic};static handlePromptCancel=()=>{y.cancel("Operation cancelled."),process.exit(4)};static getDefaultConfig=(e,t)=>({...t,...e,addMock:!e.custom});static railConfig=async e=>{const t=tt.getDefaultConfig(e,qe);if(e.custom){const n=await y.group({name:async()=>await this.askName("rail",e.name),navigation:async()=>await this.askComponentOption({componentOption:e.navigation,optionList:Ke,optionType:"navigation"}),direction:async()=>await this.askComponentOption({componentOption:e.direction,optionList:Ye,optionType:"direction"}),isCyclic:async()=>await this.askCyclic(e),itemView:async()=>await this.askName("itemView",e.itemView)},{onCancel:()=>tt.handlePromptCancel()});return{...t,...n}}return t};static menuConfig=async e=>{const t=tt.getDefaultConfig(e,Qe);if(e.custom){const n=await y.group({name:async()=>await this.askName("menu",e.name),itemView:async()=>await this.askName("itemView",e.itemView),itemMargin:async()=>await this.askNumber("item margin",e.itemMargin),direction:async()=>await this.askComponentOption({componentOption:e.direction,optionList:Ye,optionType:"direction"})},{onCancel:()=>tt.handlePromptCancel()});return{...t,...n}}return t};static scrollViewConfig=async e=>{const t=tt.getDefaultConfig(e,et);if(e.custom){const n=await y.group({name:async()=>await this.askName("scrollView",e.name),itemView:async()=>await this.askName("itemView",e.itemView),itemMargin:async()=>await this.askNumber("item margin",e.itemMargin)},{onCancel:()=>tt.handlePromptCancel()});return{...t,...n}}return t};static screenConfig=async e=>({name:e.name??await this.askName("screen")})},nt=async(e,t)=>{const n={...t};e&&(n.name=e);const o=[{...n,...await tt.menuConfig(n)}];if(n.custom||o.push({type:ve,name:n.itemView??Qe.itemView}),Xe(o),!n.custom){const e=M.cwd(),t=Se.getTemplatePath(),n=u.join(u.dirname(t),"mocks","menuMock.json"),o=u.join(u.dirname(t),"icons"),r=u.resolve(e,"menuMock.json"),i=u.resolve(e,"./images/icons");c(n,r),c(o,i,{recursive:!0})}},ot=async(e,t)=>{const n={...t};e&&(n.name=e);const o=[{...n,...await tt.railConfig(n)}];if(n.custom||o.push({type:ye,name:n.itemView??qe.itemView}),Xe(o),!n.custom){const e=M.cwd(),t=Se.getTemplatePath(),n=u.join(u.dirname(t),"mocks","railMock.json"),o=u.resolve(e,"railMock.json");c(n,o)}},rt=async(e,t)=>{const n={...t};e&&(n.name=e);const o=[{...n,...await tt.scrollViewConfig(n)}];if(n.custom||o.push({type:we,name:n.itemView??et.itemView},{type:ye,name:"mockTile"}),Xe(o),!n.custom){const e=M.cwd(),t=Se.getTemplatePath(),n=u.join(u.dirname(t),"mocks","scrollViewMock.json"),o=u.resolve(e,"scrollViewMock.json");c(n,o)}},it=async(e,t)=>{try{const n={name:e??"Mock",type:t?.screenType??Ce};t?.screenType===Ne&&(await nt(Ne,{}),await rt(Ne,{})),Xe([n])}catch(e){y.log.info(`Error creating screen: ${e.message}`)}},at=e=>{y.outro(O.red(e.message??le["error.common.start.message"])),process.exit(6)},st=async({org:e,port:t,remote:n=!1})=>{const o=Te.get(e);try{let e;o.dana?.id_token&&o.dana?.refresh_token?Ze.isTokenExpired(o.dana.id_token)||o.aws&&new Date(o.aws.expiration)<new Date?(y.intro(`Refreshing credentials for organization ${o.org}`),e=await Ze.refresh(o.org,o.dana.refresh_token,n,t)):e=o:(y.intro(`Login to organization ${o.org} ...`),e=await Ze.login(o.org,n,t)),y.outro(O.green("✓")+" Login successful");const r=await Ze.loginCodeArtifact(o.org,e.aws);y.log.step(`Login expires in 12 hours at: ${r.expiration.toLocaleString()}`)}catch(e){at(e)}};var ct;!function(e){e[e.LOGGED=1]="LOGGED",e[e.NOT_LOGGED=2]="NOT_LOGGED",e[e.TOKEN_EXPIRED=3]="TOKEN_EXPIRED"}(ct||(ct={}));const lt=()=>{(()=>{const e=Te.get();if(!e?.dana?.id_token)return y.log.error(`${le["login.error.not_logged"]} ${le["login.info.please_login"]}`),ct.NOT_LOGGED;const t=e.dana.id_token,{given_name:n,family_name:o,email:r,exp:i}=G.decode(t),a=i&&new Date(1e3*i);if(a&&new Date>a)return y.log.error(`${le["login.info.token_expired"]} ${le["login.info.please_login"]}`),ct.TOKEN_EXPIRED;const s=a?`\nToken expires on ${a.toUTCString()}`:"";y.log.success(`${le["login.info.logged"]} ${O.bold(e.org)}: ${O.bold(n+" "+o)} (${r})${s}\n `),ct.LOGGED})()},dt=async({org:e})=>{const t=Te.get(e);try{y.intro(`Logout from ${t.org}...`),await Ze.logout(t.org,t.dana,t.isRemote),y.outro(O.green("✓")+" Logout successful. You are now being logged out in your browser.")}catch(e){at(e)}},mt=async e=>{const t=Te.get(e.org);if("android"===e.target)return(async e=>{const t=ke(e),n=new R({domain:Ae,domainOwner:Oe});try{const e=await t.send(n);console.log(e.authorizationToken)}catch(e){y.log.error(e.message),process.exit(9)}})(t.aws)};class ut{static checkSetup=async()=>{try{await this.executeCheck([{title:"Node version validation",task:async()=>this.validateNodeVersion()},{title:"Git install validation",task:async()=>this.validateGitInstallation()},{title:"AWS install validation",task:async()=>this.validateAwsInstallation()}]),y.log.success(O.green("✔ ")+le["setup.ok"])}catch(e){y.outro(`${O.red(le["setup.ko"])}: ${e.message??""}`),process.exit(8)}};static async executeCheck(e){for(const t of e)await t.task()}static async validateNodeVersion(){return Number.parseInt(process.version.slice(1).split(".")[0],10)>=22?Promise.resolve("Node version ok !"):Promise.reject(new Error(`${le["node.error"]} 22`))}static async validateGitInstallation(){return new Promise((e,t)=>{C("git --version",{},n=>{null!=n&&t(new Error(le["git.error"])),e("Git installation ok !")})})}static async validateAwsInstallation(){return new Promise((e,t)=>{C("aws --version",{},n=>{null!=n&&t(new Error(le["aws.cli.error"])),e("AWS installation ok !")})})}}const ft="modules";var pt;!function(e){e.MENU="menu",e.VOD="vod",e.FIP="fip",e.SETTINGS="settings",e.HOME="home",e.SEARCH="search",e.PLAYER="player"}(pt||(pt={}));const gt=e=>[{title:"Copy template",task:async()=>Ge.copyTemplate(e)},{title:"Update templated files",task:async()=>Ve.applyTemplatesToFiles(e)},{title:"Update npmrc",task:async()=>Ve.updateNpmrcFile(e)},{title:"Update package.json",task:async()=>Ve.updatePackageJson(e)},{title:"Copy app.config files",task:async()=>Ge.copyAppConfigFiles(e)},{title:"Update app.config.json",task:async()=>Ve.updateAppConfigFile(e)},{title:"Install dependencies with npm",task:async()=>Be.installDependencies(e)},{title:"Install grunt globally",task:async()=>Be.installGrunt()},{title:"Execute grunt tasks",task:async()=>Ge.executeGruntTasks(e)},{title:"Execute devices config",task:async()=>Ve.setDevicesConfig(e)}],ht=e=>({title:"Initialize git",task:async()=>Be.initGit(e)}),yt=e=>[{title:"Copy for tutorial",task:async()=>Ge.copyForTutorial(e)}],Et=e=>{const t=f(p(Se.getTemplatePath()),"modules"),n=d(t),o=n.some(e=>e===pt.SEARCH||e===pt.MENU||e===pt.SETTINGS||e===pt.PLAYER);return[{title:"Copy modules for templated",task:async()=>Ge.copyForTemplatedApp(e,n,t)},{title:"Update app.config with modules list and ",task:async()=>Ve.addModuleToAppConfig(e,{modules:n,shouldAddIconFont:o})},{title:"Update appTheme",task:async()=>Ve.updateAppTheme(e,"icons"),condition:o},{title:"Set first route",task:()=>xe.setFirstRoute(e)}]},wt=async(e,t)=>{const{devices:n,type:r}=t,i=r===Me.BARE?"":r;y.intro(O.inverse(`Let's create a ${i} Dana application !`)),await ut.checkSetup();const a=await y.group(je.getPrompts(e,n),{onCancel:()=>tt.handlePromptCancel()});a.config=await je.getDevicesConfig(a),a.awsProfile=Te.get().org;const s=y.spinner();try{s.start(le["task.installation.start"]);const e=((e,t)=>{const n=gt(e);return t===Me.TUTORIAL&&n.push(...yt(e)),t===Me.TEMPLATED&&n.push(...Et(e)),n.push(ht(e)),n})(a,r);await xe.installation(e,s),s.stop(le["task.installation.end"])}catch(e){const t=e instanceof Error?e.message:"Error";s.stop(t),o.rmSync(`./${a.directory}`,{recursive:!0,force:!0}),y.outro(O.red(`${le["error.common.start.message"]}: `)+O.yellow(`\n${a.directory} folder has been removed.`)),process.exit(1)}y.outro(le["creation.final"]),y.intro(O.inverse(le["script.run.title"])),xe.printNpmCommandForUser(a),y.outro("---")},vt="bash",Ct="zsh",Nt=e=>{[vt,Ct].includes(e)||Dt(`Error: Shell must be either ${vt} or ${Ct}`);const t=u.dirname(_(import.meta.url)),n=g(t,"../dana_completion.sh"),o=`.${e}rc`,r=g(k(),o),i=`\n#${"=".repeat(25)}\n# Dana CLI completion`,a=`\nsource "${n}"\n`,s=e===Ct?`${i}\nautoload -U compinit\ncompinit ${a}`:`${i}${a}`;try{m(r,s),y.log.success(O.green("✓")+le["command.completion.success"]+` ${o}`),y.log.info(`Run 'source ~/${o}' or restart your terminal`)}catch(e){Dt(`Failed to install completion: ${e}`)}},Dt=e=>{y.log.error(e),process.exit(7)};function It(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Lt,St,At={exports:{}};function Ot(){return St?Lt:(St=1,Lt={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24})}var Tt,_t,kt,Ft,Pt,bt,Rt,Ut,xt={};function jt(){return Tt||(Tt=1,function(e){const t={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function n(e){return function(...t){return t.length&&(e=e.replace(/\{(\d)\}/g,(e,n)=>t[n]||"")),new Error("ADM-ZIP: "+e)}}for(const o of Object.keys(t))e[o]=n(t[o])}(xt)),xt}function $t(){return Ut||(Ut=1,At.exports=function(){if(kt)return _t;kt=1;const e=Z,t=J,n=Ot(),o=jt(),r="object"==typeof process&&"win32"===process.platform,i=e=>"object"==typeof e&&null!==e,a=new Uint32Array(256).map((e,t)=>{for(let e=0;e<8;e++)1&t?t=3988292384^t>>>1:t>>>=1;return t>>>0});function s(n){this.sep=t.sep,this.fs=e,i(n)&&i(n.fs)&&"function"==typeof n.fs.statSync&&(this.fs=n.fs)}return _t=s,s.prototype.makeDir=function(e){const t=this;!function(e){let n=e.split(t.sep)[0];e.split(t.sep).forEach(function(e){if(e&&":"!==e.substr(-1,1)){var r;n+=t.sep+e;try{r=t.fs.statSync(n)}catch(e){t.fs.mkdirSync(n)}if(r&&r.isFile())throw o.FILE_IN_THE_WAY(`"${n}"`)}})}(e)},s.prototype.writeFileTo=function(e,n,o,r){const i=this;if(i.fs.existsSync(e)){if(!o)return!1;if(i.fs.statSync(e).isDirectory())return!1}var a,s=t.dirname(e);i.fs.existsSync(s)||i.makeDir(s);try{a=i.fs.openSync(e,"w",438)}catch(t){i.fs.chmodSync(e,438),a=i.fs.openSync(e,"w",438)}if(a)try{i.fs.writeSync(a,n,0,n.length,0)}finally{i.fs.closeSync(a)}return i.fs.chmodSync(e,r||438),!0},s.prototype.writeFileToAsync=function(e,n,o,r,i){"function"==typeof r&&(i=r,r=void 0);const a=this;a.fs.exists(e,function(s){if(s&&!o)return i(!1);a.fs.stat(e,function(o,c){if(s&&c.isDirectory())return i(!1);var l=t.dirname(e);a.fs.exists(l,function(t){t||a.makeDir(l),a.fs.open(e,"w",438,function(t,o){t?a.fs.chmod(e,438,function(){a.fs.open(e,"w",438,function(t,o){a.fs.write(o,n,0,n.length,0,function(){a.fs.close(o,function(){a.fs.chmod(e,r||438,function(){i(!0)})})})})}):o?a.fs.write(o,n,0,n.length,0,function(){a.fs.close(o,function(){a.fs.chmod(e,r||438,function(){i(!0)})})}):a.fs.chmod(e,r||438,function(){i(!0)})})})})})},s.prototype.findFiles=function(e){const n=this;return function e(o,r,i){let a=[];return n.fs.readdirSync(o).forEach(function(s){const c=t.join(o,s),l=n.fs.statSync(c);a.push(t.normalize(c)+(l.isDirectory()?n.sep:"")),l.isDirectory()&&i&&(a=a.concat(e(c,r,i)))}),a}(e,void 0,!0)},s.prototype.findFilesAsync=function(e,n){const o=this;let r=[];o.fs.readdir(e,function(i,a){if(i)return n(i);let s=a.length;if(!s)return n(null,r);a.forEach(function(i){i=t.join(e,i),o.fs.stat(i,function(e,a){if(e)return n(e);a&&(r.push(t.normalize(i)+(a.isDirectory()?o.sep:"")),a.isDirectory()?o.findFilesAsync(i,function(e,t){if(e)return n(e);r=r.concat(t),--s||n(null,r)}):--s||n(null,r))})})})},s.prototype.getAttributes=function(){},s.prototype.setAttributes=function(){},s.crc32update=function(e,t){return a[255&(e^t)]^e>>>8},s.crc32=function(e){"string"==typeof e&&(e=Buffer.from(e,"utf8"));let t=e.length,n=-1;for(let o=0;o<t;)n=s.crc32update(n,e[o++]);return~n>>>0},s.methodToString=function(e){switch(e){case n.STORED:return"STORED ("+e+")";case n.DEFLATED:return"DEFLATED ("+e+")";default:return"UNSUPPORTED ("+e+")"}},s.canonical=function(e){if(!e)return"";const n=t.posix.normalize("/"+e.split("\\").join("/"));return t.join(".",n)},s.zipnamefix=function(e){if(!e)return"";const n=t.posix.normalize("/"+e.split("\\").join("/"));return t.posix.join(".",n)},s.findLast=function(e,t){if(!Array.isArray(e))throw new TypeError("arr is not array");for(let n=(e.length>>>0)-1;n>=0;n--)if(t(e[n],n,e))return e[n]},s.sanitize=function(e,n){e=t.resolve(t.normalize(e));for(var o=n.split("/"),r=0,i=o.length;r<i;r++){var a=t.normalize(t.join(e,o.slice(r,i).join(t.sep)));if(0===a.indexOf(e))return a}return t.normalize(t.join(e,t.basename(n)))},s.toBuffer=function(e,t){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):"string"==typeof e?t(e):Buffer.alloc(0)},s.readBigUInt64LE=function(e,t){var n=Buffer.from(e.slice(t,t+8));return n.swap64(),parseInt(`0x${n.toString("hex")}`)},s.fromDOS2Date=function(e){return new Date(1980+(e>>25&127),Math.max((e>>21&15)-1,0),Math.max(e>>16&31,1),e>>11&31,e>>5&63,(31&e)<<1)},s.fromDate2DOS=function(e){let t=0,n=0;return e.getFullYear()>1979&&(t=(e.getFullYear()-1980&127)<<9|e.getMonth()+1<<5|e.getDate(),n=e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1),t<<16|n},s.isWin=r,s.crcTable=a,_t}(),At.exports.Constants=Ot(),At.exports.Errors=jt(),At.exports.FileAttr=function(){if(Pt)return Ft;Pt=1;const e=J;return Ft=function(t,{fs:n}){var o=t||"",r={directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0},i=null;return o&&n.existsSync(o)?(i=n.statSync(o),r.directory=i.isDirectory(),r.mtime=i.mtime,r.atime=i.atime,r.executable=!!(73&i.mode),r.readonly=!(128&i.mode),r.hidden="."===e.basename(o)[0]):console.warn("Invalid path: "+o),{get directory(){return r.directory},get readOnly(){return r.readonly},get hidden(){return r.hidden},get mtime(){return r.mtime},get atime(){return r.atime},get executable(){return r.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:o,isDirectory:r.directory,isReadOnly:r.readonly,isHidden:r.hidden,isExecutable:r.executable,mTime:r.mtime,aTime:r.atime}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}},Ft}(),At.exports.decoder=Rt?bt:(Rt=1,bt={efs:!0,encode:e=>Buffer.from(e,"utf8"),decode:e=>e.toString("utf8")})),At.exports}var Mt,zt,Vt,Bt,Gt,Ht={};function Zt(){if(zt)return Mt;zt=1;var e=$t(),t=e.Constants;return Mt=function(){var n=20,o=10,r=0,i=0,a=0,s=0,c=0,l=0,d=0,m=0,u=0,f=0,p=0,g=0,h=0;n|=e.isWin?2560:768,r|=t.FLG_EFS;const y={extraLen:0},E=e=>Math.max(0,e)>>>0;return a=e.fromDate2DOS(new Date),{get made(){return n},set made(e){n=e},get version(){return o},set version(e){o=e},get flags(){return r},set flags(e){r=e},get flags_efs(){return(r&t.FLG_EFS)>0},set flags_efs(e){e?r|=t.FLG_EFS:r&=~t.FLG_EFS},get flags_desc(){return(r&t.FLG_DESC)>0},set flags_desc(e){e?r|=t.FLG_DESC:r&=~t.FLG_DESC},get method(){return i},set method(e){switch(e){case t.STORED:this.version=10;case t.DEFLATED:default:this.version=20}i=e},get time(){return e.fromDOS2Date(this.timeval)},set time(t){this.timeval=e.fromDate2DOS(t)},get timeval(){return a},set timeval(e){a=E(e)},get timeHighByte(){return e=a>>>8,255&Math.max(0,e);var e},get crc(){return s},set crc(e){s=E(e)},get compressedSize(){return c},set compressedSize(e){c=E(e)},get size(){return l},set size(e){l=E(e)},get fileNameLength(){return d},set fileNameLength(e){d=e},get extraLength(){return m},set extraLength(e){m=e},get extraLocalLength(){return y.extraLen},set extraLocalLength(e){y.extraLen=e},get commentLength(){return u},set commentLength(e){u=e},get diskNumStart(){return f},set diskNumStart(e){f=E(e)},get inAttr(){return p},set inAttr(e){p=E(e)},get attr(){return g},set attr(e){g=E(e)},get fileAttr(){return(g||0)>>16&4095},get offset(){return h},set offset(e){h=E(e)},get encrypted(){return(r&t.FLG_ENC)===t.FLG_ENC},get centralHeaderSize(){return t.CENHDR+d+m+u},get realDataOffset(){return h+t.LOCHDR+y.fnameLen+y.extraLen},get localHeader(){return y},loadLocalHeaderFromBinary:function(n){var o=n.slice(h,h+t.LOCHDR);if(o.readUInt32LE(0)!==t.LOCSIG)throw e.Errors.INVALID_LOC();y.version=o.readUInt16LE(t.LOCVER),y.flags=o.readUInt16LE(t.LOCFLG),y.method=o.readUInt16LE(t.LOCHOW),y.time=o.readUInt32LE(t.LOCTIM),y.crc=o.readUInt32LE(t.LOCCRC),y.compressedSize=o.readUInt32LE(t.LOCSIZ),y.size=o.readUInt32LE(t.LOCLEN),y.fnameLen=o.readUInt16LE(t.LOCNAM),y.extraLen=o.readUInt16LE(t.LOCEXT);const r=h+t.LOCHDR+y.fnameLen,i=r+y.extraLen;return n.slice(r,i)},loadFromBinary:function(y){if(y.length!==t.CENHDR||y.readUInt32LE(0)!==t.CENSIG)throw e.Errors.INVALID_CEN();n=y.readUInt16LE(t.CENVEM),o=y.readUInt16LE(t.CENVER),r=y.readUInt16LE(t.CENFLG),i=y.readUInt16LE(t.CENHOW),a=y.readUInt32LE(t.CENTIM),s=y.readUInt32LE(t.CENCRC),c=y.readUInt32LE(t.CENSIZ),l=y.readUInt32LE(t.CENLEN),d=y.readUInt16LE(t.CENNAM),m=y.readUInt16LE(t.CENEXT),u=y.readUInt16LE(t.CENCOM),f=y.readUInt16LE(t.CENDSK),p=y.readUInt16LE(t.CENATT),g=y.readUInt32LE(t.CENATX),h=y.readUInt32LE(t.CENOFF)},localHeaderToBinary:function(){var e=Buffer.alloc(t.LOCHDR);return e.writeUInt32LE(t.LOCSIG,0),e.writeUInt16LE(o,t.LOCVER),e.writeUInt16LE(r,t.LOCFLG),e.writeUInt16LE(i,t.LOCHOW),e.writeUInt32LE(a,t.LOCTIM),e.writeUInt32LE(s,t.LOCCRC),e.writeUInt32LE(c,t.LOCSIZ),e.writeUInt32LE(l,t.LOCLEN),e.writeUInt16LE(d,t.LOCNAM),e.writeUInt16LE(y.extraLen,t.LOCEXT),e},centralHeaderToBinary:function(){var e=Buffer.alloc(t.CENHDR+d+m+u);return e.writeUInt32LE(t.CENSIG,0),e.writeUInt16LE(n,t.CENVEM),e.writeUInt16LE(o,t.CENVER),e.writeUInt16LE(r,t.CENFLG),e.writeUInt16LE(i,t.CENHOW),e.writeUInt32LE(a,t.CENTIM),e.writeUInt32LE(s,t.CENCRC),e.writeUInt32LE(c,t.CENSIZ),e.writeUInt32LE(l,t.CENLEN),e.writeUInt16LE(d,t.CENNAM),e.writeUInt16LE(m,t.CENEXT),e.writeUInt16LE(u,t.CENCOM),e.writeUInt16LE(f,t.CENDSK),e.writeUInt16LE(p,t.CENATT),e.writeUInt32LE(g,t.CENATX),e.writeUInt32LE(h,t.CENOFF),e},toJSON:function(){const a=function(e){return e+" bytes"};return{made:n,version:o,flags:r,method:e.methodToString(i),time:this.time,crc:"0x"+s.toString(16).toUpperCase(),compressedSize:a(c),size:a(l),fileNameLength:a(d),extraLength:a(m),commentLength:a(u),diskNumStart:f,inAttr:p,attr:g,offset:h,centralHeaderSize:a(t.CENHDR+d+m+u)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}function Jt(){return Gt||(Gt=1,Ht.EntryHeader=Zt(),Ht.MainHeader=function(){if(Bt)return Vt;Bt=1;var e=$t(),t=e.Constants;return Vt=function(){var n=0,o=0,r=0,i=0,a=0;return{get diskEntries(){return n},set diskEntries(e){n=o=e},get totalEntries(){return o},set totalEntries(e){o=n=e},get size(){return r},set size(e){r=e},get offset(){return i},set offset(e){i=e},get commentLength(){return a},set commentLength(e){a=e},get mainHeaderSize(){return t.ENDHDR+a},loadFromBinary:function(s){if((s.length!==t.ENDHDR||s.readUInt32LE(0)!==t.ENDSIG)&&(s.length<t.ZIP64HDR||s.readUInt32LE(0)!==t.ZIP64SIG))throw e.Errors.INVALID_END();s.readUInt32LE(0)===t.ENDSIG?(n=s.readUInt16LE(t.ENDSUB),o=s.readUInt16LE(t.ENDTOT),r=s.readUInt32LE(t.ENDSIZ),i=s.readUInt32LE(t.ENDOFF),a=s.readUInt16LE(t.ENDCOM)):(n=e.readBigUInt64LE(s,t.ZIP64SUB),o=e.readBigUInt64LE(s,t.ZIP64TOT),r=e.readBigUInt64LE(s,t.ZIP64SIZE),i=e.readBigUInt64LE(s,t.ZIP64OFF),a=0)},toBinary:function(){var e=Buffer.alloc(t.ENDHDR+a);return e.writeUInt32LE(t.ENDSIG,0),e.writeUInt32LE(0,4),e.writeUInt16LE(n,t.ENDSUB),e.writeUInt16LE(o,t.ENDTOT),e.writeUInt32LE(r,t.ENDSIZ),e.writeUInt32LE(i,t.ENDOFF),e.writeUInt16LE(a,t.ENDCOM),e.fill(" ",t.ENDHDR),e},toJSON:function(){return{diskEntries:n,totalEntries:o,size:r+" bytes",offset:function(e,t){let n=e.toString(16).toUpperCase();for(;n.length<t;)n="0"+n;return"0x"+n}(i,4),commentLength:a}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}()),Ht}var Wt,Xt,Kt,Yt,qt,Qt,en,tn,nn,on,rn,an,sn,cn={};function ln(){if(Qt)return qt;Qt=1;const{randomFillSync:e}=X,t=jt(),n=new Uint32Array(256).map((e,t)=>{for(let e=0;e<8;e++)1&t?t=t>>>1^3988292384:t>>>=1;return t>>>0}),o=(e,t)=>Math.imul(e,t)>>>0,r=(e,t)=>n[255&(e^t)]^e>>>8,i=()=>"function"==typeof e?e(Buffer.alloc(12)):i.node();i.node=()=>{const e=Buffer.alloc(12),t=e.length;for(let n=0;n<t;n++)e[n]=256*Math.random()&255;return e};const a={genSalt:i};function s(e){const t=Buffer.isBuffer(e)?e:Buffer.from(e);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let e=0;e<t.length;e++)this.updateKeys(t[e])}return s.prototype.updateKeys=function(e){const t=this.keys;return t[0]=r(t[0],e),t[1]+=255&t[0],t[1]=o(t[1],134775813)+1,t[2]=r(t[2],t[1]>>>24),e},s.prototype.next=function(){const e=(2|this.keys[2])>>>0;return o(e,1^e)>>8&255},qt={decrypt:function(e,n,o){if(!e||!Buffer.isBuffer(e)||e.length<12)return Buffer.alloc(0);const r=function(e){const t=new s(e);return function(e){const n=Buffer.alloc(e.length);let o=0;for(let r of e)n[o++]=t.updateKeys(r^t.next());return n}}(o),i=r(e.slice(0,12)),a=8&~n.flags?n.crc>>>24:n.timeHighByte;if(i[11]!==a)throw t.WRONG_PASSWORD();return r(e.slice(12))},encrypt:function(e,t,n,o=!1){null==e&&(e=Buffer.alloc(0)),Buffer.isBuffer(e)||(e=Buffer.from(e.toString()));const r=function(e){const t=new s(e);return function(e,n,o=0){n||(n=Buffer.alloc(e.length));for(let r of e){const e=t.next();n[o++]=r^e,t.updateKeys(r)}return n}}(n),i=a.genSalt();i[11]=t.crc>>>24&255,o&&(i[10]=t.crc>>>16&255);const c=Buffer.alloc(e.length+12);return r(i,c),r(e,c,12)},_salter:function(e){Buffer.isBuffer(e)&&e.length>=12?a.genSalt=function(){return e.slice(0,12)}:a.genSalt="node"===e?i.node:i}}}function dn(){return en||(en=1,cn.Deflater=Xt?Wt:(Xt=1,Wt=function(e){var t=W,n={chunkSize:1024*(parseInt(e.length/1024)+1)};return{deflate:function(){return t.deflateRawSync(e,n)},deflateAsync:function(o){var r=t.createDeflateRaw(n),i=[],a=0;r.on("data",function(e){i.push(e),a+=e.length}),r.on("end",function(){var e=Buffer.alloc(a),t=0;e.fill(0);for(var n=0;n<i.length;n++){var r=i[n];r.copy(e,t),t+=r.length}o&&o(e)}),r.end(e)}}}),cn.Inflater=function(){if(Yt)return Kt;Yt=1;const e=+(process.versions?process.versions.node:"").split(".")[0]||0;return Kt=function(t,n){var o=W;const r=e>=15&&n>0?{maxOutputLength:n}:{};return{inflate:function(){return o.inflateRawSync(t,r)},inflateAsync:function(e){var n=o.createInflateRaw(r),i=[],a=0;n.on("data",function(e){i.push(e),a+=e.length}),n.on("end",function(){var t=Buffer.alloc(a),n=0;t.fill(0);for(var o=0;o<i.length;o++){var r=i[o];r.copy(t,n),n+=r.length}e&&e(t)}),n.end(t)}}}}(),cn.ZipCrypto=ln()),cn}function mn(){if(nn)return tn;nn=1;var e=$t(),t=Jt(),n=e.Constants,o=dn();return tn=function(r,i){var a=new t.EntryHeader,s=Buffer.alloc(0),c=Buffer.alloc(0),l=!1,d=null,m=Buffer.alloc(0),u=Buffer.alloc(0),f=!0;const p=r,g="object"==typeof p.decoder?p.decoder:e.decoder;function h(){return i&&i instanceof Uint8Array?(u=a.loadLocalHeaderFromBinary(i),i.slice(a.realDataOffset,a.realDataOffset+a.compressedSize)):Buffer.alloc(0)}function y(t){if(a.flags_desc){const o={},r=a.realDataOffset+a.compressedSize;if(i.readUInt32LE(r)==n.LOCSIG||i.readUInt32LE(r)==n.CENSIG)throw e.Errors.DESCRIPTOR_NOT_EXIST();if(i.readUInt32LE(r)==n.EXTSIG)o.crc=i.readUInt32LE(r+n.EXTCRC),o.compressedSize=i.readUInt32LE(r+n.EXTSIZ),o.size=i.readUInt32LE(r+n.EXTLEN);else{if(19280!==i.readUInt16LE(r+12))throw e.Errors.DESCRIPTOR_UNKNOWN();o.crc=i.readUInt32LE(r+n.EXTCRC-4),o.compressedSize=i.readUInt32LE(r+n.EXTSIZ-4),o.size=i.readUInt32LE(r+n.EXTLEN-4)}if(o.compressedSize!==a.compressedSize||o.size!==a.size||o.crc!==a.crc)throw e.Errors.DESCRIPTOR_FAULTY();if(e.crc32(t)!==o.crc)return!1}else if(e.crc32(t)!==a.localHeader.crc)return!1;return!0}function E(t,n,r){if(void 0===n&&"string"==typeof t&&(r=t,t=void 0),l)return t&&n&&n(Buffer.alloc(0),e.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var i=h();if(0===i.length)return t&&n&&n(i),i;if(a.encrypted){if("string"!=typeof r&&!Buffer.isBuffer(r))throw e.Errors.INVALID_PASS_PARAM();i=o.ZipCrypto.decrypt(i,a,r)}var c=Buffer.alloc(a.size);switch(a.method){case e.Constants.STORED:if(i.copy(c),y(c))return t&&n&&n(c),c;throw t&&n&&n(c,e.Errors.BAD_CRC()),e.Errors.BAD_CRC();case e.Constants.DEFLATED:var d=new o.Inflater(i,a.size);if(!t){if(d.inflate(c).copy(c,0),!y(c))throw e.Errors.BAD_CRC(`"${g.decode(s)}"`);return c}d.inflateAsync(function(t){t.copy(t,0),n&&(y(t)?n(t):n(t,e.Errors.BAD_CRC()))});break;default:throw t&&n&&n(Buffer.alloc(0),e.Errors.UNKNOWN_METHOD()),e.Errors.UNKNOWN_METHOD()}}function w(t,n){if((!d||!d.length)&&Buffer.isBuffer(i))return t&&n&&n(h()),h();if(d.length&&!l){var r;switch(a.method){case e.Constants.STORED:return a.compressedSize=a.size,r=Buffer.alloc(d.length),d.copy(r),t&&n&&n(r),r;default:case e.Constants.DEFLATED:var s=new o.Deflater(d);if(!t){var c=s.deflate();return a.compressedSize=c.length,c}s.deflateAsync(function(e){r=Buffer.alloc(e.length),a.compressedSize=e.length,e.copy(r),n&&n(r)}),s=null}}else{if(!t||!n)return Buffer.alloc(0);n(Buffer.alloc(0))}}function v(e,t){return(e.readUInt32LE(t+4)<<4)+e.readUInt32LE(t)}function C(e){var t,o,r,i;e.length>=n.EF_ZIP64_SCOMP&&(t=v(e,n.EF_ZIP64_SUNCOMP),a.size===n.EF_ZIP64_OR_32&&(a.size=t)),e.length>=n.EF_ZIP64_RHO&&(o=v(e,n.EF_ZIP64_SCOMP),a.compressedSize===n.EF_ZIP64_OR_32&&(a.compressedSize=o)),e.length>=n.EF_ZIP64_DSN&&(r=v(e,n.EF_ZIP64_RHO),a.offset===n.EF_ZIP64_OR_32&&(a.offset=r)),e.length>=n.EF_ZIP64_DSN+4&&(i=e.readUInt32LE(n.EF_ZIP64_DSN),a.diskNumStart===n.EF_ZIP64_OR_16&&(a.diskNumStart=i))}return f=!!g.hasOwnProperty("efs")&&g.efs,{get entryName(){return g.decode(s)},get rawEntryName(){return s},set entryName(t){var n=(s=e.toBuffer(t,g.encode))[s.length-1];l=47===n||92===n,a.fileNameLength=s.length},get efs(){return"function"==typeof f?f(this.entryName):f},get extra(){return m},set extra(t){m=t,a.extraLength=t.length,function(t){try{for(var o,r,i,a=0;a+4<t.length;)o=t.readUInt16LE(a),a+=2,r=t.readUInt16LE(a),a+=2,i=t.slice(a,a+r),a+=r,n.ID_ZIP64===o&&C(i)}catch(t){throw e.Errors.EXTRA_FIELD_PARSE_ERROR()}}(t)},get comment(){return g.decode(c)},set comment(t){if(c=e.toBuffer(t,g.encode),a.commentLength=c.length,c.length>65535)throw e.Errors.COMMENT_TOO_LONG()},get name(){var e=g.decode(s);return l?e.substr(e.length-1).split("/").pop():e.split("/").pop()},get isDirectory(){return l},getCompressedData:function(){return w(!1,null)},getCompressedDataAsync:function(e){w(!0,e)},setData:function(t){d=e.toBuffer(t,e.decoder.encode),!l&&d.length?(a.size=d.length,a.method=e.Constants.DEFLATED,a.crc=e.crc32(t),a.changed=!0):a.method=e.Constants.STORED},getData:function(e){return a.changed?d:E(!1,null,e)},getDataAsync:function(e,t){a.changed?e(d):E(!0,e,t)},set attr(e){a.attr=e},get attr(){return a.attr},set header(e){a.loadFromBinary(e)},get header(){return a},packCentralHeader:function(){a.flags_efs=this.efs,a.extraLength=m.length;var t=a.centralHeaderToBinary(),n=e.Constants.CENHDR;return s.copy(t,n),n+=s.length,m.copy(t,n),n+=a.extraLength,c.copy(t,n),t},packLocalHeader:function(){let e=0;a.flags_efs=this.efs,a.extraLocalLength=u.length;const t=a.localHeaderToBinary(),n=Buffer.alloc(t.length+s.length+a.extraLocalLength);return t.copy(n,e),e+=t.length,s.copy(n,e),e+=s.length,u.copy(n,e),e+=u.length,n},toJSON:function(){const e=function(e){return"<"+(e&&e.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:a.toJSON(),compressedData:e(i),data:e(d)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}},tn}function un(){if(rn)return on;rn=1;const e=mn(),t=Jt(),n=$t();return on=function(o,r){var i=[],a={},s=Buffer.alloc(0),c=new t.MainHeader,l=!1;const d=new Set,m=r,{noSort:u,decoder:f}=m;function p(){if(l=!0,a={},c.diskEntries>(o.length-c.offset)/n.Constants.CENHDR)throw n.Errors.DISK_ENTRY_TOO_LARGE();i=new Array(c.diskEntries);for(var t=c.offset,r=0;r<i.length;r++){var s=t,u=new e(m,o);u.header=o.slice(s,s+=n.Constants.CENHDR),u.entryName=o.slice(s,s+=u.header.fileNameLength),u.header.extraLength&&(u.extra=o.slice(s,s+=u.header.extraLength)),u.header.commentLength&&(u.comment=o.slice(s,s+u.header.commentLength)),t+=u.header.centralHeaderSize,i[r]=u,a[u.entryName]=u}d.clear(),function(){const t=new Set;for(const e of Object.keys(a)){const n=e.split("/");if(n.pop(),n.length)for(let e=0;e<n.length;e++){const o=n.slice(0,e+1).join("/")+"/";t.add(o)}}for(const n of t)if(!(n in a)){const t=new e(m);t.entryName=n,t.attr=16,t.temporary=!0,i.push(t),a[t.entryName]=t,d.add(t)}}()}function g(){i.length>1&&!u&&i.sort((e,t)=>e.entryName.toLowerCase().localeCompare(t.entryName.toLowerCase()))}return o?function(e){var t=o.length-n.Constants.ENDHDR,r=Math.max(0,t-65535),i=r,a=o.length,l=-1,d=0;"boolean"==typeof m.trailingSpace&&m.trailingSpace&&(r=0);for(;t>=i;t--)if(80===o[t])if(o.readUInt32LE(t)!==n.Constants.ENDSIG)if(o.readUInt32LE(t)!==n.Constants.END64SIG){if(o.readUInt32LE(t)===n.Constants.ZIP64SIG){l=t,a=t+n.readBigUInt64LE(o,t+n.Constants.ZIP64SIZE)+n.Constants.ZIP64LEAD;break}}else i=r;else l=t,d=t,a=t+n.Constants.ENDHDR,i=t-n.Constants.END64HDR;if(-1==l)throw n.Errors.INVALID_FORMAT();c.loadFromBinary(o.slice(l,a)),c.commentLength&&(s=o.slice(d+n.Constants.ENDHDR));e&&p()}(m.readEntries):l=!0,{get entries(){return l||p(),i.filter(e=>!d.has(e))},get comment(){return f.decode(s)},set comment(e){s=n.toBuffer(e,f.encode),c.commentLength=s.length},getEntryCount:function(){return l?i.length:c.diskEntries},forEach:function(e){this.entries.forEach(e)},getEntry:function(e){return l||p(),a[e]||null},setEntry:function(e){l||p(),i.push(e),a[e.entryName]=e,c.totalEntries=i.length},deleteFile:function(e,t=!0){l||p();const n=a[e];this.getEntryChildren(n,t).map(e=>e.entryName).forEach(this.deleteEntry)},deleteEntry:function(e){l||p();const t=a[e],n=i.indexOf(t);n>=0&&(i.splice(n,1),delete a[e],c.totalEntries=i.length)},getEntryChildren:function(e,t=!0){if(l||p(),"object"==typeof e){if(e.isDirectory&&t){const t=[],n=e.entryName;for(const e of i)e.entryName.startsWith(n)&&t.push(e);return t}return[e]}return[]},getChildCount:function(e){if(e&&e.isDirectory){const t=this.getEntryChildren(e);return t.includes(e)?t.length-1:t.length}return 0},compressToBuffer:function(){l||p(),g();const e=[],t=[];let r=0,i=0;c.size=0,c.offset=0;let a=0;for(const n of this.entries){const o=n.getCompressedData();n.header.offset=i;const s=n.packLocalHeader(),l=s.length+o.length;i+=l,e.push(s),e.push(o);const d=n.packCentralHeader();t.push(d),c.size+=d.length,r+=l+d.length,a++}r+=c.mainHeaderSize,c.offset=i,c.totalEntries=a,i=0;const d=Buffer.alloc(r);for(const t of e)t.copy(d,i),i+=t.length;for(const e of t)e.copy(d,i),i+=e.length;const m=c.toBinary();return s&&s.copy(m,n.Constants.ENDHDR),m.copy(d,i),o=d,l=!1,d},toAsyncBuffer:function(e,t,r,i){try{l||p(),g();const t=[],a=[];let d=0,m=0,u=0;c.size=0,c.offset=0;const f=function(p){if(p.length>0){const e=p.shift(),n=e.entryName+e.extra.toString();r&&r(n),e.getCompressedDataAsync(function(o){i&&i(n),e.header.offset=m;const r=e.packLocalHeader(),s=r.length+o.length;m+=s,t.push(r),t.push(o);const l=e.packCentralHeader();a.push(l),c.size+=l.length,d+=s+l.length,u++,f(p)})}else{d+=c.mainHeaderSize,c.offset=m,c.totalEntries=u,m=0;const r=Buffer.alloc(d);t.forEach(function(e){e.copy(r,m),m+=e.length}),a.forEach(function(e){e.copy(r,m),m+=e.length});const i=c.toBinary();s&&s.copy(i,n.Constants.ENDHDR),i.copy(r,m),o=r,l=!1,e(r)}};f(Array.from(this.entries))}catch(e){t(e)}}}},on}var fn=function(){if(sn)return an;sn=1;const e=$t(),t=J,n=mn(),o=un(),r=(...t)=>e.findLast(t,e=>"boolean"==typeof e),i=(...t)=>e.findLast(t,e=>"string"==typeof e),a={noSort:!1,readEntries:!1,method:e.Constants.NONE,fs:null};return an=function(s,c){let l=null;const d=Object.assign(Object.create(null),a);s&&"object"==typeof s&&(s instanceof Uint8Array||(Object.assign(d,s),s=d.input?d.input:void 0,d.input&&delete d.input),Buffer.isBuffer(s)&&(l=s,d.method=e.Constants.BUFFER,s=void 0)),Object.assign(d,c);const m=new e(d);if("object"==typeof d.decoder&&"function"==typeof d.decoder.encode&&"function"==typeof d.decoder.decode||(d.decoder=e.decoder),s&&"string"==typeof s){if(!m.fs.existsSync(s))throw e.Errors.INVALID_FILENAME();d.method=e.Constants.FILE,d.filename=s,l=m.fs.readFileSync(s)}const u=new o(l,d),{canonical:f,sanitize:p,zipnamefix:g}=e;function h(e){var n;if(e&&u&&("string"==typeof e&&(n=u.getEntry(t.posix.normalize(e))),"object"==typeof e&&void 0!==e.entryName&&void 0!==e.header&&(n=u.getEntry(e.entryName)),n))return n;return null}function y(e){const{join:n,normalize:o,sep:r}=t.posix;return n(".",o(r+e.split("\\").join(r)+r))}function E(e){return e instanceof RegExp?(t=e,function(e){return t.test(e)}):"function"!=typeof e?()=>!0:e;var t}const w=(e,n)=>{let o=n.slice(-1);return o=o===m.sep?m.sep:"",t.relative(e,n)+o};return{readFile:function(e,t){var n=h(e);return n&&n.getData(t)||null},childCount:function(e){const t=h(e);if(t)return u.getChildCount(t)},readFileAsync:function(e,t){var n=h(e);n?n.getDataAsync(t):t(null,"getEntry failed for:"+e)},readAsText:function(e,t){var n=h(e);if(n){var o=n.getData();if(o&&o.length)return o.toString(t||"utf8")}return""},readAsTextAsync:function(e,t,n){var o=h(e);o?o.getDataAsync(function(e,o){o?t(e,o):e&&e.length?t(e.toString(n||"utf8")):t("")}):t("")},deleteFile:function(e,t=!0){var n=h(e);n&&u.deleteFile(n.entryName,t)},deleteEntry:function(e){var t=h(e);t&&u.deleteEntry(t.entryName)},addZipComment:function(e){u.comment=e},getZipComment:function(){return u.comment||""},addZipEntryComment:function(e,t){var n=h(e);n&&(n.comment=t)},getZipEntryComment:function(e){var t=h(e);return t&&t.comment||""},updateFile:function(e,t){var n=h(e);n&&n.setData(t)},addLocalFile:function(n,o,r,i){if(!m.fs.existsSync(n))throw e.Errors.FILE_NOT_FOUND(n);{o=o?y(o):"";const e=t.win32.basename(t.win32.normalize(n));o+=r||e;const a=m.fs.statSync(n),s=a.isFile()?m.fs.readFileSync(n):Buffer.alloc(0);a.isDirectory()&&(o+=m.sep),this.addFile(o,s,i,a)}},addLocalFileAsync:function(e,n){e="object"==typeof e?e:{localPath:e};const o=t.resolve(e.localPath),{comment:r}=e;let{zipPath:i,zipName:a}=e;const s=this;m.fs.stat(o,function(e,c){if(e)return n(e,!1);i=i?y(i):"";const l=t.win32.basename(t.win32.normalize(o));if(i+=a||l,c.isFile())m.fs.readFile(o,function(e,t){return e?n(e,!1):(s.addFile(i,t,r,c),setImmediate(n,void 0,!0))});else if(c.isDirectory())return i+=m.sep,s.addFile(i,Buffer.alloc(0),r,c),setImmediate(n,void 0,!0)})},addLocalFolder:function(n,o,r){if(r=E(r),o=o?y(o):"",n=t.normalize(n),!m.fs.existsSync(n))throw e.Errors.FILE_NOT_FOUND(n);{const e=m.findFiles(n),i=this;if(e.length)for(const a of e){const e=t.join(o,w(n,a));r(e)&&i.addLocalFile(a,t.dirname(e))}}},addLocalFolderAsync:function(n,o,r,i){i=E(i),r=r?y(r):"",n=t.normalize(n);var a=this;m.fs.open(n,"r",function(t){if(t&&"ENOENT"===t.code)o(void 0,e.Errors.FILE_NOT_FOUND(n));else if(t)o(void 0,t);else{var s=m.findFiles(n),c=-1,l=function(){if((c+=1)<s.length){var e=s[c],t=w(n,e).split("\\").join("/");t=t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),i(t)?m.fs.stat(e,function(n,i){n&&o(void 0,n),i.isFile()?m.fs.readFile(e,function(e,n){e?o(void 0,e):(a.addFile(r+t,n,"",i),l())}):(a.addFile(r+t+"/",Buffer.alloc(0),"",i),l())}):process.nextTick(()=>{l()})}else o(!0,void 0)};l()}})},addLocalFolderAsync2:function(n,o){const r=this;n="object"==typeof n?n:{localPath:n},localPath=t.resolve(y(n.localPath));let{zipPath:i,filter:a,namefix:s}=n;var c;a instanceof RegExp?(c=a,a=function(e){return c.test(e)}):"function"!=typeof a&&(a=function(){return!0}),i=i?y(i):"","latin1"==s&&(s=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),"function"!=typeof s&&(s=e=>e);const l=e=>t.join(i,s(w(localPath,e))),d=e=>t.win32.basename(t.win32.normalize(s(e)));m.fs.open(localPath,"r",function(n){n&&"ENOENT"===n.code?o(void 0,e.Errors.FILE_NOT_FOUND(localPath)):n?o(void 0,n):m.findFilesAsync(localPath,function(e,n){if(e)return o(e);(n=n.filter(e=>a(l(e)))).length||o(void 0,!1),setImmediate(n.reverse().reduce(function(e,n){return function(o,i){if(o||!1===i)return setImmediate(e,o,!1);r.addLocalFileAsync({localPath:n,zipPath:t.dirname(l(n)),zipName:d(n)},e)}},o))})})},addLocalFolderPromise:function(e,t){return new Promise((n,o)=>{this.addLocalFolderAsync2(Object.assign({localPath:e},t),(e,t)=>{e&&o(e),t&&n(this)})})},addFile:function(e,t,o,r){let i=h(e=g(e));const a=null!=i;a||(i=new n(d),i.entryName=e),i.comment=o||"";const s="object"==typeof r&&r instanceof m.fs.Stats;s&&(i.header.time=r.mtime);var c=i.isDirectory?16:0;let l=i.isDirectory?16384:32768;return l|=s?4095&r.mode:"number"==typeof r?4095&r:i.isDirectory?493:420,c=(c|l<<16)>>>0,i.attr=c,i.setData(t),a||u.setEntry(i),i},getEntries:function(e){return u.password=e,u?u.entries:[]},getEntry:function(e){return h(e)},getEntryCount:function(){return u.getEntryCount()},forEach:function(e){return u.forEach(e)},extractEntryTo:function(n,o,a,s,c,l){s=r(!1,s),c=r(!1,c),a=r(!0,a),l=i(c,l);var d=h(n);if(!d)throw e.Errors.NO_ENTRY();var g=f(d.entryName),y=p(o,l&&!d.isDirectory?l:a?g:t.basename(g));if(d.isDirectory)return u.getEntryChildren(d).forEach(function(n){if(n.isDirectory)return;var r=n.getData();if(!r)throw e.Errors.CANT_EXTRACT_FILE();var i=f(n.entryName),l=p(o,a?i:t.basename(i));const d=c?n.header.fileAttr:void 0;m.writeFileTo(l,r,s,d)}),!0;var E=d.getData(u.password);if(!E)throw e.Errors.CANT_EXTRACT_FILE();if(m.fs.existsSync(y)&&!s)throw e.Errors.CANT_OVERRIDE();const w=c?n.header.fileAttr:void 0;return m.writeFileTo(y,E,s,w),!0},test:function(e){if(!u)return!1;for(var t in u.entries)try{if(t.isDirectory)continue;if(!u.entries[t].getData(e))return!1}catch(e){return!1}return!0},extractAllTo:function(t,n,o,a){if(o=r(!1,o),a=i(o,a),n=r(!1,n),!u)throw e.Errors.NO_ZIP();u.entries.forEach(function(r){var i=p(t,f(r.entryName));if(r.isDirectory)return void m.makeDir(i);var s=r.getData(a);if(!s)throw e.Errors.CANT_EXTRACT_FILE();const c=o?r.header.fileAttr:void 0;m.writeFileTo(i,s,n,c);try{m.fs.utimesSync(i,r.header.time,r.header.time)}catch(t){throw e.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(n,o,i,a){if(a=((...t)=>e.findLast(t,e=>"function"==typeof e))(o,i,a),i=r(!1,i),o=r(!1,o),!a)return new Promise((e,t)=>{this.extractAllToAsync(n,o,i,function(n){n?t(n):e(this)})});if(!u)return void a(e.Errors.NO_ZIP());n=t.resolve(n);const s=e=>p(n,t.normalize(f(e.entryName))),c=(e,t)=>new Error(e+': "'+t+'"'),l=[],d=[];u.entries.forEach(e=>{e.isDirectory?l.push(e):d.push(e)});for(const e of l){const t=s(e),n=i?e.header.fileAttr:void 0;try{m.makeDir(t),n&&m.fs.chmodSync(t,n),m.fs.utimesSync(t,e.header.time,e.header.time)}catch(e){a(c("Unable to create folder",t))}}d.reverse().reduce(function(r,a){return function(s){if(s)r(s);else{const s=t.normalize(f(a.entryName)),l=p(n,s);a.getDataAsync(function(t,n){if(n)r(n);else if(t){const e=i?a.header.fileAttr:void 0;m.writeFileToAsync(l,t,o,e,function(e){e||r(c("Unable to write file",l)),m.fs.utimes(l,a.header.time,a.header.time,function(e){e?r(c("Unable to set times",l)):r()})})}else r(e.Errors.CANT_EXTRACT_FILE())})}}},a)()},writeZip:function(e,t){if(1===arguments.length&&"function"==typeof e&&(t=e,e=""),!e&&d.filename&&(e=d.filename),e){var n=u.compressToBuffer();if(n){var o=m.writeFileTo(e,n,!0);"function"==typeof t&&t(o?null:new Error("failed"),"")}}},writeZipPromise:function(e,t){const{overwrite:n,perm:o}=Object.assign({overwrite:!0},t);return new Promise((t,r)=>{!e&&d.filename&&(e=d.filename),e||r("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(i=>{m.writeFileToAsync(e,i,n,o,e=>e?t(e):r("ADM-ZIP: Wasn't able to write zip file"))},r)})},toBufferPromise:function(){return new Promise((e,t)=>{u.toAsyncBuffer(e,t)})},toBuffer:function(e,t,n,o){return"function"==typeof e?(u.toAsyncBuffer(e,t,n,o),null):u.compressToBuffer()}}},an}(),pn=It(fn);const gn=[".git",".github",".idea","doc","generated","node_modules","dist","build","coverage","templates","tests"];async function hn(){const e=await H(".dana",{type:"directory"}),t=p(e??"").split("/").pop();if(!t)throw new Error("Unable to get your dana project directory name. Please run the command from the root directory of the project");const n=new pn;n.addLocalFolder(`../${t}`,void 0,e=>!function(e){return e.endsWith(".zip")}(e)&&!function(e){return gn.some(t=>e.split("/").includes(t))}(e)),n.writeZip(`./archive-${t}-${Date.now()}.zip`)}const yn=async()=>{y.intro(O.inverse("Creating an uploadable archive !"));const e=y.spinner();try{e.start(le["command.package.creation.start"]),await hn(),e.stop(le["command.package.creation.end"])}catch(t){const n=t instanceof Error?t.message:"Error";e.stop(n),y.outro(O.red(`${le["error.common.start.message"]}: `)),M.exit(11)}y.outro(le["command.package.final"])},En=async e=>{const t=await H(".dana",{type:"directory"}),n=p(t);r(f(n,ft,e))&&(y.log.error(`The ${e} module already exist`),M.exit(12));try{const t=f(p(Se.getTemplatePath()),"modules",e);c(t,g(n,ft,e),{recursive:!0});const o=e===pt.HOME||e===pt.VOD;if(o){const e=f(p(Se.getTemplatePath()),"modules",pt.MENU);c(e,g(n,ft,pt.MENU),{recursive:!0})}const r=o?" and menu":"";y.log.success(`The ${e} module has been created\n Don't forget to add ${e}${r} in the desired profile(s)`)}catch(e){y.log.error(`An error occurred : ${e}`),M.exit(12)}};(()=>{const r=u.dirname(_(import.meta.url)),i=u.join(r,"..","package.json"),a=JSON.parse(o.readFileSync(i,{encoding:"utf-8"})),s=new e(a.name);return s.usage(`${le["program.usage"]}`).version(a.version).addCommand((()=>{const t=new e("add-rail");return t.description(le["command.rail.description"]).argument("[name]",le["command.component.name"]).option("--cm, --custom",le["command.component.customization"]).option("-n, --navigation <navigation>",le["command.rail.option.navigation"]).option("-d, --direction <direction>",le["command.rail.option.direction"]).option("-c, --cyclic",le["command.rail.option.cyclic"]).option("-i, --itemView <itemView>",le["command.menu.option.itemView"]).addHelpText("after",`\n${le["help.option.title"]}\n -navigation: ${Ie(Ke)} \n -direction: ${Ie(Ye)} \n\nMore about rail feature, ${le["help.option.check"]} https://doc.dana-framework.com/docs/vendorcomponents/recycling-listview\n`).action(ot),t})()).addCommand(new e("add-device").description(le["command.device.description"]).hook("preAction",Je).action(He)).addCommand((()=>{const t=new e("add-menu");return t.description(le["command.menu.description"]).argument("[name]",le["command.component.name"]).option("--cm, --custom",le["command.component.customization"]).option("-i, --itemView <itemView>",le["command.menu.option.itemView"]).option("-m, --itemMargin <itemMargin>",le["command.menu.option.itemMargin"]).option("-d, --direction <direction>",le["command.rail.option.direction"]).action(nt),t})()).addCommand((()=>{const n=new e("auth").description(le["command.auth.description"]),o=new e("login").description(le["command.auth.login.description"]).option("-o, --org <organization>",le["command.auth.login.option.org"]).option("-r, --remote",le["command.auth.login.option.remote"]).option("-p, --port <port>",le["command.auth.login.option.port"]).action(st);n.addCommand(o);const r=new e("logout").description(le["command.auth.logout.description"]).option("-o, --org <organization>",le["command.auth.login.option.org"]).action(dt);n.addCommand(r);const i=new e("status").description(le["command.auth.status.description"]).action(lt);n.addCommand(i);const a=new e("get-packages-token").description(le["command.auth.get-packages-token.description"]).addOption(new t("-t, --target <target>","Packages target").makeOptionMandatory(!0).choices(["android"])).option("-o, --org <organization>",le["command.auth.login.option.org"]).hook("preAction",Je).action(mt);return n.addCommand(a),n})()).addCommand(new e("add-scrollView").description(le["command.scrollView.description"]).argument("[name]",le["command.component.name"]).option("--cm, --custom",le["command.component.customization"]).option("-i, --itemView <itemView>",le["command.menu.option.itemView"]).option("-m, --itemMargin <itemMargin>",le["command.menu.option.itemMargin"]).action(rt)).addCommand((()=>{const t=new e("add-screen");return t.description(le["command.screen.description"]).argument("[name]",le["command.component.name"]).option("-s, --screenType [screenType]",le["command.screen.option.type"]).action(it),t})()).addCommand((()=>{const n=new e("create-app");return n.description(le["command.create_app.description"]).argument("[projectName]",le["command.create_app.name"]).addOption(new t("-t, --type <type>",le["command.create_app.type"]).choices([Me.BARE,Me.TUTORIAL,Me.TEMPLATED]).default(Me.BARE)).option("-d, --devices",le["command.create_app.devices"]).hook("preAction",Je).action(wt),n})()).addCommand((()=>{const t=new e("completion");return t.description(le["command.completion.description"]).argument("<shell>",le["command.completion.argument"]).action(Nt),t})()).addCommand((()=>{const t=new e("package");return t.description(le["command.package.description"]).action(yn),t})()).addCommand((()=>{const t=new e("add-module");return t.description(le["command.module"]).addArgument(new n("name",le["command.module.name"]).choices(Object.values(pt))).action(En),t})()).hook("preSubcommand",async(e,t)=>{await(async(e,t)=>{if(["create-app","auth"].includes(t.name()))return;await H(".dana",{type:"directory"})||(y.log.error(le["command.hook.dana_project"]),process.exit(10))})(0,t)}),s.helpInformation=()=>(e=>{const t=" "+e.commands.map(e=>`${e.name()}: ${e.description()}`).sort((e,t)=>e.localeCompare(t)).join("\n "),n=Object.values(se).map(e=>e.label).sort((e,t)=>e.localeCompare(t)).join(", ");return`\n DANA\n===================\n\n${le["help.custom.commands"]}\n${t}\n\n\n${le["help.custom.devices"]}\n${n}\n\n`})(s),s.addHelpText("afterAll",`\n${le["program.help.footer"]}\n `),s})().parse();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RailConfig, MenuConfig, ScreenConfig, ScrollViewConfig } from "./componentTypes.js";
|
|
2
|
-
import { ConfigOptions, OptionList } from "
|
|
2
|
+
import { ConfigOptions, OptionList } from "@/common/types/helperTypes.js";
|
|
3
3
|
interface AskComponentParam {
|
|
4
4
|
componentOption: string;
|
|
5
5
|
optionList: OptionList;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MenuConfig, RailConfig, ScrollViewConfig } from "
|
|
1
|
+
import { MenuConfig, RailConfig, ScrollViewConfig } from "@/commands/addComponent/config/componentTypes.js";
|
|
2
2
|
export declare const RAIL_DEFAULT_CONFIG: RailConfig;
|
|
3
3
|
export declare const MENU_DEFAULT_CONFIG: MenuConfig;
|
|
4
4
|
export declare const SCROLLVIEW_DEFAULT_CONFIG: ScrollViewConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OptionList, SelectionArray } from "
|
|
1
|
+
import { OptionList, SelectionArray } from "@/common/types/helperTypes.js";
|
|
2
2
|
declare const ComponentHelper: {
|
|
3
3
|
new (): {};
|
|
4
4
|
readonly selectionFactory: (name: string, options: SelectionArray, message: string) => Promise<string>;
|
|
@@ -13,17 +13,8 @@ export interface TizenConf {
|
|
|
13
13
|
renderers: string[];
|
|
14
14
|
}
|
|
15
15
|
export interface WebosConf {
|
|
16
|
-
device: WebosDevice;
|
|
17
16
|
renderers: string[];
|
|
18
17
|
}
|
|
19
|
-
export interface WebosDevice {
|
|
20
|
-
appId: string;
|
|
21
|
-
appVendor: string;
|
|
22
|
-
appTitle: string;
|
|
23
|
-
icon: string;
|
|
24
|
-
largeIcon: string;
|
|
25
|
-
disableBackHistoryAPI: boolean;
|
|
26
|
-
}
|
|
27
18
|
export interface TvosConf {
|
|
28
19
|
jscVersion: string;
|
|
29
20
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WebosConf
|
|
1
|
+
import { WebosConf } from "./configTypes.js";
|
|
2
2
|
declare const WebosConfig: {
|
|
3
3
|
new (): {};
|
|
4
4
|
readonly appConfig: {
|
|
@@ -21,34 +21,6 @@ declare const WebosConfig: {
|
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
-
/**
|
|
25
|
-
* Ask the appId
|
|
26
|
-
*/
|
|
27
|
-
readonly _askAppId: () => Promise<string>;
|
|
28
|
-
/**
|
|
29
|
-
* Ask the vendor name
|
|
30
|
-
*/
|
|
31
|
-
readonly _askVendorName: () => Promise<string>;
|
|
32
|
-
/**
|
|
33
|
-
* Ask the app title
|
|
34
|
-
* @returns {Promise<String>}
|
|
35
|
-
*/
|
|
36
|
-
readonly _askAppTitle: () => Promise<string>;
|
|
37
|
-
/**
|
|
38
|
-
* Get the app icon url
|
|
39
|
-
* @returns {String}
|
|
40
|
-
*/
|
|
41
|
-
readonly _getAppIcon: () => Promise<string>;
|
|
42
|
-
/**
|
|
43
|
-
* Ask back handling
|
|
44
|
-
* @returns {Promise<boolean>}
|
|
45
|
-
*/
|
|
46
|
-
readonly _askBackHistory: () => Promise<boolean>;
|
|
47
|
-
/**
|
|
48
|
-
* Asks for mandatory app.config properties
|
|
49
|
-
* @returns {Promise<Object>}
|
|
50
|
-
*/
|
|
51
|
-
readonly getAppConfigProperties: () => Promise<WebosDevice>;
|
|
52
24
|
readonly getConfig: () => Promise<WebosConf>;
|
|
53
25
|
readonly setConfig: ({ directory, config }: {
|
|
54
26
|
directory: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AwsCredentials, DanaToken } from "./helper/CredentialsHelper.js";
|
|
1
|
+
import { AwsCredentials, CodeArtifactToken, DanaToken } from "./helper/CredentialsHelper.js";
|
|
2
2
|
import { JwtPayload } from "jsonwebtoken";
|
|
3
3
|
export interface CognitoIdToken extends JwtPayload {
|
|
4
4
|
given_name: string;
|
|
@@ -8,6 +8,7 @@ export interface CognitoIdToken extends JwtPayload {
|
|
|
8
8
|
export interface AuthCredentials {
|
|
9
9
|
aws: AwsCredentials;
|
|
10
10
|
dana: DanaToken;
|
|
11
|
+
codeArtifact?: CodeArtifactToken;
|
|
11
12
|
org: string;
|
|
12
13
|
isRemote: boolean;
|
|
13
14
|
port?: number;
|
|
@@ -16,7 +17,7 @@ export declare class AuthenticationManager {
|
|
|
16
17
|
private static getAPIURL;
|
|
17
18
|
static login(organization: string, isRemote: boolean, userPort?: number): Promise<AuthCredentials>;
|
|
18
19
|
static logout(organization: string, creds?: Partial<DanaToken>, isRemote?: boolean): Promise<void>;
|
|
19
|
-
static refresh(organization: string, token: string, isRemote: boolean, port?: number): Promise<{
|
|
20
|
+
static refresh(organization: string, token: string, isRemote: boolean, port?: number): Promise<AuthCredentials | {
|
|
20
21
|
aws: AwsCredentials;
|
|
21
22
|
dana: {
|
|
22
23
|
refresh_token: string;
|
|
@@ -26,14 +27,12 @@ export declare class AuthenticationManager {
|
|
|
26
27
|
token_type: string;
|
|
27
28
|
};
|
|
28
29
|
org: string;
|
|
30
|
+
isRemote: boolean;
|
|
31
|
+
port: number | undefined;
|
|
29
32
|
}>;
|
|
30
33
|
static isTokenExpired(token: string): boolean;
|
|
31
|
-
static
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
static loginGradle(organization: string, credentials: AwsCredentials): Promise<{
|
|
36
|
-
token: string;
|
|
37
|
-
expiration?: Date;
|
|
38
|
-
}>;
|
|
34
|
+
static loginCodeArtifact(organization: string, credentials: AwsCredentials): Promise<CodeArtifactToken>;
|
|
35
|
+
static loginNPM(organization: string, credentials: AwsCredentials, token: CodeArtifactToken): Promise<void>;
|
|
36
|
+
static loginGradle(organization: string, token: CodeArtifactToken): void;
|
|
37
|
+
static loginSPM(organization: string, credentials: AwsCredentials, token: CodeArtifactToken): Promise<void>;
|
|
39
38
|
}
|
|
@@ -4,7 +4,7 @@ interface GetRepositoryEndpointOptions {
|
|
|
4
4
|
organization: string;
|
|
5
5
|
credentials?: AwsCredentials;
|
|
6
6
|
client?: CodeartifactClient;
|
|
7
|
-
format: "npm" | "maven";
|
|
7
|
+
format: "npm" | "maven" | "swift";
|
|
8
8
|
}
|
|
9
9
|
export declare const getRepositoryEndpoint: ({ organization, credentials, client, format, }: GetRepositoryEndpointOptions) => Promise<string>;
|
|
10
10
|
export declare const createCodeArtifactClient: (credentials: AwsCredentials) => CodeartifactClient;
|
|
@@ -12,9 +12,14 @@ export interface DanaToken {
|
|
|
12
12
|
expires_in: number;
|
|
13
13
|
token_type: string;
|
|
14
14
|
}
|
|
15
|
+
export interface CodeArtifactToken {
|
|
16
|
+
token: string;
|
|
17
|
+
expiration: Date;
|
|
18
|
+
}
|
|
15
19
|
export interface OrgCredentials {
|
|
16
20
|
aws: AwsCredentials;
|
|
17
21
|
dana: DanaToken;
|
|
22
|
+
codeArtifact?: CodeArtifactToken;
|
|
18
23
|
}
|
|
19
24
|
export interface DanaConfig {
|
|
20
25
|
lastUsedOrg: string;
|
|
@@ -36,9 +41,11 @@ export declare class CredentialsHelper {
|
|
|
36
41
|
static get(org?: string): {
|
|
37
42
|
aws?: AwsCredentials;
|
|
38
43
|
dana?: DanaToken;
|
|
44
|
+
npm?: CodeArtifactToken;
|
|
39
45
|
org: string;
|
|
40
46
|
isRemote: boolean;
|
|
41
47
|
port?: number;
|
|
42
48
|
};
|
|
43
49
|
static delete(org: string): void;
|
|
50
|
+
static updateCodeArtifactToken(org: string, token: CodeArtifactToken): void;
|
|
44
51
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface RegistriesJSON {
|
|
2
|
+
authentication: Record<string, {
|
|
3
|
+
loginAPIPath: string;
|
|
4
|
+
type: string;
|
|
5
|
+
}>;
|
|
6
|
+
registries: Record<string, {
|
|
7
|
+
supportsAvailability: boolean;
|
|
8
|
+
url: string;
|
|
9
|
+
}>;
|
|
10
|
+
version: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @return {string} Path of the SPM registries.json config file
|
|
14
|
+
*/
|
|
15
|
+
export declare function ensureSPMDirectoriesExists(): string;
|
|
16
|
+
export declare function updateSPMRegistries(filePath: string, registry: string, url: string): void;
|
|
17
|
+
export declare function updateSPMToken(url: string, token: string): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { AppType } from "./const/templateConst.js";
|
|
2
|
+
export interface ProgramOptions {
|
|
2
3
|
devices: boolean;
|
|
3
|
-
|
|
4
|
+
type: AppType;
|
|
4
5
|
}
|
|
5
|
-
declare const createApp: (projectName: string,
|
|
6
|
+
declare const createApp: (projectName: string, options?: ProgramOptions) => Promise<void>;
|
|
6
7
|
export default createApp;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as prompts from "@clack/prompts";
|
|
2
|
-
import { Task, SelectionArray, Data } from "
|
|
2
|
+
import { Task, SelectionArray, Data } from "@/common/types/helperTypes.js";
|
|
3
3
|
export type Spinner = ReturnType<typeof prompts.spinner>;
|
|
4
4
|
declare const CreateAppHelper: {
|
|
5
5
|
new (): {};
|
|
@@ -17,6 +17,12 @@ declare const CreateAppHelper: {
|
|
|
17
17
|
getConfig(..._: string[]): Promise<unknown>;
|
|
18
18
|
setConfig(..._: unknown[]): Promise<string>;
|
|
19
19
|
updateProfileJsonWithRenderers(jsonData: Record<string, unknown>, renderers: string[]): object;
|
|
20
|
+
} | {
|
|
21
|
+
new (): {};
|
|
22
|
+
readonly getConfig: () => Promise<import("../../addDevice/deviceConfig/configTypes.js").VidaaConf>;
|
|
23
|
+
readonly setConfig: () => Promise<string>;
|
|
24
|
+
readonly appConfig: {};
|
|
25
|
+
updateProfileJsonWithRenderers(jsonData: Record<string, unknown>, renderers: string[]): object;
|
|
20
26
|
} | {
|
|
21
27
|
new (): {};
|
|
22
28
|
readonly appConfig: {
|
|
@@ -39,12 +45,6 @@ declare const CreateAppHelper: {
|
|
|
39
45
|
};
|
|
40
46
|
};
|
|
41
47
|
};
|
|
42
|
-
readonly _askAppId: () => Promise<string>;
|
|
43
|
-
readonly _askVendorName: () => Promise<string>;
|
|
44
|
-
readonly _askAppTitle: () => Promise<string>;
|
|
45
|
-
readonly _getAppIcon: () => Promise<string>;
|
|
46
|
-
readonly _askBackHistory: () => Promise<boolean>;
|
|
47
|
-
readonly getAppConfigProperties: () => Promise<import("../../addDevice/deviceConfig/configTypes.js").WebosDevice>;
|
|
48
48
|
readonly getConfig: () => Promise<import("../../addDevice/deviceConfig/configTypes.js").WebosConf>;
|
|
49
49
|
readonly setConfig: ({ directory, config }: {
|
|
50
50
|
directory: string;
|
|
@@ -103,12 +103,6 @@ declare const CreateAppHelper: {
|
|
|
103
103
|
readonly updateProfileJson: (directory: string, config: import("../../addDevice/deviceConfig/configTypes.js").AndroidConfig) => Promise<string>;
|
|
104
104
|
readonly appConfig: {};
|
|
105
105
|
updateProfileJsonWithRenderers(jsonData: Record<string, unknown>, renderers: string[]): object;
|
|
106
|
-
} | {
|
|
107
|
-
new (): {};
|
|
108
|
-
readonly getConfig: () => Promise<import("../../addDevice/deviceConfig/configTypes.js").VidaaConf>;
|
|
109
|
-
readonly setConfig: () => Promise<string>;
|
|
110
|
-
readonly appConfig: {};
|
|
111
|
-
updateProfileJsonWithRenderers(jsonData: Record<string, unknown>, renderers: string[]): object;
|
|
112
106
|
};
|
|
113
107
|
readonly promptUnavailableDevices: (unavailableDevices: string[]) => void;
|
|
114
108
|
readonly promptSelectDevices: (devices: SelectionArray, required?: boolean) => Promise<string[]>;
|
|
@@ -120,5 +114,8 @@ declare const CreateAppHelper: {
|
|
|
120
114
|
* Prompt all script commands to launch subscribed devices
|
|
121
115
|
*/
|
|
122
116
|
readonly printNpmCommandForUser: (data: Data) => void;
|
|
117
|
+
readonly setFirstRoute: ({ directory }: {
|
|
118
|
+
directory: string;
|
|
119
|
+
}) => Promise<string>;
|
|
123
120
|
};
|
|
124
121
|
export default CreateAppHelper;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const APP_CREATION_ERROR = 1;
|
|
2
|
+
export declare const TEMPLATE_OPTION_ERROR = 2;
|
|
2
3
|
export declare const COMPONENT_ERROR = 3;
|
|
3
4
|
export declare const CANCEL = 4;
|
|
4
5
|
export declare const DEVICE_ERROR = 5;
|
|
@@ -6,3 +7,6 @@ export declare const LOGIN_ERROR = 6;
|
|
|
6
7
|
export declare const COMMAND_ERROR = 7;
|
|
7
8
|
export declare const SETUP_ERROR = 8;
|
|
8
9
|
export declare const GET_PACKAGES_TOKEN_ERROR = 9;
|
|
10
|
+
export declare const DANA_PROJECT_HOOK_ERROR = 10;
|
|
11
|
+
export declare const GENERATE_ARCHIVE_ERROR = 11;
|
|
12
|
+
export declare const MODULE_ERROR = 12;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generateArchive(): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Config } from "
|
|
1
|
+
import { Config } from "@/common/types/helperTypes.js";
|
|
2
2
|
declare class CreateFileHelper {
|
|
3
3
|
/**
|
|
4
4
|
* Copy the template
|
|
@@ -12,6 +12,12 @@ declare class CreateFileHelper {
|
|
|
12
12
|
static readonly copyForTutorial: ({ directory }: {
|
|
13
13
|
directory: string;
|
|
14
14
|
}) => Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Copy made for templated app
|
|
17
|
+
*/
|
|
18
|
+
static readonly copyForTemplatedApp: ({ directory }: {
|
|
19
|
+
directory: string;
|
|
20
|
+
}, availableModules: string[], templateDir: string) => Promise<string>;
|
|
15
21
|
/**
|
|
16
22
|
* Copy app.config files for selected devices
|
|
17
23
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const validInputLength: (
|
|
1
|
+
export declare const validInputLength: (errorMessage: string, value?: string) => string;
|
|
2
2
|
export declare const validAppVersion: (value: string) => string;
|
|
3
3
|
export declare const validAppVersionCode: (value: string | number) => string;
|
|
4
4
|
export declare const validAppId: (value: string) => string;
|