ts-pantry 0.9.20 → 0.9.21
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 +7 -7
- package/dist/chunk-2dk28v6k.js +2 -0
- package/dist/chunk-2nfjspwd.js +1 -0
- package/dist/{chunk-t71cv3gr.js → chunk-9f0255fc.js} +1 -1
- package/dist/{chunk-2hbhg54n.js → chunk-b0zr0ad6.js} +1 -1
- package/dist/{chunk-vy4gt433.js → chunk-bmr9qds3.js} +1 -1
- package/dist/chunk-cdzdw53j.js +42 -0
- package/dist/chunk-f2c8kapq.js +2 -0
- package/dist/{chunk-j9mv6dze.js → chunk-h8phykmh.js} +1 -1
- package/dist/chunk-jym7xrra.js +2 -0
- package/dist/{chunk-th964914.js → chunk-k4yefwkp.js} +15 -15
- package/dist/chunk-nqztmdqz.js +275 -0
- package/dist/{chunk-5798tqhf.js → chunk-t8296krc.js} +1 -1
- package/dist/{chunk-33qtfw71.js → chunk-xkm30wah.js} +2 -2
- package/dist/chunk-y5rfbg9v.js +11 -0
- package/dist/consts.d.ts +1 -1
- package/dist/desktop-apps.d.ts +1 -0
- package/dist/packages/alacrittyorg.d.ts +1 -1
- package/dist/packages/alttabapp.d.ts +1 -1
- package/dist/packages/ansiblecom.d.ts +1 -1
- package/dist/packages/apktoolorg.d.ts +1 -1
- package/dist/packages/arkadedev.d.ts +1 -1
- package/dist/packages/atlasgoio.d.ts +1 -1
- package/dist/packages/augeasnet.d.ts +1 -1
- package/dist/packages/babashkaorg.d.ts +1 -1
- package/dist/packages/borepub.d.ts +1 -1
- package/dist/packages/bufbuild.d.ts +1 -1
- package/dist/packages/bytebasecom.d.ts +1 -1
- package/dist/packages/casdoororg.d.ts +1 -1
- package/dist/packages/ccachedev.d.ts +1 -1
- package/dist/packages/certbotefforg.d.ts +1 -1
- package/dist/packages/chezmoiio.d.ts +1 -1
- package/dist/packages/circlecicom.d.ts +1 -1
- package/dist/packages/cligithubcom.d.ts +1 -1
- package/dist/packages/cmakeorg.d.ts +1 -1
- package/dist/packages/cnqueryio.d.ts +1 -1
- package/dist/packages/codercom.d.ts +1 -1
- package/dist/packages/codevisualstudiocom.d.ts +1 -1
- package/dist/packages/cointopsh.d.ts +1 -1
- package/dist/packages/conftestdev.d.ts +1 -1
- package/dist/packages/convcogithubio.d.ts +1 -1
- package/dist/packages/cuelangorg.d.ts +1 -1
- package/dist/packages/cythonorg.d.ts +1 -1
- package/dist/packages/daggerio.d.ts +1 -1
- package/dist/packages/daytonaio.d.ts +1 -1
- package/dist/packages/dblabdanvergaracom.d.ts +1 -1
- package/dist/packages/denoland.d.ts +1 -1
- package/dist/packages/depotdev.d.ts +1 -1
- package/dist/packages/dgraphio.d.ts +1 -1
- package/dist/packages/direnvnet.d.ts +1 -1
- package/dist/packages/dotnetmicrosoftcom.d.ts +1 -1
- package/dist/packages/dozzledev.d.ts +1 -1
- package/dist/packages/dprintdev.d.ts +1 -1
- package/dist/packages/duckdborg.d.ts +1 -1
- package/dist/packages/elementsprojectorg.d.ts +1 -1
- package/dist/packages/encoredev.d.ts +1 -1
- package/dist/packages/etcdio.d.ts +1 -1
- package/dist/packages/fastlanetools.d.ts +1 -1
- package/dist/packages/flyio.d.ts +1 -1
- package/dist/packages/getcomposerorg.d.ts +1 -1
- package/dist/packages/getsynthcom.d.ts +1 -1
- package/dist/packages/getzolaorg.d.ts +1 -1
- package/dist/packages/gflagsgithubio.d.ts +1 -1
- package/dist/packages/ghostscriptcom.d.ts +1 -1
- package/dist/packages/gleamrun.d.ts +1 -1
- package/dist/packages/gohugoio.d.ts +1 -1
- package/dist/packages/goreleasercom.d.ts +1 -1
- package/dist/packages/gourceio.d.ts +1 -1
- package/dist/packages/graphitesilorg.d.ts +1 -1
- package/dist/packages/harfbuzzorg.d.ts +1 -1
- package/dist/packages/hasuraio.d.ts +1 -1
- package/dist/packages/helmsh.d.ts +1 -1
- package/dist/packages/htopdev.d.ts +1 -1
- package/dist/packages/httpieio.d.ts +1 -1
- package/dist/packages/huggingfaceco.d.ts +1 -1
- package/dist/packages/imagemagickorg.d.ts +1 -1
- package/dist/packages/infracostio.d.ts +1 -1
- package/dist/packages/ipythonorg.d.ts +1 -1
- package/dist/packages/irohcomputer.d.ts +1 -1
- package/dist/packages/istioio.d.ts +1 -1
- package/dist/packages/jbangdev.d.ts +1 -1
- package/dist/packages/jemallocnet.d.ts +1 -1
- package/dist/packages/jujuis.d.ts +1 -1
- package/dist/packages/julialangorg.d.ts +1 -1
- package/dist/packages/jumppaddev.d.ts +1 -1
- package/dist/packages/k3dio.d.ts +1 -1
- package/dist/packages/k6io.d.ts +1 -1
- package/dist/packages/kagglecom.d.ts +1 -1
- package/dist/packages/kubesharkco.d.ts +1 -1
- package/dist/packages/laravelcom.d.ts +1 -1
- package/dist/packages/lavinmqcom.d.ts +1 -1
- package/dist/packages/libcxxllvmorg.d.ts +1 -1
- package/dist/packages/libeventorg.d.ts +1 -1
- package/dist/packages/libexifgithubio.d.ts +1 -1
- package/dist/packages/libgdgithubio.d.ts +1 -1
- package/dist/packages/libssh2org.d.ts +1 -1
- package/dist/packages/libusbinfo.d.ts +1 -1
- package/dist/packages/libuvorg.d.ts +1 -1
- package/dist/packages/libvipsorg.d.ts +1 -1
- package/dist/packages/libziporg.d.ts +1 -1
- package/dist/packages/liteclicom.d.ts +1 -1
- package/dist/packages/littlecmscom.d.ts +1 -1
- package/dist/packages/llmdatasetteio.d.ts +1 -1
- package/dist/packages/llvmorg.d.ts +1 -1
- package/dist/packages/localaiio.d.ts +1 -1
- package/dist/packages/luarocksorg.d.ts +1 -1
- package/dist/packages/lxmlde.d.ts +1 -1
- package/dist/packages/macfusegithubio.d.ts +1 -1
- package/dist/packages/macvimorg.d.ts +1 -1
- package/dist/packages/mailpitaxllentorg.d.ts +1 -1
- package/dist/packages/maturinrs.d.ts +1 -1
- package/dist/packages/mavenapacheorg.d.ts +1 -1
- package/dist/packages/meilisearchcom.d.ts +1 -1
- package/dist/packages/mercurerocks.d.ts +1 -1
- package/dist/packages/mesonbuildcom.d.ts +1 -1
- package/dist/packages/misejdxdev.d.ts +1 -1
- package/dist/packages/mitmproxyorg.d.ts +1 -1
- package/dist/packages/mkcertdev.d.ts +1 -1
- package/dist/packages/moshorg.d.ts +1 -1
- package/dist/packages/msgpackorg.d.ts +1 -1
- package/dist/packages/neovimio.d.ts +1 -1
- package/dist/packages/networkxorg.d.ts +1 -1
- package/dist/packages/nginxorg.d.ts +1 -1
- package/dist/packages/nodejsorg.d.ts +1 -1
- package/dist/packages/nomadprojectio.d.ts +1 -1
- package/dist/packages/npmjscom.d.ts +1 -1
- package/dist/packages/nushellsh.d.ts +1 -1
- package/dist/packages/odigosio.d.ts +1 -1
- package/dist/packages/ohmyposhdev.d.ts +1 -1
- package/dist/packages/ollamaai.d.ts +1 -1
- package/dist/packages/onefetchdev.d.ts +1 -1
- package/dist/packages/openblasnet.d.ts +1 -1
- package/dist/packages/opencodeai.d.ts +1 -1
- package/dist/packages/openexrcom.d.ts +1 -1
- package/dist/packages/openjpegorg.d.ts +1 -1
- package/dist/packages/openmpllvmorg.d.ts +1 -1
- package/dist/packages/openpolicyagentorg.d.ts +1 -1
- package/dist/packages/opensearchorg.d.ts +1 -1
- package/dist/packages/opentofuorg.d.ts +1 -1
- package/dist/packages/orasland.d.ts +1 -1
- package/dist/packages/packerio.d.ts +1 -1
- package/dist/packages/phpnet.d.ts +1 -1
- package/dist/packages/pinnipeddev.d.ts +1 -1
- package/dist/packages/pipenvpypaio.d.ts +1 -1
- package/dist/packages/planetscalecom.d.ts +1 -1
- package/dist/packages/pocketbaseio.d.ts +1 -1
- package/dist/packages/podmanio.d.ts +1 -1
- package/dist/packages/postgrestorg.d.ts +1 -1
- package/dist/packages/prefixdev.d.ts +1 -1
- package/dist/packages/projenio.d.ts +1 -1
- package/dist/packages/projorg.d.ts +1 -1
- package/dist/packages/pulumiio.d.ts +1 -1
- package/dist/packages/pygmentsorg.d.ts +1 -1
- package/dist/packages/railwayapp.d.ts +1 -1
- package/dist/packages/rapidjsonorg.d.ts +1 -1
- package/dist/packages/rcloneorg.d.ts +1 -1
- package/dist/packages/rectangleapp.d.ts +1 -1
- package/dist/packages/rendercom.d.ts +1 -1
- package/dist/packages/replibytecom.d.ts +1 -1
- package/dist/packages/rhashsourceforgenet.d.ts +1 -1
- package/dist/packages/riotermcom.d.ts +1 -1
- package/dist/packages/rubocoporg.d.ts +1 -1
- package/dist/packages/rubygemsorg.d.ts +1 -1
- package/dist/packages/runatlantisio.d.ts +1 -1
- package/dist/packages/s3toolsorg.d.ts +1 -1
- package/dist/packages/scalewaycom.d.ts +1 -1
- package/dist/packages/seaweedfscom.d.ts +1 -1
- package/dist/packages/sentryio.d.ts +1 -1
- package/dist/packages/shellchecknet.d.ts +1 -1
- package/dist/packages/skaffolddev.d.ts +1 -1
- package/dist/packages/sniffnetnet.d.ts +1 -1
- package/dist/packages/soldeerxyz.d.ts +1 -1
- package/dist/packages/soliditylangorg.d.ts +1 -1
- package/dist/packages/sqlcdev.d.ts +1 -1
- package/dist/packages/squawkhqcom.d.ts +1 -1
- package/dist/packages/starshiprs.d.ts +1 -1
- package/dist/packages/statsapp.d.ts +1 -1
- package/dist/packages/steampipeio.d.ts +1 -1
- package/dist/packages/straceio.d.ts +1 -1
- package/dist/packages/streamlinkgithubio.d.ts +1 -1
- package/dist/packages/stripecom.d.ts +1 -1
- package/dist/packages/swiftorg.d.ts +1 -1
- package/dist/packages/symfonycom.d.ts +1 -1
- package/dist/packages/sympyorg.d.ts +1 -1
- package/dist/packages/syncthingnet.d.ts +1 -1
- package/dist/packages/tailwindcsscom.d.ts +1 -1
- package/dist/packages/tartrun.d.ts +1 -1
- package/dist/packages/taskfiledev.d.ts +1 -1
- package/dist/packages/terraformio.d.ts +1 -1
- package/dist/packages/terragruntgruntworkio.d.ts +1 -1
- package/dist/packages/terratagio.d.ts +1 -1
- package/dist/packages/tiltdev.d.ts +1 -1
- package/dist/packages/tinygoorg.d.ts +1 -1
- package/dist/packages/tldrsh.d.ts +1 -1
- package/dist/packages/toxwiki.d.ts +1 -1
- package/dist/packages/traefikio.d.ts +1 -1
- package/dist/packages/tursotech.d.ts +1 -1
- package/dist/packages/typescriptlangorg.d.ts +1 -1
- package/dist/packages/uriparsergithubio.d.ts +1 -1
- package/dist/packages/vapoursynthcom.d.ts +1 -1
- package/dist/packages/vaultprojectio.d.ts +1 -1
- package/dist/packages/wavpackcom.d.ts +1 -1
- package/dist/packages/werfio.d.ts +1 -1
- package/dist/packages/xcfiledev.d.ts +1 -1
- package/dist/packages/xkbcommonorg.d.ts +1 -1
- package/dist/packages/zarfdev.d.ts +1 -1
- package/dist/packages/zeddev.d.ts +1 -1
- package/dist/packages/zeromqorg.d.ts +1 -1
- package/dist/packages/ziglangorg.d.ts +3 -3
- package/dist/packages/zotregistrydev.d.ts +1 -1
- package/dist/packages/zrokio.d.ts +1 -1
- package/dist/pantry-api.d.ts +1 -0
- package/dist/src/index.js +1 -1
- package/dist/testing/index.d.ts +3 -0
- package/package.json +3 -4
- package/dist/chunk-c5xmxyxn.js +0 -2
- package/dist/chunk-hxhs2gtk.js +0 -2
- package/dist/chunk-r8pej0xx.js +0 -275
- package/dist/chunk-tjxmz5d2.js +0 -42
- package/dist/chunk-w6phftp9.js +0 -11
- package/dist/chunk-zddfmw54.js +0 -2
- package/dist/chunk-zsgm3kjz.js +0 -1
- package/scripts/pantry-cli.ts +0 -319
package/dist/chunk-zsgm3kjz.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{lb as a,mb as b,nb as c,ob as d,pb as e}from"./chunk-c5xmxyxn.js";import"./chunk-yjz3e391.js";export{d as PACKAGE_ALIASES,c as DEFAULT_TIMEOUT_MS,b as DEFAULT_CACHE_EXPIRATION_MINUTES,a as DEFAULT_CACHE_DIR,e as ALL_KNOWN_PACKAGES};
|
package/scripts/pantry-cli.ts
DELETED
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Pantry CLI
|
|
5
|
-
*
|
|
6
|
-
* A CLI tool that uses your custom S3 registry for packages
|
|
7
|
-
* built with custom extensions (like PHP with pdo_pgsql).
|
|
8
|
-
*
|
|
9
|
-
* Usage:
|
|
10
|
-
* pantry install # Install packages from pantry.yaml
|
|
11
|
-
* pantry shell # Start a shell with packages in PATH
|
|
12
|
-
* pantry run <cmd> # Run a command with packages in PATH
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import { existsSync, readFileSync, mkdirSync } from 'node:fs'
|
|
16
|
-
import { execSync, spawn } from 'node:child_process'
|
|
17
|
-
import { join } from 'node:path'
|
|
18
|
-
import { homedir } from 'node:os'
|
|
19
|
-
|
|
20
|
-
const INSTALL_DIR = join(homedir(), '.pantry')
|
|
21
|
-
const DEFAULT_BUCKET = 'pantry-registry'
|
|
22
|
-
const DEFAULT_REGION = 'us-east-1'
|
|
23
|
-
|
|
24
|
-
interface Config {
|
|
25
|
-
dependencies: Record<string, string>
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function findConfig(): string | null {
|
|
29
|
-
const candidates = ['pantry.yaml', 'deps.yaml', '.pantry.yaml']
|
|
30
|
-
|
|
31
|
-
for (const candidate of candidates) {
|
|
32
|
-
if (existsSync(candidate)) {
|
|
33
|
-
return candidate
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return null
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function parseConfig(path: string): Config {
|
|
41
|
-
const content = readFileSync(path, 'utf-8')
|
|
42
|
-
const config: Config = { dependencies: {} }
|
|
43
|
-
|
|
44
|
-
const lines = content.split('\n')
|
|
45
|
-
let inDeps = false
|
|
46
|
-
|
|
47
|
-
for (const line of lines) {
|
|
48
|
-
const trimmed = line.trim()
|
|
49
|
-
|
|
50
|
-
if (trimmed === 'dependencies:') {
|
|
51
|
-
inDeps = true
|
|
52
|
-
continue
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (inDeps && line.match(/^\s+\S/)) {
|
|
56
|
-
const match = trimmed.match(/^([^:]+):\s*(.+)$/)
|
|
57
|
-
if (match) {
|
|
58
|
-
config.dependencies[match[1].trim()] = match[2].trim().replace(/['"]/g, '')
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
else if (inDeps && !line.match(/^\s/) && trimmed !== '') {
|
|
62
|
-
inDeps = false
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return config
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function getInstalledPackagePaths(packages: string[]): string[] {
|
|
70
|
-
const paths: string[] = []
|
|
71
|
-
|
|
72
|
-
for (const pkg of packages) {
|
|
73
|
-
const binDir = join(INSTALL_DIR, pkg, 'current', 'bin')
|
|
74
|
-
const sbinDir = join(INSTALL_DIR, pkg, 'current', 'sbin')
|
|
75
|
-
|
|
76
|
-
if (existsSync(binDir)) paths.push(binDir)
|
|
77
|
-
if (existsSync(sbinDir)) paths.push(sbinDir)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return paths
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function getLibraryPaths(packages: string[]): string[] {
|
|
84
|
-
const paths: string[] = []
|
|
85
|
-
|
|
86
|
-
for (const pkg of packages) {
|
|
87
|
-
const libDir = join(INSTALL_DIR, pkg, 'current', 'lib')
|
|
88
|
-
if (existsSync(libDir)) paths.push(libDir)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return paths
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
async function install(bucket: string, region: string): Promise<boolean> {
|
|
95
|
-
const configPath = findConfig()
|
|
96
|
-
|
|
97
|
-
if (!configPath) {
|
|
98
|
-
console.error('❌ No pantry.yaml or deps.yaml found in current directory')
|
|
99
|
-
return false
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
console.log(`📦 Installing from ${configPath}...`)
|
|
103
|
-
|
|
104
|
-
// Run the download script
|
|
105
|
-
const scriptPath = join(import.meta.dir, 'download-from-s3.ts')
|
|
106
|
-
const cmd = `bun "${scriptPath}" -c "${configPath}" -b "${bucket}" -r "${region}"`
|
|
107
|
-
|
|
108
|
-
try {
|
|
109
|
-
execSync(cmd, { stdio: 'inherit' })
|
|
110
|
-
return true
|
|
111
|
-
}
|
|
112
|
-
catch (error) {
|
|
113
|
-
return false
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function shellEnv(packages: string[]): Record<string, string> {
|
|
118
|
-
const binPaths = getInstalledPackagePaths(packages)
|
|
119
|
-
const libPaths = getLibraryPaths(packages)
|
|
120
|
-
|
|
121
|
-
const env = { ...process.env } as Record<string, string>
|
|
122
|
-
|
|
123
|
-
if (binPaths.length > 0) {
|
|
124
|
-
env.PATH = [...binPaths, process.env.PATH || ''].join(':')
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (libPaths.length > 0) {
|
|
128
|
-
env.LD_LIBRARY_PATH = [...libPaths, process.env.LD_LIBRARY_PATH || ''].join(':')
|
|
129
|
-
env.DYLD_LIBRARY_PATH = [...libPaths, process.env.DYLD_LIBRARY_PATH || ''].join(':')
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// Set custom indicator
|
|
133
|
-
env.PANTRY_CUSTOM = '1'
|
|
134
|
-
env.PANTRY_DIR = INSTALL_DIR
|
|
135
|
-
|
|
136
|
-
return env
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
async function startShell(packages: string[]): Promise<void> {
|
|
140
|
-
const env = shellEnv(packages)
|
|
141
|
-
const shell = process.env.SHELL || '/bin/bash'
|
|
142
|
-
|
|
143
|
-
console.log(`\n🐚 Starting shell with ${packages.length} packages in PATH`)
|
|
144
|
-
console.log(` Packages: ${packages.join(', ')}`)
|
|
145
|
-
console.log(` Exit with 'exit' or Ctrl+D\n`)
|
|
146
|
-
|
|
147
|
-
const child = spawn(shell, ['-i'], {
|
|
148
|
-
stdio: 'inherit',
|
|
149
|
-
env,
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
await new Promise<void>((resolve) => {
|
|
153
|
-
child.on('close', () => resolve())
|
|
154
|
-
})
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
async function runCommand(packages: string[], args: string[]): Promise<number> {
|
|
158
|
-
const env = shellEnv(packages)
|
|
159
|
-
|
|
160
|
-
const child = spawn(args[0], args.slice(1), {
|
|
161
|
-
stdio: 'inherit',
|
|
162
|
-
env,
|
|
163
|
-
})
|
|
164
|
-
|
|
165
|
-
return new Promise((resolve) => {
|
|
166
|
-
child.on('close', (code) => resolve(code || 0))
|
|
167
|
-
})
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function showStatus(packages: string[]): void {
|
|
171
|
-
console.log(`\n📊 Pantry Status`)
|
|
172
|
-
console.log(`${'='.repeat(50)}`)
|
|
173
|
-
console.log(`Install directory: ${INSTALL_DIR}`)
|
|
174
|
-
console.log(`\nInstalled packages:`)
|
|
175
|
-
|
|
176
|
-
for (const pkg of packages) {
|
|
177
|
-
const pkgDir = join(INSTALL_DIR, pkg)
|
|
178
|
-
const currentLink = join(pkgDir, 'current')
|
|
179
|
-
|
|
180
|
-
if (existsSync(currentLink)) {
|
|
181
|
-
try {
|
|
182
|
-
const version = readFileSync(currentLink, 'utf-8').trim() ||
|
|
183
|
-
execSync(`readlink "${currentLink}"`, { encoding: 'utf-8' }).trim()
|
|
184
|
-
console.log(` ✅ ${pkg} @ ${version}`)
|
|
185
|
-
}
|
|
186
|
-
catch {
|
|
187
|
-
console.log(` ✅ ${pkg}`)
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
else if (existsSync(pkgDir)) {
|
|
191
|
-
console.log(` ⚠️ ${pkg} (no current version linked)`)
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
console.log(` ❌ ${pkg} (not installed)`)
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
async function main(): Promise<void> {
|
|
200
|
-
const args = process.argv.slice(2)
|
|
201
|
-
const command = args[0]
|
|
202
|
-
|
|
203
|
-
// Parse global options
|
|
204
|
-
let bucket = DEFAULT_BUCKET
|
|
205
|
-
let region = DEFAULT_REGION
|
|
206
|
-
|
|
207
|
-
const bucketIdx = args.indexOf('--bucket')
|
|
208
|
-
if (bucketIdx !== -1 && args[bucketIdx + 1]) {
|
|
209
|
-
bucket = args[bucketIdx + 1]
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const regionIdx = args.indexOf('--region')
|
|
213
|
-
if (regionIdx !== -1 && args[regionIdx + 1]) {
|
|
214
|
-
region = args[regionIdx + 1]
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// Get config for package list
|
|
218
|
-
const configPath = findConfig()
|
|
219
|
-
const config = configPath ? parseConfig(configPath) : { dependencies: {} }
|
|
220
|
-
const packages = Object.keys(config.dependencies)
|
|
221
|
-
|
|
222
|
-
switch (command) {
|
|
223
|
-
case 'install':
|
|
224
|
-
case 'i':
|
|
225
|
-
const success = await install(bucket, region)
|
|
226
|
-
process.exit(success ? 0 : 1)
|
|
227
|
-
break
|
|
228
|
-
|
|
229
|
-
case 'shell':
|
|
230
|
-
case 'sh':
|
|
231
|
-
if (packages.length === 0) {
|
|
232
|
-
console.error('❌ No packages defined in pantry.yaml')
|
|
233
|
-
process.exit(1)
|
|
234
|
-
}
|
|
235
|
-
await startShell(packages)
|
|
236
|
-
break
|
|
237
|
-
|
|
238
|
-
case 'run':
|
|
239
|
-
case 'exec':
|
|
240
|
-
if (args.length < 2) {
|
|
241
|
-
console.error('Usage: pantry run <command> [args...]')
|
|
242
|
-
process.exit(1)
|
|
243
|
-
}
|
|
244
|
-
const exitCode = await runCommand(packages, args.slice(1))
|
|
245
|
-
process.exit(exitCode)
|
|
246
|
-
break
|
|
247
|
-
|
|
248
|
-
case 'status':
|
|
249
|
-
case 'list':
|
|
250
|
-
showStatus(packages)
|
|
251
|
-
break
|
|
252
|
-
|
|
253
|
-
case 'env':
|
|
254
|
-
// Print environment variables for sourcing
|
|
255
|
-
const env = shellEnv(packages)
|
|
256
|
-
console.log(`export PATH="${env.PATH}"`)
|
|
257
|
-
if (env.LD_LIBRARY_PATH) {
|
|
258
|
-
console.log(`export LD_LIBRARY_PATH="${env.LD_LIBRARY_PATH}"`)
|
|
259
|
-
}
|
|
260
|
-
if (env.DYLD_LIBRARY_PATH) {
|
|
261
|
-
console.log(`export DYLD_LIBRARY_PATH="${env.DYLD_LIBRARY_PATH}"`)
|
|
262
|
-
}
|
|
263
|
-
break
|
|
264
|
-
|
|
265
|
-
case 'help':
|
|
266
|
-
case '--help':
|
|
267
|
-
case '-h':
|
|
268
|
-
default:
|
|
269
|
-
console.log(`
|
|
270
|
-
pantry - Custom package manager using your S3 registry
|
|
271
|
-
|
|
272
|
-
Usage:
|
|
273
|
-
pantry <command> [options]
|
|
274
|
-
|
|
275
|
-
Commands:
|
|
276
|
-
install, i Install packages from pantry.yaml
|
|
277
|
-
shell, sh Start an interactive shell with packages in PATH
|
|
278
|
-
run, exec Run a command with packages in PATH
|
|
279
|
-
status, list Show installed package status
|
|
280
|
-
env Print environment variables for sourcing
|
|
281
|
-
help Show this help message
|
|
282
|
-
|
|
283
|
-
Options:
|
|
284
|
-
--bucket <name> S3 bucket name (default: ${DEFAULT_BUCKET})
|
|
285
|
-
--region <region> AWS region (default: ${DEFAULT_REGION})
|
|
286
|
-
|
|
287
|
-
Examples:
|
|
288
|
-
# Install all packages from pantry.yaml
|
|
289
|
-
pantry install
|
|
290
|
-
|
|
291
|
-
# Start a shell with packages available
|
|
292
|
-
pantry shell
|
|
293
|
-
|
|
294
|
-
# Run PHP with custom extensions
|
|
295
|
-
pantry run php -v
|
|
296
|
-
|
|
297
|
-
# Run composer install
|
|
298
|
-
pantry run composer install
|
|
299
|
-
|
|
300
|
-
# Source environment in current shell
|
|
301
|
-
eval $(pantry env)
|
|
302
|
-
|
|
303
|
-
Configuration:
|
|
304
|
-
Create a pantry.yaml in your project:
|
|
305
|
-
|
|
306
|
-
dependencies:
|
|
307
|
-
php.net: ^8.4
|
|
308
|
-
getcomposer.org: ^2
|
|
309
|
-
postgresql.org: ^17
|
|
310
|
-
redis.io: ^7
|
|
311
|
-
`)
|
|
312
|
-
break
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
main().catch((error) => {
|
|
317
|
-
console.error('Error:', error.message)
|
|
318
|
-
process.exit(1)
|
|
319
|
-
})
|