summaryrefslogtreecommitdiffhomepage
path: root/pkg/npm/Makefile
diff options
context:
space:
mode:
authorAlexander Borisov <alexander.borisov@nginx.com>2018-10-23 13:06:44 +0300
committerAlexander Borisov <alexander.borisov@nginx.com>2018-10-23 13:06:44 +0300
commit780181412623c0dc9232fc7f56055b6e3312a319 (patch)
tree517920aacc44de60f204f516a9066aa8a3094328 /pkg/npm/Makefile
parent0e76769c1be43fed1ad1ce32c90ca56b84af903a (diff)
downloadunit-780181412623c0dc9232fc7f56055b6e3312a319.tar.gz
unit-780181412623c0dc9232fc7f56055b6e3312a319.tar.bz2
Added ability to publish Node.js module.
Diffstat (limited to 'pkg/npm/Makefile')
-rw-r--r--pkg/npm/Makefile27
1 files changed, 27 insertions, 0 deletions
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