@budibase/cli 3.35.1 → 3.35.2

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -4423,7 +4423,7 @@ ${t}
4423
4423
  </style>
4424
4424
  `,a=!1,c,u,l=[];if(i){let h=`${t}.pre-svelte5`;as.default.writeFileSync(h,e),as.default.writeFileSync(t,o),a=!0,c=e,u=o,l.push(`Updated ${t} to use <svelte:boundary>, $$restProps, and error UI.`)}else l.push(`${t} already looks Svelte 5 compatible (uses <svelte:boundary> with no legacy Boundary.js wrapper).`);let d=wf.default.join(wf.default.dirname(t),"Boundary.js");if(as.default.existsSync(d))try{as.default.unlinkSync(d),a=!0,l.push("Removed legacy lib/Boundary.js (incompatible with Svelte 5).")}catch(h){console.log("Failed to delete legacy Boundary.js:",h instanceof Error?h.message:h)}return{changed:a,before:c,after:u,message:l.join(" ")}}s(PVa,"migrateWrapper");function kVa(){let t=wf.default.join(process.cwd(),"package.json");if(!as.default.existsSync(t))return{changed:!1,message:"package.json not found"};let e=as.default.readFileSync(t,"utf8"),r;try{r=JSON.parse(e)}catch(d){return{changed:!1,message:`Invalid package.json: ${d?.message||"parse error"}`}}let n=JSON.stringify(r,null,2),i=typeof r.version=="string"?r.version.trim():void 0,o=F6n(i);r.dependencies||(r.dependencies={}),r.dependencies.svelte="^5.0.0",r.peerDependencies={...r.peerDependencies||{},svelte:"^5.0.0"};let a=r.devDependencies||{};a.rollup="^4.21.0",a["@rollup/plugin-commonjs"]="^25.0.7",a["@rollup/plugin-node-resolve"]="^15.2.3",a["rollup-plugin-svelte"]="^7.2.3",a["@budibase/backend-core"]&&(a["@budibase/backend-core"]="^2.8.0"),a["npm-run-all"]&&delete a["npm-run-all"],r.devDependencies=a,r.dependencies?.["@crownframework/svelte-error-boundary"]&&delete r.dependencies["@crownframework/svelte-error-boundary"],r.scripts||(r.scripts={}),r.scripts.build="rollup -c rollup.config.mjs",r.scripts.watch="rollup -cw rollup.config.mjs",o&&(r.version=o);let c=JSON.stringify(r,null,2);if(n===c)return{changed:!1,message:"package.json already appears Svelte 5 ready. Skipping."};as.default.writeFileSync(`${t}.pre-svelte5`,e),as.default.writeFileSync(t,`${c}
4425
4425
  `);let u=i&&o?` (version ${i} -> ${o})`:"",l=o?`Updated package.json for Svelte 5, Rollup 4, scripts, and version bump${u}.`:"Updated package.json for Svelte 5, Rollup 4, and scripts.";return{changed:!0,before:n,after:c,message:l}}s(kVa,"migratePackageJson");function j6n(){let t=wf.default.join(process.cwd(),".github","workflows");return as.default.existsSync(t)?as.default.readdirSync(t).filter(r=>r.endsWith(".yml")||r.endsWith(".yaml")).map(r=>wf.default.join(".github","workflows",r)):[]}s(j6n,"findWorkflowFiles");function LVa(){let t=j6n();if(t.length===0)return{changed:!1,message:"No GitHub workflow files found in .github/workflows/ - skipping node version migration."};let e=[],r=!1;for(let n of t){let i=wf.default.join(process.cwd(),n),o=as.default.readFileSync(i,"utf8");if(!/node-version:\s*['"]?16['"]?/g.test(o))continue;let c=o.replace(/node-version:\s*['"]?16['"]?/g,"node-version: 18");if(c!==o){let u=`${i}.pre-svelte5`;as.default.writeFileSync(u,o),as.default.writeFileSync(i,c),r=!0,e.push(`Updated ${n}: node-version 16 -> 18`)}}return r?{changed:!0,message:e.join("; ")}:{changed:!1,message:"No workflow files with node-version: 16 found - skipping node version migration."}}s(LVa,"migrateNodeVersion");function MVa(){let t=wf.default.join(process.cwd(),"schema.json");if(!as.default.existsSync(t))return{changed:!1,message:"schema.json not found - skipping schema metadata migration."};let e=as.default.readFileSync(t,"utf8"),r;try{r=JSON.parse(e)}catch(u){return{changed:!1,message:`Invalid schema.json: ${u?.message||"parse error"}`}}let n=r&&typeof r.metadata=="object"&&!Array.isArray(r.metadata)?r.metadata:{};if(!(n?.svelteMajor!==5))return{changed:!1,message:"schema.json metadata already includes svelteMajor: 5. Skipping."};let o=JSON.stringify(r,null,2),a={...n,svelteMajor:5};r.metadata=a;let c=JSON.stringify(r,null,2);return as.default.writeFileSync(`${t}.pre-svelte5`,e),as.default.writeFileSync(t,`${c}
4426
- `),{changed:!0,before:o,after:c,message:"Updated schema.json metadata to include svelteMajor: 5."}}s(MVa,"migrateSchemaJson");async function H6n(){let t=[],e=as.default.readFileSync("package.json","utf8"),r=JSON.parse(e),n=r?.dependencies?.svelte?.startsWith("^5")||r?.peerDependencies?.svelte?.startsWith("^5"),i=typeof r?.version=="string"?r.version.trim():void 0,o=F6n(i);n?t.push("package.json appears to already depend on Svelte 5."):t.push("Will bump svelte to ^5.0.0 and align dev/peer dependencies."),r?.dependencies?.["@crownframework/svelte-error-boundary"]&&t.push("Detected @crownframework/svelte-error-boundary; migration will replace it with <svelte:boundary> in lib/Wrapper.svelte."),o&&i&&o!==i&&t.push(`Will bump package.json version from ${i} to ${o}.`);let a=Q6n(),c="unknown";if(a){let E=as.default.readFileSync(a,"utf8");q6n(E)?(c="looks-new",t.push(`Rollup config ${a} already looks Svelte 5-ready.`)):(c="needs-migration",t.push("Will write Rollup 4 / Svelte 5 config and rename to rollup.config.mjs."))}else c="unknown",t.push("No rollup config found - will create rollup.config.mjs.");let u=V6n(),l="not-found";u?as.default.readFileSync(u,"utf8").includes("<svelte:boundary>")?(l="looks-new",t.push(`${u} already uses <svelte:boundary>.`)):(l="needs-migration",t.push(`Will update ${u} to use <svelte:boundary>, $$restProps, and error UI.`)):t.push("No wrapper.svelte found - skipping wrapper migration.");let d="unknown";if(as.default.existsSync("schema.json"))try{let E=as.default.readFileSync("schema.json","utf8"),y=JSON.parse(E);(y&&typeof y.metadata=="object"&&!Array.isArray(y.metadata)?y.metadata:{}).svelteMajor===5?(d="looks-new",t.push("schema.json metadata already declares svelteMajor: 5.")):(d="needs-migration",t.push("Will update schema.json metadata to set svelteMajor: 5."))}catch(E){d="unknown",t.push(`schema.json could not be parsed - please fix JSON before migration (${E?.message||"parse error"}).`)}else d="not-found",t.push("schema.json not found - cannot update metadata.");let h=n?"looks-new":"needs-migration",m="not-found",g=j6n();if(g.length>0){let E=!1,y=!1;for(let b of g){let C=wf.default.join(process.cwd(),b),x=as.default.readFileSync(C,"utf8");/node-version:\s*['"]?16['"]?/.test(x)&&(E=!0),/node-version:\s*['"]?(18|20|22)['"]?/.test(x)&&(y=!0)}E?(m="needs-migration",t.push("Will update GitHub workflow files: node-version 16 -> 18.")):y?(m="looks-new",t.push("GitHub workflow files already use node-version 18 or higher.")):(m="looks-new",t.push("GitHub workflow files found but no node-version: 16 detected."))}else t.push("No GitHub workflow files found in .github/workflows/ - skipping node version check.");return{report:t,rollup:c,packageJson:h,wrapper:l,schema:d,nodeVersion:m,canBuildAfter:!0,rollupFile:a,wrapperFile:u,pkg:r}}s(H6n,"analysePluginForSvelte5");async function Y6n(){let t=await BVa();if(t.message.includes("Failed to retrieve canonical rollup.config.mjs from skeleton"))return{pkgRes:{changed:!1,message:"Skipped package.json migration due to Rollup template failure."},schemaRes:{changed:!1,message:"Skipped schema.json migration due to Rollup template failure."},rollupRes:t,wrapperRes:{changed:!1,message:"Skipped wrapper migration due to Rollup template failure."},nodeVersionRes:{changed:!1,message:"Skipped node version migration due to Rollup template failure."}};let e=PVa(),r=MVa(),n=kVa(),i=LVa();return{pkgRes:n,schemaRes:r,rollupRes:t,wrapperRes:e,nodeVersionRes:i}}s(Y6n,"runSvelte5Migration");var W6n=require("child_process");var UVa=require("find-free-port");function FVa(t){let e=[],r=[];for(let n of new Set(t.filter(Boolean)))if(NN.default.existsSync(n))try{NN.default.unlinkSync(n),e.push(n)}catch(i){r.push({path:n,error:i instanceof Error?i.message:String(i)})}return{deleted:e,failed:r}}s(FVa,"cleanupPreSvelte5Backups");function z6n(){if(!NN.default.existsSync("package.json"))throw new Error("Please run in a plugin directory - must contain package.json");if(!NN.default.existsSync("schema.json"))throw new Error("Please run in a plugin directory - must contain schema.json")}s(z6n,"checkInPlugin");async function QVa(t){return NN.default.readdirSync(process.cwd()).find(r=>r===".git")?!1:(console.log(Si(`By default the plugin will be created in the directory "${t}"`)),console.log(Si("if you are already in an empty directory, such as a new Git repo, you can disable this functionality.")),m0("Create top level directory?"))}s(QVa,"askAboutTopLevel");async function qVa(t){let e=t.init||t;if(!e||!qOt.includes(e)){console.log(ha("Please provide a type to init, either 'component', 'datasource' or 'automation'."));return}console.log(Si("Lets get some details about your new plugin:"));let r=await zB("Name",`budibase-${e}`);if(NN.default.existsSync(r)){console.log(ha("Directory by plugin name already exists, pick a new name."));return}let n=await zB("Description",`An amazing Budibase ${e}!`),i=await zB("Version","1.0.0"),o=await QVa(r);console.log(Si("Retrieving project...")),await Xxe(e,r),await k6n(e,r,n,i),console.log(Si("Installing dependencies...")),await J8("install",(0,Zxe.join)(process.cwd(),r)),o?console.log(Si(`Plugin created in directory "${r}"`)):(rBe(r,process.cwd()),console.log(Si("Plugin created in current directory."))),Pne(hR.PluginInit,{type:e,name:r,description:n,version:i})}s(qVa,"init");async function RRt(){z6n(),console.log(Si("Verifying plugin..."));let t=NN.default.readFileSync("schema.json","utf8"),e=NN.default.readFileSync("package.json","utf8"),r,n;try{let i=JSON.parse(t),o=JSON.parse(e);if(!o.name||!o.version||!o.description)throw new Error("package.json is missing one of 'name', 'version' or 'description'.");return r=o.name,n=o.version,a0e.validate(i),{name:r,version:n}}catch(i){i&&i.message&&i.message.includes("not valid JSON")?console.log(ha(`schema.json is not valid JSON: ${i.message}`)):console.log(ha(`Invalid schema/package.json: ${i.message}`))}}s(RRt,"verify");async function GVa(){let t=await RRt();if(!t?.name)return;console.log(Ga("Verified!")),console.log(Si("Building plugin...")),await J8("build");let e=(0,Zxe.join)("dist",`${t.name}-${t.version}.tar.gz`);console.log(Ga(`Build complete - output in: ${e}`))}s(GVa,"build");async function VVa(){let t=await RRt();if(!t?.name)return;let e=(0,Zxe.join)("dist",`${t.name}-${t.version}.tar.gz`);console.log(Si(`Watching - build in: ${e}`));try{await J8("watch")}catch{console.log(Ga("Watch exited."))}}s(VVa,"watch");async function jVa(){let t=await zB("Directory to watch","./"),[e]=await UVa(1e4),r="admin";await Fne({init:"quick",single:!0,watchPluginDir:t,genUser:r,port:e,silent:!0}),await l2(),console.log(Ga("Configuration has been written to docker-compose.yaml")),console.log(Ga("Development environment started successfully - connect at: ")+Si(`http://localhost:${e}`)),console.log(Ga("Use the following credentials to login:")),console.log(Ga("Email: ")+Si(_Be)),console.log(Ga("Password: ")+Si(r))}s(jVa,"dev");async function HVa(t){z6n();let e=!!t?.yes,r=!!t?.force,n=!1;try{n=!!(0,W6n.execSync)("git status --porcelain",{encoding:"utf8"}).trim()}catch{}if(n&&!r&&(console.log(Si("Your git working directory is not clean. Commit or stash changes, or re-run with --force.")),!await m0("Proceed with migration anyway?"))){console.log(Si("Migration aborted."));return}console.log(Si("Analyzing plugin for Svelte 5 migration..."));let i=await H6n();console.log(Si("Proposed changes:"));for(let u of i.report)console.log(Si(" - "+u));let o=["package.json.pre-svelte5","schema.json.pre-svelte5",i.rollupFile?`${i.rollupFile}.pre-svelte5`:void 0,i.wrapperFile?`${i.wrapperFile}.pre-svelte5`:void 0];if(!e&&!await m0("Apply these changes now?")){console.log(Si("Migration aborted by user."));return}console.log(Si("Applying migrations..."));let a=await Y6n();if(a.rollupRes?.message?.includes("Failed to retrieve canonical rollup.config.mjs from skeleton")){console.log(ha(a.rollupRes.message));return}if(a.pkgRes?.message&&console.log(Si(a.pkgRes.message)),a.schemaRes?.message&&console.log(Si(a.schemaRes.message)),a.rollupRes?.message&&console.log(Si(a.rollupRes.message)),a.wrapperRes?.message&&console.log(Si(a.wrapperRes.message)),console.log(Si("Installing updated dependencies...")),await J8("install"),console.log(Si("Re-verifying plugin...")),!(await RRt())?.name){console.log(ha("Verification failed after migration."));return}console.log(Si("Attempting build..."));try{await J8("build");let u=FVa(o.filter(l=>!!l));console.log(Ga("Migration completed. Your plugin was migrated to Svelte 5 and built successfully.")),u.deleted.length&&console.log(Si(`Removed ${u.deleted.length} pre-svelte5 backup file(s): ${u.deleted.join(", ")}`)),u.failed.length&&console.log(Si(`Failed to remove ${u.failed.length} pre-svelte5 backup file(s): ${u.failed.map(l=>`${l.path} (${l.error})`).join(", ")}`))}catch(u){console.log(ha(`Build failed after migration. Please review the errors above. ${u?.message||""}`))}}s(HVa,"migrateSvelte5");var K6n=new p0("plugins").addHelp("Custom plugins for Budibase, init, build and verify your components and datasources with this tool.").addSubOption("--init [type]","Init a new plugin project, with a type of either component or datasource.",qVa).addSubOption("--build","Build your plugin, this will verify and produce a final tarball for your project.",GVa).addSubOption("--watch","Automatically build any changes to your plugin.",VVa).addSubOption("--dev","Run a development environment which automatically watches the current directory.",jVa).addSubOption("--migrate-svelte5","Migrate this plugin to the Svelte 5-compatible Budibase plugin format.",HVa,[{command:"--yes",help:"Skip confirmation prompts during migration."},{command:"--force",help:"Proceed even if the git working directory is not clean (creates .pre-svelte5 backups during migration, removed on success)."}]);function $6n(){return[oBt,BDt,fjn,K6n]}s($6n,"getCommands");var X6n=require("commander");Od();var J6n="3.35.1";async function WVa(){let t=new X6n.Command().addHelpCommand("help",pW("Help with Budibase commands.")).helpOption(!1).version(J6n);for(let e of $6n())e.configure(t);await t.parseAsync(process.argv)}s(WVa,"init");var zVa=["exit","SIGINT","SIGUSR1","SIGUSR2","uncaughtException"];zVa.forEach(t=>{process.on(t,e=>{e&&!isNaN(e)||e&&(console.error(ha("Failed to run CLI command - please report with the following message:")),console.error(ha(e)))})});WVa().catch(t=>{console.error("Unexpected error - ",t)});
4426
+ `),{changed:!0,before:o,after:c,message:"Updated schema.json metadata to include svelteMajor: 5."}}s(MVa,"migrateSchemaJson");async function H6n(){let t=[],e=as.default.readFileSync("package.json","utf8"),r=JSON.parse(e),n=r?.dependencies?.svelte?.startsWith("^5")||r?.peerDependencies?.svelte?.startsWith("^5"),i=typeof r?.version=="string"?r.version.trim():void 0,o=F6n(i);n?t.push("package.json appears to already depend on Svelte 5."):t.push("Will bump svelte to ^5.0.0 and align dev/peer dependencies."),r?.dependencies?.["@crownframework/svelte-error-boundary"]&&t.push("Detected @crownframework/svelte-error-boundary; migration will replace it with <svelte:boundary> in lib/Wrapper.svelte."),o&&i&&o!==i&&t.push(`Will bump package.json version from ${i} to ${o}.`);let a=Q6n(),c="unknown";if(a){let E=as.default.readFileSync(a,"utf8");q6n(E)?(c="looks-new",t.push(`Rollup config ${a} already looks Svelte 5-ready.`)):(c="needs-migration",t.push("Will write Rollup 4 / Svelte 5 config and rename to rollup.config.mjs."))}else c="unknown",t.push("No rollup config found - will create rollup.config.mjs.");let u=V6n(),l="not-found";u?as.default.readFileSync(u,"utf8").includes("<svelte:boundary>")?(l="looks-new",t.push(`${u} already uses <svelte:boundary>.`)):(l="needs-migration",t.push(`Will update ${u} to use <svelte:boundary>, $$restProps, and error UI.`)):t.push("No wrapper.svelte found - skipping wrapper migration.");let d="unknown";if(as.default.existsSync("schema.json"))try{let E=as.default.readFileSync("schema.json","utf8"),y=JSON.parse(E);(y&&typeof y.metadata=="object"&&!Array.isArray(y.metadata)?y.metadata:{}).svelteMajor===5?(d="looks-new",t.push("schema.json metadata already declares svelteMajor: 5.")):(d="needs-migration",t.push("Will update schema.json metadata to set svelteMajor: 5."))}catch(E){d="unknown",t.push(`schema.json could not be parsed - please fix JSON before migration (${E?.message||"parse error"}).`)}else d="not-found",t.push("schema.json not found - cannot update metadata.");let h=n?"looks-new":"needs-migration",m="not-found",g=j6n();if(g.length>0){let E=!1,y=!1;for(let b of g){let C=wf.default.join(process.cwd(),b),x=as.default.readFileSync(C,"utf8");/node-version:\s*['"]?16['"]?/.test(x)&&(E=!0),/node-version:\s*['"]?(18|20|22)['"]?/.test(x)&&(y=!0)}E?(m="needs-migration",t.push("Will update GitHub workflow files: node-version 16 -> 18.")):y?(m="looks-new",t.push("GitHub workflow files already use node-version 18 or higher.")):(m="looks-new",t.push("GitHub workflow files found but no node-version: 16 detected."))}else t.push("No GitHub workflow files found in .github/workflows/ - skipping node version check.");return{report:t,rollup:c,packageJson:h,wrapper:l,schema:d,nodeVersion:m,canBuildAfter:!0,rollupFile:a,wrapperFile:u,pkg:r}}s(H6n,"analysePluginForSvelte5");async function Y6n(){let t=await BVa();if(t.message.includes("Failed to retrieve canonical rollup.config.mjs from skeleton"))return{pkgRes:{changed:!1,message:"Skipped package.json migration due to Rollup template failure."},schemaRes:{changed:!1,message:"Skipped schema.json migration due to Rollup template failure."},rollupRes:t,wrapperRes:{changed:!1,message:"Skipped wrapper migration due to Rollup template failure."},nodeVersionRes:{changed:!1,message:"Skipped node version migration due to Rollup template failure."}};let e=PVa(),r=MVa(),n=kVa(),i=LVa();return{pkgRes:n,schemaRes:r,rollupRes:t,wrapperRes:e,nodeVersionRes:i}}s(Y6n,"runSvelte5Migration");var W6n=require("child_process");var UVa=require("find-free-port");function FVa(t){let e=[],r=[];for(let n of new Set(t.filter(Boolean)))if(NN.default.existsSync(n))try{NN.default.unlinkSync(n),e.push(n)}catch(i){r.push({path:n,error:i instanceof Error?i.message:String(i)})}return{deleted:e,failed:r}}s(FVa,"cleanupPreSvelte5Backups");function z6n(){if(!NN.default.existsSync("package.json"))throw new Error("Please run in a plugin directory - must contain package.json");if(!NN.default.existsSync("schema.json"))throw new Error("Please run in a plugin directory - must contain schema.json")}s(z6n,"checkInPlugin");async function QVa(t){return NN.default.readdirSync(process.cwd()).find(r=>r===".git")?!1:(console.log(Si(`By default the plugin will be created in the directory "${t}"`)),console.log(Si("if you are already in an empty directory, such as a new Git repo, you can disable this functionality.")),m0("Create top level directory?"))}s(QVa,"askAboutTopLevel");async function qVa(t){let e=t.init||t;if(!e||!qOt.includes(e)){console.log(ha("Please provide a type to init, either 'component', 'datasource' or 'automation'."));return}console.log(Si("Lets get some details about your new plugin:"));let r=await zB("Name",`budibase-${e}`);if(NN.default.existsSync(r)){console.log(ha("Directory by plugin name already exists, pick a new name."));return}let n=await zB("Description",`An amazing Budibase ${e}!`),i=await zB("Version","1.0.0"),o=await QVa(r);console.log(Si("Retrieving project...")),await Xxe(e,r),await k6n(e,r,n,i),console.log(Si("Installing dependencies...")),await J8("install",(0,Zxe.join)(process.cwd(),r)),o?console.log(Si(`Plugin created in directory "${r}"`)):(rBe(r,process.cwd()),console.log(Si("Plugin created in current directory."))),Pne(hR.PluginInit,{type:e,name:r,description:n,version:i})}s(qVa,"init");async function RRt(){z6n(),console.log(Si("Verifying plugin..."));let t=NN.default.readFileSync("schema.json","utf8"),e=NN.default.readFileSync("package.json","utf8"),r,n;try{let i=JSON.parse(t),o=JSON.parse(e);if(!o.name||!o.version||!o.description)throw new Error("package.json is missing one of 'name', 'version' or 'description'.");return r=o.name,n=o.version,a0e.validate(i),{name:r,version:n}}catch(i){i&&i.message&&i.message.includes("not valid JSON")?console.log(ha(`schema.json is not valid JSON: ${i.message}`)):console.log(ha(`Invalid schema/package.json: ${i.message}`))}}s(RRt,"verify");async function GVa(){let t=await RRt();if(!t?.name)return;console.log(Ga("Verified!")),console.log(Si("Building plugin...")),await J8("build");let e=(0,Zxe.join)("dist",`${t.name}-${t.version}.tar.gz`);console.log(Ga(`Build complete - output in: ${e}`))}s(GVa,"build");async function VVa(){let t=await RRt();if(!t?.name)return;let e=(0,Zxe.join)("dist",`${t.name}-${t.version}.tar.gz`);console.log(Si(`Watching - build in: ${e}`));try{await J8("watch")}catch{console.log(Ga("Watch exited."))}}s(VVa,"watch");async function jVa(){let t=await zB("Directory to watch","./"),[e]=await UVa(1e4),r="admin";await Fne({init:"quick",single:!0,watchPluginDir:t,genUser:r,port:e,silent:!0}),await l2(),console.log(Ga("Configuration has been written to docker-compose.yaml")),console.log(Ga("Development environment started successfully - connect at: ")+Si(`http://localhost:${e}`)),console.log(Ga("Use the following credentials to login:")),console.log(Ga("Email: ")+Si(_Be)),console.log(Ga("Password: ")+Si(r))}s(jVa,"dev");async function HVa(t){z6n();let e=!!t?.yes,r=!!t?.force,n=!1;try{n=!!(0,W6n.execSync)("git status --porcelain",{encoding:"utf8"}).trim()}catch{}if(n&&!r&&(console.log(Si("Your git working directory is not clean. Commit or stash changes, or re-run with --force.")),!await m0("Proceed with migration anyway?"))){console.log(Si("Migration aborted."));return}console.log(Si("Analyzing plugin for Svelte 5 migration..."));let i=await H6n();console.log(Si("Proposed changes:"));for(let u of i.report)console.log(Si(" - "+u));let o=["package.json.pre-svelte5","schema.json.pre-svelte5",i.rollupFile?`${i.rollupFile}.pre-svelte5`:void 0,i.wrapperFile?`${i.wrapperFile}.pre-svelte5`:void 0];if(!e&&!await m0("Apply these changes now?")){console.log(Si("Migration aborted by user."));return}console.log(Si("Applying migrations..."));let a=await Y6n();if(a.rollupRes?.message?.includes("Failed to retrieve canonical rollup.config.mjs from skeleton")){console.log(ha(a.rollupRes.message));return}if(a.pkgRes?.message&&console.log(Si(a.pkgRes.message)),a.schemaRes?.message&&console.log(Si(a.schemaRes.message)),a.rollupRes?.message&&console.log(Si(a.rollupRes.message)),a.wrapperRes?.message&&console.log(Si(a.wrapperRes.message)),console.log(Si("Installing updated dependencies...")),await J8("install"),console.log(Si("Re-verifying plugin...")),!(await RRt())?.name){console.log(ha("Verification failed after migration."));return}console.log(Si("Attempting build..."));try{await J8("build");let u=FVa(o.filter(l=>!!l));console.log(Ga("Migration completed. Your plugin was migrated to Svelte 5 and built successfully.")),u.deleted.length&&console.log(Si(`Removed ${u.deleted.length} pre-svelte5 backup file(s): ${u.deleted.join(", ")}`)),u.failed.length&&console.log(Si(`Failed to remove ${u.failed.length} pre-svelte5 backup file(s): ${u.failed.map(l=>`${l.path} (${l.error})`).join(", ")}`))}catch(u){console.log(ha(`Build failed after migration. Please review the errors above. ${u?.message||""}`))}}s(HVa,"migrateSvelte5");var K6n=new p0("plugins").addHelp("Custom plugins for Budibase, init, build and verify your components and datasources with this tool.").addSubOption("--init [type]","Init a new plugin project, with a type of either component or datasource.",qVa).addSubOption("--build","Build your plugin, this will verify and produce a final tarball for your project.",GVa).addSubOption("--watch","Automatically build any changes to your plugin.",VVa).addSubOption("--dev","Run a development environment which automatically watches the current directory.",jVa).addSubOption("--migrate-svelte5","Migrate this plugin to the Svelte 5-compatible Budibase plugin format.",HVa,[{command:"--yes",help:"Skip confirmation prompts during migration."},{command:"--force",help:"Proceed even if the git working directory is not clean (creates .pre-svelte5 backups during migration, removed on success)."}]);function $6n(){return[oBt,BDt,fjn,K6n]}s($6n,"getCommands");var X6n=require("commander");Od();var J6n="3.35.2";async function WVa(){let t=new X6n.Command().addHelpCommand("help",pW("Help with Budibase commands.")).helpOption(!1).version(J6n);for(let e of $6n())e.configure(t);await t.parseAsync(process.argv)}s(WVa,"init");var zVa=["exit","SIGINT","SIGUSR1","SIGUSR2","uncaughtException"];zVa.forEach(t=>{process.on(t,e=>{e&&!isNaN(e)||e&&(console.error(ha("Failed to run CLI command - please report with the following message:")),console.error(ha(e)))})});WVa().catch(t=>{console.error("Unexpected error - ",t)});
4427
4427
  /*! Bundled license information:
4428
4428
 
4429
4429
  lodash/lodash.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@budibase/cli",
3
- "version": "3.35.1",
3
+ "version": "3.35.2",
4
4
  "description": "Budibase CLI, for developers, self hosting and migrations.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -41,5 +41,5 @@
41
41
  "@types/pouchdb": "^6.4.0",
42
42
  "ts-node": "10.8.1"
43
43
  },
44
- "gitHead": "456c750d6bbffa0660dbf58bfbfe3ee7b56b2184"
44
+ "gitHead": "703bb93d48608fb224de516a55db3937dfb88257"
45
45
  }