Skip to content

Commit 3a6012f

Browse files
committed
Types: Add package.json
Signed-off-by: Jakub Jirutka <[email protected]>
1 parent 4df79b7 commit 3a6012f

File tree

6 files changed

+48
-0
lines changed

6 files changed

+48
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
package-lock.json

.hgignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/node_modules/
2+
package-lock.json

auto/make

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Copyright (C) NGINX, Inc.
44

55
. auto/deps
6+
. ts/config
67

78
echo "creating $NJS_MAKEFILE"
89

@@ -264,10 +265,19 @@ benchmark: $NJS_BUILD_DIR/njs_auto_config.h \\
264265
ts:
265266
mkdir -p $NJS_BUILD_DIR/ts
266267
cp ts/* $NJS_BUILD_DIR/ts/
268+
rm $NJS_BUILD_DIR/ts/config
269+
NJS_VER=`grep NJS_VERSION src/njs.h | sed -e 's/.*"\(.*\)".*/\1/'`; \\
270+
NJS_TYPES_VER=\$\${NJS_VER}-$NJS_TYPES_VER_SUFFIX; \\
271+
sed 's/\("version":\s*\)"\([^"]\+\)"/\1"'\$\${NJS_TYPES_VER}'"/' \\
272+
ts/package.json > $NJS_BUILD_DIR/ts/package.json
267273

268274
ts_test: ts
275+
cd $NJS_BUILD_DIR/ts && tsc
269276
tsc ./test/ts/test.ts
270277

278+
ts_publish: ts
279+
npm publish $NJS_BUILD_DIR/ts
280+
271281
dist:
272282
NJS_VER=`grep NJS_VERSION src/njs.h | sed -e 's/.*"\(.*\)".*/\1/'`; \\
273283
rm -rf njs-\$\${NJS_VER} \\

ts/config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# The "version" field in package.json is substituted by
2+
# <NJS_VERSION>-<NJS_TYPES_VER_SUFFIX> during build.
3+
# Increment this number if you need to publish a new version of njs-types on
4+
# npm without bumping njs version. And reset it back to "1" after bumping
5+
# NJS_VERSION.
6+
NJS_TYPES_VER_SUFFIX=1

ts/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference path="njs_core.d.ts" />

ts/package.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "njs-types",
3+
"version": "0.0.0-dev",
4+
"description": "TypeScript definitions for njs scripting language and nginx js modules.",
5+
"scripts": {
6+
"test": "tsc"
7+
},
8+
"types": "index.d.ts",
9+
"repository": {
10+
"type": "git",
11+
"url": "https://github.com/nginx/njs.git"
12+
},
13+
"keywords": [
14+
"nginx",
15+
"njs",
16+
"types"
17+
],
18+
"author": "NGINX, Inc.",
19+
"license": "BSD-2-Clause",
20+
"bugs": {
21+
"url": "https://github.com/nginx/njs/issues"
22+
},
23+
"homepage": "https://nginx.org/en/docs/njs/",
24+
"dependencies": {
25+
"typescript": "^4.0.3"
26+
}
27+
}

0 commit comments

Comments
 (0)