Skip to content

Commit

Permalink
chore(robo): nicer update available message w/ hint to disable
Browse files Browse the repository at this point in the history
  • Loading branch information
Pkmmte committed Dec 23, 2024
1 parent c5a3a41 commit d9d171a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/modern-walls-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'robo.js': patch
---

chore: nicer update available message w/ hint to disable
2 changes: 1 addition & 1 deletion .changeset/odd-frogs-lick.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'robo.js': patch
---

feat(cli): retrieves credentials from `robo cloud status` command
feat(cli): new `--credentials` option in `robo cloud status` for ci setup
18 changes: 10 additions & 8 deletions packages/robo/src/cli/commands/dev.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Command } from '../utils/cli-handler.js'
import { ChildProcess, spawn } from 'child_process'
import { logger } from '../../core/logger.js'
import { DEFAULT_CONFIG, FLASHCORE_KEYS, Indent, cloudflareLogger } from '../../core/constants.js'
import { DEFAULT_CONFIG, FLASHCORE_KEYS, HighlightGreen, Indent, cloudflareLogger } from '../../core/constants.js'
import { getConfigPaths, loadConfig, loadConfigPath } from '../../core/config.js'
import { installCloudflared, isCloudflaredInstalled, startCloudflared, stopCloudflared } from '../utils/cloudflared.js'
import { IS_WINDOWS, filterExistingPaths, getWatchedPlugins, packageJson, timeout } from '../utils/utils.js'
Expand All @@ -10,6 +10,7 @@ import Watcher, { Change } from '../utils/watcher.js'
import { color, composeColors } from '../../core/color.js'
import { Spirits } from '../utils/spirits.js'
import { buildAction } from './build/index.js'
import { Highlight } from '../../core/constants.js'
import { Flashcore, prepareFlashcore } from '../../core/flashcore.js'
import { getPackageExecutor, getPackageManager } from '../utils/runtime-utils.js'
import { Mode, setMode } from '../../core/mode.js'
Expand Down Expand Up @@ -366,15 +367,16 @@ export async function checkUpdates(config: Config, forceCheck = false, suggest =
if (update.hasUpdate) {
// Prepare commands
const packageExecutor = getPackageExecutor()
const command = `${packageExecutor} sage upgrade`

// Print update message
const highlightColor = composeColors(color.green, color.bold)
const highlight = highlightColor(
`A new version of Robo.js is available! (v${packageJson.version} -> v${latestVersion})`
)
const suggestion = suggest ? `Run ${color.bold(command)} to update.` : ''
logger.info(highlight, suggestion)
const versionDelta = color.dim(`(v${packageJson.version} → v${latestVersion})`)
let message = `\n${Indent} 💡 ${HighlightGreen('Update available!')} ${versionDelta}\n`

if (suggest) {
const command = `${packageExecutor} sage upgrade`
message += `${Indent} Run ${Highlight(command)} or disable update checks in config.\n`
}
logger.log(message)
}

return update
Expand Down
2 changes: 1 addition & 1 deletion packages/robo/src/core/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ let _globalOverwrites: string[] = []
* Sometimes you need to store sensitive information, like API keys, database URLs, or Discord Credentials.
*
* ```ts
* import { Env } from 'robo'
* import { Env } from 'robo.js'
*
* Env.loadSync({ mode: 'dev' })
* Env.data().NODE_ENV // 'development'
Expand Down

0 comments on commit d9d171a

Please sign in to comment.