Skip to content

Commit 33fc5bf

Browse files
committedDec 9, 2022
fix pack generation
1 parent 971948a commit 33fc5bf

File tree

6 files changed

+27
-8
lines changed

6 files changed

+27
-8
lines changed
 

‎.npmignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
src
2+
packages
3+
scripts
4+
lib/**/*.ts
5+
lib/**/*.map
6+
!lib/**/*.d.ts
7+
.idea
8+
*.tgz
9+
tsconfig.*
10+
yarn.lock
11+
*.abi
12+
.gitattributes

‎package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"name": "hyperion-sequential-reader",
2+
"name": "@eosrio/hyperion-sequential-reader",
3+
"repository": "eosrio/hyperion-sequential-reader",
34
"version": "1.0.0",
45
"description": "",
56
"main": "./lib/esm/index.js",
@@ -14,8 +15,9 @@
1415
"type": "module",
1516
"scripts": {
1617
"start": "nodemon dist/main.js",
17-
"build": "tsc",
18+
"build": "tsc && node scripts/create-dist-packages.mjs",
1819
"build:watch": "tsc --watch",
20+
"release": "npm run build && npm pack --pack-destination packages",
1921
"test": "echo \"Error: no test specified\" && exit 1"
2022
},
2123
"author": "",
@@ -33,4 +35,4 @@
3335
"tsx": "^3.12.1",
3436
"typescript": "^4.9.3"
3537
}
36-
}
38+
}

‎scripts/create-dist-packages.mjs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import {writeFileSync} from "node:fs";
2+
3+
writeFileSync('./lib/esm/package.json', JSON.stringify({
4+
type: 'module'
5+
}, null, 2));

‎src/index.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
import {HyperionSequentialReader} from "./reader";
2-
3-
export default HyperionSequentialReader;
1+
export * from "./reader.js";

‎src/reader.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {ABI, ABIDecoder, Serializer} from "@greymass/eosio";
33
import {EventEmitter} from "events";
44
import {Worker} from "worker_threads";
55
import * as path from "path";
6+
import { fileURLToPath } from "node:url";
67

78
export class HyperionSequentialReader {
89
ws: WebSocket
@@ -297,7 +298,8 @@ export class HyperionSequentialReader {
297298

298299
createWorkers(param: { poolSize: number }) {
299300
for (let i = 0; i < param.poolSize; i++) {
300-
const w = new Worker(path.resolve('dist/ds-worker.js'), {
301+
const __dirname = fileURLToPath(new URL('.', import.meta.url));
302+
const w = new Worker(path.join(__dirname, 'ds-worker.js'), {
301303
workerData: {
302304
wIndex: i
303305
}

‎tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@
2828
"compileOnSave": false,
2929
"exclude": ["node_modules", "dist", "lib"],
3030
"include": ["src"]
31-
}
31+
}

0 commit comments

Comments
 (0)
Please sign in to comment.