Skip to content

Commit

Permalink
feat(staking): make sdk ready for release (#1933)
Browse files Browse the repository at this point in the history
* feat(staking): make sdk ready for release

* fix

* fix
  • Loading branch information
keyvankhademi authored Sep 19, 2024
1 parent ee3249d commit 75781f8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
6 changes: 4 additions & 2 deletions governance/pyth_staking_sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
"exports": {
".": "./src/index.ts"
},
"private": true,
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "tsc",
"build": "tsc && node scripts/update-package-json.js",
"test": "pnpm run test:format && pnpm run test:lint && pnpm run test:integration && pnpm run test:types",
"fix": "pnpm fix:lint && pnpm fix:format",
"fix:format": "prettier --write .",
Expand Down
22 changes: 22 additions & 0 deletions governance/pyth_staking_sdk/scripts/update-package-json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";

/**
* This script updates the package.json file in the dist directory after the TypeScript build.
*
* This ensures that the published package correctly references the compiled JavaScript
* instead of the TypeScript source files.
*/

const __dirname = path.dirname(fileURLToPath(import.meta.url));

const distPackageJsonPath = path.join(__dirname, "..", "dist", "package.json");

const packageJson = JSON.parse(fs.readFileSync(distPackageJsonPath, "utf8"));

packageJson.exports = {
".": "./src/index.js",
};

fs.writeFileSync(distPackageJsonPath, JSON.stringify(packageJson, null, 2));

0 comments on commit 75781f8

Please sign in to comment.