Skip to content

Commit

Permalink
Merge pull request #13 from script3/audit-update
Browse files Browse the repository at this point in the history
feat: update gov interface and update to p21
  • Loading branch information
mootz12 authored Jun 19, 2024
2 parents de705b2 + 0678d81 commit 092d60d
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 53 deletions.
36 changes: 18 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.1",
"version": "1.1.0",
"name": "@script3/soroban-governor-sdk",
"description": "Javascript SDK for the Soroban Governor",
"type": "module",
Expand Down Expand Up @@ -29,7 +29,7 @@
"homepage": "https://github.com/script3/soroban-governor-js-sdk#readme",
"dependencies": {
"buffer": "6.0.3",
"@stellar/stellar-sdk": "11.3.0"
"@stellar/stellar-sdk": "12.1.0"
},
"devDependencies": {
"typescript": "5.3.3"
Expand Down
60 changes: 42 additions & 18 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
@@ -1,37 +1,61 @@
import { spawnSync } from "node:child_process"
import fs from "node:fs"
import path from "node:path"
import { spawnSync } from "node:child_process";
import fs from "node:fs";
import path from "node:path";

const buildDir = "./dist"
const buildDir = "./dist";

const { error, stderr } = spawnSync("tsc", ["-b", "./scripts/tsconfig.cjs.json", "./scripts/tsconfig.esm.json", "./scripts/tsconfig.types.json"], { stdio: "inherit" })
const { error, stderr } = spawnSync(
"tsc",
[
"-b",
"./scripts/tsconfig.cjs.json",
"./scripts/tsconfig.esm.json",
"./scripts/tsconfig.types.json",
],
{ stdio: "inherit" }
);

if (error) {
console.error(stderr)
console.error(error)
throw error
console.error(stderr);
console.error(error);
throw error;
}

function createEsmModulePackageJson() {
fs.readdir(buildDir, function (err, dirs) {
if (err) {
throw err
throw err;
}
dirs.forEach(function (dir) {
if (dir === "esm") {
// 1. add package.json file with "type": "module"
var packageJsonFile = path.join(buildDir, dir, "/package.json")
if (!fs.existsSync(packageJsonFile)) {
var esmPackageJson = path.join(buildDir, dir, "/package.json");
if (!fs.existsSync(esmPackageJson)) {
fs.writeFileSync(
packageJsonFile,
esmPackageJson,
'{"type": "module"}',
'utf8',
err => { if (err) throw err }
)
"utf8",
(err) => {
if (err) throw err;
}
);
}
} else if (dir === "cjs") {
// 2. add package.json file with "type": "commonjs"
var cjsPackageJson = path.join(buildDir, dir, "/package.json");
if (!fs.existsSync(cjsPackageJson)) {
fs.writeFileSync(
cjsPackageJson,
'{"type": "commonjs"}',
"utf8",
(err) => {
if (err) throw err;
}
);
}
}
})
})
});
});
}

createEsmModulePackageJson()
createEsmModulePackageJson();
Loading

0 comments on commit 092d60d

Please sign in to comment.