Skip to content

Commit

Permalink
chore: fix tsconfig and pbjs issue (#574)
Browse files Browse the repository at this point in the history
* tsconfig looks like not work on prepare script processing, so remove it
* pass --module nodenext --modueResolution nodenext --target es6 as command arg
* import Long as deps for ES5, and because issue --force-number does not work (protobufjs/protobuf.js#1109), we cannot use number instead
* With nodenext resolution, the export/import in index.ts should with file extension.
  • Loading branch information
RyanKung committed Apr 27, 2024
1 parent 5f1a104 commit ab74421
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
8 changes: 5 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import init from "./rings_node";
import init from "./rings_node.js";

export default init;

export * from "./rings_node";
export * from "./rings_node_proto";
export * from "./rings_node.js";
import Long from "long";

export * from "./rings_node_proto.js";
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,24 @@
"description": "Rings is a structured peer-to-peer network implementation using WebRTC, Chord algorithm, and full WebAssembly (WASM) support.\n",
"version": "0.6.1",
"license": "GPL-3.0",
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/RingsNetwork/rings-node"
},
"scripts": {
"wasm_pack": "wasm-pack build crates/node --release --scope ringsnetwork -t web --no-default-features --features browser_default --features console_error_panic_hook",
"proto_generate": "mkdir -p dist && pbjs -t static-module --keep-case -o dist/rings_node_proto.js crates/rpc/src/protos/rings_node.proto && pbts -o dist/rings_node_proto.d.ts dist/rings_node_proto.js",
"prepare": "npm run wasm_pack && npm run proto_generate && cp crates/node/pkg/rings_node* ./dist && cp index.ts ./dist && tsc ./dist/index.ts"
"prepare": "npm run wasm_pack && npm run proto_generate && cp crates/node/pkg/rings_node* ./dist && cp index.ts ./dist && tsc --target es6 --moduleResolution nodenext --module nodenext ./dist/index.ts"
},
"dependencies": {
"circomlib": "^2.0.5",
"protobufjs": "https://github.com/RingsNetwork/protobuf.js#83686a0"
"protobufjs": "https://github.com/RingsNetwork/protobuf.js#83686a0",
"long": "^3.2.0"
},
"devDependencies": {
"protobufjs-cli": "^1.1.2",
"typescript": "^4.9.5"
"typescript": "^5"
},
"files": [
"dist/"
Expand Down
8 changes: 0 additions & 8 deletions tsconfig.json

This file was deleted.

0 comments on commit ab74421

Please sign in to comment.