Procházet zdrojové kódy

fix(crank_executor): fixed build

benduran před 3 týdny
rodič
revize
b75ec2d55e

+ 13 - 4
governance/xc_admin/packages/crank_executor/package.json

@@ -6,7 +6,7 @@
   "author": "",
   "homepage": "https://github.com/pyth-network/pyth-crosschain",
   "license": "ISC",
-  "main": "src/index.ts",
+  "main": "./dist/index.js",
   "repository": {
     "type": "git",
     "url": "git+https://github.com/pyth-network/pyth-crosschain.git"
@@ -15,8 +15,8 @@
     "url": "https://github.com/pyth-network/pyth-crosschain/issues"
   },
   "scripts": {
-    "build": "ts-duality",
-    "start": "node lib/index.js",
+    "build": "ts-duality --noEsm",
+    "start": "node dist/index.js",
     "fix:format": "prettier --write \"src/**/*.ts\"",
     "test:format": "prettier --check \"src/**/*.ts\"",
     "clean": "rm -rf ./dist"
@@ -38,5 +38,14 @@
     "pnpm": ">=10.19.0"
   },
   "packageManager": "pnpm@10.19.0",
-  "type": "module"
+  "type": "module",
+  "exports": {
+    ".": {
+      "default": "./dist/index.js",
+      "types": "./dist/index.d.ts"
+    },
+    "./package.json": "./package.json"
+  },
+  "module": "./dist/esm/index.js",
+  "types": "./dist/index.d.ts"
 }

+ 8 - 3
governance/xc_admin/packages/crank_executor/src/index.ts

@@ -1,4 +1,9 @@
-import { Commitment, Connection, Keypair, PublicKey } from "@solana/web3.js";
+import {
+  type Commitment,
+  Connection,
+  Keypair,
+  PublicKey,
+} from "@solana/web3.js";
 import SquadsMesh, { DEFAULT_MULTISIG_PROGRAM_ID } from "@sqds/mesh";
 import * as fs from "fs";
 import NodeWallet from "@project-serum/anchor/dist/cjs/nodewallet";
@@ -9,7 +14,7 @@ import {
 } from "@pythnetwork/xc-admin-common";
 import {
   getPythClusterApiUrl,
-  PythCluster,
+  type PythCluster,
 } from "@pythnetwork/client/lib/cluster";
 
 const CLUSTER: PythCluster = envOrErr("CLUSTER") as PythCluster;
@@ -42,7 +47,7 @@ async function run() {
     // If we have previously cancelled because the proposal was failing, don't attempt
     if (proposal.cancelled.length == 0) {
       await executeProposal(proposal, squad, CLUSTER, COMMITMENT, {
-        computeUnitPriceMicroLamports: COMPUTE_UNIT_PRICE_MICROLAMPORTS,
+        computeUnitPriceMicroLamports: COMPUTE_UNIT_PRICE_MICROLAMPORTS!,
       });
     } else {
       console.log("Skipping: ", proposal.publicKey.toBase58());

+ 2 - 1
governance/xc_admin/packages/crank_executor/tsconfig.build.json

@@ -3,7 +3,8 @@
   "compilerOptions": {
     "noEmit": false,
     "incremental": false,
-    "declaration": true
+    "declaration": true,
+    "isolatedModules": false
   },
   "exclude": [
     "node_modules",

+ 4 - 0
governance/xc_admin/packages/crank_executor/tsconfig.json

@@ -1,5 +1,9 @@
 {
   "extends": "@cprussin/tsconfig/base.json",
   "include": ["src"],
+  "compilerOptions": {
+    "module": "preserve",
+    "moduleResolution": "node"
+  },
   "exclude": ["dist", "node_modules", "**/__tests__/*"]
 }