diff options
author | Alexander Borisov <alexander.borisov@nginx.com> | 2018-10-23 13:06:44 +0300 |
---|---|---|
committer | Alexander Borisov <alexander.borisov@nginx.com> | 2018-10-23 13:06:44 +0300 |
commit | 780181412623c0dc9232fc7f56055b6e3312a319 (patch) | |
tree | 517920aacc44de60f204f516a9066aa8a3094328 | |
parent | 0e76769c1be43fed1ad1ce32c90ca56b84af903a (diff) | |
download | unit-780181412623c0dc9232fc7f56055b6e3312a319.tar.gz unit-780181412623c0dc9232fc7f56055b6e3312a319.tar.bz2 |
Added ability to publish Node.js module.
-rw-r--r-- | pkg/Makefile | 8 | ||||
-rw-r--r-- | pkg/npm/Makefile | 27 | ||||
-rw-r--r-- | src/nodejs/unit-http/README.md | 19 | ||||
-rw-r--r-- | src/nodejs/unit-http/binding_pub.gyp | 2 | ||||
-rw-r--r-- | src/nodejs/unit-http/package.json | 2 |
5 files changed, 54 insertions, 4 deletions
diff --git a/pkg/Makefile b/pkg/Makefile index f5cfd3c2..6001a034 100644 --- a/pkg/Makefile +++ b/pkg/Makefile @@ -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 diff --git a/pkg/npm/Makefile b/pkg/npm/Makefile new file mode 100644 index 00000000..2696c226 --- /dev/null +++ b/pkg/npm/Makefile @@ -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 diff --git a/src/nodejs/unit-http/README.md b/src/nodejs/unit-http/README.md index 139597f9..71a4067a 100644 --- a/src/nodejs/unit-http/README.md +++ b/src/nodejs/unit-http/README.md @@ -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 diff --git a/src/nodejs/unit-http/binding_pub.gyp b/src/nodejs/unit-http/binding_pub.gyp index e53538d0..6fe3d9bc 100644 --- a/src/nodejs/unit-http/binding_pub.gyp +++ b/src/nodejs/unit-http/binding_pub.gyp @@ -2,6 +2,6 @@ 'targets': [{ 'target_name': "unit-http", 'sources': ["unit.cpp", "addon.cpp"], - 'libraries': ["unit"] + 'libraries': ["-lunit"] }] } diff --git a/src/nodejs/unit-http/package.json b/src/nodejs/unit-http/package.json index bc481bc9..3a15d573 100644 --- a/src/nodejs/unit-http/package.json +++ b/src/nodejs/unit-http/package.json @@ -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" |