@budibase/cli 3.34.9 → 3.34.10
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/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4605,7 +4605,7 @@ ${t}
|
|
|
4605
4605
|
</style>
|
|
4606
4606
|
`,a=!1,c,u,l=[];if(i){let f=`${t}.pre-svelte5`;Ps.default.writeFileSync(f,e),Ps.default.writeFileSync(t,s),a=!0,c=e,u=s,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=nh.default.join(nh.default.dirname(t),"Boundary.js");if(Ps.default.existsSync(d))try{Ps.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(" ")}}o(wVl,"migrateWrapper");function vVl(){let t=nh.default.join(process.cwd(),"package.json");if(!Ps.default.existsSync(t))return{changed:!1,message:"package.json not found"};let e=Ps.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,s=Gvs(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",s&&(r.version=s);let c=JSON.stringify(r,null,2);if(n===c)return{changed:!1,message:"package.json already appears Svelte 5 ready. Skipping."};Ps.default.writeFileSync(`${t}.pre-svelte5`,e),Ps.default.writeFileSync(t,`${c}
|
|
4607
4607
|
`);let u=i&&s?` (version ${i} -> ${s})`:"",l=s?`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}}o(vVl,"migratePackageJson");function Wvs(){let t=nh.default.join(process.cwd(),".github","workflows");return Ps.default.existsSync(t)?Ps.default.readdirSync(t).filter(r=>r.endsWith(".yml")||r.endsWith(".yaml")).map(r=>nh.default.join(".github","workflows",r)):[]}o(Wvs,"findWorkflowFiles");function NVl(){let t=Wvs();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=nh.default.join(process.cwd(),n),s=Ps.default.readFileSync(i,"utf8");if(!/node-version:\s*['"]?16['"]?/g.test(s))continue;let c=s.replace(/node-version:\s*['"]?16['"]?/g,"node-version: 18");if(c!==s){let u=`${i}.pre-svelte5`;Ps.default.writeFileSync(u,s),Ps.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."}}o(NVl,"migrateNodeVersion");function OVl(){let t=nh.default.join(process.cwd(),"schema.json");if(!Ps.default.existsSync(t))return{changed:!1,message:"schema.json not found - skipping schema metadata migration."};let e=Ps.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 s=JSON.stringify(r,null,2),a={...n,svelteMajor:5};r.metadata=a;let c=JSON.stringify(r,null,2);return Ps.default.writeFileSync(`${t}.pre-svelte5`,e),Ps.default.writeFileSync(t,`${c}
|
|
4608
|
-
`),{changed:!0,before:s,after:c,message:"Updated schema.json metadata to include svelteMajor: 5."}}o(OVl,"migrateSchemaJson");async function zvs(){let t=[],e=Ps.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,s=Gvs(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."),s&&i&&s!==i&&t.push(`Will bump package.json version from ${i} to ${s}.`);let a=jvs(),c="unknown";if(a){let E=Ps.default.readFileSync(a,"utf8");Vvs(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=Yvs(),l="not-found";u?Ps.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(Ps.default.existsSync("schema.json"))try{let E=Ps.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 f=n?"looks-new":"needs-migration",h="not-found",m=Wvs();if(m.length>0){let E=!1,y=!1;for(let b of m){let S=nh.default.join(process.cwd(),b),v=Ps.default.readFileSync(S,"utf8");/node-version:\s*['"]?16['"]?/.test(v)&&(E=!0),/node-version:\s*['"]?(18|20|22)['"]?/.test(v)&&(y=!0)}E?(h="needs-migration",t.push("Will update GitHub workflow files: node-version 16 -> 18.")):y?(h="looks-new",t.push("GitHub workflow files already use node-version 18 or higher.")):(h="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:h,canBuildAfter:!0,rollupFile:a,wrapperFile:u,pkg:r}}o(zvs,"analysePluginForSvelte5");async function $vs(){let t=await CVl();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=wVl(),r=OVl(),n=vVl(),i=NVl();return{pkgRes:n,schemaRes:r,rollupRes:t,wrapperRes:e,nodeVersionRes:i}}o($vs,"runSvelte5Migration");var Kvs=require("child_process");var xVl=require("find-free-port");function DVl(t){let e=[],r=[];for(let n of new Set(t.filter(Boolean)))if(f1.default.existsSync(n))try{f1.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}}o(DVl,"cleanupPreSvelte5Backups");function Jvs(){if(!f1.default.existsSync("package.json"))throw new Error("Please run in a plugin directory - must contain package.json");if(!f1.default.existsSync("schema.json"))throw new Error("Please run in a plugin directory - must contain schema.json")}o(Jvs,"checkInPlugin");async function PVl(t){return f1.default.readdirSync(process.cwd()).find(r=>r===".git")?!1:(console.log(Yi(`By default the plugin will be created in the directory "${t}"`)),console.log(Yi("if you are already in an empty directory, such as a new Git repo, you can disable this functionality.")),sC("Create top level directory?"))}o(PVl,"askAboutTopLevel");async function kVl(t){let e=t.init||t;if(!e||!ahr.includes(e)){console.log(Wa("Please provide a type to init, either 'component', 'datasource' or 'automation'."));return}console.log(Yi("Lets get some details about your new plugin:"));let r=await XF("Name",`budibase-${e}`);if(f1.default.existsSync(r)){console.log(Wa("Directory by plugin name already exists, pick a new name."));return}let n=await XF("Description",`An amazing Budibase ${e}!`),i=await XF("Version","1.0.0"),s=await PVl(r);console.log(Yi("Retrieving project...")),await $5e(e,r),await Uvs(e,r,n,i),console.log(Yi("Installing dependencies...")),await Mee("install",(0,K5e.join)(process.cwd(),r)),s?console.log(Yi(`Plugin created in directory "${r}"`)):(Z9e(r,process.cwd()),console.log(Yi("Plugin created in current directory."))),gEe(VN.PluginInit,{type:e,name:r,description:n,version:i})}o(kVl,"init");async function Hcr(){Jvs(),console.log(Yi("Verifying plugin..."));let t=f1.default.readFileSync("schema.json","utf8"),e=f1.default.readFileSync("package.json","utf8"),r,n;try{let i=JSON.parse(t),s=JSON.parse(e);if(!s.name||!s.version||!s.description)throw new Error("package.json is missing one of 'name', 'version' or 'description'.");return r=s.name,n=s.version,sVe.validate(i),{name:r,version:n}}catch(i){i&&i.message&&i.message.includes("not valid JSON")?console.log(Wa(`schema.json is not valid JSON: ${i.message}`)):console.log(Wa(`Invalid schema/package.json: ${i.message}`))}}o(Hcr,"verify");async function BVl(){let t=await Hcr();if(!t?.name)return;console.log(wc("Verified!")),console.log(Yi("Building plugin...")),await Mee("build");let e=(0,K5e.join)("dist",`${t.name}-${t.version}.tar.gz`);console.log(wc(`Build complete - output in: ${e}`))}o(BVl,"build");async function MVl(){let t=await Hcr();if(!t?.name)return;let e=(0,K5e.join)("dist",`${t.name}-${t.version}.tar.gz`);console.log(Yi(`Watching - build in: ${e}`));try{await Mee("watch")}catch{console.log(wc("Watch exited."))}}o(MVl,"watch");async function LVl(){let t=await XF("Directory to watch","./"),[e]=await xVl(1e4),r="admin";await TEe({init:"quick",single:!0,watchPluginDir:t,genUser:r,port:e,silent:!0}),await KY(),console.log(wc("Configuration has been written to docker-compose.yaml")),console.log(wc("Development environment started successfully - connect at: ")+Yi(`http://localhost:${e}`)),console.log(wc("Use the following credentials to login:")),console.log(wc("Email: ")+Yi(m$e)),console.log(wc("Password: ")+Yi(r))}o(LVl,"dev");async function UVl(t){Jvs();let e=!!t?.yes,r=!!t?.force,n=!1;try{n=!!(0,Kvs.execSync)("git status --porcelain",{encoding:"utf8"}).trim()}catch{}if(n&&!r&&(console.log(Yi("Your git working directory is not clean. Commit or stash changes, or re-run with --force.")),!await sC("Proceed with migration anyway?"))){console.log(Yi("Migration aborted."));return}console.log(Yi("Analyzing plugin for Svelte 5 migration..."));let i=await zvs();console.log(Yi("Proposed changes:"));for(let u of i.report)console.log(Yi(" - "+u));let s=["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 sC("Apply these changes now?")){console.log(Yi("Migration aborted by user."));return}console.log(Yi("Applying migrations..."));let a=await $vs();if(a.rollupRes?.message?.includes("Failed to retrieve canonical rollup.config.mjs from skeleton")){console.log(Wa(a.rollupRes.message));return}if(a.pkgRes?.message&&console.log(Yi(a.pkgRes.message)),a.schemaRes?.message&&console.log(Yi(a.schemaRes.message)),a.rollupRes?.message&&console.log(Yi(a.rollupRes.message)),a.wrapperRes?.message&&console.log(Yi(a.wrapperRes.message)),console.log(Yi("Installing updated dependencies...")),await Mee("install"),console.log(Yi("Re-verifying plugin...")),!(await Hcr())?.name){console.log(Wa("Verification failed after migration."));return}console.log(Yi("Attempting build..."));try{await Mee("build");let u=DVl(s.filter(l=>!!l));console.log(wc("Migration completed. Your plugin was migrated to Svelte 5 and built successfully.")),u.deleted.length&&console.log(Yi(`Removed ${u.deleted.length} pre-svelte5 backup file(s): ${u.deleted.join(", ")}`)),u.failed.length&&console.log(Yi(`Failed to remove ${u.failed.length} pre-svelte5 backup file(s): ${u.failed.map(l=>`${l.path} (${l.error})`).join(", ")}`))}catch(u){console.log(Wa(`Build failed after migration. Please review the errors above. ${u?.message||""}`))}}o(UVl,"migrateSvelte5");var Xvs=new iC("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.",kVl).addSubOption("--build","Build your plugin, this will verify and produce a final tarball for your project.",BVl).addSubOption("--watch","Automatically build any changes to your plugin.",MVl).addSubOption("--dev","Run a development environment which automatically watches the current directory.",LVl).addSubOption("--migrate-svelte5","Migrate this plugin to the Svelte 5-compatible Budibase plugin format.",UVl,[{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 Zvs(){return[Cgr,Zmr,hbs,Xvs]}o(Zvs,"getCommands");var tNs=require("commander");ep();var eNs="3.34.9";async function qVl(){let t=new tNs.Command().addHelpCommand("help",Zee("Help with Budibase commands.")).helpOption(!1).version(eNs);for(let e of Zvs())e.configure(t);await t.parseAsync(process.argv)}o(qVl,"init");var QVl=["exit","SIGINT","SIGUSR1","SIGUSR2","uncaughtException"];QVl.forEach(t=>{process.on(t,e=>{e&&!isNaN(e)||e&&(console.error(Wa("Failed to run CLI command - please report with the following message:")),console.error(Wa(e)))})});qVl().catch(t=>{console.error("Unexpected error - ",t)});
|
|
4608
|
+
`),{changed:!0,before:s,after:c,message:"Updated schema.json metadata to include svelteMajor: 5."}}o(OVl,"migrateSchemaJson");async function zvs(){let t=[],e=Ps.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,s=Gvs(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."),s&&i&&s!==i&&t.push(`Will bump package.json version from ${i} to ${s}.`);let a=jvs(),c="unknown";if(a){let E=Ps.default.readFileSync(a,"utf8");Vvs(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=Yvs(),l="not-found";u?Ps.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(Ps.default.existsSync("schema.json"))try{let E=Ps.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 f=n?"looks-new":"needs-migration",h="not-found",m=Wvs();if(m.length>0){let E=!1,y=!1;for(let b of m){let S=nh.default.join(process.cwd(),b),v=Ps.default.readFileSync(S,"utf8");/node-version:\s*['"]?16['"]?/.test(v)&&(E=!0),/node-version:\s*['"]?(18|20|22)['"]?/.test(v)&&(y=!0)}E?(h="needs-migration",t.push("Will update GitHub workflow files: node-version 16 -> 18.")):y?(h="looks-new",t.push("GitHub workflow files already use node-version 18 or higher.")):(h="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:h,canBuildAfter:!0,rollupFile:a,wrapperFile:u,pkg:r}}o(zvs,"analysePluginForSvelte5");async function $vs(){let t=await CVl();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=wVl(),r=OVl(),n=vVl(),i=NVl();return{pkgRes:n,schemaRes:r,rollupRes:t,wrapperRes:e,nodeVersionRes:i}}o($vs,"runSvelte5Migration");var Kvs=require("child_process");var xVl=require("find-free-port");function DVl(t){let e=[],r=[];for(let n of new Set(t.filter(Boolean)))if(f1.default.existsSync(n))try{f1.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}}o(DVl,"cleanupPreSvelte5Backups");function Jvs(){if(!f1.default.existsSync("package.json"))throw new Error("Please run in a plugin directory - must contain package.json");if(!f1.default.existsSync("schema.json"))throw new Error("Please run in a plugin directory - must contain schema.json")}o(Jvs,"checkInPlugin");async function PVl(t){return f1.default.readdirSync(process.cwd()).find(r=>r===".git")?!1:(console.log(Yi(`By default the plugin will be created in the directory "${t}"`)),console.log(Yi("if you are already in an empty directory, such as a new Git repo, you can disable this functionality.")),sC("Create top level directory?"))}o(PVl,"askAboutTopLevel");async function kVl(t){let e=t.init||t;if(!e||!ahr.includes(e)){console.log(Wa("Please provide a type to init, either 'component', 'datasource' or 'automation'."));return}console.log(Yi("Lets get some details about your new plugin:"));let r=await XF("Name",`budibase-${e}`);if(f1.default.existsSync(r)){console.log(Wa("Directory by plugin name already exists, pick a new name."));return}let n=await XF("Description",`An amazing Budibase ${e}!`),i=await XF("Version","1.0.0"),s=await PVl(r);console.log(Yi("Retrieving project...")),await $5e(e,r),await Uvs(e,r,n,i),console.log(Yi("Installing dependencies...")),await Mee("install",(0,K5e.join)(process.cwd(),r)),s?console.log(Yi(`Plugin created in directory "${r}"`)):(Z9e(r,process.cwd()),console.log(Yi("Plugin created in current directory."))),gEe(VN.PluginInit,{type:e,name:r,description:n,version:i})}o(kVl,"init");async function Hcr(){Jvs(),console.log(Yi("Verifying plugin..."));let t=f1.default.readFileSync("schema.json","utf8"),e=f1.default.readFileSync("package.json","utf8"),r,n;try{let i=JSON.parse(t),s=JSON.parse(e);if(!s.name||!s.version||!s.description)throw new Error("package.json is missing one of 'name', 'version' or 'description'.");return r=s.name,n=s.version,sVe.validate(i),{name:r,version:n}}catch(i){i&&i.message&&i.message.includes("not valid JSON")?console.log(Wa(`schema.json is not valid JSON: ${i.message}`)):console.log(Wa(`Invalid schema/package.json: ${i.message}`))}}o(Hcr,"verify");async function BVl(){let t=await Hcr();if(!t?.name)return;console.log(wc("Verified!")),console.log(Yi("Building plugin...")),await Mee("build");let e=(0,K5e.join)("dist",`${t.name}-${t.version}.tar.gz`);console.log(wc(`Build complete - output in: ${e}`))}o(BVl,"build");async function MVl(){let t=await Hcr();if(!t?.name)return;let e=(0,K5e.join)("dist",`${t.name}-${t.version}.tar.gz`);console.log(Yi(`Watching - build in: ${e}`));try{await Mee("watch")}catch{console.log(wc("Watch exited."))}}o(MVl,"watch");async function LVl(){let t=await XF("Directory to watch","./"),[e]=await xVl(1e4),r="admin";await TEe({init:"quick",single:!0,watchPluginDir:t,genUser:r,port:e,silent:!0}),await KY(),console.log(wc("Configuration has been written to docker-compose.yaml")),console.log(wc("Development environment started successfully - connect at: ")+Yi(`http://localhost:${e}`)),console.log(wc("Use the following credentials to login:")),console.log(wc("Email: ")+Yi(m$e)),console.log(wc("Password: ")+Yi(r))}o(LVl,"dev");async function UVl(t){Jvs();let e=!!t?.yes,r=!!t?.force,n=!1;try{n=!!(0,Kvs.execSync)("git status --porcelain",{encoding:"utf8"}).trim()}catch{}if(n&&!r&&(console.log(Yi("Your git working directory is not clean. Commit or stash changes, or re-run with --force.")),!await sC("Proceed with migration anyway?"))){console.log(Yi("Migration aborted."));return}console.log(Yi("Analyzing plugin for Svelte 5 migration..."));let i=await zvs();console.log(Yi("Proposed changes:"));for(let u of i.report)console.log(Yi(" - "+u));let s=["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 sC("Apply these changes now?")){console.log(Yi("Migration aborted by user."));return}console.log(Yi("Applying migrations..."));let a=await $vs();if(a.rollupRes?.message?.includes("Failed to retrieve canonical rollup.config.mjs from skeleton")){console.log(Wa(a.rollupRes.message));return}if(a.pkgRes?.message&&console.log(Yi(a.pkgRes.message)),a.schemaRes?.message&&console.log(Yi(a.schemaRes.message)),a.rollupRes?.message&&console.log(Yi(a.rollupRes.message)),a.wrapperRes?.message&&console.log(Yi(a.wrapperRes.message)),console.log(Yi("Installing updated dependencies...")),await Mee("install"),console.log(Yi("Re-verifying plugin...")),!(await Hcr())?.name){console.log(Wa("Verification failed after migration."));return}console.log(Yi("Attempting build..."));try{await Mee("build");let u=DVl(s.filter(l=>!!l));console.log(wc("Migration completed. Your plugin was migrated to Svelte 5 and built successfully.")),u.deleted.length&&console.log(Yi(`Removed ${u.deleted.length} pre-svelte5 backup file(s): ${u.deleted.join(", ")}`)),u.failed.length&&console.log(Yi(`Failed to remove ${u.failed.length} pre-svelte5 backup file(s): ${u.failed.map(l=>`${l.path} (${l.error})`).join(", ")}`))}catch(u){console.log(Wa(`Build failed after migration. Please review the errors above. ${u?.message||""}`))}}o(UVl,"migrateSvelte5");var Xvs=new iC("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.",kVl).addSubOption("--build","Build your plugin, this will verify and produce a final tarball for your project.",BVl).addSubOption("--watch","Automatically build any changes to your plugin.",MVl).addSubOption("--dev","Run a development environment which automatically watches the current directory.",LVl).addSubOption("--migrate-svelte5","Migrate this plugin to the Svelte 5-compatible Budibase plugin format.",UVl,[{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 Zvs(){return[Cgr,Zmr,hbs,Xvs]}o(Zvs,"getCommands");var tNs=require("commander");ep();var eNs="3.34.10";async function qVl(){let t=new tNs.Command().addHelpCommand("help",Zee("Help with Budibase commands.")).helpOption(!1).version(eNs);for(let e of Zvs())e.configure(t);await t.parseAsync(process.argv)}o(qVl,"init");var QVl=["exit","SIGINT","SIGUSR1","SIGUSR2","uncaughtException"];QVl.forEach(t=>{process.on(t,e=>{e&&!isNaN(e)||e&&(console.error(Wa("Failed to run CLI command - please report with the following message:")),console.error(Wa(e)))})});qVl().catch(t=>{console.error("Unexpected error - ",t)});
|
|
4609
4609
|
/*! Bundled license information:
|
|
4610
4610
|
|
|
4611
4611
|
lodash/lodash.js:
|