@budibase/cli 3.31.7 → 3.31.9
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/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1499,7 +1499,7 @@ ${t}
|
|
|
1499
1499
|
</style>
|
|
1500
1500
|
`,a=!1,c,u,l=[];if(i){let f=`${t}.pre-svelte5`;ns.default.writeFileSync(f,e),ns.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(ns.default.existsSync(d))try{ns.default.unlinkSync(d),a=!0,l.push("Removed legacy lib/Boundary.js (incompatible with Svelte 5).")}catch(f){console.log("Failed to delete legacy Boundary.js:",f instanceof Error?f.message:f)}return{changed:a,before:c,after:u,message:l.join(" ")}}s(RXu,"migrateWrapper");function OXu(){let t=wf.default.join(process.cwd(),"package.json");if(!ns.default.existsSync(t))return{changed:!1,message:"package.json not found"};let e=ns.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=zJi(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."};ns.default.writeFileSync(`${t}.pre-svelte5`,e),ns.default.writeFileSync(t,`${c}
|
|
1501
1501
|
`);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(OXu,"migratePackageJson");function XJi(){let t=wf.default.join(process.cwd(),".github","workflows");return ns.default.existsSync(t)?ns.default.readdirSync(t).filter(r=>r.endsWith(".yml")||r.endsWith(".yaml")).map(r=>wf.default.join(".github","workflows",r)):[]}s(XJi,"findWorkflowFiles");function kXu(){let t=XJi();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=ns.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`;ns.default.writeFileSync(u,o),ns.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(kXu,"migrateNodeVersion");function NXu(){let t=wf.default.join(process.cwd(),"schema.json");if(!ns.default.existsSync(t))return{changed:!1,message:"schema.json not found - skipping schema metadata migration."};let e=ns.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 ns.default.writeFileSync(`${t}.pre-svelte5`,e),ns.default.writeFileSync(t,`${c}
|
|
1502
|
-
`),{changed:!0,before:o,after:c,message:"Updated schema.json metadata to include svelteMajor: 5."}}s(NXu,"migrateSchemaJson");async function ZJi(){let t=[],e=ns.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=zJi(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=WJi(),c="unknown";if(a){let A=ns.default.readFileSync(a,"utf8");YJi(A)?(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=JJi(),l="not-found";u?ns.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(ns.default.existsSync("schema.json"))try{let A=ns.default.readFileSync("schema.json","utf8"),y=JSON.parse(A);(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(A){d="unknown",t.push(`schema.json could not be parsed - please fix JSON before migration (${A?.message||"parse error"}).`)}else d="not-found",t.push("schema.json not found - cannot update metadata.");let f=n?"looks-new":"needs-migration",p="not-found",h=XJi();if(h.length>0){let A=!1,y=!1;for(let v of h){let b=wf.default.join(process.cwd(),v),x=ns.default.readFileSync(b,"utf8");/node-version:\s*['"]?16['"]?/.test(x)&&(A=!0),/node-version:\s*['"]?(18|20|22)['"]?/.test(x)&&(y=!0)}A?(p="needs-migration",t.push("Will update GitHub workflow files: node-version 16 -> 18.")):y?(p="looks-new",t.push("GitHub workflow files already use node-version 18 or higher.")):(p="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:f,wrapper:l,schema:d,nodeVersion:p,canBuildAfter:!0,rollupFile:a,wrapperFile:u,pkg:r}}s(ZJi,"analysePluginForSvelte5");async function eXi(){let t=await xXu();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=RXu(),r=NXu(),n=OXu(),i=kXu();return{pkgRes:n,schemaRes:r,rollupRes:t,wrapperRes:e,nodeVersionRes:i}}s(eXi,"runSvelte5Migration");var tXi=require("child_process");var DXu=require("find-free-port");function PXu(t){let e=[],r=[];for(let n of new Set(t.filter(Boolean)))if(IO.default.existsSync(n))try{IO.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(PXu,"cleanupPreSvelte5Backups");function rXi(){if(!IO.default.existsSync("package.json"))throw new Error("Please run in a plugin directory - must contain package.json");if(!IO.default.existsSync("schema.json"))throw new Error("Please run in a plugin directory - must contain schema.json")}s(rXi,"checkInPlugin");async function BXu(t){return IO.default.readdirSync(process.cwd()).find(r=>r===".git")?!1:(console.log(bi(`By default the plugin will be created in the directory "${t}"`)),console.log(bi("if you are already in an empty directory, such as a new Git repo, you can disable this functionality.")),d0("Create top level directory?"))}s(BXu,"askAboutTopLevel");async function MXu(t){let e=t.init||t;if(!e||!wJt.includes(e)){console.log(Xo("Please provide a type to init, either 'component', 'datasource' or 'automation'."));return}console.log(bi("Lets get some details about your new plugin:"));let r=await LB("Name",`budibase-${e}`);if(IO.default.existsSync(r)){console.log(Xo("Directory by plugin name already exists, pick a new name."));return}let n=await LB("Description",`An amazing Budibase ${e}!`),i=await LB("Version","1.0.0"),o=await BXu(r);console.log(bi("Retrieving project...")),await TGe(e,r),await HJi(e,r,n,i),console.log(bi("Installing dependencies...")),await Q9("install",(0,CGe.join)(process.cwd(),r)),o?console.log(bi(`Plugin created in directory "${r}"`)):(R3e(r,process.cwd()),console.log(bi("Plugin created in current directory."))),cfe(PC.PluginInit,{type:e,name:r,description:n,version:i})}s(MXu,"init");async function f6t(){rXi(),console.log(bi("Verifying plugin..."));let t=IO.default.readFileSync("schema.json","utf8"),e=IO.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,rLe.validate(i),{name:r,version:n}}catch(i){i&&i.message&&i.message.includes("not valid JSON")?console.log(Xo(`schema.json is not valid JSON: ${i.message}`)):console.log(Xo(`Invalid schema/package.json: ${i.message}`))}}s(f6t,"verify");async function LXu(){let t=await f6t();if(!t?.name)return;console.log(Ca("Verified!")),console.log(bi("Building plugin...")),await Q9("build");let e=(0,CGe.join)("dist",`${t.name}-${t.version}.tar.gz`);console.log(Ca(`Build complete - output in: ${e}`))}s(LXu,"build");async function UXu(){let t=await f6t();if(!t?.name)return;let e=(0,CGe.join)("dist",`${t.name}-${t.version}.tar.gz`);console.log(bi(`Watching - build in: ${e}`));try{await Q9("watch")}catch{console.log(Ca("Watch exited."))}}s(UXu,"watch");async function FXu(){let t=await LB("Directory to watch","./"),[e]=await DXu(1e4),r="admin";await pfe({init:"quick",single:!0,watchPluginDir:t,genUser:r,port:e,silent:!0}),await iH(),console.log(Ca("Configuration has been written to docker-compose.yaml")),console.log(Ca("Development environment started successfully - connect at: ")+bi(`http://localhost:${e}`)),console.log(Ca("Use the following credentials to login:")),console.log(Ca("Email: ")+bi(V3e)),console.log(Ca("Password: ")+bi(r))}s(FXu,"dev");async function qXu(t){rXi();let e=!!t?.yes,r=!!t?.force,n=!1;try{n=!!(0,tXi.execSync)("git status --porcelain",{encoding:"utf8"}).trim()}catch{}if(n&&!r&&(console.log(bi("Your git working directory is not clean. Commit or stash changes, or re-run with --force.")),!await d0("Proceed with migration anyway?"))){console.log(bi("Migration aborted."));return}console.log(bi("Analyzing plugin for Svelte 5 migration..."));let i=await ZJi();console.log(bi("Proposed changes:"));for(let u of i.report)console.log(bi(" - "+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 d0("Apply these changes now?")){console.log(bi("Migration aborted by user."));return}console.log(bi("Applying migrations..."));let a=await eXi();if(a.rollupRes?.message?.includes("Failed to retrieve canonical rollup.config.mjs from skeleton")){console.log(Xo(a.rollupRes.message));return}if(a.pkgRes?.message&&console.log(bi(a.pkgRes.message)),a.schemaRes?.message&&console.log(bi(a.schemaRes.message)),a.rollupRes?.message&&console.log(bi(a.rollupRes.message)),a.wrapperRes?.message&&console.log(bi(a.wrapperRes.message)),console.log(bi("Installing updated dependencies...")),await Q9("install"),console.log(bi("Re-verifying plugin...")),!(await f6t())?.name){console.log(Xo("Verification failed after migration."));return}console.log(bi("Attempting build..."));try{await Q9("build");let u=PXu(o.filter(l=>!!l));console.log(Ca("Migration completed. Your plugin was migrated to Svelte 5 and built successfully.")),u.deleted.length&&console.log(bi(`Removed ${u.deleted.length} pre-svelte5 backup file(s): ${u.deleted.join(", ")}`)),u.failed.length&&console.log(bi(`Failed to remove ${u.failed.length} pre-svelte5 backup file(s): ${u.failed.map(l=>`${l.path} (${l.error})`).join(", ")}`))}catch(u){console.log(Xo(`Build failed after migration. Please review the errors above. ${u?.message||""}`))}}s(qXu,"migrateSvelte5");var nXi=new l0("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.",MXu).addSubOption("--build","Build your plugin, this will verify and produce a final tarball for your project.",LXu).addSubOption("--watch","Automatically build any changes to your plugin.",UXu).addSubOption("--dev","Run a development environment which automatically watches the current directory.",FXu).addSubOption("--migrate-svelte5","Migrate this plugin to the Svelte 5-compatible Budibase plugin format.",qXu,[{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 iXi(){return[jZt,mZt,_Yi,nXi]}s(iXi,"getCommands");var oXi=require("commander");xd();var sXi="3.31.7";async function jXu(){let t=new oXi.Command().addHelpCommand("help",iK("Help with Budibase commands.")).helpOption(!1).version(sXi);for(let e of iXi())e.configure(t);await t.parseAsync(process.argv)}s(jXu,"init");var HXu=["exit","SIGINT","SIGUSR1","SIGUSR2","uncaughtException"];HXu.forEach(t=>{process.on(t,e=>{e&&!isNaN(e)||e&&(console.error(Xo("Failed to run CLI command - please report with the following message:")),console.error(Xo(e)))})});jXu().catch(t=>{console.error("Unexpected error - ",t)});
|
|
1502
|
+
`),{changed:!0,before:o,after:c,message:"Updated schema.json metadata to include svelteMajor: 5."}}s(NXu,"migrateSchemaJson");async function ZJi(){let t=[],e=ns.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=zJi(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=WJi(),c="unknown";if(a){let A=ns.default.readFileSync(a,"utf8");YJi(A)?(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=JJi(),l="not-found";u?ns.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(ns.default.existsSync("schema.json"))try{let A=ns.default.readFileSync("schema.json","utf8"),y=JSON.parse(A);(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(A){d="unknown",t.push(`schema.json could not be parsed - please fix JSON before migration (${A?.message||"parse error"}).`)}else d="not-found",t.push("schema.json not found - cannot update metadata.");let f=n?"looks-new":"needs-migration",p="not-found",h=XJi();if(h.length>0){let A=!1,y=!1;for(let v of h){let b=wf.default.join(process.cwd(),v),x=ns.default.readFileSync(b,"utf8");/node-version:\s*['"]?16['"]?/.test(x)&&(A=!0),/node-version:\s*['"]?(18|20|22)['"]?/.test(x)&&(y=!0)}A?(p="needs-migration",t.push("Will update GitHub workflow files: node-version 16 -> 18.")):y?(p="looks-new",t.push("GitHub workflow files already use node-version 18 or higher.")):(p="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:f,wrapper:l,schema:d,nodeVersion:p,canBuildAfter:!0,rollupFile:a,wrapperFile:u,pkg:r}}s(ZJi,"analysePluginForSvelte5");async function eXi(){let t=await xXu();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=RXu(),r=NXu(),n=OXu(),i=kXu();return{pkgRes:n,schemaRes:r,rollupRes:t,wrapperRes:e,nodeVersionRes:i}}s(eXi,"runSvelte5Migration");var tXi=require("child_process");var DXu=require("find-free-port");function PXu(t){let e=[],r=[];for(let n of new Set(t.filter(Boolean)))if(IO.default.existsSync(n))try{IO.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(PXu,"cleanupPreSvelte5Backups");function rXi(){if(!IO.default.existsSync("package.json"))throw new Error("Please run in a plugin directory - must contain package.json");if(!IO.default.existsSync("schema.json"))throw new Error("Please run in a plugin directory - must contain schema.json")}s(rXi,"checkInPlugin");async function BXu(t){return IO.default.readdirSync(process.cwd()).find(r=>r===".git")?!1:(console.log(bi(`By default the plugin will be created in the directory "${t}"`)),console.log(bi("if you are already in an empty directory, such as a new Git repo, you can disable this functionality.")),d0("Create top level directory?"))}s(BXu,"askAboutTopLevel");async function MXu(t){let e=t.init||t;if(!e||!wJt.includes(e)){console.log(Xo("Please provide a type to init, either 'component', 'datasource' or 'automation'."));return}console.log(bi("Lets get some details about your new plugin:"));let r=await LB("Name",`budibase-${e}`);if(IO.default.existsSync(r)){console.log(Xo("Directory by plugin name already exists, pick a new name."));return}let n=await LB("Description",`An amazing Budibase ${e}!`),i=await LB("Version","1.0.0"),o=await BXu(r);console.log(bi("Retrieving project...")),await TGe(e,r),await HJi(e,r,n,i),console.log(bi("Installing dependencies...")),await Q9("install",(0,CGe.join)(process.cwd(),r)),o?console.log(bi(`Plugin created in directory "${r}"`)):(R3e(r,process.cwd()),console.log(bi("Plugin created in current directory."))),cfe(PC.PluginInit,{type:e,name:r,description:n,version:i})}s(MXu,"init");async function f6t(){rXi(),console.log(bi("Verifying plugin..."));let t=IO.default.readFileSync("schema.json","utf8"),e=IO.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,rLe.validate(i),{name:r,version:n}}catch(i){i&&i.message&&i.message.includes("not valid JSON")?console.log(Xo(`schema.json is not valid JSON: ${i.message}`)):console.log(Xo(`Invalid schema/package.json: ${i.message}`))}}s(f6t,"verify");async function LXu(){let t=await f6t();if(!t?.name)return;console.log(Ca("Verified!")),console.log(bi("Building plugin...")),await Q9("build");let e=(0,CGe.join)("dist",`${t.name}-${t.version}.tar.gz`);console.log(Ca(`Build complete - output in: ${e}`))}s(LXu,"build");async function UXu(){let t=await f6t();if(!t?.name)return;let e=(0,CGe.join)("dist",`${t.name}-${t.version}.tar.gz`);console.log(bi(`Watching - build in: ${e}`));try{await Q9("watch")}catch{console.log(Ca("Watch exited."))}}s(UXu,"watch");async function FXu(){let t=await LB("Directory to watch","./"),[e]=await DXu(1e4),r="admin";await pfe({init:"quick",single:!0,watchPluginDir:t,genUser:r,port:e,silent:!0}),await iH(),console.log(Ca("Configuration has been written to docker-compose.yaml")),console.log(Ca("Development environment started successfully - connect at: ")+bi(`http://localhost:${e}`)),console.log(Ca("Use the following credentials to login:")),console.log(Ca("Email: ")+bi(V3e)),console.log(Ca("Password: ")+bi(r))}s(FXu,"dev");async function qXu(t){rXi();let e=!!t?.yes,r=!!t?.force,n=!1;try{n=!!(0,tXi.execSync)("git status --porcelain",{encoding:"utf8"}).trim()}catch{}if(n&&!r&&(console.log(bi("Your git working directory is not clean. Commit or stash changes, or re-run with --force.")),!await d0("Proceed with migration anyway?"))){console.log(bi("Migration aborted."));return}console.log(bi("Analyzing plugin for Svelte 5 migration..."));let i=await ZJi();console.log(bi("Proposed changes:"));for(let u of i.report)console.log(bi(" - "+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 d0("Apply these changes now?")){console.log(bi("Migration aborted by user."));return}console.log(bi("Applying migrations..."));let a=await eXi();if(a.rollupRes?.message?.includes("Failed to retrieve canonical rollup.config.mjs from skeleton")){console.log(Xo(a.rollupRes.message));return}if(a.pkgRes?.message&&console.log(bi(a.pkgRes.message)),a.schemaRes?.message&&console.log(bi(a.schemaRes.message)),a.rollupRes?.message&&console.log(bi(a.rollupRes.message)),a.wrapperRes?.message&&console.log(bi(a.wrapperRes.message)),console.log(bi("Installing updated dependencies...")),await Q9("install"),console.log(bi("Re-verifying plugin...")),!(await f6t())?.name){console.log(Xo("Verification failed after migration."));return}console.log(bi("Attempting build..."));try{await Q9("build");let u=PXu(o.filter(l=>!!l));console.log(Ca("Migration completed. Your plugin was migrated to Svelte 5 and built successfully.")),u.deleted.length&&console.log(bi(`Removed ${u.deleted.length} pre-svelte5 backup file(s): ${u.deleted.join(", ")}`)),u.failed.length&&console.log(bi(`Failed to remove ${u.failed.length} pre-svelte5 backup file(s): ${u.failed.map(l=>`${l.path} (${l.error})`).join(", ")}`))}catch(u){console.log(Xo(`Build failed after migration. Please review the errors above. ${u?.message||""}`))}}s(qXu,"migrateSvelte5");var nXi=new l0("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.",MXu).addSubOption("--build","Build your plugin, this will verify and produce a final tarball for your project.",LXu).addSubOption("--watch","Automatically build any changes to your plugin.",UXu).addSubOption("--dev","Run a development environment which automatically watches the current directory.",FXu).addSubOption("--migrate-svelte5","Migrate this plugin to the Svelte 5-compatible Budibase plugin format.",qXu,[{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 iXi(){return[jZt,mZt,_Yi,nXi]}s(iXi,"getCommands");var oXi=require("commander");xd();var sXi="3.31.9";async function jXu(){let t=new oXi.Command().addHelpCommand("help",iK("Help with Budibase commands.")).helpOption(!1).version(sXi);for(let e of iXi())e.configure(t);await t.parseAsync(process.argv)}s(jXu,"init");var HXu=["exit","SIGINT","SIGUSR1","SIGUSR2","uncaughtException"];HXu.forEach(t=>{process.on(t,e=>{e&&!isNaN(e)||e&&(console.error(Xo("Failed to run CLI command - please report with the following message:")),console.error(Xo(e)))})});jXu().catch(t=>{console.error("Unexpected error - ",t)});
|
|
1503
1503
|
/*! Bundled license information:
|
|
1504
1504
|
|
|
1505
1505
|
lodash/lodash.js:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/cli",
|
|
3
|
-
"version": "3.31.
|
|
3
|
+
"version": "3.31.9",
|
|
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": "
|
|
44
|
+
"gitHead": "fd3896fb9777306c4a0f32479094782ab428081b"
|
|
45
45
|
}
|