Skip to content

Commit cb57baa

Browse files
committed
Fix issues with links in terminals that don’t support them. Also skip update check of version starts with 0.0.0
1 parent b89d655 commit cb57baa

File tree

11 files changed

+168
-16
lines changed

11 files changed

+168
-16
lines changed

packages/cli-v3/src/commands/deploy.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
saveLogs,
2727
} from "../deploy/logs.js";
2828
import { buildManifestToJSON } from "../utilities/buildManifest.js";
29-
import { chalkError, cliLink, prettyError } from "../utilities/cliOutput.js";
29+
import { chalkError, cliLink, isLinksSupported, prettyError } from "../utilities/cliOutput.js";
3030
import { loadDotEnvVars } from "../utilities/dotEnv.js";
3131
import { writeJSONFile } from "../utilities/fileSystem.js";
3232
import { printStandloneInitialBanner } from "../utilities/initialBanner.js";
@@ -303,7 +303,11 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
303303

304304
const $spinner = spinner();
305305

306-
$spinner.start(`Deploying version ${version} ${deploymentLink}`);
306+
if (isLinksSupported) {
307+
$spinner.start(`Deploying version ${version} ${deploymentLink}`);
308+
} else {
309+
$spinner.start(`Deploying version ${version}`);
310+
}
307311

308312
const selfHostedRegistryHost = deployment.registryHost ?? options.registry;
309313
const registryHost = selfHostedRegistryHost ?? "registry.trigger.dev";
@@ -419,9 +423,9 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
419423
const taskCount = deploymentWithWorker.worker?.tasks.length ?? 0;
420424

421425
outro(
422-
`Version ${version} deployed with ${taskCount} detected task${
423-
taskCount === 1 ? "" : "s"
424-
} | ${deploymentLink} | ${testLink}`
426+
`Version ${version} deployed with ${taskCount} detected task${taskCount === 1 ? "" : "s"} ${
427+
isLinksSupported ? `| ${deploymentLink} | ${testLink}` : ""
428+
}`
425429
);
426430
}
427431

packages/cli-v3/src/commands/update.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ export async function updateTriggerPackages(
5252
requireUpdate?: boolean
5353
): Promise<boolean> {
5454
let hasOutput = false;
55+
const cliVersion = VERSION;
56+
57+
if (cliVersion.startsWith("0.0.0")) {
58+
return false;
59+
}
5560

5661
if (!embedded) {
5762
intro("Updating packages");
@@ -66,7 +71,6 @@ export async function updateTriggerPackages(
6671
return false;
6772
}
6873

69-
const cliVersion = VERSION;
7074
const newCliVersion = await updateCheck();
7175

7276
if (newCliVersion) {
@@ -93,7 +97,11 @@ export async function updateTriggerPackages(
9397
const mismatches: Dependency[] = [];
9498

9599
for (const dep of deps) {
96-
if (dep.version === targetVersion || dep.version.startsWith("https://pkg.pr.new")) {
100+
if (
101+
dep.version === targetVersion ||
102+
dep.version.startsWith("https://pkg.pr.new") ||
103+
dep.version.startsWith("0.0.0")
104+
) {
97105
continue;
98106
}
99107

packages/cli-v3/src/dev/devOutput.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
chalkWarning,
1818
chalkWorker,
1919
cliLink,
20+
isLinksSupported,
2021
prettyError,
2122
prettyPrintDate,
2223
} from "../utilities/cliOutput.js";
@@ -50,23 +51,31 @@ export function startDevOutput(options: DevOutputOptions) {
5051
const backgroundWorkerInitialized = (
5152
...[worker]: EventBusEventArgs<"backgroundWorkerInitialized">
5253
) => {
54+
const logParts: string[] = [];
55+
5356
const testUrl = `${dashboardUrl}/projects/v3/${config.project}/test?environment=dev`;
5457
const runsUrl = `${dashboardUrl}/projects/v3/${config.project}/runs?envSlug=dev`;
5558

5659
const pipe = chalkGrey("|");
5760
const bullet = chalkGrey("○");
5861
const arrow = chalkGrey("->");
5962

63+
logParts.push(bullet);
64+
6065
const testLink = chalkLink(cliLink("Test tasks", testUrl));
6166
const runsLink = chalkLink(cliLink("View runs", runsUrl));
6267

6368
const runtime = chalkGrey(`[${worker.build.runtime}]`);
6469
const workerStarted = chalkGrey("Background worker ready");
6570
const workerVersion = chalkWorker(worker.serverWorker!.version);
6671

67-
logger.log(
68-
`${bullet} ${workerStarted} ${runtime} ${arrow} ${workerVersion} ${pipe} ${testLink} ${pipe} ${runsLink}`
69-
);
72+
logParts.push(workerStarted, runtime, arrow, workerVersion);
73+
74+
if (isLinksSupported) {
75+
logParts.push(pipe, testLink, pipe, runsLink);
76+
}
77+
78+
logger.log(logParts.join(" "));
7079
};
7180

7281
const backgroundWorkerIndexingError = (
@@ -113,9 +122,9 @@ export function startDevOutput(options: DevOutputOptions) {
113122
const runId = chalkRun(`${execution.run.id}.${execution.attempt.number}`);
114123

115124
logger.log(
116-
`${bullet} ${timestampPrefix} ${chalkGrey(
117-
"->"
118-
)} ${link} ${pipe} ${workerPrefix} ${pipe} ${taskPrefix} ${pipe} ${runId}`
125+
`${bullet} ${timestampPrefix} ${chalkGrey("->")} ${
126+
isLinksSupported ? `${link} ${pipe}` : ""
127+
} ${workerPrefix} ${pipe} ${taskPrefix} ${pipe} ${runId}`
119128
);
120129
};
121130

@@ -162,9 +171,9 @@ export function startDevOutput(options: DevOutputOptions) {
162171
const runId = chalkRun(`${execution.run.id}.${execution.attempt.number}`);
163172

164173
logger.log(
165-
`${bullet} ${timestampPrefix} ${chalkGrey(
166-
"->"
167-
)} ${link} ${pipe} ${workerPrefix} ${pipe} ${taskPrefix} ${pipe} ${runId} ${pipe} ${resultText} ${elapsedText}${errorText}`
174+
`${bullet} ${timestampPrefix} ${chalkGrey("->")} ${
175+
isLinksSupported ? `${link} ${pipe}` : ""
176+
} ${workerPrefix} ${pipe} ${taskPrefix} ${pipe} ${runId} ${pipe} ${resultText} ${elapsedText}${errorText}`
168177
);
169178
};
170179

packages/cli-v3/src/utilities/cliOutput.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import terminalLink, { Options as TerminalLinkOptions } from "terminal-link";
44
import { hasTTY } from "std-env";
55

66
export const isInteractive = hasTTY;
7+
export const isLinksSupported = terminalLink.isSupported;
78

89
export const green = "#4FFF54";
910
export const purple = "#735BF3";

pnpm-lock.yaml

Lines changed: 68 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

references/hello-world/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.trigger

references/hello-world/package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "references-hello-world",
3+
"private": true,
4+
"type": "module",
5+
"devDependencies": {
6+
"trigger.dev": "workspace:*",
7+
"typescript": "^5.5.4"
8+
},
9+
"dependencies": {
10+
"@trigger.dev/sdk": "0.0.0-prerelease-20240825150620"
11+
}
12+
}

references/hello-world/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { logger, task, wait } from "@trigger.dev/sdk/v3";
2+
3+
export const helloWorldTask = task({
4+
id: "hello-world",
5+
run: async (payload: any, { ctx }) => {
6+
logger.log("Hello, world!", { payload, ctx });
7+
8+
await wait.for({ seconds: 5 });
9+
10+
return {
11+
message: "Hello, world!",
12+
}
13+
},
14+
});
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { defineConfig } from "@trigger.dev/sdk/v3";
2+
3+
export default defineConfig({
4+
project: "proj_rrkpdguyagvsoktglnod",
5+
logLevel: "log",
6+
retries: {
7+
enabledInDev: true,
8+
default: {
9+
maxAttempts: 3,
10+
minTimeoutInMs: 1000,
11+
maxTimeoutInMs: 10000,
12+
factor: 2,
13+
randomize: true,
14+
},
15+
},
16+
});

references/hello-world/tsconfig.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2023",
4+
"module": "Node16",
5+
"moduleResolution": "Node16",
6+
"esModuleInterop": true,
7+
"strict": true,
8+
"skipLibCheck": true,
9+
"customConditions": ["@triggerdotdev/source"],
10+
"jsx": "preserve",
11+
"lib": ["DOM", "DOM.Iterable"],
12+
"noEmit": true
13+
},
14+
"include": [
15+
"./src/**/*.ts",
16+
"trigger.config.ts"
17+
]
18+
}

0 commit comments

Comments
 (0)