Skip to content

Commit 370deed

Browse files
committed
nodejs: Add test-node-versions.mk for testing versions
1 parent 45075dd commit 370deed

3 files changed

Lines changed: 40 additions & 2 deletions

File tree

nodejs/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/.cache/
2+
/bad
13
/node_modules/
24
/nvm/
35
/package-lock.json

nodejs/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ release: $(NODE)
2323
npm publish
2424

2525
clean::
26-
$(RM) package-lock.json strace.txt
26+
$(RM) package-lock.json strace.txt bad
2727

2828
distclean::
29-
$(RM) -r node_modules
29+
$(RM) -r node_modules .cache

nodejs/test-node-versions.mk

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
M := .cache/makes
2+
$(shell [ -d $M ] || git clone -q https://github.com/makeplus/makes $M)
3+
include $M/init.mk
4+
include $M/node.mk
5+
6+
export LD_LIBRARY_PATH := ../libys/lib
7+
8+
LIBYS := $(LD_LIBRARY_PATH)/libys.so.0.2.3
9+
10+
NODES := $(shell \
11+
curl -s https://nodejs.org/download/release/ \
12+
| ys - -e '.split(/href/).filter(/="v/) \
13+
.map(\(replace(_ /.*v(\d*\.\d+\.\d+).*/ "$$1"))) \
14+
.mapv(say) && nil' \
15+
| sort -rV \
16+
| uniq)
17+
18+
MAKE-THIS := $(MAKE) -f test-node-versions.mk
19+
20+
test: $(NODES)
21+
22+
$(NODES):
23+
$(MAKE-THIS) test-node NODE-VERSION=$@
24+
25+
test-node: $(NODE) $(LIBYS) node_modules
26+
@echo '=== $(NODE-VERSION) ==========================================='
27+
NODE_PATH=lib \
28+
node -e 'YS = require("yamlscript"); ys = new YS(); console.log(ys.load(fs.readFileSync(0, "utf8")))' \
29+
<<<$$'!YS-v0:\nfoo:: sum(3 .. 9)' || \
30+
(echo; ( echo 'Bad version: $(NODE-VERSION)' | tee -a bad ); echo)
31+
32+
$(LIBYS):
33+
$(MAKE) -C ../libys build
34+
35+
node_modules:
36+
$(MAKE) test NODE-VERSION=24.8.0

0 commit comments

Comments
 (0)