Skip to content

Commit

Permalink
Fix node.js publish (#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewkeil authored Aug 26, 2024
1 parent 2b38295 commit 85a964e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 26 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/nodejs-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ jobs:
- macos-latest
- windows-latest
node:
- 16
- 18
- 20
- 22
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -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
Expand All @@ -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
3 changes: 3 additions & 0 deletions bindings/node.js/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
*.node
node_modules
2 changes: 1 addition & 1 deletion bindings/node.js/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 3 additions & 15 deletions bindings/node.js/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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" .
Expand Down
16 changes: 12 additions & 4 deletions bindings/node.js/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "c-kzg",
"version": "4.0.0",
"version": "4.0.1",
"description": "NodeJS bindings for C-KZG",
"contributors": [
"Dan Coffman <dgcoffman@gmail.com>",
"Matthew Keil <me@matthewkeil.com>"
"Matthew Keil <me@matthewkeil.com>",
"Dan Coffman <dgcoffman@gmail.com>"
],
"license": "MIT",
"dependencies": {
Expand Down Expand Up @@ -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"
]
}

0 comments on commit 85a964e

Please sign in to comment.