@budibase/cli 3.37.2 → 3.37.3

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
@@ -4369,7 +4369,7 @@ ${t}
4369
4369
  </style>
4370
4370
  `,a=!1,u,c,l=[];if(i){let d=`${t}.pre-svelte5`;ws.default.writeFileSync(d,e),ws.default.writeFileSync(t,o),a=!0,u=e,c=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 f=Zd.default.join(Zd.default.dirname(t),"Boundary.js");if(ws.default.existsSync(f))try{ws.default.unlinkSync(f),a=!0,l.push("Removed legacy lib/Boundary.js (incompatible with Svelte 5).")}catch(d){console.log("Failed to delete legacy Boundary.js:",d instanceof Error?d.message:d)}return{changed:a,before:u,after:c,message:l.join(" ")}}s(tMa,"migrateWrapper");function rMa(){let t=Zd.default.join(process.cwd(),"package.json");if(!ws.default.existsSync(t))return{changed:!1,message:"package.json not found"};let e=ws.default.readFileSync(t,"utf8"),r;try{r=JSON.parse(e)}catch(f){return{changed:!1,message:`Invalid package.json: ${f?.message||"parse error"}`}}let n=JSON.stringify(r,null,2),i=typeof r.version=="string"?r.version.trim():void 0,o=V9n(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 u=JSON.stringify(r,null,2);if(n===u)return{changed:!1,message:"package.json already appears Svelte 5 ready. Skipping."};ws.default.writeFileSync(`${t}.pre-svelte5`,e),ws.default.writeFileSync(t,`${u}
4371
4371
  `);let c=i&&o?` (version ${i} -> ${o})`:"",l=o?`Updated package.json for Svelte 5, Rollup 4, scripts, and version bump${c}.`:"Updated package.json for Svelte 5, Rollup 4, and scripts.";return{changed:!0,before:n,after:u,message:l}}s(rMa,"migratePackageJson");function z9n(){let t=Zd.default.join(process.cwd(),".github","workflows");return ws.default.existsSync(t)?ws.default.readdirSync(t).filter(r=>r.endsWith(".yml")||r.endsWith(".yaml")).map(r=>Zd.default.join(".github","workflows",r)):[]}s(z9n,"findWorkflowFiles");function nMa(){let t=z9n();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=Zd.default.join(process.cwd(),n),o=ws.default.readFileSync(i,"utf8");if(!/node-version:\s*['"]?16['"]?/g.test(o))continue;let u=o.replace(/node-version:\s*['"]?16['"]?/g,"node-version: 18");if(u!==o){let c=`${i}.pre-svelte5`;ws.default.writeFileSync(c,o),ws.default.writeFileSync(i,u),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(nMa,"migrateNodeVersion");function iMa(){let t=Zd.default.join(process.cwd(),"schema.json");if(!ws.default.existsSync(t))return{changed:!1,message:"schema.json not found - skipping schema metadata migration."};let e=ws.default.readFileSync(t,"utf8"),r;try{r=JSON.parse(e)}catch(c){return{changed:!1,message:`Invalid schema.json: ${c?.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 u=JSON.stringify(r,null,2);return ws.default.writeFileSync(`${t}.pre-svelte5`,e),ws.default.writeFileSync(t,`${u}
4372
- `),{changed:!0,before:o,after:u,message:"Updated schema.json metadata to include svelteMajor: 5."}}s(iMa,"migrateSchemaJson");async function $9n(){let t=[],e=ws.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=V9n(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=j9n(),u="unknown";if(a){let T=ws.default.readFileSync(a,"utf8");Y9n(T)?(u="looks-new",t.push(`Rollup config ${a} already looks Svelte 5-ready.`)):(u="needs-migration",t.push("Will write Rollup 4 / Svelte 5 config and rename to rollup.config.mjs."))}else u="unknown",t.push("No rollup config found - will create rollup.config.mjs.");let c=W9n(),l="not-found";c?ws.default.readFileSync(c,"utf8").includes("<svelte:boundary>")?(l="looks-new",t.push(`${c} already uses <svelte:boundary>.`)):(l="needs-migration",t.push(`Will update ${c} to use <svelte:boundary>, $$restProps, and error UI.`)):t.push("No wrapper.svelte found - skipping wrapper migration.");let f="unknown";if(ws.default.existsSync("schema.json"))try{let T=ws.default.readFileSync("schema.json","utf8"),S=JSON.parse(T);(S&&typeof S.metadata=="object"&&!Array.isArray(S.metadata)?S.metadata:{}).svelteMajor===5?(f="looks-new",t.push("schema.json metadata already declares svelteMajor: 5.")):(f="needs-migration",t.push("Will update schema.json metadata to set svelteMajor: 5."))}catch(T){f="unknown",t.push(`schema.json could not be parsed - please fix JSON before migration (${T?.message||"parse error"}).`)}else f="not-found",t.push("schema.json not found - cannot update metadata.");let d=n?"looks-new":"needs-migration",m="not-found",A=z9n();if(A.length>0){let T=!1,S=!1;for(let b of A){let C=Zd.default.join(process.cwd(),b),B=ws.default.readFileSync(C,"utf8");/node-version:\s*['"]?16['"]?/.test(B)&&(T=!0),/node-version:\s*['"]?(18|20|22)['"]?/.test(B)&&(S=!0)}T?(m="needs-migration",t.push("Will update GitHub workflow files: node-version 16 -> 18.")):S?(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:u,packageJson:d,wrapper:l,schema:f,nodeVersion:m,canBuildAfter:!0,rollupFile:a,wrapperFile:c,pkg:r}}s($9n,"analysePluginForSvelte5");async function K9n(){let t=await eMa();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=tMa(),r=iMa(),n=rMa(),i=nMa();return{pkgRes:n,schemaRes:r,rollupRes:t,wrapperRes:e,nodeVersionRes:i}}s(K9n,"runSvelte5Migration");var J9n=require("child_process");var sMa=require("find-free-port");function oMa(t){let e=[],r=[];for(let n of new Set(t.filter(Boolean)))if(JO.default.existsSync(n))try{JO.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(oMa,"cleanupPreSvelte5Backups");function X9n(){if(!JO.default.existsSync("package.json"))throw new Error("Please run in a plugin directory - must contain package.json");if(!JO.default.existsSync("schema.json"))throw new Error("Please run in a plugin directory - must contain schema.json")}s(X9n,"checkInPlugin");async function aMa(t){return JO.default.readdirSync(process.cwd()).find(r=>r===".git")?!1:(console.log(Fi(`By default the plugin will be created in the directory "${t}"`)),console.log(Fi("if you are already in an empty directory, such as a new Git repo, you can disable this functionality.")),II("Create top level directory?"))}s(aMa,"askAboutTopLevel");async function uMa(t){let e=t.init||t;if(!e||!AMt.includes(e)){console.log(Qa("Please provide a type to init, either 'component', 'datasource' or 'automation'."));return}console.log(Fi("Lets get some details about your new plugin:"));let r=await zk("Name",`budibase-${e}`);if(JO.default.existsSync(r)){console.log(Qa("Directory by plugin name already exists, pick a new name."));return}let n=await zk("Description",`An amazing Budibase ${e}!`),i=await zk("Version","1.0.0"),o=await aMa(r);console.log(Fi("Retrieving project...")),await HLe(e,r),await F9n(e,r,n,i),console.log(Fi("Installing dependencies...")),await x6("install",(0,WLe.join)(process.cwd(),r)),o?console.log(Fi(`Plugin created in directory "${r}"`)):(vQe(r,process.cwd()),console.log(Fi("Plugin created in current directory."))),aue(Cw.PluginInit,{type:e,name:r,description:n,version:i})}s(uMa,"init");async function HBt(){X9n(),console.log(Fi("Verifying plugin..."));let t=JO.default.readFileSync("schema.json","utf8"),e=JO.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,Gbe.validate(i),{name:r,version:n}}catch(i){i&&i.message&&i.message.includes("not valid JSON")?console.log(Qa(`schema.json is not valid JSON: ${i.message}`)):console.log(Qa(`Invalid schema/package.json: ${i.message}`))}}s(HBt,"verify");async function cMa(){let t=await HBt();if(!t?.name)return;console.log(mu("Verified!")),console.log(Fi("Building plugin...")),await x6("build");let e=(0,WLe.join)("dist",`${t.name}-${t.version}.tar.gz`);console.log(mu(`Build complete - output in: ${e}`))}s(cMa,"build");async function lMa(){let t=await HBt();if(!t?.name)return;let e=(0,WLe.join)("dist",`${t.name}-${t.version}.tar.gz`);console.log(Fi(`Watching - build in: ${e}`));try{await x6("watch")}catch{console.log(mu("Watch exited."))}}s(lMa,"watch");async function fMa(){let t=await zk("Directory to watch","./"),[e]=await sMa(1e4),r="admin";await due({init:"quick",single:!0,watchPluginDir:t,genUser:r,port:e,silent:!0}),await iq(),console.log(mu("Configuration has been written to docker-compose.yaml")),console.log(mu("Development environment started successfully - connect at: ")+Fi(`http://localhost:${e}`)),console.log(mu("Use the following credentials to login:")),console.log(mu("Email: ")+Fi(HQe)),console.log(mu("Password: ")+Fi(r))}s(fMa,"dev");async function dMa(t){X9n();let e=!!t?.yes,r=!!t?.force,n=!1;try{n=!!(0,J9n.execSync)("git status --porcelain",{encoding:"utf8"}).trim()}catch{}if(n&&!r&&(console.log(Fi("Your git working directory is not clean. Commit or stash changes, or re-run with --force.")),!await II("Proceed with migration anyway?"))){console.log(Fi("Migration aborted."));return}console.log(Fi("Analyzing plugin for Svelte 5 migration..."));let i=await $9n();console.log(Fi("Proposed changes:"));for(let c of i.report)console.log(Fi(" - "+c));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 II("Apply these changes now?")){console.log(Fi("Migration aborted by user."));return}console.log(Fi("Applying migrations..."));let a=await K9n();if(a.rollupRes?.message?.includes("Failed to retrieve canonical rollup.config.mjs from skeleton")){console.log(Qa(a.rollupRes.message));return}if(a.pkgRes?.message&&console.log(Fi(a.pkgRes.message)),a.schemaRes?.message&&console.log(Fi(a.schemaRes.message)),a.rollupRes?.message&&console.log(Fi(a.rollupRes.message)),a.wrapperRes?.message&&console.log(Fi(a.wrapperRes.message)),console.log(Fi("Installing updated dependencies...")),await x6("install"),console.log(Fi("Re-verifying plugin...")),!(await HBt())?.name){console.log(Qa("Verification failed after migration."));return}console.log(Fi("Attempting build..."));try{await x6("build");let c=oMa(o.filter(l=>!!l));console.log(mu("Migration completed. Your plugin was migrated to Svelte 5 and built successfully.")),c.deleted.length&&console.log(Fi(`Removed ${c.deleted.length} pre-svelte5 backup file(s): ${c.deleted.join(", ")}`)),c.failed.length&&console.log(Fi(`Failed to remove ${c.failed.length} pre-svelte5 backup file(s): ${c.failed.map(l=>`${l.path} (${l.error})`).join(", ")}`))}catch(c){console.log(Qa(`Build failed after migration. Please review the errors above. ${c?.message||""}`))}}s(dMa,"migrateSvelte5");var Z9n=new SI("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.",uMa).addSubOption("--build","Build your plugin, this will verify and produce a final tarball for your project.",cMa).addSubOption("--watch","Automatically build any changes to your plugin.",lMa).addSubOption("--dev","Run a development environment which automatically watches the current directory.",fMa).addSubOption("--migrate-svelte5","Migrate this plugin to the Svelte 5-compatible Budibase plugin format.",dMa,[{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 eKn(){return[MFt,lFt,PYn,Z9n]}s(eKn,"getCommands");var rKn=require("commander");ad();var tKn="3.37.2";async function pMa(){let t=new rKn.Command().addHelpCommand("help",$5("Help with Budibase commands.")).helpOption(!1).version(tKn);for(let e of eKn())e.configure(t);await t.parseAsync(process.argv)}s(pMa,"init");var gMa=["exit","SIGINT","SIGUSR1","SIGUSR2","uncaughtException"];gMa.forEach(t=>{process.on(t,e=>{e&&!isNaN(e)||e&&(console.error(Qa("Failed to run CLI command - please report with the following message:")),console.error(Qa(e)))})});pMa().catch(t=>{console.error("Unexpected error - ",t)});
4372
+ `),{changed:!0,before:o,after:u,message:"Updated schema.json metadata to include svelteMajor: 5."}}s(iMa,"migrateSchemaJson");async function $9n(){let t=[],e=ws.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=V9n(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=j9n(),u="unknown";if(a){let T=ws.default.readFileSync(a,"utf8");Y9n(T)?(u="looks-new",t.push(`Rollup config ${a} already looks Svelte 5-ready.`)):(u="needs-migration",t.push("Will write Rollup 4 / Svelte 5 config and rename to rollup.config.mjs."))}else u="unknown",t.push("No rollup config found - will create rollup.config.mjs.");let c=W9n(),l="not-found";c?ws.default.readFileSync(c,"utf8").includes("<svelte:boundary>")?(l="looks-new",t.push(`${c} already uses <svelte:boundary>.`)):(l="needs-migration",t.push(`Will update ${c} to use <svelte:boundary>, $$restProps, and error UI.`)):t.push("No wrapper.svelte found - skipping wrapper migration.");let f="unknown";if(ws.default.existsSync("schema.json"))try{let T=ws.default.readFileSync("schema.json","utf8"),S=JSON.parse(T);(S&&typeof S.metadata=="object"&&!Array.isArray(S.metadata)?S.metadata:{}).svelteMajor===5?(f="looks-new",t.push("schema.json metadata already declares svelteMajor: 5.")):(f="needs-migration",t.push("Will update schema.json metadata to set svelteMajor: 5."))}catch(T){f="unknown",t.push(`schema.json could not be parsed - please fix JSON before migration (${T?.message||"parse error"}).`)}else f="not-found",t.push("schema.json not found - cannot update metadata.");let d=n?"looks-new":"needs-migration",m="not-found",A=z9n();if(A.length>0){let T=!1,S=!1;for(let b of A){let C=Zd.default.join(process.cwd(),b),B=ws.default.readFileSync(C,"utf8");/node-version:\s*['"]?16['"]?/.test(B)&&(T=!0),/node-version:\s*['"]?(18|20|22)['"]?/.test(B)&&(S=!0)}T?(m="needs-migration",t.push("Will update GitHub workflow files: node-version 16 -> 18.")):S?(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:u,packageJson:d,wrapper:l,schema:f,nodeVersion:m,canBuildAfter:!0,rollupFile:a,wrapperFile:c,pkg:r}}s($9n,"analysePluginForSvelte5");async function K9n(){let t=await eMa();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=tMa(),r=iMa(),n=rMa(),i=nMa();return{pkgRes:n,schemaRes:r,rollupRes:t,wrapperRes:e,nodeVersionRes:i}}s(K9n,"runSvelte5Migration");var J9n=require("child_process");var sMa=require("find-free-port");function oMa(t){let e=[],r=[];for(let n of new Set(t.filter(Boolean)))if(JO.default.existsSync(n))try{JO.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(oMa,"cleanupPreSvelte5Backups");function X9n(){if(!JO.default.existsSync("package.json"))throw new Error("Please run in a plugin directory - must contain package.json");if(!JO.default.existsSync("schema.json"))throw new Error("Please run in a plugin directory - must contain schema.json")}s(X9n,"checkInPlugin");async function aMa(t){return JO.default.readdirSync(process.cwd()).find(r=>r===".git")?!1:(console.log(Fi(`By default the plugin will be created in the directory "${t}"`)),console.log(Fi("if you are already in an empty directory, such as a new Git repo, you can disable this functionality.")),II("Create top level directory?"))}s(aMa,"askAboutTopLevel");async function uMa(t){let e=t.init||t;if(!e||!AMt.includes(e)){console.log(Qa("Please provide a type to init, either 'component', 'datasource' or 'automation'."));return}console.log(Fi("Lets get some details about your new plugin:"));let r=await zk("Name",`budibase-${e}`);if(JO.default.existsSync(r)){console.log(Qa("Directory by plugin name already exists, pick a new name."));return}let n=await zk("Description",`An amazing Budibase ${e}!`),i=await zk("Version","1.0.0"),o=await aMa(r);console.log(Fi("Retrieving project...")),await HLe(e,r),await F9n(e,r,n,i),console.log(Fi("Installing dependencies...")),await x6("install",(0,WLe.join)(process.cwd(),r)),o?console.log(Fi(`Plugin created in directory "${r}"`)):(vQe(r,process.cwd()),console.log(Fi("Plugin created in current directory."))),aue(Cw.PluginInit,{type:e,name:r,description:n,version:i})}s(uMa,"init");async function HBt(){X9n(),console.log(Fi("Verifying plugin..."));let t=JO.default.readFileSync("schema.json","utf8"),e=JO.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,Gbe.validate(i),{name:r,version:n}}catch(i){i&&i.message&&i.message.includes("not valid JSON")?console.log(Qa(`schema.json is not valid JSON: ${i.message}`)):console.log(Qa(`Invalid schema/package.json: ${i.message}`))}}s(HBt,"verify");async function cMa(){let t=await HBt();if(!t?.name)return;console.log(mu("Verified!")),console.log(Fi("Building plugin...")),await x6("build");let e=(0,WLe.join)("dist",`${t.name}-${t.version}.tar.gz`);console.log(mu(`Build complete - output in: ${e}`))}s(cMa,"build");async function lMa(){let t=await HBt();if(!t?.name)return;let e=(0,WLe.join)("dist",`${t.name}-${t.version}.tar.gz`);console.log(Fi(`Watching - build in: ${e}`));try{await x6("watch")}catch{console.log(mu("Watch exited."))}}s(lMa,"watch");async function fMa(){let t=await zk("Directory to watch","./"),[e]=await sMa(1e4),r="admin";await due({init:"quick",single:!0,watchPluginDir:t,genUser:r,port:e,silent:!0}),await iq(),console.log(mu("Configuration has been written to docker-compose.yaml")),console.log(mu("Development environment started successfully - connect at: ")+Fi(`http://localhost:${e}`)),console.log(mu("Use the following credentials to login:")),console.log(mu("Email: ")+Fi(HQe)),console.log(mu("Password: ")+Fi(r))}s(fMa,"dev");async function dMa(t){X9n();let e=!!t?.yes,r=!!t?.force,n=!1;try{n=!!(0,J9n.execSync)("git status --porcelain",{encoding:"utf8"}).trim()}catch{}if(n&&!r&&(console.log(Fi("Your git working directory is not clean. Commit or stash changes, or re-run with --force.")),!await II("Proceed with migration anyway?"))){console.log(Fi("Migration aborted."));return}console.log(Fi("Analyzing plugin for Svelte 5 migration..."));let i=await $9n();console.log(Fi("Proposed changes:"));for(let c of i.report)console.log(Fi(" - "+c));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 II("Apply these changes now?")){console.log(Fi("Migration aborted by user."));return}console.log(Fi("Applying migrations..."));let a=await K9n();if(a.rollupRes?.message?.includes("Failed to retrieve canonical rollup.config.mjs from skeleton")){console.log(Qa(a.rollupRes.message));return}if(a.pkgRes?.message&&console.log(Fi(a.pkgRes.message)),a.schemaRes?.message&&console.log(Fi(a.schemaRes.message)),a.rollupRes?.message&&console.log(Fi(a.rollupRes.message)),a.wrapperRes?.message&&console.log(Fi(a.wrapperRes.message)),console.log(Fi("Installing updated dependencies...")),await x6("install"),console.log(Fi("Re-verifying plugin...")),!(await HBt())?.name){console.log(Qa("Verification failed after migration."));return}console.log(Fi("Attempting build..."));try{await x6("build");let c=oMa(o.filter(l=>!!l));console.log(mu("Migration completed. Your plugin was migrated to Svelte 5 and built successfully.")),c.deleted.length&&console.log(Fi(`Removed ${c.deleted.length} pre-svelte5 backup file(s): ${c.deleted.join(", ")}`)),c.failed.length&&console.log(Fi(`Failed to remove ${c.failed.length} pre-svelte5 backup file(s): ${c.failed.map(l=>`${l.path} (${l.error})`).join(", ")}`))}catch(c){console.log(Qa(`Build failed after migration. Please review the errors above. ${c?.message||""}`))}}s(dMa,"migrateSvelte5");var Z9n=new SI("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.",uMa).addSubOption("--build","Build your plugin, this will verify and produce a final tarball for your project.",cMa).addSubOption("--watch","Automatically build any changes to your plugin.",lMa).addSubOption("--dev","Run a development environment which automatically watches the current directory.",fMa).addSubOption("--migrate-svelte5","Migrate this plugin to the Svelte 5-compatible Budibase plugin format.",dMa,[{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 eKn(){return[MFt,lFt,PYn,Z9n]}s(eKn,"getCommands");var rKn=require("commander");ad();var tKn="3.37.3";async function pMa(){let t=new rKn.Command().addHelpCommand("help",$5("Help with Budibase commands.")).helpOption(!1).version(tKn);for(let e of eKn())e.configure(t);await t.parseAsync(process.argv)}s(pMa,"init");var gMa=["exit","SIGINT","SIGUSR1","SIGUSR2","uncaughtException"];gMa.forEach(t=>{process.on(t,e=>{e&&!isNaN(e)||e&&(console.error(Qa("Failed to run CLI command - please report with the following message:")),console.error(Qa(e)))})});pMa().catch(t=>{console.error("Unexpected error - ",t)});
4373
4373
  /*! Bundled license information:
4374
4374
 
4375
4375
  lodash/lodash.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@budibase/cli",
3
- "version": "3.37.2",
3
+ "version": "3.37.3",
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": "16651aba054e221a0d92fab3574df679ece11843"
44
+ "gitHead": "ca7841a3a42b1a1328df0cbb96a51650c0c1e8a7"
45
45
  }