WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit f23a2ce

Browse files
committed
chore: drop support for node 18 and below. drop many testing related dev dependencies and use native node test runner
1 parent a434355 commit f23a2ce

14 files changed

+219
-227
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ${{ matrix.os }}
1616
strategy:
1717
matrix:
18-
node-version: [ 16.x, 18.x, 20.x ]
18+
node-version: [ 20.x, 22.x ]
1919
os: [ windows-latest, ubuntu-latest, macOS-latest ]
2020

2121
# Go
@@ -46,22 +46,15 @@ jobs:
4646
- name: Install
4747
run: npm install
4848

49-
- name: Test (Node.js <= 16.x only)
50-
if: matrix.node-version <= '16.x'
51-
run: npm run test:nolint
52-
env:
53-
CI: true
54-
5549
- name: Test
56-
if: matrix.node-version > '16.x'
5750
run: npm test
5851
env:
5952
CI: true
6053

6154
- name: Notify
6255
uses: sarisia/actions-status-discord@v1
6356
# Only fire alert once
64-
if: github.ref == 'refs/heads/main' && failure() && matrix.node-version == '20.x' && matrix.os == 'ubuntu-latest'
57+
if: github.ref == 'refs/heads/main' && failure() && matrix.node-version == '22.x' && matrix.os == 'ubuntu-latest'
6558
with:
6659
webhook: ${{ secrets.DISCORD_WEBHOOK }}
6760
title: "build and test"

changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
---
44

5+
## [8.0.0] 2025-04-06
6+
7+
### Changed
8+
9+
- Breaking change: dropped node 16, 18 support
10+
11+
---
12+
513
## [7.0.0 - 7.0.1] 2024-01-08
614

715
### Changed

package.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@
77
"deno:test": "deno test -A --unstable mod.test.ts",
88
"deno:fmt": "deno fmt mod.ts && deno fmt mod.test.ts",
99
"lint": "eslint . --fix",
10-
"test:unit": "cross-env tape 'test/*-test.js' | tap-arc",
11-
"coverage": "nyc --reporter=lcov --reporter=text-summary npm run test:unit",
12-
"test:nolint": "npm run coverage",
10+
"test:unit": "node --test",
11+
"coverage": "node --test --experimental-test-coverage",
1312
"test": "npm run lint && npm run coverage",
1413
"rc": "npm version prerelease --preid RC",
1514
"build": "rollup -c",
1615
"vendor:js-yaml": "mkdir -p tmp && browserify --node --standalone js-yaml --im --no-builtins node_modules/js-yaml/index.js > tmp/js-yaml.js && mkdir -p src/compat/vendor && terser tmp/js-yaml.js -o src/compat/vendor/js-yaml.min.js",
1716
"vendor": "npm run vendor:js-yaml"
1817
},
1918
"engines": {
20-
"node": ">=16"
19+
"node": ">=20"
2120
},
2221
"repository": {
2322
"type": "git",
@@ -34,13 +33,9 @@
3433
"@rollup/plugin-json": "^6.0.0",
3534
"@rollup/plugin-terser": "~0.4.3",
3635
"browserify": "~17.0.0",
37-
"cross-env": "~7.0.3",
3836
"eslint": "~9.1.1",
3937
"js-yaml": "~4.1.0",
40-
"nyc": "^15.1.0",
4138
"rollup": "^3.27.0",
42-
"tap-arc": "~1.2.2",
43-
"tape": "~5.7.5",
4439
"terser": "~5.31.0"
4540
}
4641
}

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Parsing the file with the following code:
5959
```javascript
6060
#!/usr/bin/env node
6161
const parse = require('@architect/parser')
62-
const fs = require('fs')
62+
const fs = require('node:fs')
6363
const text = fs.readFileSync('./some-arc-file.txt').toString()
6464
const result = parse(text)
6565

test/00-lexer-test.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
let test = require('tape')
1+
let test = require('node:test')
22
let lex = require('../src/lexer')
33

44
let arcfile = `
@@ -15,28 +15,24 @@ false false false
1515
# comment with spaces
1616
foo bar
1717
18-
thing
19-
nested thing
20-
semi;colons
18+
#semi;colons?
2119
`
2220

2321
test('lex', t => {
2422
t.plan(5)
2523

2624
// can lex
27-
t.ok(lex, 'exists')
25+
t.assert.ok(lex, 'exists')
2826
let result = lex(arcfile)
2927

3028
// got an array
31-
t.ok(Array.isArray(result), 'lexed')
29+
t.assert.ok(Array.isArray(result), 'lexed')
3230
let first = result[0]
3331
let second = result[1]
3432
let third = result[2]
3533

3634
// ensure the arcfile parses as we'd expect
37-
t.ok(first.type === 'newline' && first.line === 1 && first.column === 1, 'line 1 column 1 is a newline')
38-
t.ok(second.type === 'newline' && second.line === 2 && first.column === 1, 'line 2 column 1 is a newline')
39-
t.ok(third.type === 'pragma' && third.value === 'pragma1' && third.line === 3 && third.column === 1, 'hunp')
40-
41-
console.log(result)
35+
t.assert.ok(first.type === 'newline' && first.line === 1 && first.column === 1, 'line 1 column 1 is a newline')
36+
t.assert.ok(second.type === 'newline' && second.line === 2 && first.column === 1, 'line 2 column 1 is a newline')
37+
t.assert.ok(third.type === 'pragma' && third.value === 'pragma1' && third.line === 3 && third.column === 1, 'hunp')
4238
})

test/01-ast-scalar-test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
let test = require('tape')
1+
let { test } = require('node:test')
22
let parse = require('../')
33

44
test('ast empty', t => {
@@ -32,8 +32,8 @@ test('ast empty', t => {
3232
}
3333

3434
let parsed = parse.parser(parse.lexer(mock))
35-
console.dir(parsed, { depth: null })
36-
t.same(parsed, expected, 'successfully parsed ast for empty types')
35+
// console.dir(parsed, { depth: null })
36+
t.assert.deepEqual(parsed, expected, 'successfully parsed ast for empty types')
3737
})
3838

3939
test('ast scalars', t => {
@@ -74,8 +74,8 @@ true`
7474
}
7575

7676
let parsed = parse.parser(parse.lexer(mock))
77-
console.dir(parsed, { depth: null })
78-
t.same(parsed, expected, 'successfully parsed ast for scalar types')
77+
// console.dir(parsed, { depth: null })
78+
t.assert.deepEqual(parsed, expected, 'successfully parsed ast for scalar types')
7979
})
8080

8181
test('ast arrays', t => {
@@ -127,6 +127,6 @@ one true 3 # comment2`
127127

128128
let tokens = parse.lexer(mock)
129129
let parsed = parse.parser(tokens)
130-
console.dir(parsed, { depth: null })
131-
t.same(parsed, expected, 'successfully parsed array')
130+
// console.dir(parsed, { depth: null })
131+
t.assert.deepEqual(parsed, expected, 'successfully parsed array')
132132
})

test/02-ast-complex-test.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
let test = require('tape')
1+
let { test } = require('node:test')
22
let parse = require('../')
33
let isVector = require('../src/parser/_is-vector')
44
let isMap = require('../src/parser/_is-map')
@@ -15,7 +15,7 @@ vec # hi
1515
some stuff here`
1616
let tokens = parse.lexer(mock)
1717
let start = tokens.slice(3, tokens.length) // start at 'vec'
18-
t.ok(isVector(start), 'found a valid vector')
18+
t.assert.ok(isVector(start), 'found a valid vector')
1919
})
2020

2121
test('is not a vector', t => {
@@ -26,7 +26,7 @@ map
2626
one two`
2727
let tokens = parse.lexer(mock)
2828
let start = tokens.slice(3, tokens.length) // start at 'map' token
29-
t.ok(isVector(start) === false, 'did not find a valid vector')
29+
t.assert.ok(isVector(start) === false, 'did not find a valid vector')
3030
})
3131

3232
test('ast vectors', t => {
@@ -106,8 +106,8 @@ this should be ignored`
106106
],
107107
}
108108
let parsed = parse.parser(parse.lexer(mock))
109-
console.dir(parsed, { depth: null })
110-
t.same(parsed, expected, 'successfully parsed vector')
109+
// console.dir(parsed, { depth: null })
110+
t.assert.deepEqual(parsed, expected, 'successfully parsed vector')
111111
})
112112

113113
test('isMap', t => {
@@ -123,8 +123,8 @@ map
123123
`
124124
let tokens = parse.lexer(mock)
125125
let start = tokens.slice(3, tokens.length)
126-
console.log(start)
127-
t.ok(isMap(start))
126+
// console.log(start)
127+
t.assert.ok(isMap(start))
128128
})
129129

130130
test('map has three keys (vectors)', t => {
@@ -137,11 +137,11 @@ m1 # also cool
137137
three 3`
138138
let tokens = parse.lexer(mock)
139139
let ast = parse.parser(tokens)
140-
console.dir(ast, { depth: null })
140+
// console.dir(ast, { depth: null })
141141
let pragma = ast.values.find(t => t.type === 'pragma' && t.name === 'map-test')
142142
let map = pragma.values.find(t => t.type === 'map' && t.name === 'm1')
143143
let keys = map.values.filter(t => t.type === 'vector')
144-
t.ok(keys.length === 3, 'has three keys')
144+
t.assert.ok(keys.length === 3, 'has three keys')
145145
})
146146

147147
test('map with vector', t => {
@@ -157,10 +157,10 @@ m1 #comment2
157157
false`
158158
let tokens = parse.lexer(mock)
159159
let mapTokens = tokens.slice(5, tokens.length)
160-
t.ok(isVector(mapTokens) === false, 'isVector is false')
161-
t.ok(isMap(mapTokens) === true, 'isMap is true')
162-
let parsed = parse.parser(tokens)
163-
console.dir(parsed, { depth: null })
160+
t.assert.ok(isVector(mapTokens) === false, 'isVector is false')
161+
t.assert.ok(isMap(mapTokens) === true, 'isMap is true')
162+
/* let parsed = */parse.parser(tokens)
163+
// console.dir(parsed, { depth: null })
164164
})
165165

166166
test('map with scalars and vectors', t => {
@@ -185,7 +185,7 @@ m1 #comment2
185185
let map = pragma.values.find(t => t.type === 'map')
186186
let keys = map.values.filter( t => t.type === 'vector')
187187
let bools = keys.find(t => t.name === 'bools')
188-
t.ok(keys.length === 4, 'has four keys')
189-
t.ok(bools.values.filter(t => t.type === 'boolean').length === 2, 'bools has two booleans')
190-
console.dir(parsed, { depth: null })
188+
t.assert.ok(keys.length === 4, 'has four keys')
189+
t.assert.ok(bools.values.filter(t => t.type === 'boolean').length === 2, 'bools has two booleans')
190+
// console.dir(parsed, { depth: null })
191191
})

0 commit comments

Comments
 (0)