2 Commits

Author SHA1 Message Date
68a0c0e35b chore(release): v1.12.2 2024-03-04 22:56:50 +02:00
8cc93d55da fix: use http module instead of fetch (#17)
allows usage of RCZ with NodeJS v14 and v16
2024-03-04 22:53:48 +02:00
3 changed files with 23 additions and 4 deletions

View File

@@ -1,7 +1,11 @@
# Changelog
Generation of this changelog is based on commits
## v1.12.2
### Fixes
- [8cc93d55d] - use http module instead of fetch (#17)
## v1.12.1
### Miscellaneous
- [dd4ca1f1c] - **release**: v1.12.1
- [7264816e0] - change installation instructions
## v1.12.0
### Miscellaneous

View File

@@ -1,6 +1,6 @@
{
"name": "@resultium/rcz",
"version": "1.12.1",
"version": "1.12.2",
"license": "GPL-3.0-or-later",
"description": "Resultium commit standardization library, inspired by conventional commits",
"main": "./dist/index.js",

View File

@@ -37,6 +37,7 @@ import { Command } from "commander";
import semver from "semver";
import { execSync } from "child_process";
import { tmpdir } from "os";
import { request } from "http";
const GetConfig = async () => {
if (fs.existsSync(path.join(process.cwd(), ".rczrc"))) {
@@ -105,6 +106,21 @@ const GetPostReleaseScript = async () => {
return null;
}
};
const isOnline = () => {
return new Promise<boolean>((resolve) => {
request({ method: "GET", hostname: "icanhazip.com" }, (res) => {
res.on("data", () => {});
res.on("end", () => {
resolve(res.statusCode === 200);
});
})
.on("error", () => {
resolve(false);
})
.end();
});
};
const CheckForUpdates = async () => {
const updateText =
@@ -119,8 +135,7 @@ const CheckForUpdates = async () => {
// even if cached once in a while it should get newest data
if ((cachedVersion && Math.random() < 0.1) || cachedVersion === null) {
const isOnline = (await fetch("https://icanhazip.com")).status === 200;
if (!isOnline) return;
if (!(await isOnline())) return;
const serverVersion = execSync("npm show @resultium/rcz version")
.toString()
@@ -142,7 +157,7 @@ const program = new Command();
program
.name("rcz")
.description("Resultium commit standardization command-line interface")
.version("1.12.1");
.version("1.12.2");
program
.command("commit")