Skip to content

Commit b8d1910

Browse files
committed
A couple tweaks to the update command
1 parent 979f5f8 commit b8d1910

File tree

3 files changed

+1155
-52
lines changed

3 files changed

+1155
-52
lines changed

docs/documentation/guides/cli.mdx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,43 @@ yarn dlx @trigger.dev/cli@latest dev
109109
You can optionally pass the hostname if you're not running on localhost by adding
110110
`--hostname <host>`. Example, in case your Next.js is running on 0.0.0.0: `--hostname 0.0.0.0`.
111111
</Note>
112+
113+
## update Command
114+
115+
The `update` command will update all Trigger.dev packages to the latest version.
116+
117+
<CodeGroup>
118+
119+
```bash npm
120+
npx @trigger.dev/cli@latest update
121+
```
122+
123+
```bash pnpm
124+
pnpm dlx @trigger.dev/cli@latest update
125+
```
126+
127+
```bash yarn
128+
yarn dlx @trigger.dev/cli@latest update
129+
```
130+
131+
</CodeGroup>
132+
133+
## whoami Command
134+
135+
The `whoami` command will print out information about your current Trigger.dev project and environment, based on the API key found in your `.env` or `.env.local` file
136+
137+
<CodeGroup>
138+
139+
```bash npm
140+
npx @trigger.dev/cli@latest whoami
141+
```
142+
143+
```bash pnpm
144+
pnpm dlx @trigger.dev/cli@latest whoami
145+
```
146+
147+
```bash yarn
148+
yarn dlx @trigger.dev/cli@latest whoami
149+
```
150+
151+
</CodeGroup>

packages/cli/src/commands/update.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import inquirer from "inquirer";
33
import { run, RunOptions } from "npm-check-updates";
44
import { installDependencies } from "../utils/installDependencies.js";
55
import { readJSONFileSync, writeJSONFile } from "../utils/fileSystem.js";
6+
import { logger } from "../utils/logger.js";
67

78
export async function updateCommand(projectPath: string) {
89
const triggerDevPackage = "@trigger.dev";
9-
const packageJSONPath = path.join(projectPath, "package.json")
10+
const packageJSONPath = path.join(projectPath, "package.json");
1011
const packageData = readJSONFileSync(packageJSONPath);
1112

1213
if (!packageData) {
@@ -31,6 +32,7 @@ export async function updateCommand(projectPath: string) {
3132
packageData,
3233
upgrade: true,
3334
jsonUpgraded: true,
35+
target: "latest",
3436
};
3537

3638
// Can either give a json like package.json or just with deps and their new versions
@@ -53,7 +55,7 @@ export async function updateCommand(projectPath: string) {
5355

5456
// If there are no @trigger.dev packages
5557
if (triggerPackages.length === 0) {
56-
console.log("No @trigger.dev/* packages found in package.json.");
58+
logger.success(`✅ All @trigger.dev/* packages are up to date.`);
5759
return;
5860
}
5961

@@ -63,7 +65,7 @@ export async function updateCommand(projectPath: string) {
6365

6466
// If no packages require any updation
6567
if (packagesToUpdate.length === 0) {
66-
console.log("All @trigger.dev/* packages are up to date.");
68+
logger.success(`✅ All @trigger.dev/* packages are up to date.`);
6769
return;
6870
}
6971

@@ -93,9 +95,6 @@ export async function updateCommand(projectPath: string) {
9395
}
9496
});
9597
await writeJSONFile(packageJSONPath, newPackageJSON);
96-
console.log("package.json updated. Reinstalling dependencies...");
9798
await installDependencies(projectPath);
98-
} else {
99-
console.log("Operation canceled. No changes were made.");
10099
}
101100
}

0 commit comments

Comments
 (0)