@budibase/cli 3.33.0 → 3.33.1
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 +3 -3
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(DXu,"migrateWrapper");function PXu(){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=JJi(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(PXu,"migratePackageJson");function rXi(){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(rXi,"findWorkflowFiles");function BXu(){let t=rXi();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(BXu,"migrateNodeVersion");function MXu(){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(MXu,"migrateSchemaJson");async function nXi(){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=JJi(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=XJi(),c="unknown";if(a){let A=ns.default.readFileSync(a,"utf8");ZJi(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=tXi(),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=rXi();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(nXi,"analysePluginForSvelte5");async function iXi(){let t=await NXu();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=DXu(),r=MXu(),n=PXu(),i=BXu();return{pkgRes:n,schemaRes:r,rollupRes:t,wrapperRes:e,nodeVersionRes:i}}s(iXi,"runSvelte5Migration");var sXi=require("child_process");var LXu=require("find-free-port");function UXu(t){let e=[],r=[];for(let n of new Set(t.filter(Boolean)))if(xO.default.existsSync(n))try{xO.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(UXu,"cleanupPreSvelte5Backups");function oXi(){if(!xO.default.existsSync("package.json"))throw new Error("Please run in a plugin directory - must contain package.json");if(!xO.default.existsSync("schema.json"))throw new Error("Please run in a plugin directory - must contain schema.json")}s(oXi,"checkInPlugin");async function FXu(t){return xO.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(FXu,"askAboutTopLevel");async function qXu(t){let e=t.init||t;if(!e||!IJt.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(xO.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 FXu(r);console.log(bi("Retrieving project...")),await TGe(e,r),await zJi(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."))),ufe(PC.PluginInit,{type:e,name:r,description:n,version:i})}s(qXu,"init");async function f6t(){oXi(),console.log(bi("Verifying plugin..."));let t=xO.default.readFileSync("schema.json","utf8"),e=xO.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 QXu(){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(QXu,"build");async function jXu(){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(jXu,"watch");async function HXu(){let t=await LB("Directory to watch","./"),[e]=await LXu(1e4),r="admin";await hfe({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(HXu,"dev");async function GXu(t){oXi();let e=!!t?.yes,r=!!t?.force,n=!1;try{n=!!(0,sXi.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 nXi();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 iXi();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=UXu(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(GXu,"migrateSvelte5");var aXi=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.",qXu).addSubOption("--build","Build your plugin, this will verify and produce a final tarball for your project.",QXu).addSubOption("--watch","Automatically build any changes to your plugin.",jXu).addSubOption("--dev","Run a development environment which automatically watches the current directory.",HXu).addSubOption("--migrate-svelte5","Migrate this plugin to the Svelte 5-compatible Budibase plugin format.",GXu,[{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 cXi(){return[$Zt,_Zt,vYi,aXi]}s(cXi,"getCommands");var lXi=require("commander");xd();var uXi="3.33.0";async function $Xu(){let t=new lXi.Command().addHelpCommand("help",iK("Help with Budibase commands.")).helpOption(!1).version(uXi);for(let e of cXi())e.configure(t);await t.parseAsync(process.argv)}s($Xu,"init");var zXu=["exit","SIGINT","SIGUSR1","SIGUSR2","uncaughtException"];zXu.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)))})});$Xu().catch(t=>{console.error("Unexpected error - ",t)});
|
|
1502
|
+
`),{changed:!0,before:o,after:c,message:"Updated schema.json metadata to include svelteMajor: 5."}}s(MXu,"migrateSchemaJson");async function nXi(){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=JJi(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=XJi(),c="unknown";if(a){let A=ns.default.readFileSync(a,"utf8");ZJi(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=tXi(),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=rXi();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(nXi,"analysePluginForSvelte5");async function iXi(){let t=await NXu();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=DXu(),r=MXu(),n=PXu(),i=BXu();return{pkgRes:n,schemaRes:r,rollupRes:t,wrapperRes:e,nodeVersionRes:i}}s(iXi,"runSvelte5Migration");var sXi=require("child_process");var LXu=require("find-free-port");function UXu(t){let e=[],r=[];for(let n of new Set(t.filter(Boolean)))if(xO.default.existsSync(n))try{xO.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(UXu,"cleanupPreSvelte5Backups");function oXi(){if(!xO.default.existsSync("package.json"))throw new Error("Please run in a plugin directory - must contain package.json");if(!xO.default.existsSync("schema.json"))throw new Error("Please run in a plugin directory - must contain schema.json")}s(oXi,"checkInPlugin");async function FXu(t){return xO.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(FXu,"askAboutTopLevel");async function qXu(t){let e=t.init||t;if(!e||!IJt.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(xO.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 FXu(r);console.log(bi("Retrieving project...")),await TGe(e,r),await zJi(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."))),ufe(PC.PluginInit,{type:e,name:r,description:n,version:i})}s(qXu,"init");async function f6t(){oXi(),console.log(bi("Verifying plugin..."));let t=xO.default.readFileSync("schema.json","utf8"),e=xO.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 QXu(){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(QXu,"build");async function jXu(){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(jXu,"watch");async function HXu(){let t=await LB("Directory to watch","./"),[e]=await LXu(1e4),r="admin";await hfe({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(HXu,"dev");async function GXu(t){oXi();let e=!!t?.yes,r=!!t?.force,n=!1;try{n=!!(0,sXi.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 nXi();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 iXi();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=UXu(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(GXu,"migrateSvelte5");var aXi=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.",qXu).addSubOption("--build","Build your plugin, this will verify and produce a final tarball for your project.",QXu).addSubOption("--watch","Automatically build any changes to your plugin.",jXu).addSubOption("--dev","Run a development environment which automatically watches the current directory.",HXu).addSubOption("--migrate-svelte5","Migrate this plugin to the Svelte 5-compatible Budibase plugin format.",GXu,[{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 cXi(){return[$Zt,_Zt,vYi,aXi]}s(cXi,"getCommands");var lXi=require("commander");xd();var uXi="3.33.1";async function $Xu(){let t=new lXi.Command().addHelpCommand("help",iK("Help with Budibase commands.")).helpOption(!1).version(uXi);for(let e of cXi())e.configure(t);await t.parseAsync(process.argv)}s($Xu,"init");var zXu=["exit","SIGINT","SIGUSR1","SIGUSR2","uncaughtException"];zXu.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)))})});$Xu().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.33.
|
|
3
|
+
"version": "3.33.1",
|
|
4
4
|
"description": "Budibase CLI, for developers, self hosting and migrations.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"posthog-node": "4.0.1",
|
|
34
34
|
"pouchdb": "9.0.0",
|
|
35
35
|
"randomstring": "1.1.5",
|
|
36
|
-
"tar": "7.5.
|
|
36
|
+
"tar": "7.5.11",
|
|
37
37
|
"yaml": "^2.8.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"@types/pouchdb": "^6.4.0",
|
|
42
42
|
"ts-node": "10.8.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "7e37f4dca78aaab158a4fa07ba631720003da6b3"
|
|
45
45
|
}
|