@computesdk/cmd
Advanced tools
+21
-3
@@ -1049,6 +1049,11 @@ "use strict"; | ||
| }); | ||
| var isTTYEnvironment = () => { | ||
| if (typeof process === "undefined") return false; | ||
| return Boolean(process.stdin?.isTTY || process.stdout?.isTTY); | ||
| }; | ||
| var install = (options) => { | ||
| const installUrl = options?.version ? `https://computesdk.com/install.sh?version=${options.version}` : "https://computesdk.com/install.sh"; | ||
| const curlFlags = options?.silent ? "-fsSL" : "-fSL"; | ||
| let installCmd = `curl ${curlFlags} ${installUrl} | bash`; | ||
| const isInteractive = options?.interactive ?? isTTYEnvironment(); | ||
| let installCmd = isInteractive ? `curl ${curlFlags} ${installUrl} | bash -s` : `curl ${curlFlags} ${installUrl} | bash -s -- --non-interactive`; | ||
| if (options?.apiKey) { | ||
@@ -1082,2 +1087,8 @@ installCmd = `COMPUTESDK_API_KEY="${options.apiKey}" ${installCmd}`; | ||
| } | ||
| if (options?.wait) { | ||
| args.push("--wait"); | ||
| if (options.waitTimeout) { | ||
| args.push("--wait-timeout", String(options.waitTimeout)); | ||
| } | ||
| } | ||
| return args; | ||
@@ -1111,3 +1122,4 @@ }; | ||
| const curlFlags = options?.silent ? "-fsSL" : "-fSL"; | ||
| let installCmd = `curl ${curlFlags} ${installUrl} | bash`; | ||
| const isInteractive = options?.interactive ?? isTTYEnvironment(); | ||
| let installCmd = isInteractive ? `curl ${curlFlags} ${installUrl} | bash -s` : `curl ${curlFlags} ${installUrl} | bash -s -- --non-interactive`; | ||
| if (apiKey) { | ||
@@ -1125,3 +1137,9 @@ installCmd = `COMPUTESDK_API_KEY="${apiKey}" ${installCmd}`; | ||
| } | ||
| const fullCmd = `${installCmd} && ${startCmd} > /dev/null 2>&1 &`; | ||
| if (options?.wait) { | ||
| startCmd += " --wait"; | ||
| if (options.waitTimeout) { | ||
| startCmd += ` --wait-timeout ${options.waitTimeout}`; | ||
| } | ||
| } | ||
| const fullCmd = options?.wait ? `${installCmd} && ${startCmd}` : `${installCmd} && ${startCmd} > /dev/null 2>&1 &`; | ||
| return ["sh", "-c", fullCmd]; | ||
@@ -1128,0 +1146,0 @@ }; |
+20
-1
@@ -113,6 +113,8 @@ /** | ||
| }) => Command) & { | ||
| install: (options?: { | ||
| install: (// Callable: shell wrapper with sh default | ||
| options?: { | ||
| apiKey?: string; | ||
| version?: string; | ||
| silent?: boolean; | ||
| interactive?: boolean; | ||
| }) => Command; | ||
@@ -126,2 +128,4 @@ isInstalled: () => Command; | ||
| logLevel?: "debug" | "info" | "warn" | "error"; | ||
| wait?: boolean; | ||
| waitTimeout?: number; | ||
| }) => Command; | ||
@@ -143,2 +147,5 @@ stop: () => Command; | ||
| silent?: boolean; | ||
| interactive?: boolean; | ||
| wait?: boolean; | ||
| waitTimeout?: number; | ||
| }) => Command; | ||
@@ -150,2 +157,3 @@ compute: { | ||
| silent?: boolean; | ||
| interactive?: boolean; | ||
| }) => Command; | ||
@@ -159,2 +167,4 @@ isInstalled: () => Command; | ||
| logLevel?: "debug" | "info" | "warn" | "error"; | ||
| wait?: boolean; | ||
| waitTimeout?: number; | ||
| }) => Command; | ||
@@ -172,2 +182,5 @@ stop: () => Command; | ||
| silent?: boolean; | ||
| interactive?: boolean; | ||
| wait?: boolean; | ||
| waitTimeout?: number; | ||
| }) => Command; | ||
@@ -811,2 +824,3 @@ isSetup: (options?: { | ||
| silent?: boolean; | ||
| interactive?: boolean; | ||
| }) => Command; | ||
@@ -820,2 +834,4 @@ isInstalled: () => Command; | ||
| logLevel?: "debug" | "info" | "warn" | "error"; | ||
| wait?: boolean; | ||
| waitTimeout?: number; | ||
| }) => Command; | ||
@@ -833,2 +849,5 @@ stop: () => Command; | ||
| silent?: boolean; | ||
| interactive?: boolean; | ||
| wait?: boolean; | ||
| waitTimeout?: number; | ||
| }) => Command; | ||
@@ -835,0 +854,0 @@ isSetup: (options?: { |
+20
-1
@@ -113,6 +113,8 @@ /** | ||
| }) => Command) & { | ||
| install: (options?: { | ||
| install: (// Callable: shell wrapper with sh default | ||
| options?: { | ||
| apiKey?: string; | ||
| version?: string; | ||
| silent?: boolean; | ||
| interactive?: boolean; | ||
| }) => Command; | ||
@@ -126,2 +128,4 @@ isInstalled: () => Command; | ||
| logLevel?: "debug" | "info" | "warn" | "error"; | ||
| wait?: boolean; | ||
| waitTimeout?: number; | ||
| }) => Command; | ||
@@ -143,2 +147,5 @@ stop: () => Command; | ||
| silent?: boolean; | ||
| interactive?: boolean; | ||
| wait?: boolean; | ||
| waitTimeout?: number; | ||
| }) => Command; | ||
@@ -150,2 +157,3 @@ compute: { | ||
| silent?: boolean; | ||
| interactive?: boolean; | ||
| }) => Command; | ||
@@ -159,2 +167,4 @@ isInstalled: () => Command; | ||
| logLevel?: "debug" | "info" | "warn" | "error"; | ||
| wait?: boolean; | ||
| waitTimeout?: number; | ||
| }) => Command; | ||
@@ -172,2 +182,5 @@ stop: () => Command; | ||
| silent?: boolean; | ||
| interactive?: boolean; | ||
| wait?: boolean; | ||
| waitTimeout?: number; | ||
| }) => Command; | ||
@@ -811,2 +824,3 @@ isSetup: (options?: { | ||
| silent?: boolean; | ||
| interactive?: boolean; | ||
| }) => Command; | ||
@@ -820,2 +834,4 @@ isInstalled: () => Command; | ||
| logLevel?: "debug" | "info" | "warn" | "error"; | ||
| wait?: boolean; | ||
| waitTimeout?: number; | ||
| }) => Command; | ||
@@ -833,2 +849,5 @@ stop: () => Command; | ||
| silent?: boolean; | ||
| interactive?: boolean; | ||
| wait?: boolean; | ||
| waitTimeout?: number; | ||
| }) => Command; | ||
@@ -835,0 +854,0 @@ isSetup: (options?: { |
+21
-3
@@ -949,6 +949,11 @@ var __defProp = Object.defineProperty; | ||
| }); | ||
| var isTTYEnvironment = () => { | ||
| if (typeof process === "undefined") return false; | ||
| return Boolean(process.stdin?.isTTY || process.stdout?.isTTY); | ||
| }; | ||
| var install = (options) => { | ||
| const installUrl = options?.version ? `https://computesdk.com/install.sh?version=${options.version}` : "https://computesdk.com/install.sh"; | ||
| const curlFlags = options?.silent ? "-fsSL" : "-fSL"; | ||
| let installCmd = `curl ${curlFlags} ${installUrl} | bash`; | ||
| const isInteractive = options?.interactive ?? isTTYEnvironment(); | ||
| let installCmd = isInteractive ? `curl ${curlFlags} ${installUrl} | bash -s` : `curl ${curlFlags} ${installUrl} | bash -s -- --non-interactive`; | ||
| if (options?.apiKey) { | ||
@@ -982,2 +987,8 @@ installCmd = `COMPUTESDK_API_KEY="${options.apiKey}" ${installCmd}`; | ||
| } | ||
| if (options?.wait) { | ||
| args.push("--wait"); | ||
| if (options.waitTimeout) { | ||
| args.push("--wait-timeout", String(options.waitTimeout)); | ||
| } | ||
| } | ||
| return args; | ||
@@ -1011,3 +1022,4 @@ }; | ||
| const curlFlags = options?.silent ? "-fsSL" : "-fSL"; | ||
| let installCmd = `curl ${curlFlags} ${installUrl} | bash`; | ||
| const isInteractive = options?.interactive ?? isTTYEnvironment(); | ||
| let installCmd = isInteractive ? `curl ${curlFlags} ${installUrl} | bash -s` : `curl ${curlFlags} ${installUrl} | bash -s -- --non-interactive`; | ||
| if (apiKey) { | ||
@@ -1025,3 +1037,9 @@ installCmd = `COMPUTESDK_API_KEY="${apiKey}" ${installCmd}`; | ||
| } | ||
| const fullCmd = `${installCmd} && ${startCmd} > /dev/null 2>&1 &`; | ||
| if (options?.wait) { | ||
| startCmd += " --wait"; | ||
| if (options.waitTimeout) { | ||
| startCmd += ` --wait-timeout ${options.waitTimeout}`; | ||
| } | ||
| } | ||
| const fullCmd = options?.wait ? `${installCmd} && ${startCmd}` : `${installCmd} && ${startCmd} > /dev/null 2>&1 &`; | ||
| return ["sh", "-c", fullCmd]; | ||
@@ -1028,0 +1046,0 @@ }; |
+7
-3
| { | ||
| "name": "@computesdk/cmd", | ||
| "version": "0.3.0", | ||
| "version": "0.3.1", | ||
| "type": "module", | ||
@@ -22,2 +22,3 @@ "description": "Type-safe shell command builders for ComputeSDK sandboxes", | ||
| "keywords": [ | ||
| "computesdk", | ||
| "commands", | ||
@@ -28,3 +29,6 @@ "shell", | ||
| "bash", | ||
| "cli" | ||
| "cli", | ||
| "command-builder", | ||
| "type-safe", | ||
| "shell-commands" | ||
| ], | ||
@@ -36,3 +40,3 @@ "repository": { | ||
| }, | ||
| "homepage": "https://github.com/computesdk/computesdk/tree/main/packages/cmd", | ||
| "homepage": "https://www.computesdk.com", | ||
| "bugs": { | ||
@@ -39,0 +43,0 @@ "url": "https://github.com/computesdk/computesdk/issues" |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Obfuscated code
Supply chain riskObfuscated files are intentionally packed to hide their behavior. This could be a sign of malware.
Found 1 instance in 1 package
285768
3.59%3340
1.67%0
-100%