Skip to content

Commit

Permalink
fix: isServeDUpToDate
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Feb 25, 2021
1 parent b309331 commit 7539693
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"@types/decompress": "^4.2.3",
"@types/fs-extra": "^9.0.7",
"@types/node": "^14.14.31",
"@types/semver": "^7.3.4",
"build-commit": "0.1.4",
"cross-env": "7.0.3",
"decompress": "^4.2.1",
Expand All @@ -96,6 +97,7 @@
"eslint-config-atomic": "^1.10.2",
"gitly": "^2.0.2",
"prettier": "^2.2.1",
"semver": "^7.3.4",
"shx": "0.3.3",
"ts-node": "^9.1.1",
"typescript": "^4.2.2"
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/installation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { copy } from "fs-extra"
import pathExists from "path-exists"
import { join, dirname } from "path"
import semverCompare from "semver/functions/compare"

import { execFile as execFileRaw } from "child_process"
import { promisify } from "util"
Expand Down Expand Up @@ -43,6 +44,14 @@ async function getServeDVersion(file: string) {
return null
}
}

const targetVersion = "0.7.0-beta.4"
/** Check if the given serve-d is up to date against the target version */
export async function isServeDUpToDate(file: string) {
const v1 = await getServeDVersion(file)
return semverCompare(v1, targetVersion)
}

export async function installServeD() {
const codeDBinFolder = await getCodeDBinFolder()
const serveDPath = join(codeDBinFolder, serveDExeFileName)
Expand Down

0 comments on commit 7539693

Please sign in to comment.