Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: compile the build typescript files for production #531

Merged
merged 8 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"node_modules/",
"build/",
"lib/",
"libzmq/",
"tmp/",
"zmq/",
"v5-compat.d.ts",
"draft.d.ts"
"draft.d.ts",
"script/*.js",
"script/*.d.ts"
]
}
17 changes: 12 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
build
docs
lib
tmp
/build
/docs
/lib
/tmp
node_modules
yarn.lock
yarn-error.log
package-lock.json
lib/binary/*.node
lib/binary/napi-v*/*.node
build-tmp-napi-v*
prebuilds
/prebuilds
test.js
.cache/
test/typings-compatibility/
/script/*.js
/script/*.d.ts
/script/*.js.map
/script/*/*.js
/script/*/*.d.ts
/script/*/*.js.map
tsconfig.tsbuildinfo
2 changes: 1 addition & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
'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'],
}],
],
'action': ['ts-node', '<(module_root_dir)/script/build.ts'],
'action': ['node', '<(module_root_dir)/script/build.js'],
}],
}],
],
Expand Down
4 changes: 2 additions & 2 deletions examples/threaded-worker/threaded-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as zmq from "zeromq"
export class ThreadedWorker {
static async spawn(threads: number) {
const workers = Array.from({length: threads}).map(() => {
return new Promise((resolve, reject) => {
return new Promise<undefined>((resolve, reject) => {
const src = `
const zmq = require("zeromq")
${ThreadedWorker.toString()}
Expand All @@ -13,7 +13,7 @@ export class ThreadedWorker {

new Worker(src, {eval: true}).on("exit", code => {
if (code === 0) {
resolve()
resolve(undefined)
} else {
reject(new Error(`Worker stopped with exit code ${code}`))
}
Expand Down
14 changes: 12 additions & 2 deletions examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
{
"include": ["*"],
"include": [
"./**/*.ts"
],
"compilerOptions": {
"target": "es2018",
"module": "commonjs",
"lib": ["es2018", "esnext.asynciterable"],
"lib": [
"es2018",
"esnext.asynciterable"
],
"strict": true,
"paths": {
"zeromq": [
"../src/index.ts"
],
},
}
}
37 changes: 17 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@
"url": "https://github.com/zeromq/zeromq.js.git"
},
"dependencies": {
"@types/node": "^18.11.9",
"@types/shelljs": "^0.8.11",
"cross-env": "^7.0.3",
"node-addon-api": "^5.0.0",
"node-gyp-build": "^4.5.0",
"shelljs": "^0.8.5",
"ts-node": "10.9"
"shx": "^0.3.4"
},
"devDependencies": {
"@gnd/typedoc": "^0.15.0-0",
"@types/chai": ">=4.3",
"@types/fs-extra": "^9.0.13",
"@types/mocha": ">=10.0",
"@types/node": "^18.11.9",
"@types/semver": ">=7",
"@types/shelljs": "^0.8.11",
"@types/weak-napi": "^2.0.1",
"benchmark": ">=2",
"chai": ">=4.3",
"cross-env": "^7.0.3",
"deasync": "^0.1.28",
"eslint-config-atomic": "^1.18.1",
"eslint-plugin-prettier": "^4.2.1",
Expand All @@ -47,9 +47,9 @@
"prettier": "^2.7.1",
"rocha": "^2.5.10",
"semver": ">=7",
"shx": "^0.3.4",
"tar-fs": "^2.1.1",
"ts-morph": "^16.0.0",
"ts-node": "10.9",
"typescript": "4.9",
"weak-napi": "^2.0.2"
},
Expand All @@ -61,30 +61,27 @@
"LICENSE",
"README.md",
"binding.gyp",
"draft.d.ts",
"draft.js",
"*.d.ts",
"*.js",
"lib",
"src/util/*.h",
"src/*.cc",
"src/*.h",
"script/build.sh",
"src",
"script",
"prebuilds",
"v5-compat.d.ts",
"v5-compat.js",
"vendor/*.h",
"vendor/LICENSE.md"
"tsconfig.json"
],
"scripts": {
"install": "node-gyp-build",
"install": "(shx test -f ./script/build.js || run-s build.js) && node-gyp-build",
"clean": "shx rm -rf ./build ./lib/ ./prebuilds",
"clean.temp": "shx rm -rf ./tmp && shx mkdir -p tmp && shx touch tmp/.gitkeep",
"build.js": "tsc --project tsconfig-build.json && node script/ci/downlevel-dts.js",
"build.library": "shx rm -rf ./lib && tsc -p ./src/tsconfig.json && node script/ci/downlevel-dts.js",
"build.script": "tsc -p ./script/tsconfig.json",
"build.js": "run-p build.script build.library",
"build.doc": "typedoc --out docs --name zeromq.js --excludeProtected --excludePrivate --excludeNotExported --excludeExternals --externalPattern 'src/+(draft|native|compat).ts' --tsconfig tsconfig-build.json --mode file",
"prebuild": "ts-node -P ./tsconfig.json ./script/prebuild.ts",
"prebuild": "run-s build.js && node ./script/prebuild.js",
"build.native": "node-gyp configure --release && node-gyp build --release",
"build.native.debug": "cross-env CMAKE_BUILD_TYPE=Debug node-gyp configure --debug && cross-env CMAKE_BUILD_TYPE=Debug node-gyp build --debug",
"build": "run-p build.js build.native",
"build.debug": "run-p build.js build.native.debug",
"build": "run-s build.js build.native",
"build.debug": "run-s build.js build.native.debug",
"test": "run-s build && mocha",
"test.skip_gc_tests": "run-s build.debug && cross-env SKIP_GC_TESTS=true mocha",
"lint.clang-format": "clang-format -i -style=file ./src/*.cc ./src/*.h ./src/util/*.h",
Expand Down
Loading