diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eadccbe..7c1fbee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,8 @@ name: CI on: - push: + pull_request: + types: [opened, synchronize, reopened] env: CI: true @@ -9,12 +10,17 @@ env: jobs: lint: uses: NicTool/.github/.github/workflows/lint.yml@main + permissions: + contents: read coverage: uses: NicTool/.github/.github/workflows/coverage.yml@main secrets: inherit + permissions: + contents: read test: - needs: lint uses: NicTool/.github/.github/workflows/test.yml@main secrets: inherit + permissions: + contents: read diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 46e21d1..0000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: CodeQL - -on: - push: - branches: [main] - pull_request: - # The branches below must be a subset of the branches above - branches: [main] - schedule: - - cron: '18 7 * * 4' - -jobs: - codeql: - uses: NicTool/.github/.github/workflows/codeql.yml@main diff --git a/.gitignore b/.gitignore index 8682f98..de208cf 100644 --- a/.gitignore +++ b/.gitignore @@ -106,3 +106,4 @@ dist/*-grammar.js dist/*.js package-lock.json src/mara-moo.ne +.release/ diff --git a/.release b/.release index d106d83..a6911a9 160000 --- a/.release +++ b/.release @@ -1 +1 @@ -Subproject commit d106d83e69d5d8c99e4d6be4ba98ddde550d082b +Subproject commit a6911a90f1b15486fb319d844341421c78035b2a diff --git a/CHANGELOG.md b/CHANGELOG.md index f4a1bdc..e9320f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ### Unreleased +### [1.1.8] - 2026-04-07 + +- style: replace str.substring (deprecated) with slice + ### [1.1.7] - 2026-03-13 - dep(eslint): update to v10 @@ -192,3 +196,4 @@ [1.1.5]: https://github.com/NicTool/dns-zone/releases/tag/1.1.5 [1.1.6]: https://github.com/NicTool/dns-zone/releases/tag/v1.1.6 [1.1.7]: https://github.com/NicTool/dns-zone/releases/tag/v1.1.7 +[1.1.8]: https://github.com/NicTool/dns-zone/releases/tag/v1.1.8 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 58fe475..ea5d711 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -2,7 +2,7 @@ This handcrafted artisanal software is brought to you by: -|
msimerson (27) | +|
msimerson (28) | | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | this file is generated by [.release](https://github.com/msimerson/.release). diff --git a/bin/dns-zone.js b/bin/dns-zone.js index 00cf6f1..73fe972 100755 --- a/bin/dns-zone.js +++ b/bin/dns-zone.js @@ -351,7 +351,7 @@ function toHuman(zoneArray) { .getRdataFields() .map((f) => r.get(f)) .join(' ') - process.stdout.write(rdata.substring(0, rdataWidth)) + process.stdout.write(rdata.slice(0, rdataWidth)) if (rdata.length > rdataWidth) process.stdout.write('...') process.stdout.write('\n') diff --git a/lib/tinydns.js b/lib/tinydns.js index 000de57..40e53c3 100644 --- a/lib/tinydns.js +++ b/lib/tinydns.js @@ -84,7 +84,7 @@ function parseTinyDot(str) { * an A (``address'') record showing ip as the IP address of x.ns.fqdn; and * an SOA (``start of authority'') record for fqdn listing x.ns.fqdn as the primary name server and hostmaster@fqdn as the contact address. */ - const [fqdn, ip, mname, ttl, ts, loc] = str.substring(1).split(':') + const [fqdn, ip, mname, ttl, ts, loc] = str.slice(1).split(':') const rrs = [] rrs.push( @@ -100,7 +100,7 @@ function parseTinyDot(str) { expire: 1048576, minimum: 2560, timestamp: parseInt(ts) || '', - location: loc !== '' && loc !== '\n' ? loc : '', + location: loc?.trim() || '', }), ) @@ -111,7 +111,7 @@ function parseTinyDot(str) { type: 'NS', dname: rr.fullyQualify(/\./.test(mname) ? mname : `${mname}.ns.${fqdn}`), timestamp: ts, - location: loc !== '' && loc !== '\n' ? loc : '', + location: loc?.trim() || '', }), ) @@ -123,7 +123,7 @@ function parseTinyDot(str) { address: ip, ttl: parseInt(ttl, 10), timestamp: ts, - location: loc !== '' && loc !== '\n' ? loc : '', + location: loc?.trim() || '', }), ) } @@ -133,7 +133,7 @@ function parseTinyDot(str) { function parseTinyAmpersand(str) { // &fqdn:ip:x:ttl:timestamp:lo - const [fqdn, ip, dname, ttl, ts, loc] = str.substring(1).split(':') + const [fqdn, ip, dname, ttl, ts, loc] = str.slice(1).split(':') const rrs = [] rrs.push( @@ -143,7 +143,7 @@ function parseTinyAmpersand(str) { dname: rr.fullyQualify(/\./.test(dname) ? dname : `${dname}.ns.${fqdn}`), ttl: parseInt(ttl, 10), timestamp: ts, - location: loc !== '' && loc !== '\n' ? loc : '', + location: loc?.trim() || '', }), ) @@ -155,7 +155,7 @@ function parseTinyAmpersand(str) { address: ip, ttl: parseInt(ttl, 10), timestamp: ts, - location: loc !== '' && loc !== '\n' ? loc : '', + location: loc?.trim() || '', }), ) } @@ -167,7 +167,7 @@ function parseTinyEquals(str) { // =fqdn:ip:ttl:timestamp:lo const rrs = [new RR.A({ tinyline: str })] - const [fqdn, ip, ttl, ts, loc] = str.substring(1).split(':') + const [fqdn, ip, ttl, ts, loc] = str.slice(1).split(':') rrs.push( new RR.PTR({ owner: `${ip.split('.').reverse().join('.')}.in-addr.arpa`, @@ -175,7 +175,7 @@ function parseTinyEquals(str) { type: 'PTR', dname: rr.fullyQualify(fqdn), timestamp: ts, - location: loc !== '' && loc !== '\n' ? loc : '', + location: loc?.trim() || '', }), ) @@ -187,7 +187,7 @@ function parseTinyAt(str) { const rrs = [new RR.MX({ tinyline: str })] // eslint-disable-next-line no-unused-vars - const [fqdn, ip, x, preference, ttl, ts, loc] = str.substring(1).split(':') + const [fqdn, ip, x, preference, ttl, ts, loc] = str.slice(1).split(':') if (ip) { rrs.push( new RR.A({ @@ -196,7 +196,7 @@ function parseTinyAt(str) { address: ip, ttl: parseInt(ttl, 10), timestamp: ts, - location: loc !== '' && loc !== '\n' ? loc : '', + location: loc?.trim() || '', }), ) } @@ -208,7 +208,7 @@ function parseTinySix(str) { // AAAA,PTR => 6 fqdn:ip:x:ttl:timestamp:lo const rrs = [new RR.AAAA({ tinyline: str })] - const [fqdn, rdata, , ttl, ts, loc] = str.substring(1).split(':') + const [fqdn, rdata, , ttl, ts, loc] = str.slice(1).split(':') rrs.push( new RR.PTR({ @@ -217,7 +217,7 @@ function parseTinySix(str) { dname: rr.fullyQualify(fqdn), ttl: parseInt(ttl, 10), timestamp: ts, - location: loc !== '' && loc !== '\n' ? loc : '', + location: loc?.trim() || '', }), ) return rrs @@ -226,7 +226,7 @@ function parseTinySix(str) { function parseTinyGeneric(str) { // generic, :fqdn:n:rdata:ttl:timestamp:lo - const [, n, , , ,] = str.substring(1).split(':') + const [, n, , , ,] = str.slice(1).split(':') switch (parseInt(n, 10)) { case 13: diff --git a/package.json b/package.json index 9693961..09b8103 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nictool/dns-zone", - "version": "1.1.7", + "version": "1.1.8", "description": "DNS Zone", "main": "index.js", "type": "module", @@ -18,9 +18,10 @@ "prettier": "npx prettier --ignore-path .gitignore --check .", "prettier:fix": "npx prettier --ignore-path .gitignore --write .", "test": "npx mocha", - "versions": "npx dependency-version-checker check", - "versions:fix": "npx dependency-version-checker update", - "format": "npm run prettier:fix && npm run lint:fix" + "versions": "npx npm-dep-mgr check", + "versions:fix": "npx npm-dep-mgr update", + "format": "npm run prettier:fix && npm run lint:fix", + "test:coverage": "npx c8 --reporter=text --reporter=text-summary npm test" }, "repository": { "type": "git", @@ -59,4 +60,4 @@ "singleQuote": true, "trailingComma": "all" } -} \ No newline at end of file +}