@tigrisdata/cli 2.13.1-main.1 → 2.13.1
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.
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{d as m,e as d,f}from"./chunk-2XAO2OYD.js";import{readFileSync as I,writeFileSync as T,mkdirSync as N}from"fs";import{join as g}from"path";import{homedir as h}from"os";import j from"https";var u="2.13.1";var b=g(h(),".tigris","update-check.json");function y(){try{let t=I(b,"utf-8"),s=JSON.parse(t);return typeof s.latestVersion=="string"&&typeof s.lastChecked=="number"?s:null}catch{return null}}function v(t){try{N(g(h(),".tigris"),{recursive:!0}),T(b,JSON.stringify(t),"utf-8")}catch{}}function E(t,s){let a=o=>{let r=o.startsWith("v")?o.slice(1):o,c=null,l=r.indexOf("-");l!==-1&&(c=r.slice(l+1),r=r.slice(0,l));let p=r.split(".");if(p.length!==3)return null;let n=p.map(Number);return n.some(isNaN)?null:{major:n[0],minor:n[1],patch:n[2],prerelease:c}},e=a(t),i=a(s);return!e||!i?!1:i.major>e.major?!0:i.major<e.major?!1:i.minor>e.minor?!0:i.minor<e.minor?!1:i.patch>e.patch?!0:i.patch<e.patch?!1:e.prerelease&&!i.prerelease?!0:(!e.prerelease&&i.prerelease,!1)}function w(){try{let t=j.get(m,{timeout:5e3},s=>{let a="";s.on("data",e=>{a+=e}),s.on("end",()=>{try{let e=JSON.parse(a);if(typeof e.version=="string"){let i=y();v({...i,latestVersion:e.version,lastChecked:Date.now()})}}catch{}})});t.on("error",()=>{}),t.on("timeout",()=>{t.destroy()}),t.end(),t.on("socket",s=>{s.unref()})}catch{}}function V(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let t=y(),s=Number(process.env.TIGRIS_UPDATE_NOTIFY_INTERVAL_MS)||216e5;if(t&&E(u,t.latestVersion)&&(!t.lastNotified||Date.now()-t.lastNotified>s)){let e=globalThis.__TIGRIS_BINARY===!0,i=process.platform==="win32",o=`Update available: ${u} \u2192 ${t.latestVersion}`,r;e?i?r="Run `irm https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install.ps1 | iex`":r="Run `curl -fsSL https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install.sh | sh`":r="Run `npm install -g @tigrisdata/cli` to upgrade.";let c=Math.max(o.length,r.length)+4,l="\u250C"+"\u2500".repeat(c-2)+"\u2510",p="\u2514"+"\u2500".repeat(c-2)+"\u2518",n=_=>"\u2502 "+_.padEnd(c-4)+" \u2502";console.log(`
|
|
2
|
+
${l}
|
|
3
|
+
${n("")}
|
|
4
|
+
${n(o)}
|
|
5
|
+
${n(r)}
|
|
6
|
+
${n("")}
|
|
7
|
+
${p}
|
|
8
|
+
`),v({...t,lastNotified:Date.now()})}let a=Number(process.env.TIGRIS_UPDATE_CHECK_INTERVAL_MS)||864e5;(!t||Date.now()-t.lastChecked>a)&&w()}export{u as a,E as b,V as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,c as l}from"./chunk-
|
|
1
|
+
import{a as s,c as l}from"./chunk-47THEW77.js";import{b as m}from"./chunk-BETAO4PB.js";import{a as t,k as i}from"./chunk-4V35SYMM.js";import{existsSync as c}from"fs";import{join as a,dirname as u}from"path";import{fileURLToPath as f}from"url";t();var j=f(import.meta.url),d=u(j),h=m(),y=o=>{if(o.length===0)return!1;let e=a(d,"lib",...o)+".js";if(c(e))return!0;let r=a(d,"lib",...o,"index.js");return!!c(r)},b=async o=>{let e=[`./lib/${o.join("/")}.js`,`./lib/${o.join("/")}/index.js`];for(let p of e){let n=await import(p).catch(()=>null);if(n)return{module:n,error:null}}return{module:null,error:`Command not found: ${o.join(" ")}`}},x=i({specs:h,version:s,loadModule:b,hasImplementation:y});x.parse();l();
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-YERF43U2.js";import"./chunk-47THEW77.js";import"./chunk-BETAO4PB.js";import"./chunk-4V35SYMM.js";import"./chunk-2XAO2OYD.js";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-
|
|
1
|
+
import"./chunk-YERF43U2.js";import"./chunk-47THEW77.js";import"./chunk-BETAO4PB.js";import"./chunk-4V35SYMM.js";import"./chunk-2XAO2OYD.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a,c as b}from"../chunk-
|
|
1
|
+
import{b as a,c as b}from"../chunk-47THEW77.js";import"../chunk-2XAO2OYD.js";export{b as checkForUpdates,a as isNewerVersion};
|
package/package.json
CHANGED
package/dist/chunk-ZCWF7T5J.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{d as m,e as d,f}from"./chunk-2XAO2OYD.js";import{readFileSync as I,writeFileSync as T,mkdirSync as N}from"fs";import{join as g}from"path";import{homedir as h}from"os";import j from"https";var u="2.13.1-main.1";var b=g(h(),".tigris","update-check.json");function y(){try{let t=I(b,"utf-8"),s=JSON.parse(t);return typeof s.latestVersion=="string"&&typeof s.lastChecked=="number"?s:null}catch{return null}}function v(t){try{N(g(h(),".tigris"),{recursive:!0}),T(b,JSON.stringify(t),"utf-8")}catch{}}function E(t,s){let a=o=>{let r=o.startsWith("v")?o.slice(1):o,c=null,l=r.indexOf("-");l!==-1&&(c=r.slice(l+1),r=r.slice(0,l));let p=r.split(".");if(p.length!==3)return null;let n=p.map(Number);return n.some(isNaN)?null:{major:n[0],minor:n[1],patch:n[2],prerelease:c}},e=a(t),i=a(s);return!e||!i?!1:i.major>e.major?!0:i.major<e.major?!1:i.minor>e.minor?!0:i.minor<e.minor?!1:i.patch>e.patch?!0:i.patch<e.patch?!1:e.prerelease&&!i.prerelease?!0:(!e.prerelease&&i.prerelease,!1)}function w(){try{let t=j.get(m,{timeout:5e3},s=>{let a="";s.on("data",e=>{a+=e}),s.on("end",()=>{try{let e=JSON.parse(a);if(typeof e.version=="string"){let i=y();v({...i,latestVersion:e.version,lastChecked:Date.now()})}}catch{}})});t.on("error",()=>{}),t.on("timeout",()=>{t.destroy()}),t.end(),t.on("socket",s=>{s.unref()})}catch{}}function V(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let t=y(),s=Number(process.env.TIGRIS_UPDATE_NOTIFY_INTERVAL_MS)||216e5;if(t&&E(u,t.latestVersion)&&(!t.lastNotified||Date.now()-t.lastNotified>s)){let e=globalThis.__TIGRIS_BINARY===!0,i=process.platform==="win32",o=`Update available: ${u} \u2192 ${t.latestVersion}`,r;e?i?r="Run `irm https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install.ps1 | iex`":r="Run `curl -fsSL https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install.sh | sh`":r="Run `npm install -g @tigrisdata/cli` to upgrade.";let c=Math.max(o.length,r.length)+4,l="\u250C"+"\u2500".repeat(c-2)+"\u2510",p="\u2514"+"\u2500".repeat(c-2)+"\u2518",n=_=>"\u2502 "+_.padEnd(c-4)+" \u2502";console.log(`
|
|
2
|
-
${l}
|
|
3
|
-
${n("")}
|
|
4
|
-
${n(o)}
|
|
5
|
-
${n(r)}
|
|
6
|
-
${n("")}
|
|
7
|
-
${p}
|
|
8
|
-
`),v({...t,lastNotified:Date.now()})}let a=Number(process.env.TIGRIS_UPDATE_CHECK_INTERVAL_MS)||864e5;(!t||Date.now()-t.lastChecked>a)&&w()}export{u as a,E as b,V as c};
|