ts-pantry 0.11.169 → 0.11.172
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/bin/cli.js +6 -6
- package/dist/bin/desktop.js +1 -1
- package/dist/{chunk-365xgy2v.js → chunk-02k5jygc.js} +2 -2
- package/dist/chunk-03mwedeq.js +1 -0
- package/dist/{chunk-hn7jw7ht.js → chunk-07h7aknr.js} +1 -1
- package/dist/chunk-35x1m26s.js +2 -0
- package/dist/chunk-7sqzkxsa.js +1 -0
- package/dist/{chunk-1h4kvqsh.js → chunk-8spxmc7n.js} +1 -1
- package/dist/{chunk-xts3cctq.js → chunk-a0qvjn4a.js} +3 -3
- package/dist/{chunk-e20vgg36.js → chunk-f36r1p1d.js} +1 -1
- package/dist/{chunk-kq4jkyn1.js → chunk-h0t00ce5.js} +54 -54
- package/dist/chunk-h6wpf5z0.js +2 -0
- package/dist/chunk-he1j2wa3.js +1 -0
- package/dist/{chunk-0e4jg545.js → chunk-hnhjtezs.js} +2 -2
- package/dist/chunk-t965ankb.js +3 -0
- package/dist/{chunk-frrv46sd.js → chunk-y67kbve9.js} +1 -1
- package/dist/chunk-y9k1j6rh.js +2 -0
- package/dist/chunk-znzk19w7.js +1 -0
- package/dist/src/catalog/client.js +1 -1
- package/dist/src/desktop/service.d.ts +3 -0
- package/dist/src/desktop/service.js +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/native/index.js +2 -2
- package/dist/src/native/release.js +1 -1
- package/dist/src/testing/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2x8yyzhm.js +0 -2
- package/dist/chunk-3sc39cqf.js +0 -3
- package/dist/chunk-46np890y.js +0 -1
- package/dist/chunk-cv2tknjc.js +0 -1
- package/dist/chunk-gk0495tp.js +0 -1
- package/dist/chunk-hd6pedsb.js +0 -1
- package/dist/chunk-mvzv8skb.js +0 -2
- package/dist/chunk-xq8dke4k.js +0 -2
package/dist/bin/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{q}from"../chunk-7q8as4h2.js";import{r,f,b,D,H,ye,k,R,I,O,W,ke,ve,n,X,z,u,Z,E,_,L,M,l,ee,Ce,je,Se,ha,fa}from"../chunk-
|
|
2
|
+
import{q}from"../chunk-7q8as4h2.js";import{r,f,b,D,H,ye,k,R,I,O,W,ke,ve,n,X,z,u,Z,E,_,L,M,l,ee,Ce,je,Se,ha,fa}from"../chunk-h0t00ce5.js";import{a,C}from"../chunk-02k5jygc.js";import"../chunk-y67kbve9.js";import"../chunk-t965ankb.js";import{Sa}from"../chunk-hnhjtezs.js";import{d}from"../chunk-35x1m26s.js";import m from"node:fs";import v from"node:path";import s from"node:process";C();async function ae(t="src/pantry"){if(!m.existsSync(t))throw Error(`Pantry directory not found: ${t}. Please run 'bun ./bin/cli.ts update-pantry' first.`);let e=[];function o(i,c=""){let g=m.readdirSync(i,{withFileTypes:!0}),p=v.join(i,"package.yml");if(c&&m.existsSync(p))e.push(c);for(let S of g)if(S.isDirectory()&&!S.name.startsWith(".")){let w=c?`${c}/${S.name}`:S.name,x=v.join(i,S.name);o(x,w)}}return o(t),console.log(`\uD83D\uDCE6 Found ${e.length} packages in local pantry`),e.sort()}async function ce(t=!1){async function e(p){let S=new URL("https://s3.amazonaws.com/dist.tea.xyz/");if(S.searchParams.set("list-type","2"),S.searchParams.set("prefix",""),S.searchParams.set("max-keys","1000"),p)S.searchParams.set("continuation-token",p);let w=await fetch(S.toString());if(!w.ok)throw Error(`Failed to fetch S3 listing: ${w.status}`);let x=await w.text(),B=[],J=x.match(/<Key>([^<]+)<\/Key>/g);if(J)for(let G of J){let U=G.replace(/<Key>([^<]+)<\/Key>/,"$1");B.push({Key:U})}let y=x.includes("<IsTruncated>true</IsTruncated>"),F=x.match(/<NextContinuationToken>([^<]+)<\/NextContinuationToken>/),h=F?F[1]:void 0;return{IsTruncated:y,NextContinuationToken:h,Contents:B}}console.log("Scraping packages from S3 registry...");let o=new Set,i;do{let p=await e(i);for(let S of p.Contents){let w=S.Key,x=w.split("/");if(x.length===0)continue;if(x[0].startsWith(".")||x[0].includes(" ")||w.match(/\.(md|txt|yml|yaml|json)$/i))continue;let B=["darwin","linux","windows"],J=-1;for(let y=1;y<x.length;y++)if(B.includes(x[y])){J=y;break}if(J>0){let y=x.slice(0,J).join("/");if(y.includes("."))o.add(y)}else if(x.length>=2&&x[0].includes(".")&&!x[1].startsWith("v")&&!x[1].match(/^\d/)){let y=`${x[0]}/${x[1]}`;o.add(y)}else if(x.length>=1&&x[0].includes("."))o.add(x[0])}i=p.NextContinuationToken,console.log(`Found ${o.size} packages so far...`)}while(i);let c=Array.from(o).sort(),g=[];for(let p of c){if(!p.includes(".")||p.match(/^[a-z0-9.-]+\.[a-z]{2,}(\/[\w.-]+){0,20}$/i)===null)continue;if(p.endsWith("/README.rst")||p.endsWith("/README")||p.includes("/docs/"))continue;if(p.endsWith("/.pkgroot"))continue;if(["amazon.com/aws","charm.sh","code.videolan.org","crates.io"].includes(p))continue;g.push(p)}return console.log(`\uD83D\uDCE6 Found ${g.length} valid packages in registry`),g}async function le(t,e){let i=`/**
|
|
3
3
|
* Constants used throughout the ts-pantry package
|
|
4
4
|
* This file is auto-generated from ${e}. Do not edit manually.
|
|
5
5
|
* Generated on ${new Date().toISOString()}
|
|
@@ -62,17 +62,17 @@ ${c.join(`
|
|
|
62
62
|
Conflicts found:`),y.conflicts.forEach((h)=>{console.log(` ${h.package}: ${h.versions.join(", ")}`)});if(console.log(`
|
|
63
63
|
\uD83D\uDCCB All unique packages to install:`),y.uniquePackages.forEach((h,G)=>{let U=y.allDependencies.find((N)=>N.name===h),P=U&&U.version&&U.version!=="latest"?` (${U.version})`:"";console.log(` ${G+1}. ${h}${P}`)}),x)console.log(`
|
|
64
64
|
\uD83D\uDE80 Install command:`),console.log(`pantry install ${y.uniquePackages.join(" ")}`);if(Object.values(y.osSpecificDeps).reduce((h,G)=>h+G.length,0)>0)console.log(`
|
|
65
|
-
\uD83D\uDDA5️ OS-specific dependencies:`),Object.entries(y.osSpecificDeps).forEach(([h,G])=>{if(G.length>0)console.log(` ${h}: ${G.map((U)=>U.name).join(", ")}`)})}s.exit(0)}catch(o){if(e.json){let i={success:!1,error:String(o),timestamp:new Date().toISOString()};console.log(JSON.stringify(i))}else console.error("Error resolving dependencies:",o);s.exit(1)}});j.command("get-php-versions","Get PHP versions suitable for CI/CD workflows").option("--format <type>","Output format: json (default), yaml, or csv",{default:"json"}).option("--branches <branches>","Comma-separated list of PHP branches to include (e.g., 8.4,8.3,8.2)").option("--fallback <versions>","Comma-separated list of fallback versions if detection fails").action(async(t)=>{try{let{getPhpVersionsForWorkflow:e}=await import("../chunk-
|
|
65
|
+
\uD83D\uDDA5️ OS-specific dependencies:`),Object.entries(y.osSpecificDeps).forEach(([h,G])=>{if(G.length>0)console.log(` ${h}: ${G.map((U)=>U.name).join(", ")}`)})}s.exit(0)}catch(o){if(e.json){let i={success:!1,error:String(o),timestamp:new Date().toISOString()};console.log(JSON.stringify(i))}else console.error("Error resolving dependencies:",o);s.exit(1)}});j.command("get-php-versions","Get PHP versions suitable for CI/CD workflows").option("--format <type>","Output format: json (default), yaml, or csv",{default:"json"}).option("--branches <branches>","Comma-separated list of PHP branches to include (e.g., 8.4,8.3,8.2)").option("--fallback <versions>","Comma-separated list of fallback versions if detection fails").action(async(t)=>{try{let{getPhpVersionsForWorkflow:e}=await import("../chunk-f36r1p1d.js"),o={};if(t.branches)o.supportedBranches=t.branches.split(",").map((c)=>c.trim());if(t.fallback)o.fallbackVersions=t.fallback.split(",").map((c)=>c.trim());let i=e(o);switch(t.format.toLowerCase()){case"yaml":console.log(`php_versions:
|
|
66
66
|
${i.map((c)=>` - "${c}"`).join(`
|
|
67
|
-
`)}`);break;case"csv":console.log(i.join(","));break;case"json":default:console.log(JSON.stringify(i));break}s.exit(0)}catch(e){console.error("Error getting PHP versions:",e),s.exit(1)}});j.command("generate-zig","Generate Zig package definitions from TypeScript packages").option("--packages-dir <dir>","Directory containing TypeScript package files",{default:"src/packages"}).option("--output <file>","Output Zig file path",{default:"packages.zig"}).option("--aliases","Also generate aliases file").option("--aliases-output <file>","Output file for Zig aliases",{default:"aliases.zig"}).action(async(t)=>{try{let{generateZigDefinitions:e,generateZigAliases:o}=await import("../chunk-
|
|
67
|
+
`)}`);break;case"csv":console.log(i.join(","));break;case"json":default:console.log(JSON.stringify(i));break}s.exit(0)}catch(e){console.error("Error getting PHP versions:",e),s.exit(1)}});j.command("generate-zig","Generate Zig package definitions from TypeScript packages").option("--packages-dir <dir>","Directory containing TypeScript package files",{default:"src/packages"}).option("--output <file>","Output Zig file path",{default:"packages.zig"}).option("--aliases","Also generate aliases file").option("--aliases-output <file>","Output file for Zig aliases",{default:"aliases.zig"}).action(async(t)=>{try{let{generateZigDefinitions:e,generateZigAliases:o}=await import("../chunk-he1j2wa3.js"),{packagesDir:i="src/packages",output:c="packages.zig",aliases:g=!1,aliasesOutput:p="aliases.zig"}=t;if(console.log("\uD83D\uDE80 Generating Zig package definitions..."),await e(i,c),g)console.log(`
|
|
68
68
|
\uD83D\uDE80 Generating Zig package aliases...`),await o(i,p);console.log(`
|
|
69
|
-
✅ Zig code generation complete!`),s.exit(0)}catch(e){console.error("Error generating Zig definitions:",e),s.exit(1)}});j.command("release [type]","Release a Zig package (changelog, bump, commit, tag, push, publish)").option("-y, --yes","Non-interactive mode (skip confirmation prompts)").option("--dry-run","Preview the release without changing anything").option("--no-changelog","Skip changelog generation").option("--no-push","Skip pushing the commit and tag").option("--no-publish","Skip publishing to the pantry registry").action(async(t,e)=>{let o=(t??"patch").toLowerCase();if(!["patch","minor","major"].includes(o))console.error(`error: invalid release type "${o}" (expected: patch | minor | major)`),s.exit(1);let{runRelease:i}=await import("../chunk-cwa30yjr.js"),c=await i({type:o,yes:e.yes,dryRun:e.dryRun,noChangelog:e.changelog===!1,noPush:e.push===!1,noPublish:e.publish===!1});s.exit(c.exitCode)});j.command("apps","List installed desktop applications with version info").option("-j, --json","Output as JSON").action(async(t)=>{try{let{scanInstalledApps:e}=await import("../chunk-
|
|
69
|
+
✅ Zig code generation complete!`),s.exit(0)}catch(e){console.error("Error generating Zig definitions:",e),s.exit(1)}});j.command("release [type]","Release a Zig package (changelog, bump, commit, tag, push, publish)").option("-y, --yes","Non-interactive mode (skip confirmation prompts)").option("--dry-run","Preview the release without changing anything").option("--no-changelog","Skip changelog generation").option("--no-push","Skip pushing the commit and tag").option("--no-publish","Skip publishing to the pantry registry").action(async(t,e)=>{let o=(t??"patch").toLowerCase();if(!["patch","minor","major"].includes(o))console.error(`error: invalid release type "${o}" (expected: patch | minor | major)`),s.exit(1);let{runRelease:i}=await import("../chunk-cwa30yjr.js"),c=await i({type:o,yes:e.yes,dryRun:e.dryRun,noChangelog:e.changelog===!1,noPush:e.push===!1,noPublish:e.publish===!1});s.exit(c.exitCode)});j.command("apps","List installed desktop applications with version info").option("-j, --json","Output as JSON").action(async(t)=>{try{let{scanInstalledApps:e}=await import("../chunk-03mwedeq.js"),o=e();if(t.json)console.log(JSON.stringify({success:!0,apps:o,total:o.length}));else{console.log(`
|
|
70
70
|
Installed Desktop Apps (${o.length}):
|
|
71
|
-
`),console.log("Application".padEnd(40)+"Version"),console.log("-".repeat(60));for(let i of o)console.log(`${i.name.padEnd(40)}${i.version}`)}s.exit(0)}catch(e){console.error("Error listing apps:",e),s.exit(1)}});j.command("apps-outdated","Check for outdated desktop applications").option("-j, --json","Output as JSON").action(async(t)=>{try{let{checkAppUpdates:e}=await import("../chunk-
|
|
71
|
+
`),console.log("Application".padEnd(40)+"Version"),console.log("-".repeat(60));for(let i of o)console.log(`${i.name.padEnd(40)}${i.version}`)}s.exit(0)}catch(e){console.error("Error listing apps:",e),s.exit(1)}});j.command("apps-outdated","Check for outdated desktop applications").option("-j, --json","Output as JSON").action(async(t)=>{try{let{checkAppUpdates:e}=await import("../chunk-03mwedeq.js");if(!t.json)console.log("Checking desktop apps for updates...");let o=await e(),i=o.filter((c)=>c.updateAvailable);if(t.json)console.log(JSON.stringify({success:!0,apps:o,outdated:i.length,total:o.length,timestamp:new Date().toISOString()}));else{if(i.length>0){console.log(`
|
|
72
72
|
Outdated Apps (${i.length}):
|
|
73
73
|
`),console.log("Application".padEnd(30)+"Current".padEnd(16)+"Latest".padEnd(16)+"Source"),console.log("-".repeat(75));for(let g of i)console.log(`${g.name.padEnd(30)}${g.currentVersion.padEnd(16)}${(g.latestVersion||"?").padEnd(16)}${g.source}`)}else console.log(`
|
|
74
74
|
All desktop apps are up to date!`);let c=o.filter((g)=>!g.updateAvailable&&g.source!=="system"&&g.source!=="unknown");if(c.length>0)console.log(`
|
|
75
|
-
${c.length} app(s) up to date, ${o.filter((g)=>g.source==="unknown").length} unchecked`)}s.exit(0)}catch(e){console.error("Error checking app updates:",e),s.exit(1)}});j.command("apps-update <name>","Update a desktop application from the pantry registry").action(async(t)=>{try{let{updateApp:e}=await import("../chunk-
|
|
75
|
+
${c.length} app(s) up to date, ${o.filter((g)=>g.source==="unknown").length} unchecked`)}s.exit(0)}catch(e){console.error("Error checking app updates:",e),s.exit(1)}});j.command("apps-update <name>","Update a desktop application from the pantry registry").action(async(t)=>{try{let{updateApp:e}=await import("../chunk-03mwedeq.js");console.log(`Updating ${t} from the pantry registry...`);let o=await e(t);if(o.success)console.log(`Successfully updated ${t} to ${o.version}`);else console.error(`Failed to update ${t}: ${o.error}`),s.exit(1);s.exit(0)}catch(e){console.error("Error updating app:",e),s.exit(1)}});j.command("install <pkg>","Install a system package (e.g. ziglang.org@0.17.0-dev)").option("--global","Link binaries into the user-level global bin so they appear on PATH").option("--install-dir <dir>","Where to download into (default: ./pantry)").option("--platform <target>","Install for a target platform (e.g. linux-x86_64)").option("--no-bin-links","Skip creating local .bin/ symlinks").option("--quiet","Suppress progress output").action(async(t,e)=>{let o=t.lastIndexOf("@"),i=o>0,c=i?t.slice(0,o):t,g=i?t.slice(o+1):"latest";try{let p=await R(c,g,{installDir:e.installDir,platform:pe(e.platform),createBinLinks:e.binLinks!==!1,quiet:e.quiet,globalBin:e.global?!0:void 0});if(!e.quiet){if(console.log(`
|
|
76
76
|
✓ ${p.name}@${p.version}`),console.log(` installed to: ${p.installPath}`),p.globalLinks&&p.globalLinks.length>0){if(console.log(` linked into: ${v.dirname(p.globalLinks[0])}`),!s.env.PATH?.split(v.delimiter).includes(v.dirname(p.globalLinks[0])))console.log(`
|
|
77
77
|
⚠ ${v.dirname(p.globalLinks[0])} is not on your PATH yet.`),console.log(" Run `ts-pantry shell-init --install` once to fix that.")}}s.exit(0)}catch(p){console.error(`Error installing ${t}:`,p instanceof Error?p.message:p),s.exit(1)}});function ue(t){let e=ye(t);if(e.length===0)return[];try{return D(e[0]).map((o)=>o.version&&o.version!=="latest"?`${o.name}@${String(o.version).replace(/^[\^~>=<]+/,"")}`:o.name)}catch{return[]}}j.command("env","Print the environment pantry-installed packages need, for a program to consume").option("--json","Print JSON instead of shell assignments").option("--dir <path>","A project directory, whose dependency file is included (default: cwd)").option("--install","Install anything the dependency file names that is missing").action(async(t)=>{let e=v.resolve(t.dir??s.cwd()),o=ue(e);if(t.install&&o.length>0)for(let g of o){let p=g.lastIndexOf("@"),S=p>0;await R(S?g.slice(0,p):g,S?g.slice(p+1):"latest",{globalBin:!0,quiet:!0}).catch((w)=>{console.error(`# could not install ${g}: ${w instanceof Error?w.message:w}`)})}let i=k(),c=[v.join(e,".bin"),i].filter((g)=>m.existsSync(g));if(t.json)console.log(JSON.stringify({path:c,PATH:[...c,s.env.PATH??""].filter(Boolean).join(v.delimiter),dependencies:o,globalBin:i},null,2)),s.exit(0);console.log(`export PATH="${[...c,"$PATH"].join(v.delimiter)}"`),s.exit(0)});j.command("shell-init","Print the shell snippet that puts pantry-installed packages on PATH").option("--install","Append the snippet to your shell rc file (idempotent)").option("--uninstall","Remove a previously installed snippet").option("--shell <shell>","Force a shell (zsh|bash|fish) instead of autodetect").action(async(t)=>{let e=t.shell??I();try{if(t.uninstall){let i=ve({shell:e});console.log(i.changed?`✓ Removed pantry shell-init from ${i.rcFile}`:`Nothing to remove (no pantry shell-init block in ${i.rcFile})`),s.exit(0)}if(t.install){let i=ke({shell:e});if(i.changed)console.log(`✓ Added pantry shell-init to ${i.rcFile}`),console.log(` Restart your shell or run: source ${i.rcFile}`);else console.log(`✓ Already integrated in ${i.rcFile}`);s.exit(0)}let o=O(e);if(s.stdout.isTTY){if(console.log(`# Detected shell: ${e}`),console.log(`# Global bin dir: ${k()}`),o)console.log(`# Append this to: ${o}`);console.log("# Or run: ts-pantry shell-init --install"),console.log()}s.stdout.write(W({shell:e})),s.exit(0)}catch(o){console.error("Error:",o instanceof Error?o.message:o),s.exit(1)}});j.command("build [context]","Build a Dockerfile into an OCI image (no Docker daemon required)").option("-f, --file <path>","Path to the Dockerfile (default: <context>/Dockerfile)").option("-t, --tag <tag>","Image tag, e.g. myapp:latest (repeatable)").option("--target <stage>","Target stage for a multi-stage build").option("--build-arg <kv>","Set a build arg KEY=VALUE (repeatable)").option("--platform <os/arch>","Target platform (default: linux/<host-arch>)").option("--output <dir>","Where to write the image archive + OCI layout (default: <context>/.pantry/images)").option("--run-mode <mode>","How to run RUN steps: auto|chroot|host|skip (default: auto)").option("--push","Push the built image to the pantry registry after building").option("--quiet","Suppress step output").action(async(t,e)=>{try{let o=[].concat(e.tag??[]),i={};for(let g of[].concat(e.buildArg??[])){let p=g.indexOf("=");if(p!==-1)i[g.slice(0,p)]=g.slice(p+1)}let c=await je({context:t??".",dockerfile:e.file,tags:o,target:e.target,buildArgs:i,platform:e.platform,outputDir:e.output,runMode:e.runMode,quiet:e.quiet});if(!e.quiet){if(console.log(`
|
|
78
78
|
✓ Built ${c.imageId}`),o.length)console.log(` tags: ${o.join(", ")}`);console.log(` archive: ${c.archivePath}`),console.log(` oci layout: ${c.ociLayoutPath}`)}if(e.push){let g=ee(o[0]||"app:latest");if(!e.quiet)console.log(`
|
package/dist/bin/desktop.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import{q}from"../chunk-7q8as4h2.js";import"../chunk-
|
|
2
|
+
import{q}from"../chunk-7q8as4h2.js";import"../chunk-t965ankb.js";import"../chunk-h6wpf5z0.js";import{G,K,fe,Ye}from"../chunk-y9k1j6rh.js";import{d}from"../chunk-35x1m26s.js";import{chmodSync as k,mkdirSync as h,renameSync as P,rmSync as b,writeFileSync as f}from"node:fs";import{homedir as S}from"node:os";import{isAbsolute as x,join as s}from"node:path";var a=(t)=>t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'");function D(t,e,r){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
3
3
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
4
4
|
<plist version="1.0"><dict>
|
|
5
5
|
<key>Label</key><string>dev.pantry.desktop</string>
|