diff --git a/governance/pyth_staking_sdk/package.json b/governance/pyth_staking_sdk/package.json index 052f18edb..67ac1256e 100644 --- a/governance/pyth_staking_sdk/package.json +++ b/governance/pyth_staking_sdk/package.json @@ -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 .", diff --git a/governance/pyth_staking_sdk/scripts/update-package-json.js b/governance/pyth_staking_sdk/scripts/update-package-json.js new file mode 100644 index 000000000..92574ce32 --- /dev/null +++ b/governance/pyth_staking_sdk/scripts/update-package-json.js @@ -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));