From 1e23691ab2a6fcffc448d56c41ae04ed210dbfa4 Mon Sep 17 00:00:00 2001 From: Henrik Bengtsson Date: Mon, 29 Apr 2024 21:05:38 -0700 Subject: [PATCH] JavaScript: Now 'make check-api/seguid-javascript' works [#12] --- .github/workflows/check-javascript.yml | 3 +++ .gitmodules | 3 +++ Makefile | 17 ++++++++++++++--- seguid-javascript | 1 + 4 files changed, 21 insertions(+), 3 deletions(-) create mode 160000 seguid-javascript diff --git a/.github/workflows/check-javascript.yml b/.github/workflows/check-javascript.yml index a2c9963..9001b42 100644 --- a/.github/workflows/check-javascript.yml +++ b/.github/workflows/check-javascript.yml @@ -71,3 +71,6 @@ jobs: - name: Check CLI if: runner.os != 'Windows' run: make check-cli/seguid-javascript + + - name: Check API + run: make check-api/seguid-python diff --git a/.gitmodules b/.gitmodules index b100902..5416a0b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "tests/test_helper/bats-assert"] path = tests-cli/test_helper/bats-assert url = https://github.com/bats-core/bats-assert.git +[submodule "seguid-javascript"] + path = seguid-javascript + url = https://github.com/seguid/seguid-javascript diff --git a/Makefile b/Makefile index fda2356..8b40e03 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,17 @@ assert-bats: @cd tests-cli && command -v "${BATS}" > /dev/null || { >&2 echo "ERROR: bats is not installed"; exit 1; } +# ------------------------------------------------------------ +# Submodules +# ------------------------------------------------------------ +add-submodules: + git submodule add https://github.com/seguid/seguid-javascript seguid-javascript + +seguid-javascript: + git submodule init + git submodule update + cd "$@" && git pull origin main + # ------------------------------------------------------------ # Check CLI API # ------------------------------------------------------------ @@ -44,8 +55,8 @@ check-api: assert-SCRIPT_CALL assert-bats cd tests-api && $(BATS) *.bats ## FIXME: How do I use node/npm so it finds the 'seguid' module? -check-api/seguid-javascript: - $(MAKE) check-api SCRIPT_CALL="node" SCRIPT_PREAMBLE="const { seguid, lsseguid, ldseguid, csseguid, cdseguid } = require('seguid')" SCRIPT_PRINT_FMT="console.log(%s)" SCRIPT_ARGS_SEP=", " +check-api/seguid-javascript: seguid-javascript + $(MAKE) check-api NODE_PATH="$(shell pwd)/$<" SCRIPT_CALL="node" SCRIPT_PREAMBLE="const { seguid, lsseguid, ldseguid, csseguid, cdseguid } = require('seguid'); async function print(x) { try { const result = await x; console.log(result); } catch (error) { console.error(error); } }" SCRIPT_PRINT_FMT="print(%s)" SCRIPT_ARGS_SEP=", " check-api/seguid-python: $(MAKE) check-api SCRIPT_CALL="python" SCRIPT_PREAMBLE="from seguid import *" SCRIPT_PRINT_FMT="out=%s\nif isinstance(out, tuple):\n out=' '.join(out)\nprint(out)" SCRIPT_ARGS_SEP=", " @@ -56,4 +67,4 @@ check-api/seguid-r: check-api/seguid-tcl: $(MAKE) check-api SCRIPT_CALL="tclsh" SCRIPT_PREAMBLE="source ../src/base64.tcl; source ../src/sha1.tcl; source ../src/seguid.tcl;" SCRIPT_PRINT_FMT="puts stdout [%s]" SCRIPT_ARGS_SEP=" " SCRIPT_CALL_FMT="%s %s" -check-api/ALL: check-api/seguid-python check-api/seguid-r +check-api/ALL: check-api/seguid-javascript check-api/seguid-python check-api/seguid-r diff --git a/seguid-javascript b/seguid-javascript new file mode 160000 index 0000000..b75f499 --- /dev/null +++ b/seguid-javascript @@ -0,0 +1 @@ +Subproject commit b75f4999aef91fae8f8ae220f49b9f9e8e6d5b79