Skip to content

Commit

Permalink
fix: old deno gives an error when using deno -v (#75)
Browse files Browse the repository at this point in the history
* fix: old deno gives an error when using `deno -v`

* check version with -v
  • Loading branch information
ryuapp authored Oct 10, 2024
1 parent b3ce4fe commit cf9e348
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/hooks/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,14 @@ const registerInstallationHook = (
if (!installedPackageManagerNames.length) return
// If version 1 of Deno is installed, it will not be suggested because it doesn't have "deno install".
if (installedPackageManagerNames.includes('deno')) {
const { stdout } = await execa('deno', ['-v'])
if (stdout.split(' ')[1].split('.')[0] == '1') {
let isVersion1 = false
try {
const { stdout } = await execa('deno', ['-v'])
isVersion1 = stdout.split(' ')[1].split('.')[0] == '1'
} catch {
isVersion1 = true
}
if (isVersion1) {
installedPackageManagerNames.splice(
installedPackageManagerNames.indexOf('deno'),
1,
Expand Down

0 comments on commit cf9e348

Please sign in to comment.