From 85a964ed4d9d2870cdd84c7321b11f710c655d47 Mon Sep 17 00:00:00 2001 From: Matthew Keil Date: Mon, 26 Aug 2024 14:22:31 -0400 Subject: [PATCH] Fix node.js publish (#502) --- .github/workflows/nodejs-tests.yml | 10 ++++------ bindings/node.js/.dockerignore | 3 +++ bindings/node.js/Dockerfile | 2 +- bindings/node.js/Makefile | 18 +++--------------- bindings/node.js/package.json | 16 ++++++++++++---- 5 files changed, 23 insertions(+), 26 deletions(-) create mode 100644 bindings/node.js/.dockerignore diff --git a/.github/workflows/nodejs-tests.yml b/.github/workflows/nodejs-tests.yml index cacd82fc1..9bdc7a161 100644 --- a/.github/workflows/nodejs-tests.yml +++ b/.github/workflows/nodejs-tests.yml @@ -17,8 +17,9 @@ jobs: - macos-latest - windows-latest node: - - 16 - 18 + - 20 + - 22 steps: - uses: actions/checkout@v3 with: @@ -30,7 +31,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: "3.10" - name: Install setuptools run: | python -m pip install --upgrade pip @@ -41,7 +42,4 @@ jobs: run: make format - name: Build/test bindings working-directory: bindings/node.js - run: make build test bundle - - name: Install distribution - working-directory: bindings/node.js/dist - run: npm install + run: make build test diff --git a/bindings/node.js/.dockerignore b/bindings/node.js/.dockerignore new file mode 100644 index 000000000..d48746a67 --- /dev/null +++ b/bindings/node.js/.dockerignore @@ -0,0 +1,3 @@ +build +*.node +node_modules \ No newline at end of file diff --git a/bindings/node.js/Dockerfile b/bindings/node.js/Dockerfile index e5d2b89c7..4a2a5ce5f 100644 --- a/bindings/node.js/Dockerfile +++ b/bindings/node.js/Dockerfile @@ -3,7 +3,7 @@ RUN apk update && apk add --no-cache g++ make python3 WORKDIR /app/bindings/node.js -COPY dist . +COPY . . RUN yarn install COPY test ./test diff --git a/bindings/node.js/Makefile b/bindings/node.js/Makefile index cbc559f4f..449132741 100644 --- a/bindings/node.js/Makefile +++ b/bindings/node.js/Makefile @@ -2,7 +2,7 @@ YARN = yarn --silent .PHONY: all -all: format build test bundle +all: format build test # Cleans native dependency, bindings and typescript artifacts .PHONY: clean @@ -44,17 +44,6 @@ build: install clean @$(YARN) node-gyp --loglevel=warn configure @$(YARN) node-gyp --loglevel=warn build -# Bundle the distribution, also helpful for cross compatibility checks -.PHONY: bundle -bundle: build - @mkdir dist - @mv deps dist - @cp -r lib dist/lib - @cp -r src dist/src - @cp README.md dist/README.md - @cp package.json dist/package.json - @cp binding.gyp dist/binding.gyp - # Run unit tests and ref-tests .PHONY: test test: install @@ -69,13 +58,12 @@ format: install # Publish package to npm (requires an auth token) .PHONY: publish -publish: build bundle - @cd dist +publish: build test @npm publish # Run ref-tests in linux environment for cross-compatibility check .PHONY: linux-test -linux-test: bundle +linux-test: build @# Docker cannot copy from outside this dir @cp -r ../../tests ref-tests @docker build -t "linux-test" . diff --git a/bindings/node.js/package.json b/bindings/node.js/package.json index dbba1736a..c1426536d 100644 --- a/bindings/node.js/package.json +++ b/bindings/node.js/package.json @@ -1,10 +1,10 @@ { "name": "c-kzg", - "version": "4.0.0", + "version": "4.0.1", "description": "NodeJS bindings for C-KZG", "contributors": [ - "Dan Coffman ", - "Matthew Keil " + "Matthew Keil ", + "Dan Coffman " ], "license": "MIT", "dependencies": { @@ -37,5 +37,13 @@ "homepage": "https://github.com/ethereum/c-kzg-4844", "main": "lib/kzg.js", "types": "lib/kzg.d.ts", - "gypfile": true + "gypfile": true, + "files": [ + "deps", + "lib", + "src", + "binding.gyp", + "package.json", + "README.md" + ] }