Skip to content

Commit

Permalink
Node.js 16-ra átállás és kisebb hangolások
Browse files Browse the repository at this point in the history
  • Loading branch information
bzolka committed Feb 19, 2023
1 parent 98989a7 commit 11843d2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "AHK Neptun check"
description: "Checks if neptun.txt exists and contains a Neptun code string"
runs:
using: "node12"
using: "node16"
main: "dist/index.js"
8 changes: 4 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,22 @@ function run() {
}
function getNeptunCode() {
if (!fs.existsSync("neptun.txt")) {
throw new Error("Hiba: neptun.txt nem talalhato. Error: neptun.txt does not exist");
throw new Error("Hiba: neptun.txt nem talalhato. Error: neptun.txt does not exist.");
}
const neptunLines = fs
.readFileSync("neptun.txt", "utf-8")
.split("\n")
.filter(Boolean);
if (neptunLines.length == 0) {
throw new Error("Hiba: neptun.txt ures. Error: neptun.txt is empty");
throw new Error("Hiba: neptun.txt ures. Error: neptun.txt is empty.");
}
const neptun = neptunLines[0].trim();
if (neptun.length == 0) {
throw new Error("Hiba: neptun.txt ures. Error: neptun.txt is empty");
throw new Error("Hiba: neptun.txt ures. Error: neptun.txt is empty.");
}
const regex = /^[a-zA-Z0-9]{6}$/g;
if (!regex.test(neptun)) {
throw new Error("Hiba: neptun.txt ervenytelen neptun kodot tartalmaz. Error: neptun.txt contains an invalid neptun code");
throw new Error("Hiba: neptun.txt ervenytelen neptun kodot tartalmaz. Error: neptun.txt contains an invalid neptun code.");
}
return neptun.toUpperCase();
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/akosdudas/ahk-action-neptun-check.git"
"url": "git+https://github.com/bmeaut/ahk-action-neptuncheck.git"
},
"keywords": [
"actions"
Expand Down
8 changes: 4 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function run() {
function getNeptunCode(): string {
if (!fs.existsSync("neptun.txt")) {
throw new Error(
"Hiba: neptun.txt nem talalhato. Error: neptun.txt does not exist"
"Hiba: neptun.txt nem talalhato. Error: neptun.txt does not exist."
);
}

Expand All @@ -22,18 +22,18 @@ async function run() {
.filter(Boolean);

if (neptunLines.length == 0) {
throw new Error("Hiba: neptun.txt ures. Error: neptun.txt is empty");
throw new Error("Hiba: neptun.txt ures. Error: neptun.txt is empty.");
}

const neptun = neptunLines[0].trim();
if (neptun.length == 0) {
throw new Error("Hiba: neptun.txt ures. Error: neptun.txt is empty");
throw new Error("Hiba: neptun.txt ures. Error: neptun.txt is empty.");
}

const regex = /^[a-zA-Z0-9]{6}$/g;
if (!regex.test(neptun)) {
throw new Error(
"Hiba: neptun.txt ervenytelen neptun kodot tartalmaz. Error: neptun.txt contains an invalid neptun code"
"Hiba: neptun.txt ervenytelen neptun kodot tartalmaz. Error: neptun.txt contains an invalid neptun code."
);
}

Expand Down

0 comments on commit 11843d2

Please sign in to comment.