Skip to content

Commit

Permalink
Add to latitude -v also info about installed version of the app (#479)
Browse files Browse the repository at this point in the history
  • Loading branch information
andresgutgon committed Jun 3, 2024
1 parent 5f35828 commit b0c316d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/poor-fireants-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latitude-data/cli": minor
---

Add also to latitude version installed version of the app
15 changes: 14 additions & 1 deletion packages/cli/src/commands/version/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ import colors from 'picocolors'
import setRootDir from '$src/lib/decorators/setRootDir'
import boxedMessage from '$src/lib/boxedMessage'
import findOrCreateConfigFile from '$src/lib/latitudeConfig/findOrCreate'
import { getInstalledVersion } from '$src/lib/getAppVersions'
import config from '$src/config'

function versionLine({ name, version }: { name: string; version: string }) {
return `${colors.blue(`${name} version: `)} ${colors.green(version)}`
}
async function showVersions() {
const latitudeJson = await findOrCreateConfigFile()
const appVersion = latitudeJson.data.version
const installed = getInstalledVersion(config.rootDir)
boxedMessage({
color: 'green',
title: 'Latitude versions',
Expand All @@ -17,7 +20,17 @@ async function showVersions() {
name: 'CLI',
version: process.env.PACKAGE_VERSION ?? 'development',
})}
${versionLine({ name: 'App', version: appVersion! })}
${versionLine({ name: 'App (latitude.json)', version: appVersion! })}
${
installed
? versionLine({ name: 'App (installed)', version: installed })
: '\n'
}
${
!installed
? colors.red("App is not installed run 'latitude setup'")
: ''
}
`,
})
}
Expand Down

0 comments on commit b0c316d

Please sign in to comment.