-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(katzencore): Trying to fix windows resolve issues after release …
…(test)
- Loading branch information
Showing
2 changed files
with
31 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import pkg from '../../package.json' | ||
|
||
export interface UpdateResult { | ||
currentVersion: string | ||
latestVersion: string | ||
} | ||
|
||
export const updateCheck = async () => { | ||
const version = pkg.version | ||
const https = await import('node:https') | ||
return new Promise<UpdateResult>((resolve) => { | ||
https.get('https://registry.npmjs.org/@maxlkatze/cms/latest', (res) => { | ||
let data = '' | ||
res.on('data', (chunk) => { | ||
data += chunk | ||
}) | ||
res.on('end', () => { | ||
const latestVersion = JSON.parse(data).version | ||
if (version !== latestVersion) { | ||
resolve({ | ||
currentVersion: version, | ||
latestVersion, | ||
}) | ||
} | ||
}) | ||
}) | ||
}) | ||
} |