tthr 0.3.14 → 0.3.15
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/index.js +12 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1243,8 +1243,8 @@ PUBLIC_TETHER_PROJECT_ID=\${TETHER_PROJECT_ID}
|
|
|
1243
1243
|
}
|
|
1244
1244
|
}
|
|
1245
1245
|
}
|
|
1246
|
-
function getInstallCommand(pm,
|
|
1247
|
-
const devFlag =
|
|
1246
|
+
function getInstallCommand(pm, isDev = false) {
|
|
1247
|
+
const devFlag = isDev ? pm === "npm" ? "-D" : pm === "yarn" ? "-D" : pm === "pnpm" ? "-D" : "-d" : "";
|
|
1248
1248
|
return `${pm} ${pm === "npm" ? "install" : "add"} ${devFlag}`.trim();
|
|
1249
1249
|
}
|
|
1250
1250
|
async function installTetherPackages(projectPath, template, packageManager) {
|
|
@@ -2061,9 +2061,7 @@ import ora4 from "ora";
|
|
|
2061
2061
|
import os from "os";
|
|
2062
2062
|
import { exec } from "child_process";
|
|
2063
2063
|
import readline from "readline";
|
|
2064
|
-
var isDev = process.env.NODE_ENV === "development" || process.env.TETHER_DEV === "true";
|
|
2065
2064
|
var API_URL2 = `${getApiUrl()}/api/v1`;
|
|
2066
|
-
var AUTH_URL = isDev ? "http://localhost:3000/cli" : "https://tthr.io/cli";
|
|
2067
2065
|
async function loginCommand() {
|
|
2068
2066
|
console.log(chalk4.bold("\u26A1 Login to Tether\n"));
|
|
2069
2067
|
const existing = await getCredentials();
|
|
@@ -2076,7 +2074,7 @@ async function loginCommand() {
|
|
|
2076
2074
|
try {
|
|
2077
2075
|
const deviceCode = await requestDeviceCode();
|
|
2078
2076
|
spinner.stop();
|
|
2079
|
-
const authUrl = `${
|
|
2077
|
+
const authUrl = `${deviceCode.authUrl}/${deviceCode.userCode}`;
|
|
2080
2078
|
console.log(chalk4.dim("Authenticate in your browser:\n"));
|
|
2081
2079
|
console.log(chalk4.cyan.bold(` ${authUrl}
|
|
2082
2080
|
`));
|
|
@@ -2092,7 +2090,7 @@ async function loginCommand() {
|
|
|
2092
2090
|
} catch (error) {
|
|
2093
2091
|
spinner.fail("Authentication failed");
|
|
2094
2092
|
console.error(chalk4.red(error instanceof Error ? error.message : "Unknown error"));
|
|
2095
|
-
console.log(chalk4.dim("\nTry again or visit
|
|
2093
|
+
console.log(chalk4.dim("\nTry again or visit the docs for help\n"));
|
|
2096
2094
|
process.exit(1);
|
|
2097
2095
|
}
|
|
2098
2096
|
}
|
|
@@ -2160,13 +2158,15 @@ async function requestDeviceCode() {
|
|
|
2160
2158
|
if (response?.ok) {
|
|
2161
2159
|
return await response.json();
|
|
2162
2160
|
}
|
|
2161
|
+
const baseUrl = getApiUrl().replace(/\/api\/v1$/, "");
|
|
2163
2162
|
return {
|
|
2164
2163
|
deviceCode,
|
|
2165
2164
|
userCode,
|
|
2166
2165
|
expiresIn: 60,
|
|
2167
2166
|
// 1 minute
|
|
2168
|
-
interval: 5
|
|
2167
|
+
interval: 5,
|
|
2169
2168
|
// Poll every 5 seconds
|
|
2169
|
+
authUrl: `${baseUrl}/cli`
|
|
2170
2170
|
};
|
|
2171
2171
|
}
|
|
2172
2172
|
async function pollForApproval(deviceCode, interval, expiresIn) {
|
|
@@ -2278,18 +2278,18 @@ function detectPackageManager() {
|
|
|
2278
2278
|
}
|
|
2279
2279
|
return "npm";
|
|
2280
2280
|
}
|
|
2281
|
-
function getInstallCommand2(pm, packages,
|
|
2281
|
+
function getInstallCommand2(pm, packages, isDev) {
|
|
2282
2282
|
const packagesStr = packages.join(" ");
|
|
2283
2283
|
switch (pm) {
|
|
2284
2284
|
case "bun":
|
|
2285
|
-
return
|
|
2285
|
+
return isDev ? `bun add -d ${packagesStr}` : `bun add ${packagesStr}`;
|
|
2286
2286
|
case "pnpm":
|
|
2287
|
-
return
|
|
2287
|
+
return isDev ? `pnpm add -D ${packagesStr}` : `pnpm add ${packagesStr}`;
|
|
2288
2288
|
case "yarn":
|
|
2289
|
-
return
|
|
2289
|
+
return isDev ? `yarn add -D ${packagesStr}` : `yarn add ${packagesStr}`;
|
|
2290
2290
|
case "npm":
|
|
2291
2291
|
default:
|
|
2292
|
-
return
|
|
2292
|
+
return isDev ? `npm install -D ${packagesStr}` : `npm install ${packagesStr}`;
|
|
2293
2293
|
}
|
|
2294
2294
|
}
|
|
2295
2295
|
async function getLatestVersion2(packageName) {
|