@fabricmc/cli 0.1.465 → 0.1.466
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/bundled.mjs +3 -1
- package/package.json +1 -1
package/bundled.mjs
CHANGED
|
@@ -334,6 +334,7 @@ loom {
|
|
|
334
334
|
fabricApi {
|
|
335
335
|
configureDataGeneration {
|
|
336
336
|
client = true
|
|
337
|
+
modId = "<%= it.modid %>"
|
|
337
338
|
}
|
|
338
339
|
}
|
|
339
340
|
|
|
@@ -467,6 +468,7 @@ loom {
|
|
|
467
468
|
fabricApi {
|
|
468
469
|
configureDataGeneration {
|
|
469
470
|
client = true
|
|
471
|
+
modId = "<%= it.modid %>"
|
|
470
472
|
}
|
|
471
473
|
}
|
|
472
474
|
|
|
@@ -1265,4 +1267,4 @@ This template is available under the CC0 license. Feel free to learn from it and
|
|
|
1265
1267
|
|
|
1266
1268
|
${Ti(`Visit ${wA(this.getRepositoryUrl(A))} for available releases or run again with the ${OA("-l")} or ${OA("--list-versions")} command.`)}`);return r&&r===t&&r===n?(this.logger.warn(OA(`You're already using the latest available version ${t} of ${A}.`)),!1):n&&t===n?(this.logger.warn(OA(`You're already using version ${t} of ${A}.`)),!1):!0}async listVersions(A,t){let{versions:n}=await this.getVersions(A);this.printVersions(n,t)}printVersions(A,t,{maxCols:n=this.maxCols,indent:r=0}={}){if(A=A.sort((i,o)=>{let s=Pn(i),a=Pn(o);return Ce(a,s)}).slice(),A?.length)if(A=A.map(i=>t&&t===i?Fe(`* ${i}`):` ${i}`),A.length>this.maxListSize){let i=new qA().indent(r),o=Math.ceil(A.length/n),s=Math.min(A.length,n),a=0;for(let B=0;B<s;B++)for(let g=0;g<o;g++)i[g]||(i[g]=[]),i[g][B]=A[a++];console.log(i.toString())}else console.log(A.map(i=>" ".repeat(r)+i).join(`
|
|
1267
1269
|
`))}setLogger(A){this.logger=A}getMain(A){let t=this.main??A;return t?`/${t}`:""}};FA();function JB({spinner:e,verbose:A}={}){function t(n,...r){e?.stop(),console[n](...r),e?.start()}return{log:(...n)=>{A&&t("log",...n)},info:(...n)=>t("info",...n),warn:(...n)=>t("warn",...n),error:(...n)=>t("error",...n)}}function LB(){let{Deno:e,process:A}=globalThis;if(e)return e.noColor;if(A)return A?.env.NO_COLOR==="1"||A?.env.NODE_DISABLE_COLORS==="1";throw new Error("unsupported runtime")}var WB=new TextEncoder,mi=WB.encode("\r\x1B[K"),qp="\x1B[0m",_p=75,$p=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],AC={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m"},fi=class{#A;message;#e;#r;#t;#n=!1;constructor({spinner:A=$p,message:t="",interval:n=_p,color:r}={}){this.#A=A,this.message=t,this.#e=n,this.color=r}set color(A){this.#r=A?AC[A]:void 0}get color(){return this.#r}start(){if(this.#n||globalThis.Deno?.stdout.writable.locked)return;this.#n=!0;let A=0,t=LB(),n=()=>{let r=this.#r??"",i=WB.encode(t?this.#A[A]+" "+this.message:r+this.#A[A]+qp+" "+this.message),o=new Uint8Array(mi.length+i.length);o.set(mi),o.set(i,mi.length),le(o),A=(A+1)%this.#A.length};this.#t=setInterval(n,this.#e)}stop(){this.#t&&this.#n&&(clearInterval(this.#t),le(mi),this.#n=!1)}};FA();async function _B(){let{Deno:e,process:A}=globalThis;if(e?.version?.deno){let{DenoRuntime:t}=await Promise.resolve().then(()=>(ZB(),KB));return{runtimeName:"deno",runtime:new t}}else if(A?.versions?.bun){let{BunRuntime:t}=await Promise.resolve().then(()=>(qB(),zB));return{runtimeName:"bun",runtime:new t}}else if(A?.versions?.node){let{NodeRuntime:t}=await Promise.resolve().then(()=>(io(),XB));return{runtimeName:"node",runtime:new t}}else throw new Error("Unsupported runtime.")}async function $B({runtime:e,provider:A,...t}){if(t.force||!t.from||await A.isOutdated(t.name,t.from,t.to)){t.to==="latest"?t.logger?.log(hA("Upgrading %s to the %s version"),t.name,t.to):t.logger?.log(hA("Upgrading %s to version %s"),t.name,t.to),t.to=await A.resolveVersion(t.name,t.to),t.logger?.log(hA("Upgrading %s:"),t.name),t.logger?.log(hA(" - current version: %s"),t.from),t.logger?.log(hA(" - target version: %s"),t.to);try{if(A.upgrade)await A.upgrade(t);else{let{runtimeName:n,runtime:r}=await _B();t.logger?.log(hA(" - runtime: %s"),n),await r.upgrade({...t,...e?.[n]??{},provider:A})}}catch(n){throw t.logger?.error(VA(`Failed to upgrade ${sA(t.name)} ${t.from?`from version ${sA(t.from)} `:""}to ${sA(t.to)}.`)),n}t.logger?.info(wA(`Successfully upgraded ${sA(t.name)} from version ${sA(t.from??"")} to ${sA(t.to)}!`),hA(`(${A.getRepositoryUrl(t.name,t.to)})`))}}var Ln=class extends YA{providers;constructor({provider:A,spinner:t=!0,...n}){if(super(),this.providers=Array.isArray(A)?A:[A],!this.providers.length)throw new Error("No upgrade provider defined!");this.description(()=>`Upgrade ${this.getMainCommand().getName()} executable to latest or given version.`).noGlobals().type("provider",new ln(this.getProviderNames())).option("-r, --registry <name:provider>","The registry name from which to upgrade.",{default:this.getProvider().name,hidden:this.providers.length<2,value:r=>this.getProvider(r)}).option("-l, --list-versions","Show available versions.",{action:async({registry:r})=>{await r.listVersions(this.getMainCommand().getName(),this.getVersion()),We(0)}}).option("--version <version:string:version>","The version to upgrade to.",{default:"latest"}).option("-f, --force","Replace current installation even if not out-of-date.").option("-v, --verbose","Log verbose output.").option("--no-spinner","Disable spinner.",{hidden:!t}).complete("version",()=>this.getAllVersions()).action(async({registry:r,version:i,force:o,verbose:s,spinner:a})=>{let B=this.getMainCommand().getName(),g=this.getVersion(),l=t&&a?new fi({message:wA(`Upgrading ${sA(B)} from version ${sA(g??"")} to ${sA(i)}...`)}):void 0,u=JB({spinner:l,verbose:s});l?.start(),r.setLogger(u);try{await $B({name:B,to:i,from:g,force:o,provider:r,verbose:s,logger:u,...n})}catch(c){u.error(!s&&c instanceof Error?c.message:c),l?.stop(),We(1)}finally{l?.stop()}})}async getAllVersions(){let{versions:A}=await this.getVersions();return A}async hasRequiredPermissions(){return await this.getProvider().hasRequiredPermissions()}async getLatestVersion(){let{latest:A}=await this.getVersions();return A}getVersions(){return this.getProvider().getVersions(this.getMainCommand().getName())}getProvider(A){let t=A?this.providers.find(n=>n.name===A):this.providers[0];if(!t)throw new zA(`Unknown provider "${A}"`);return t}getProviderNames(){return this.providers.map(A=>A.name)}};var eC="https://fabricmc.net/cli",oo="fabric";function Al(){let e=new Ln({provider:new ao}).description("Upgrade Fabric CLI tools executable to latest version");return e.removeOption("version"),e.removeOption("force"),e.removeOption("list-versions"),e}var ao=class extends Vn{name=oo;constructor(){super()}async hasRequiredPermissions(){return!1}async upgrade(){let A=["install","--force","--reload","--quiet","--global","-A","--name",oo,eC],t=new Deno.Command(Deno.execPath(),{args:A}),{success:n,stderr:r}=await t.output();if(!n)throw await Deno.stderr.write(r),new Error(`Failed to upgrade ${oo}!`);console.info("Successfully upgraded!")}getVersions(A){return Promise.resolve({latest:"latest",versions:["latest"]})}getRepositoryUrl(A){throw new Error("Method not implemented.")}getRegistryUrl(A,t){throw new Error("Method not implemented.")}isOutdated(A,t,n){return Promise.resolve(!0)}};var tC="1.18-SNAPSHOT",nC={getGameVersions:ki,getLoaderVersions:Oi,getYarnVersions:Lo,getApiVersionForMinecraft:Hi,minecraftIsUnobfuscated:dt};function el(){return new YA().name("versions").description("Show the recommended Fabric versions for a Minecraft version").option("--json","Print the recommended versions as JSON").arguments("[minecraftVersion:string]").action(async(e,A)=>{let t=await rC(A);console.log(e.json?sC(t):iC(t))})}async function rC(e,A=nC){let[t,n,r]=await Promise.all([A.getGameVersions(),A.getLoaderVersions(),A.getYarnVersions()]),i=t.find(l=>l.stable);if(!i)throw new Error("Could not find a stable Minecraft version.");let o=t[0]?.stable?void 0:t[0],s=e??i.version;oC(s,t,o?.version);let a=n.find(l=>l.stable);if(!a)throw new Error("Could not find a stable Fabric Loader version.");let B=A.minecraftIsUnobfuscated(s),g={minecraft_version:s,loader_version:a.version,loom_version:tC,fabric_api_version:await A.getApiVersionForMinecraft(s)};return B||(g.yarn_mappings=r.find(l=>l.gameVersion===s)?.version??"unknown"),g}function iC(e){let A=[`minecraft_version=${e.minecraft_version}`];return e.yarn_mappings&&A.push(`yarn_mappings=${e.yarn_mappings}`),A.push(`loader_version=${e.loader_version}`),A.push(`loom_version=${e.loom_version}`),A.push(`fabric_api_version=${e.fabric_api_version}`),A.join(`
|
|
1268
|
-
`)}function sC(e){return JSON.stringify(e,null,2)}function oC(e,A,t){let n=A.find(r=>r.version===e);if(!n)throw new Error(`Unknown Minecraft version: ${e}`);if(!n.stable&&n.version!==t)throw new Error(`Minecraft version ${e} is not supported. Only stable versions and the latest snapshot are supported.`)}var gC="0.1.
|
|
1270
|
+
`)}function sC(e){return JSON.stringify(e,null,2)}function oC(e,A,t){let n=A.find(r=>r.version===e);if(!n)throw new Error(`Unknown Minecraft version: ${e}`);if(!n.stable&&n.version!==t)throw new Error(`Minecraft version ${e} is not supported. Only stable versions and the latest snapshot are supported.`)}var gC="0.1.466";{let e=new YA().name("fabric").version(gC).description("A set of command line tools to aid Fabric mod development").action(()=>{e.showHelp(),aC(0)}).command("init",TB());typeof Deno<"u"&&e.command("upgrade",Al()),e.command("versions",el()).command("completions",new Cn),await e.parse()}
|