Skip to content

Commit dd72eed

Browse files
authored
Merge pull request #531 from zeromq/build-script [skip ci]
2 parents 8810106 + 29645b2 commit dd72eed

File tree

12 files changed

+126
-65
lines changed

12 files changed

+126
-65
lines changed

.eslintrc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
"node_modules/",
1818
"build/",
1919
"lib/",
20-
"libzmq/",
2120
"tmp/",
22-
"zmq/",
2321
"v5-compat.d.ts",
24-
"draft.d.ts"
22+
"draft.d.ts",
23+
"script/*.js",
24+
"script/*.d.ts"
2525
]
2626
}

.gitignore

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
1-
build
2-
docs
3-
lib
4-
tmp
1+
/build
2+
/docs
3+
/lib
4+
/tmp
55
node_modules
66
yarn.lock
77
yarn-error.log
88
package-lock.json
99
lib/binary/*.node
1010
lib/binary/napi-v*/*.node
1111
build-tmp-napi-v*
12-
prebuilds
12+
/prebuilds
1313
test.js
1414
.cache/
1515
test/typings-compatibility/
16+
/script/*.js
17+
/script/*.d.ts
18+
/script/*.js.map
19+
/script/*/*.js
20+
/script/*/*.d.ts
21+
/script/*/*.js.map
22+
tsconfig.tsbuildinfo

binding.gyp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
'outputs': ['<(module_root_dir)/build/libzmq/lib/libzmq.lib', '<(module_root_dir)/build/libzmq/include/zmq.h', '<(module_root_dir)/build/libzmq/include/zmq_utils.h'],
2626
}],
2727
],
28-
'action': ['ts-node', '<(module_root_dir)/script/build.ts'],
28+
'action': ['node', '<(module_root_dir)/script/build.js'],
2929
}],
3030
}],
3131
],

examples/threaded-worker/threaded-worker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as zmq from "zeromq"
44
export class ThreadedWorker {
55
static async spawn(threads: number) {
66
const workers = Array.from({length: threads}).map(() => {
7-
return new Promise((resolve, reject) => {
7+
return new Promise<undefined>((resolve, reject) => {
88
const src = `
99
const zmq = require("zeromq")
1010
${ThreadedWorker.toString()}
@@ -13,7 +13,7 @@ export class ThreadedWorker {
1313

1414
new Worker(src, {eval: true}).on("exit", code => {
1515
if (code === 0) {
16-
resolve()
16+
resolve(undefined)
1717
} else {
1818
reject(new Error(`Worker stopped with exit code ${code}`))
1919
}

examples/tsconfig.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
{
2-
"include": ["*"],
2+
"include": [
3+
"./**/*.ts"
4+
],
35
"compilerOptions": {
46
"target": "es2018",
57
"module": "commonjs",
6-
"lib": ["es2018", "esnext.asynciterable"],
8+
"lib": [
9+
"es2018",
10+
"esnext.asynciterable"
11+
],
712
"strict": true,
13+
"paths": {
14+
"zeromq": [
15+
"../src/index.ts"
16+
],
17+
},
818
}
919
}

package.json

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@
1717
"url": "https://github.com/zeromq/zeromq.js.git"
1818
},
1919
"dependencies": {
20-
"@types/node": "^18.11.9",
21-
"@types/shelljs": "^0.8.11",
22-
"cross-env": "^7.0.3",
2320
"node-addon-api": "^5.0.0",
2421
"node-gyp-build": "^4.5.0",
2522
"shelljs": "^0.8.5",
26-
"ts-node": "10.9"
23+
"shx": "^0.3.4"
2724
},
2825
"devDependencies": {
2926
"@gnd/typedoc": "^0.15.0-0",
3027
"@types/chai": ">=4.3",
3128
"@types/fs-extra": "^9.0.13",
3229
"@types/mocha": ">=10.0",
30+
"@types/node": "^18.11.9",
3331
"@types/semver": ">=7",
32+
"@types/shelljs": "^0.8.11",
3433
"@types/weak-napi": "^2.0.1",
3534
"benchmark": ">=2",
3635
"chai": ">=4.3",
36+
"cross-env": "^7.0.3",
3737
"deasync": "^0.1.28",
3838
"eslint-config-atomic": "^1.18.1",
3939
"eslint-plugin-prettier": "^4.2.1",
@@ -47,9 +47,9 @@
4747
"prettier": "^2.7.1",
4848
"rocha": "^2.5.10",
4949
"semver": ">=7",
50-
"shx": "^0.3.4",
5150
"tar-fs": "^2.1.1",
5251
"ts-morph": "^16.0.0",
52+
"ts-node": "10.9",
5353
"typescript": "4.9",
5454
"weak-napi": "^2.0.2"
5555
},
@@ -61,30 +61,27 @@
6161
"LICENSE",
6262
"README.md",
6363
"binding.gyp",
64-
"draft.d.ts",
65-
"draft.js",
64+
"*.d.ts",
65+
"*.js",
6666
"lib",
67-
"src/util/*.h",
68-
"src/*.cc",
69-
"src/*.h",
70-
"script/build.sh",
67+
"src",
68+
"script",
7169
"prebuilds",
72-
"v5-compat.d.ts",
73-
"v5-compat.js",
74-
"vendor/*.h",
75-
"vendor/LICENSE.md"
70+
"tsconfig.json"
7671
],
7772
"scripts": {
78-
"install": "node-gyp-build",
73+
"install": "(shx test -f ./script/build.js || run-s build.js) && node-gyp-build",
7974
"clean": "shx rm -rf ./build ./lib/ ./prebuilds",
8075
"clean.temp": "shx rm -rf ./tmp && shx mkdir -p tmp && shx touch tmp/.gitkeep",
81-
"build.js": "tsc --project tsconfig-build.json && node script/ci/downlevel-dts.js",
76+
"build.library": "shx rm -rf ./lib && tsc -p ./src/tsconfig.json && node script/ci/downlevel-dts.js",
77+
"build.script": "tsc -p ./script/tsconfig.json",
78+
"build.js": "run-p build.script build.library",
8279
"build.doc": "typedoc --out docs --name zeromq.js --excludeProtected --excludePrivate --excludeNotExported --excludeExternals --externalPattern 'src/+(draft|native|compat).ts' --tsconfig tsconfig-build.json --mode file",
83-
"prebuild": "ts-node -P ./tsconfig.json ./script/prebuild.ts",
80+
"prebuild": "run-s build.js && node ./script/prebuild.js",
8481
"build.native": "node-gyp configure --release && node-gyp build --release",
8582
"build.native.debug": "cross-env CMAKE_BUILD_TYPE=Debug node-gyp configure --debug && cross-env CMAKE_BUILD_TYPE=Debug node-gyp build --debug",
86-
"build": "run-p build.js build.native",
87-
"build.debug": "run-p build.js build.native.debug",
83+
"build": "run-s build.js build.native",
84+
"build.debug": "run-s build.js build.native.debug",
8885
"test": "run-s build && mocha",
8986
"test.skip_gc_tests": "run-s build.debug && cross-env SKIP_GC_TESTS=true mocha",
9087
"lint.clang-format": "clang-format -i -style=file ./src/*.cc ./src/*.h ./src/util/*.h",

0 commit comments

Comments
 (0)