@lunora/cli
Version:
The Lunora CLI: init, dev, deploy, codegen, migrate, seed, doctor, insights, logs, registry, and the rest of the project commands
3 lines (2 loc) • 1.39 kB
JavaScript
import{mkdirSync as l,writeFileSync as g}from"node:fs";import{findWranglerFile as f,readWranglerJsonc as m,buildBindingManifest as c}from"@lunora/config/cloudflare";import{isAbsolute as h,resolve as u,dirname as v}from"@visulima/path";const w=i=>{const n=f(i),r=n===void 0?void 0:m(n).parsed;return r===void 0?{error:`no readable wrangler config in ${i}. The binding manifest is derived from it, and an empty one would tell a deployer this Worker needs nothing.`}:{manifest:c(r)}},y=i=>{const{destination:n,dev:r,logger:t,projectRoot:a,quiet:d=!1}=i,o=w(a);if(o.manifest===void 0)return{error:o.error};const e={...o.manifest,...r===void 0?{}:{dev:r}},s=h(n)?n:u(a,n);return l(v(s),{recursive:!0}),g(s,`${JSON.stringify(e,void 0,2)}
`,"utf8"),e.malformed.length>0&&t.warn(`wrangler config: ${e.malformed.join(", ")} ${e.malformed.length===1?"is":"are"} not the shape wrangler expects, so the binding manifest leaves ${e.malformed.length===1?"it":"them"} out. Wrangler reports the exact error when it loads the config.`),d?{}:(t.success(`binding manifest written to ${s} (${e.bindings.length.toString()} bindings, ${e.crons.length.toString()} crons)`),e.unknown.length>0&&t.warn(`binding manifest does not model these wrangler sections: ${e.unknown.join(", ")}. Anything they bind must be provisioned by hand — please report them so the manifest can cover them.`),{})};export{w as d,y as w};