Skip to content

Commit

Permalink
chore(node-wasm): add automatic generation of the types file and READ…
Browse files Browse the repository at this point in the history
…ME (#408)
  • Loading branch information
zvolin authored Oct 3, 2024
1 parent 37f9a4d commit 64cfefa
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,19 @@ jobs:
fi
# Update the version of lumina-node-wasm dependency
npm pkg set "dependencies[lumina-node-wasm]=$node_wasm_version"
# Update the types definition for lumina-node
npm i
npm run tsc
wasm-pack build ..
npm run update-readme
# push a commit to release-plz's pr
# prepare graphql query
branch_sha="$(git rev-parse "$pr_branch_name")"
package_json="$(base64 --wrap 0 package.json)"
readme="$(base64 --wrap 0 README.md)"
types_definitions="$(base64 --wrap 0 index.d.ts)"
query='{"query": "mutation {
createCommitOnBranch(input: {
branch: {
Expand All @@ -78,10 +86,20 @@ jobs:
},
expectedHeadOid: \"'"$branch_sha"'\",
fileChanges: {
additions: [{
path: \"node-wasm/js/package.json\",
contents: \"'"$package_json"'\"
}]
additions: [
{
path: \"node-wasm/js/package.json\",
contents: \"'"$package_json"'\"
},
{
path: \"node-wasm/js/README.md\",
contents: \"'"$readme"'\"
},
{
path: \"node-wasm/js/index.d.ts\",
contents: \"'"$types_definitions"'\"
}
]
}
})
{ commit { commitUrl } }
Expand Down
1 change: 1 addition & 0 deletions node-wasm/js/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
*/
export function spawnNode(): Promise<NodeClient>;
export * from "lumina-node-wasm";
import { NodeClient } from "lumina-node-wasm";
4 changes: 3 additions & 1 deletion node-wasm/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
"devDependencies": {
"concat-md": "^0.5.1",
"typedoc": "^0.26.7",
"typedoc-plugin-markdown": "^4.2.9"
"typedoc-plugin-markdown": "^4.2.9",
"typescript": "^5.6.2"
},
"scripts": {
"tsc": "tsc index.js --declaration --allowJs --emitDeclarationOnly",
"update-readme": "typedoc --plugin typedoc-plugin-markdown --out ./docs --readme ../README.md ../pkg/lumina_node_wasm.d.ts && concat-md --decrease-title-levels --dir-name-as-title docs > README.md"
}
}

0 comments on commit 64cfefa

Please sign in to comment.