hyperweb-io / hyperweb-io/ts-codegen

Sample Project Generation

オープン
#70 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
126
フォーク
31
平均マージ
19分
マージ済み PR(30日)
2

説明

CosmWasm projects usually have a setup including a contracts and packages folder: [cw-plus](https://github.com/CosmWasm/cw-plus) and [dao dao](https://github.com/DA0-DA0/dao-contracts) as a couple examples.
I think ts-codegen should have a sample project generation file in the docs to make using this tool easier.

**codegen.ts**
```
import codegen, { ContractFile } from "@cosmwasm/ts-codegen";
import { glob } from "glob";

glob("../@(contracts|packages)/*/schema", (err, matches) => {
if (err) console.log(err);

let contracts: ContractFile[] = [];

matches.forEach((x) => {
contracts.push({
name: x.split("/")[2],
dir: x,
});
});

codegen({
contracts,
outPath: "./generated",

options: {
bundle: {
bundleFile: "index.ts",
scope: "contracts",
},
types: {
enabled: true,
},
client: {
enabled: true,
},
},
}).then(() => {
console.log("✨ all done!");
});
});
```

I used glob, because this is how ts-codegen's utils.readSchemas interprets paths. If a valid path is not given from windows, then ts-codegen will not generate anything.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start from the provided codegen.ts example and the existing documentation entry point for ts-codegen usage. Add a sample project-generation section showing the contracts and packages layout, schema globbing, and generated output; done means the example is included and the Windows path caveat is documented.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
documentation
issue の種類
ドキュメント
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。