Added ability to publish Node.js module.

This commit is contained in:
Alexander Borisov
2018-10-23 13:06:44 +03:00
parent 0e76769c1b
commit 7801814126
5 changed files with 54 additions and 4 deletions

View File

@@ -6,7 +6,7 @@ VERSION ?= $(shell grep 'define NXT_VERSION' ../src/nxt_main.h \
RELEASE ?= 1
default:
@echo "available targets: dist rpm deb docker"
@echo "available targets: dist rpm deb docker npm"
dist:
rm -f unit-$(VERSION).tar.gz
@@ -24,9 +24,13 @@ deb:
docker:
@cd docker && VERSION=$(VERSION) RELEASE=$(RELEASE) make all
npm:
@cd npm && VERSION=$(VERSION) RELEASE=$(RELEASE) make all
clean:
@cd rpm && make clean
@cd deb && make clean
@cd docker && make clean
@cd npm && make clean
.PHONY: default rpm deb docker clean
.PHONY: default rpm deb docker npm clean

27
pkg/npm/Makefile Normal file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/make
DEFAULT_VERSION := $(shell grep 'define NXT_VERSION' ../../src/nxt_main.h \
| sed -e 's/^.*"\(.*\)".*/\1/')
VERSION ?= $(DEFAULT_VERSION)
NPM ?= npm
default:
@echo "valid targets: all publish clean"
copy:
cp -rp ../../src/nodejs/unit-http .
mv unit-http/binding_pub.gyp unit-http/binding.gyp
sed -e 's/"version"\s*:.*/"version": "${VERSION}.0",/' \
unit-http/package.json > unit-http/package.json.tmp
mv unit-http/package.json.tmp unit-http/package.json
publish: copy
cd unit-http && $(NPM) publish
all: copy
clean:
rm -rf unit-http
.PHONY: default all copy publish clean

View File

@@ -1,2 +1,21 @@
# Node.js Package for NGINX Unit
[<img src="https://unit.nginx.org/_static/logo.svg" width=150px>](https://unit.nginx.org)
Node.js support package for NGINX Unit.
For details, see [NGINX Unit documentation](https://unit.nginx.org).
## Installation
```bash
npm i unit-http
```
## Usage
```javascript
var http = require('unit-http');
```
## License
Apache 2.0

View File

@@ -2,6 +2,6 @@
'targets': [{
'target_name': "unit-http",
'sources': ["unit.cpp", "addon.cpp"],
'libraries': ["unit"]
'libraries': ["-lunit"]
}]
}

View File

@@ -21,7 +21,7 @@
"install": "node-gyp configure build"
},
"author": "Alexander Borisov",
"license": "Apache 2.0",
"license": "Apache-2.0",
"gypfile": true,
"dependencies": {
"node-addon-api": "1.2.0"