update ava version, migrate to gacts/install-dnscontrol and use lockfiles

This commit is contained in:
dragsbruh committed 2026-07-26 18:53:24 +05:30
1 parent fb5e12dc36
commit a692aa1209
11 files changed
+1927 -43

No files matched your search

+7 -4
View File
@@ -23,7 +23,7 @@ jobs:
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- run: npm install
- run: npm ci
- name: Fetch PR information
if: github.event_name == 'pull_request'
@@ -42,11 +42,14 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
- name: Run DNSControl tests
- uses: gacts/install-dnscontrol@v1
if: github.event_name == 'pull_request' && contains(fromJson(env.CHANGED_FILES), 'dnsconfig.js')
uses: is-a-dev/dnscontrol-action@main
with:
args: check
version: 4.14.0
- name: Run DNSControl checks
run: dnscontrol check
if: github.event_name == 'pull_request' && contains(fromJson(env.CHANGED_FILES), 'dnsconfig.js')
- name: Run tests
run: npx ava tests/*.test.js --timeout=1m
+5 -2
View File
@@ -19,6 +19,9 @@ jobs:
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: is-a-dev/dnscontrol-action@main
- uses: gacts/install-dnscontrol@v1
with:
args: check
version: 4.14.0
- name: Run DNSControl checks
run: dnscontrol check
+5 -3
View File
@@ -21,12 +21,14 @@ jobs:
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: gacts/install-dnscontrol@v1
with:
version: 4.14.0
- name: Generate creds.json
run: echo '{"cloudflare":{"TYPE":"CLOUDFLAREAPI","apitoken":"$CLOUDFLARE_API_TOKEN"}}' > ./creds.json
- name: Push DNS records
uses: is-a-dev/dnscontrol-action@main
run: dnscontrol push
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
with:
args: push
+1873
View File
File diff suppressed because it is too large. Load diff
+6 -5
View File
@@ -1,9 +1,10 @@
{
"devDependencies": {
"ava": "^6.2.0",
"fs-extra": "^11.2.0"
},
"type": "module",
"scripts": {
"test": "npx ava tests/*.test.js"
},
"devDependencies": {
"ava": "^8.0.1",
"fs-extra": "^11.4.0"
}
}
}
+3 -3
View File
@@ -1,6 +1,6 @@
const t = require("ava");
const fs = require("fs-extra");
const path = require("path");
import t from "ava";
import fs from "fs-extra";
import path from "path";
const domainsPath = path.resolve("domains");
const files = fs.readdirSync(domainsPath).filter((file) => file.endsWith(".json"));
+6 -6
View File
@@ -1,6 +1,9 @@
const t = require("ava");
const fs = require("fs-extra");
const path = require("path");
import t from "ava";
import fs from "fs-extra";
import path from "path";
import internalDomains from "../util/internal.json" with { type: "json" };
import reservedDomains from "../util/reserved.json" with { type: "json" };
const ignoredRootJSONFiles = ["package-lock.json", "package.json"];
@@ -32,9 +35,6 @@ const blockedFields = ["domain", "internal", "proxy", "reserved", "services", "s
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
const hostnameRegex = /^(?=.{1,253}$)(?:(?:[_a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)\.)+[a-zA-Z]{2,63}$/;
const internalDomains = require("../util/internal.json");
const reservedDomains = require("../util/reserved.json");
const domainsPath = path.resolve("domains");
const files = fs.readdirSync(domainsPath);
+5 -4
View File
@@ -1,9 +1,10 @@
const t = require("ava");
const fs = require("fs-extra");
const path = require("path");
import t from "ava";
import fs from "fs-extra";
import path from "path";
import trustedUsers from "../util/trusted.json" with { type: "json" };
const requiredEnvVars = ["PR_AUTHOR", "PR_AUTHOR_ID"];
const trustedUsers = require("../util/trusted.json");
const trusted = trustedUsers.map((u) => u.id.toString());
const admins = trustedUsers.filter((u) => u.admin).map((u) => u.id.toString());
+3 -3
View File
@@ -1,6 +1,6 @@
const t = require("ava");
const fs = require("fs-extra");
const path = require("path");
import t from "ava";
import fs from "fs-extra";
import path from "path";
const requiredRecordsToProxy = new Set(["A", "AAAA", "CNAME"]);
+5 -5
View File
@@ -1,6 +1,8 @@
const t = require("ava");
const fs = require("fs-extra");
const path = require("path");
import t from "ava";
import fs from "fs-extra";
import path from "path";
import disallowedCNAMEs from "../util/disallowed-cnames.json" with { type: "json" };
const validRecordTypes = new Set(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NS", "SRV", "TLSA", "TXT", "URL"]);
const hostnameRegex = /^(?=.{1,253}$)(?:(?:[_a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)\.)+[a-zA-Z]{2,63}$/;
@@ -88,8 +90,6 @@ function isValidHexadecimal(value) {
return /^[0-9a-fA-F]+$/.test(value);
}
const disallowedCNAMEs = require("../util/disallowed-cnames.json");
function validateRecordValues(t, data, file) {
const subdomain = file.replace(/\.json$/, "");
+9 -8
View File
@@ -1,8 +1,11 @@
const fs = require("fs");
const path = require("path");
import fs from "fs";
import path from "path";
const directoryPath = path.join(__dirname, "../domains");
const outputDir = path.join(__dirname, "../raw-api");
import internal from "./internal.json" with { type: "json" };
import reserved from "./reserved.json" with { type: "json" };
const directoryPath = "./domains";
const outputDir = "./raw-api";
const domainsOutputDir = path.join(outputDir, "v2", "domains");
if (!fs.existsSync(outputDir)) {
@@ -12,10 +15,6 @@ if (!fs.existsSync(domainsOutputDir)) {
fs.mkdirSync(domainsOutputDir, { recursive: true });
}
const internal = require(path.join(__dirname, "internal.json"));
const reserved = require(path.join(__dirname, "reserved.json"));
const v2 = [];
function writeDomainFile(entry) {
fs.writeFileSync(
path.join(domainsOutputDir, `${entry.subdomain}.json`),
@@ -23,6 +22,8 @@ function writeDomainFile(entry) {
);
}
const v2 = [];
for (const subdomain of internal) {
const entry = {
domain: `${subdomain}.is-a.dev`,