*WIP: minor refactor and build process to create application binaries

This commit is contained in:
Derrick Hammer 2022-07-24 22:36:49 -04:00
parent 0713216cd3
commit 98050b90b0
8 changed files with 973 additions and 17 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

158
esbuild.config.js Normal file
View File

@ -0,0 +1,158 @@
const esbuild = require("esbuild");
esbuild.buildSync({
entryPoints: ["build/index.js"],
outdir: "node-dist",
platform: "node",
target: ["node18"],
bundle: true,
format: "cjs",
mainFields: ["main"],
external: [
"buffer",
"buffer-from",
"udx-native",
"secp256k1",
"bigint-buffer",
"elliptic",
"@pokt-network/amino-js",
"@pokt-network/pocket-js",
"bufferutil",
"utf-8-validate",
"msgpackr-extract",
"sodium-native",
"loady",
"bcrypto",
"bdb",
"hsd",
"goosig",
"mrmr",
"lodash",
"through",
"JSONStream",
"jayson",
"msgpackr",
"tslib",
"async-mutex",
"clone",
"node-cache",
"kademlia-routing-table",
"time-ordered-set",
"sodium-universal",
"b4a",
"compact-encoding",
"nat-sampler",
"fast-fifo",
"compact-encoding-net",
"dht-rpc",
"@hyperswarm/dht",
"bsert",
"bcfg",
"loglevel",
"@ethersproject/bignumber",
"@ethersproject/logger",
"@ethersproject/properties",
"@ethersproject/abi",
"@ethersproject/bytes",
"@ethersproject/abstract-provider",
"@ethersproject/abstract-signer",
"@ethersproject/keccak256",
"@ethersproject/rlp",
"@ethersproject/address",
"@ethersproject/constants",
"@ethersproject/signing-key",
"@ethersproject/transactions",
"@ethersproject/contracts",
"@ethersproject/strings",
"@ethersproject/hash",
"@ethersproject/basex",
"@ethersproject/pbkdf2",
"@ethersproject/sha2",
"@ethersproject/wordlists",
"@ethersproject/hdnode",
"@ethersproject/random",
"@ethersproject/json-wallets",
"@ethersproject/wallet",
"@ethersproject/networks",
"@ethersproject/base64",
"@ethersproject/web",
"@ethersproject/providers",
"@ethersproject/solidity",
"@ethersproject/units",
"ethers",
"js-sha3",
"bech32",
"tweetnacl",
"@solana/web3.js",
"bs32",
"binet",
"bns",
"bsock",
"brq",
"bcurl",
"hs-client",
"minimatch",
"balanced-match",
"brace-expansion",
"bignumber.js",
"json-bigint",
"algosdk",
"has-symbols",
"function-bind",
"has",
"get-intrinsic",
"call-bind",
"object-inspect",
"xmlbuilder",
"sax",
"xml2js",
"jsonify",
"queue-tick",
"safety-catch",
"protomux",
"bytes",
"content-type",
"setprototypeof",
"statuses",
"inherits",
"toidentifier",
"ms",
"debug",
"destroy",
"unpipe",
"express",
"bluebird",
"ws",
"axios",
"random-key",
"querystringify",
"node-cron",
"asynckit",
"sprintf-js",
"json-stable-stringify",
"form-data",
"mime-types",
"mime-db",
"skynet-js",
"url-join",
"url-parse",
"requires-port",
"@skynetlabs/tus-js-client",
"@skynetlabs/skynet-nodejs",
"follow-redirects",
"date-fns",
"acme-client",
"path-to-regexp",
"array-flatten",
"body-parser",
"on-finished",
"ee-first",
"raw-body",
"iconv-lite",
"safer-buffer",
"http-errors",
"@hyperswarm/dht-relay",
],
define: {
"global.GENTLY": false,
},
});

View File

@ -8,6 +8,12 @@
"name": "Derrick Hammer",
"email": "contact@lumeweb.com"
},
"scripts": {
"compile": "tsc",
"bundle": "node esbuild.config.js",
"package": "bash prebuild.sh && pkg -c pkg.json node-dist/index.js -t linux",
"build": "npm run compile && npm run bundle && npm run package"
},
"dependencies": {
"@hyperswarm/dht": "^6.0.1",
"@hyperswarm/dht-relay": "^0.3.0",
@ -50,7 +56,10 @@
"@types/sprintf-js": "^1.1.2",
"esbuild": "^0.14.49",
"hyper-typings": "^1.0.0",
"pkg": "^5.8.0",
"prettier": "^2.7.1",
"rollup": "^2.77.0"
"rollup": "^2.77.0",
"supports-color": "^9.2.2",
"typescript": "^4.7.4"
}
}

9
pkg.json Normal file
View File

@ -0,0 +1,9 @@
{
"assets": [
"node_modules/udx-native/prebuilds/*/*.node",
"node_modules/sodium-native/prebuilds/*/*.node",
"node_modules/bcrypto/prebuilds/*/*.node",
"node_modules/hsd/lib/covenants/names.db"
],
"outputPath": "dist"
}

12
prebuild.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
rimraf node_modules/@tendermint/types
rimraf node_modules/@pokt-network/amino-js/node_modules/@tendermint/belt/types
rimraf node_modules/@pokt-network/amino-js/node_modules/@tendermint/belt/src
rimraf node_modules/@pokt-network/amino-js/node_modules/@tendermint/belt/index.ts
rimraf node_modules/@pokt-network/amino-js/node_modules/@tendermint/belt/dist/web*
rimraf node_modules/@tendermint/belt/types
rimraf node_modules/@tendermint/belt/node_modules/@tendermint/types
rimraf node_modules/@pokt-network/pocket-js/dist/web.js
rimraf node_modules/@pokt-network/amino-js/dist/web*
rimraf node_modules/supports-color

View File

@ -8,10 +8,14 @@ import { Mutex } from "async-mutex";
import NodeCache from "node-cache";
import { get as getDHT } from "./dht.js";
import { rpcMethods } from "./rpc/index.js";
import PocketPKG from "@pokt-network/pocket-js";
import { start as startDns } from "./dns.js";
const {
Configuration,
HttpRpcProvider,
PocketAAT,
Pocket,
} = require("@pokt-network/pocket-js/dist/index.js");
const { Configuration, HttpRpcProvider, PocketAAT, Pocket } = PocketPKG;
import {
JSONRPCError,
JSONRPCRequest,

View File

@ -1,5 +1,5 @@
import { ethers } from "ethers";
import { Pocket, PocketAAT } from "@pokt-network/pocket-js";
import { Pocket, PocketAAT } from "@pokt-network/pocket-js/dist/index.js";
import { maybeMapChainId, reverseMapChainId } from "../util.js";
import { Connection } from "@solana/web3.js";
import { getAat, getPocketServer } from "../rpc.js";

789
yarn.lock

File diff suppressed because it is too large Load Diff