ts-pantry 0.11.21 → 0.11.27

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.
Files changed (96) hide show
  1. package/dist/bin/cli.js +98 -98
  2. package/dist/installer.d.ts +3 -0
  3. package/dist/packages/ansiblecom.d.ts +1 -1
  4. package/dist/packages/anthropic.com/claude-code.d.ts +1 -1
  5. package/dist/packages/apps/codexopenaicom.d.ts +1 -1
  6. package/dist/packages/apps/cursorcom.d.ts +1 -1
  7. package/dist/packages/apps/diabrowsercom.d.ts +1 -1
  8. package/dist/packages/apps/discordcom.d.ts +1 -1
  9. package/dist/packages/apps/lmstudioai.d.ts +1 -1
  10. package/dist/packages/apps/obsidianmd.d.ts +1 -1
  11. package/dist/packages/apps/slackcom.d.ts +1 -1
  12. package/dist/packages/apps/statsapp.d.ts +1 -1
  13. package/dist/packages/apps/whatsappcom.d.ts +1 -1
  14. package/dist/packages/apps/zeddev.d.ts +1 -1
  15. package/dist/packages/argoproj.github.io/cd.d.ts +1 -1
  16. package/dist/packages/argoproj.github.io/workflows.d.ts +1 -1
  17. package/dist/packages/arkadedev.d.ts +1 -1
  18. package/dist/packages/aux4io.d.ts +1 -1
  19. package/dist/packages/buildpacksio.d.ts +1 -1
  20. package/dist/packages/bytebasecom.d.ts +1 -1
  21. package/dist/packages/casdoororg.d.ts +1 -1
  22. package/dist/packages/circlecicom.d.ts +1 -1
  23. package/dist/packages/cnqueryio.d.ts +1 -1
  24. package/dist/packages/coder.com/code-server.d.ts +1 -1
  25. package/dist/packages/codercom.d.ts +1 -1
  26. package/dist/packages/crates.io/qsv.d.ts +1 -1
  27. package/dist/packages/dblabdanvergaracom.d.ts +1 -1
  28. package/dist/packages/depotdev.d.ts +1 -1
  29. package/dist/packages/diggerdev.d.ts +1 -1
  30. package/dist/packages/dotnetmicrosoftcom.d.ts +1 -1
  31. package/dist/packages/dozzledev.d.ts +1 -1
  32. package/dist/packages/eksctlio.d.ts +1 -1
  33. package/dist/packages/encoredev.d.ts +1 -1
  34. package/dist/packages/fastlanetools.d.ts +1 -1
  35. package/dist/packages/flyio.d.ts +1 -1
  36. package/dist/packages/getzolaorg.d.ts +1 -1
  37. package/dist/packages/github.com/chainguard-dev/apko.d.ts +1 -1
  38. package/dist/packages/github.com/ggerganov/llama.cpp.d.ts +1 -1
  39. package/dist/packages/github.com/mail-os/mail.d.ts +1 -1
  40. package/dist/packages/github.com/router-for-me/CLIProxyAPI.d.ts +1 -1
  41. package/dist/packages/github.com/tw93/mole.d.ts +1 -1
  42. package/dist/packages/gohugoio.d.ts +1 -1
  43. package/dist/packages/harfbuzzorg.d.ts +1 -1
  44. package/dist/packages/harlequinsh.d.ts +1 -1
  45. package/dist/packages/hatchpypaio.d.ts +1 -1
  46. package/dist/packages/helmsh.d.ts +1 -1
  47. package/dist/packages/htopdev.d.ts +1 -1
  48. package/dist/packages/julialangorg.d.ts +1 -1
  49. package/dist/packages/jupyterorg.d.ts +1 -1
  50. package/dist/packages/k6io.d.ts +1 -1
  51. package/dist/packages/kubesharkco.d.ts +1 -1
  52. package/dist/packages/lavinmqcom.d.ts +1 -1
  53. package/dist/packages/libgeosorg.d.ts +1 -1
  54. package/dist/packages/libgit2org.d.ts +1 -1
  55. package/dist/packages/materializecom.d.ts +1 -1
  56. package/dist/packages/meilisearchcom.d.ts +1 -1
  57. package/dist/packages/mesonbuildcom.d.ts +1 -1
  58. package/dist/packages/misejdxdev.d.ts +1 -1
  59. package/dist/packages/mongodb.com/shell.d.ts +1 -1
  60. package/dist/packages/moonrepo.dev/moon.d.ts +1 -1
  61. package/dist/packages/nomadprojectio.d.ts +1 -1
  62. package/dist/packages/numpyorg.d.ts +1 -1
  63. package/dist/packages/nushellsh.d.ts +1 -1
  64. package/dist/packages/odigosio.d.ts +1 -1
  65. package/dist/packages/ohmyposhdev.d.ts +1 -1
  66. package/dist/packages/ollamaai.d.ts +1 -1
  67. package/dist/packages/opencodeai.d.ts +1 -1
  68. package/dist/packages/openshiftcom.d.ts +1 -1
  69. package/dist/packages/planetscalecom.d.ts +1 -1
  70. package/dist/packages/pnpmio.d.ts +1 -1
  71. package/dist/packages/pocketbaseio.d.ts +1 -1
  72. package/dist/packages/podmanio.d.ts +1 -1
  73. package/dist/packages/postgresqlorg.d.ts +1 -1
  74. package/dist/packages/postgrestorg.d.ts +1 -1
  75. package/dist/packages/prefixdev.d.ts +1 -1
  76. package/dist/packages/projenio.d.ts +1 -1
  77. package/dist/packages/pulumiio.d.ts +1 -1
  78. package/dist/packages/qpdfsourceforgeio.d.ts +1 -1
  79. package/dist/packages/railwayapp.d.ts +1 -1
  80. package/dist/packages/riotermcom.d.ts +1 -1
  81. package/dist/packages/rsyncsambaorg.d.ts +1 -1
  82. package/dist/packages/sconsorg.d.ts +1 -1
  83. package/dist/packages/spacetimedbcom.d.ts +1 -1
  84. package/dist/packages/steampipeio.d.ts +1 -1
  85. package/dist/packages/stripecom.d.ts +1 -1
  86. package/dist/packages/terragruntgruntworkio.d.ts +1 -1
  87. package/dist/packages/tiltdev.d.ts +1 -1
  88. package/dist/packages/toxwiki.d.ts +1 -1
  89. package/dist/packages/wailsio.d.ts +1 -1
  90. package/dist/packages/werfio.d.ts +1 -1
  91. package/dist/packages/xplrdev.d.ts +1 -1
  92. package/dist/packages/ziglangorg.d.ts +1 -1
  93. package/dist/src/index.js +97 -236
  94. package/dist/src/testing/index.js +1 -1
  95. package/dist/testing/index.d.ts +47 -25
  96. package/package.json +1 -1
@@ -1 +1 @@
1
- import{createRequire as h}from"node:module";var{defineProperty:q,getOwnPropertyNames:Y,getOwnPropertyDescriptor:Z}=Object,a=Object.prototype.hasOwnProperty;function I(s){return this[s]}var ys=(s)=>{var o=(z??=new WeakMap).get(s),t;if(o)return o;if(o=q({},"__esModule",{value:!0}),s&&typeof s==="object"||typeof s==="function"){for(var n of Y(s))if(!a.call(o,n))q(o,n,{get:I.bind(s,n),enumerable:!(t=Z(s,n))||t.enumerable})}return z.set(s,o),o},z;var W=(s)=>s;function _(s,o){this[s]=W.bind(null,o)}var ls=(s,o)=>{for(var t in o)q(s,t,{get:o[t],enumerable:!0,configurable:!0,set:_.bind(o,t)})};var y=(s,o)=>()=>(s&&(o=s(s=0)),o);var Cs=h(import.meta.url);import{execSync as m}from"node:child_process";function p(){if(B)return;B=!0;let s=()=>{for(let o of l)try{m(`pantry stop ${o}`,{stdio:"ignore",timeout:1e4})}catch{}l.clear()};process.on("exit",s),process.on("SIGINT",()=>{s(),process.exit(130)}),process.on("SIGTERM",()=>{s(),process.exit(143)})}function C(s,o=!1){let t={encoding:"utf-8",timeout:30000,stdio:o?"pipe":["pipe","pipe","pipe"]};return m(`pantry ${s}`,t)}function v(s){let o=s.match(/Name:\s+(\S+)/)?.[1]??"",t=/Status:\s+running/i.test(s),n=s.match(/Port:\s+(\d+)/),r=s.match(/PID:\s+(\d+)/),x=s.match(/Data Dir:\s+(.+)/);return{name:o,running:t,port:n?Number.parseInt(n[1],10):null,pid:r?Number.parseInt(r[1],10):null,dataDir:x?x[1].trim():null}}class e{config;_startedByUs=!1;constructor(s){this.config={name:s.name,port:s.port??0,readyTimeoutMs:s.readyTimeoutMs??15000,pollIntervalMs:s.pollIntervalMs??200,quiet:s.quiet??!0}}static isAvailable(){try{return m("pantry --version",{stdio:"ignore",timeout:5000}),!0}catch{return!1}}status(){try{let s=C(`inspect ${this.config.name}`,!0);return v(s)}catch{return{name:this.config.name,running:!1,port:null,pid:null,dataDir:null}}}isRunning(){return this.status().running}getPort(){return this.status().port}async start(){if(p(),this.isRunning())return this.status();return C(`start ${this.config.name}`,this.config.quiet),this._startedByUs=!0,l.add(this.config.name),await this.waitReady(),this.status()}async stop(){if(!this._startedByUs)return;try{C(`stop ${this.config.name}`,this.config.quiet)}catch{}l.delete(this.config.name),this._startedByUs=!1}async forceStop(){try{C(`stop ${this.config.name}`,this.config.quiet)}catch{}l.delete(this.config.name),this._startedByUs=!1}async ensureRunning(){if(this.isRunning())return this.status();return this.start()}async waitReady(){let s=Date.now()+this.config.readyTimeoutMs;while(Date.now()<s){if(this.isRunning())return;await new Promise((o)=>setTimeout(o,this.config.pollIntervalMs))}throw Error(`Service '${this.config.name}' did not become ready within ${this.config.readyTimeoutMs}ms`)}}var l,B=!1;var w=y(()=>{l=new Set});async function M(s){let o=await F.ensureRunning();return{port:s?.port??o.port??5432,host:s?.host??"localhost",database:s?.database??"postgres",username:s?.username??process.env.USER??"postgres"}}async function i(){await F.stop()}function E(s){let o=null;return{get connection(){if(!o)throw Error("Postgres not started. Ensure beforeAll has run.");return o},beforeAll:async()=>{o=await M(s)},afterAll:async()=>{await i(),o=null}}}async function j(s,o){let t=await M(o);try{return await s(t)}finally{if(o?.stopAfter!==!1)await i()}}var F;var G=y(()=>{w();F=new e({name:"postgres"})});async function A(s){let o=await H.ensureRunning(),t=s?.port??o.port??6379,n=s?.host??"localhost";return{port:t,host:n,url:`redis://${n}:${t}`}}async function T(){await H.stop()}function f(s){let o=null;return{get connection(){if(!o)throw Error("Redis not started. Ensure beforeAll has run.");return o},beforeAll:async()=>{o=await A(s)},afterAll:async()=>{await T(),o=null}}}async function k(s,o){let t=await A(o);try{return await s(t)}finally{if(o?.stopAfter!==!1)await T()}}var H;var J=y(()=>{w();H=new e({name:"redis"})});async function b(s){let o=await K.ensureRunning();return{port:s?.port??o.port??3306,host:s?.host??"localhost",database:s?.database??"test",username:s?.username??"root"}}async function P(){await K.stop()}function S(s){let o=null;return{get connection(){if(!o)throw Error("MySQL not started. Ensure beforeAll has run.");return o},beforeAll:async()=>{o=await b(s)},afterAll:async()=>{await P(),o=null}}}async function D(s,o){let t=await b(o);try{return await s(t)}finally{if(o?.stopAfter!==!1)await P()}}var K;var N=y(()=>{w();K=new e({name:"mysql"})});import{existsSync as Q,mkdirSync as U,mkdtempSync as g,rmSync as V,writeFileSync as d}from"node:fs";import{tmpdir as c}from"node:os";import{join as $}from"node:path";function ss(){if(O)return;O=!0;let s=()=>{for(let o of R)try{if(Q(o))V(o,{recursive:!0,force:!0})}catch{}R.clear()};process.on("exit",s),process.on("SIGINT",()=>{s(),process.exit(130)}),process.on("SIGTERM",()=>{s(),process.exit(143)})}function L(s="pantry-test-"){ss();let o=g($(c(),s));return R.add(o),o}function u(s){R.delete(s);try{if(Q(s))V(s,{recursive:!0,force:!0})}catch{}}async function os(s,o){let t=L(s);try{return await o(t)}finally{u(t)}}function ts(s,o){let t=L(s);try{return o(t)}finally{u(t)}}function ns(s,o,t){let n=$(s,o),r=n.substring(0,n.lastIndexOf("/"));if(r&&!Q(r))U(r,{recursive:!0});return d(n,t),n}function es(s,o){let t=$(s,o);return U(t,{recursive:!0}),t}var R,O=!1;var X=y(()=>{R=new Set});var rs=y(()=>{w();G();J();N();X()});rs();export{ts as withTempDirSync,os as withTempDir,k as withRedis,j as withPostgres,D as withMysql,f as useRedis,E as usePostgres,S as useMysql,T as stopRedis,i as stopPostgres,P as stopMysql,A as startRedis,M as startPostgres,b as startMysql,u as removeTempDir,ns as createTestFile,es as createTestDir,L as createTempDir,e as PantryService};
1
+ import{execSync as H}from"node:child_process";var b=new Set,O=!1;function v(){if(O)return;O=!0;let n=()=>{for(let o of b)try{H(`pantry stop ${o}`,{stdio:"ignore",timeout:1e4})}catch{}b.clear()};process.on("exit",n),process.on("SIGINT",()=>{n(),process.exit(130)}),process.on("SIGTERM",()=>{n(),process.exit(143)})}function R(n,o=!1){let C={encoding:"utf-8",timeout:30000,stdio:o?"pipe":["pipe","pipe","pipe"]};return H(`pantry ${n}`,C)}function P(n){let o=n.match(/Name:\s+(\S+)/)?.[1]??"",C=/Status:\s+running/i.test(n),A=n.match(/Port:\s+(\d+)/),w=n.match(/PID:\s+(\d+)/),N=n.match(/Data Dir:\s+(.+)/);return{name:o,running:C,port:A?Number.parseInt(A[1],10):null,pid:w?Number.parseInt(w[1],10):null,dataDir:N?N[1].trim():null}}class l{config;_startedByUs=!1;constructor(n){this.config={name:n.name,port:n.port??0,readyTimeoutMs:n.readyTimeoutMs??15000,pollIntervalMs:n.pollIntervalMs??200,quiet:n.quiet??!0}}static isAvailable(){try{return H("pantry --version",{stdio:"ignore",timeout:5000}),!0}catch{return!1}}status(){try{let n=R(`inspect ${this.config.name}`,!0);return P(n)}catch{return{name:this.config.name,running:!1,port:null,pid:null,dataDir:null}}}isRunning(){return this.status().running}getPort(){return this.status().port}async start(){if(v(),this.isRunning())return this.status();return R(`start ${this.config.name}`,this.config.quiet),this._startedByUs=!0,b.add(this.config.name),await this.waitReady(),this.status()}async stop(){if(!this._startedByUs)return;try{R(`stop ${this.config.name}`,this.config.quiet)}catch{}b.delete(this.config.name),this._startedByUs=!1}async forceStop(){try{R(`stop ${this.config.name}`,this.config.quiet)}catch{}b.delete(this.config.name),this._startedByUs=!1}async ensureRunning(){if(this.isRunning())return this.status();return this.start()}async waitReady(){let n=Date.now()+this.config.readyTimeoutMs;while(Date.now()<n){if(this.isRunning())return;await new Promise((o)=>setTimeout(o,this.config.pollIntervalMs))}throw Error(`Service '${this.config.name}' did not become ready within ${this.config.readyTimeoutMs}ms`)}}var U=new l({name:"mysql"});async function q(n){let o=await U.ensureRunning();return{port:n?.port??o.port??3306,host:n?.host??"localhost",database:n?.database??"test",username:n?.username??"root"}}async function Q(){await U.stop()}function V(n){let o=null;return{get connection(){if(!o)throw Error("MySQL not started. Ensure beforeAll has run.");return o},beforeAll:async()=>{o=await q(n)},afterAll:async()=>{await Q(),o=null}}}async function X(n,o){let C=await q(o);try{return await n(C)}finally{if(o?.stopAfter!==!1)await Q()}}var Y=new l({name:"postgres"});async function $(n){let o=await Y.ensureRunning();return{port:n?.port??o.port??5432,host:n?.host??"localhost",database:n?.database??"postgres",username:n?.username??process.env.USER??"postgres"}}async function L(){await Y.stop()}function Z(n){let o=null;return{get connection(){if(!o)throw Error("Postgres not started. Ensure beforeAll has run.");return o},beforeAll:async()=>{o=await $(n)},afterAll:async()=>{await L(),o=null}}}async function I(n,o){let C=await $(o);try{return await n(C)}finally{if(o?.stopAfter!==!1)await L()}}var W=new l({name:"redis"});async function M(n){let o=await W.ensureRunning(),C=n?.port??o.port??6379,A=n?.host??"localhost";return{port:C,host:A,url:`redis://${A}:${C}`}}async function y(){await W.stop()}function _(n){let o=null;return{get connection(){if(!o)throw Error("Redis not started. Ensure beforeAll has run.");return o},beforeAll:async()=>{o=await M(n)},afterAll:async()=>{await y(),o=null}}}async function E(n,o){let C=await M(o);try{return await n(C)}finally{if(o?.stopAfter!==!1)await y()}}import{existsSync as J,mkdirSync as F,mkdtempSync as f,rmSync as x,writeFileSync as s}from"node:fs";import{tmpdir as S}from"node:os";import{join as K}from"node:path";var z=new Set,j=!1;function h(){if(j)return;j=!0;let n=()=>{for(let o of z)try{if(J(o))x(o,{recursive:!0,force:!0})}catch{}z.clear()};process.on("exit",n),process.on("SIGINT",()=>{n(),process.exit(130)}),process.on("SIGTERM",()=>{n(),process.exit(143)})}function B(n="pantry-test-"){h();let o=f(K(S(),n));return z.add(o),o}function G(n){z.delete(n);try{if(J(n))x(n,{recursive:!0,force:!0})}catch{}}async function k(n,o){let C=B(n);try{return await o(C)}finally{G(C)}}function m(n,o){let C=B(n);try{return o(C)}finally{G(C)}}function u(n,o,C){let A=K(n,o),w=A.substring(0,A.lastIndexOf("/"));if(w&&!J(w))F(w,{recursive:!0});return s(A,C),A}function T(n,o){let C=K(n,o);return F(C,{recursive:!0}),C}var Rn={createTempDir:B,createTestDir:T,createTestFile:u,PantryService:l,removeTempDir:G,startMysql:q,startPostgres:$,startRedis:M,stopMysql:Q,stopPostgres:L,stopRedis:y,useMysql:V,usePostgres:Z,useRedis:_,withMysql:X,withPostgres:I,withRedis:E,withTempDir:k,withTempDirSync:m};export{m as withTempDirSync,k as withTempDir,E as withRedis,I as withPostgres,X as withMysql,_ as useRedis,Z as usePostgres,V as useMysql,Rn as testingRuntime,y as stopRedis,L as stopPostgres,Q as stopMysql,M as startRedis,$ as startPostgres,q as startMysql,G as removeTempDir,u as createTestFile,T as createTestDir,B as createTempDir,l as PantryService};
@@ -1,33 +1,55 @@
1
- export { PantryService, type TestServiceConfig, type TestServiceStatus } from './service';
1
+ import { createTempDir, createTestDir, createTestFile, removeTempDir, withTempDir, withTempDirSync } from './temp';
2
+ import { PantryService } from './service';
3
+ import { startMysql, stopMysql, useMysql, withMysql } from './mysql';
4
+ import { startPostgres, stopPostgres, usePostgres, withPostgres } from './postgres';
5
+ import { startRedis, stopRedis, useRedis, withRedis } from './redis';
6
+ export type { MysqlConfig, MysqlConnection } from './mysql';
7
+ export type { PostgresConfig, PostgresConnection } from './postgres';
8
+ export type { RedisConfig, RedisConnection } from './redis';
9
+ export type { TestServiceConfig, TestServiceStatus } from './service';
10
+ // This aggregate is also useful for dynamically selected test infrastructure.
11
+ // Keeping the concrete implementations in an exported value prevents Bun from
12
+ // dropping them while retaining only the named export aliases for this facade.
13
+ export declare const testingRuntime: TestingRuntime;
14
+ export declare interface TestingRuntime {
15
+ createTempDir: typeof createTempDir
16
+ createTestDir: typeof createTestDir
17
+ createTestFile: typeof createTestFile
18
+ PantryService: typeof PantryService
19
+ removeTempDir: typeof removeTempDir
20
+ startMysql: typeof startMysql
21
+ startPostgres: typeof startPostgres
22
+ startRedis: typeof startRedis
23
+ stopMysql: typeof stopMysql
24
+ stopPostgres: typeof stopPostgres
25
+ stopRedis: typeof stopRedis
26
+ useMysql: typeof useMysql
27
+ usePostgres: typeof usePostgres
28
+ useRedis: typeof useRedis
29
+ withMysql: typeof withMysql
30
+ withPostgres: typeof withPostgres
31
+ withRedis: typeof withRedis
32
+ withTempDir: typeof withTempDir
33
+ withTempDirSync: typeof withTempDirSync
34
+ }
2
35
  export {
3
- usePostgres,
4
- withPostgres,
36
+ createTempDir,
37
+ createTestDir,
38
+ createTestFile,
39
+ PantryService,
40
+ removeTempDir,
41
+ startMysql,
5
42
  startPostgres,
6
- stopPostgres,
7
- type PostgresConfig,
8
- type PostgresConnection,
9
- } from './postgres';
10
- export {
11
- useRedis,
12
- withRedis,
13
43
  startRedis,
44
+ stopMysql,
45
+ stopPostgres,
14
46
  stopRedis,
15
- type RedisConfig,
16
- type RedisConnection,
17
- } from './redis';
18
- export {
19
47
  useMysql,
48
+ usePostgres,
49
+ useRedis,
20
50
  withMysql,
21
- startMysql,
22
- stopMysql,
23
- type MysqlConfig,
24
- type MysqlConnection,
25
- } from './mysql';
26
- export {
27
- createTempDir,
28
- removeTempDir,
51
+ withPostgres,
52
+ withRedis,
29
53
  withTempDir,
30
54
  withTempDirSync,
31
- createTestFile,
32
- createTestDir,
33
- } from './temp';
55
+ };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "ts-pantry",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.11.21",
5
+ "version": "0.11.27",
6
6
  "description": "A library & CLI for managing packages",
7
7
  "author": "Chris Breuer <chris@stacksjs.com>",
8
8
  "license": "MIT",