UNPKG

@lunora/cli

Version:

The Lunora CLI: init, dev, deploy, codegen, migrate, seed, doctor, insights, logs, registry, and the rest of the project commands

2 lines (1 loc) • 1.2 kB
import{resolveDeployDriver as c,resolveProjectTarget as d,toolchainExecArgs as l,detectPackageManager as i}from"@lunora/config";import{defaultSpawner as u}from"./createRecordingSpawner-CYhdPBD5.mjs";const m=async(e,t,o)=>{try{const r=await u({args:t,captureStderr:!0,captureStdoutSilently:!0,command:e,cwd:o});return{code:r.code,stderr:r.stderr??"",stdout:r.stdout??""}}catch(r){return{code:1,stderr:r instanceof Error?r.message:String(r),stdout:""}}},f=e=>{let t;try{t=JSON.parse(e)}catch{return}return Array.isArray(t)?[...t.map(r=>r!==null&&typeof r=="object"?r.name:void 0).filter(r=>typeof r=="string"&&r.length>0)].toSorted((r,a)=>r.localeCompare(a)):void 0},y=async e=>{const t=c(d(e.cwd)),o=t.toolchain?.secretList?.({environment:e.env,temporary:e.temporary});if(o===void 0)return{error:`deploy target "${t.id}" has no secret store to list`,names:[],ok:!1};const{args:r,command:a}=l(i(e.cwd),o),s=await(e.runner??m)(a,r,e.cwd);if(s.code!==0)return{error:s.stderr.trim()||`wrangler secret list exited ${String(s.code)}`,names:[],ok:!1};const n=f(s.stdout);return n===void 0?{error:"could not parse `wrangler secret list --format json` output",names:[],ok:!1}:{names:n,ok:!0}};export{y as l};