@rocketh/doc 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,241 @@
1
+ import fs from 'fs-extra';
2
+ import { loadDeployments } from 'rocketh';
3
+ import Handlebars from 'handlebars';
4
+ import path, { dirname } from 'path';
5
+ import { Fragment, FunctionFragment } from 'ethers';
6
+ import { fileURLToPath } from 'url';
7
+
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+ function filter(options, name) {
10
+ if (options.exceptSuffix) {
11
+ for (const suffix of options.exceptSuffix) {
12
+ if (name.endsWith(suffix)) {
13
+ return false;
14
+ }
15
+ }
16
+ }
17
+ return true;
18
+ }
19
+ async function run(config, options) {
20
+ const { deployments, chainId } = loadDeployments(config.deployments, config.network.name);
21
+ if (!chainId) {
22
+ throw new Error(`no chainId found for ${config.network.name}`);
23
+ }
24
+ generate({ deployments }, options);
25
+ }
26
+ async function generate({ deployments }, options) {
27
+ if (!deployments || Object.keys(deployments).length === 0) {
28
+ console.log(`no deployments to export`);
29
+ return;
30
+ }
31
+ const toDocument = {};
32
+ for (const name of Object.keys(deployments)) {
33
+ if (!filter(options, name)) {
34
+ continue;
35
+ }
36
+ const deployment = deployments[name];
37
+ toDocument[name] = deployment;
38
+ }
39
+ return generateFromDeployments(toDocument, options);
40
+ }
41
+ async function runFromFolder(folder, options) {
42
+ const files = fs.readdirSync(folder);
43
+ const deployments = {};
44
+ for (const file of files) {
45
+ if (file.endsWith(".json")) {
46
+ const name = path.basename(file, ".json");
47
+ if (!filter(options, name)) {
48
+ continue;
49
+ }
50
+ const deploymentString = fs.readFileSync(path.join(folder, file), "utf-8");
51
+ const deployment = JSON.parse(deploymentString);
52
+ deployments[name] = deployment;
53
+ }
54
+ }
55
+ return generateFromDeployments(deployments, options);
56
+ }
57
+ async function generateFromDeployments(deployments, options) {
58
+ const outputFolder = options.output || "docs";
59
+ const templateFilepath = options.template || path.join(__dirname, "default_templates/{{contracts}}.hbs");
60
+ const templateName = path.basename(templateFilepath, ".hbs");
61
+ const templateContent = fs.readFileSync(templateFilepath, "utf-8");
62
+ const template = Handlebars.compile(templateContent);
63
+ const deploymentsList = [];
64
+ for (const name of Object.keys(deployments)) {
65
+ const deployment = deployments[name];
66
+ const data = generateDocumentationData(name, deployment);
67
+ deploymentsList.push(data);
68
+ }
69
+ fs.emptyDirSync(outputFolder);
70
+ if (templateName === "{{contracts}}") {
71
+ for (const deployment of deploymentsList) {
72
+ const generated = template(deployment);
73
+ if (generated.trim() !== "") {
74
+ fs.writeFileSync(path.join(outputFolder, deployment.name + ".md"), generated);
75
+ }
76
+ }
77
+ } else {
78
+ const generated = template({ contracts: deploymentsList });
79
+ fs.writeFileSync(path.join(outputFolder, templateName + ".md"), generated);
80
+ }
81
+ }
82
+ function generateDocumentationData(name, deploymentOrArfifact) {
83
+ const abi = deploymentOrArfifact.abi;
84
+ const abiMap = /* @__PURE__ */ new Map();
85
+ for (const abiElement of abi) {
86
+ switch (abiElement.type) {
87
+ case "constructor":
88
+ abiMap.set("constructor", abiElement);
89
+ break;
90
+ case "error":
91
+ abiMap.set(abiElement.name, abiElement);
92
+ break;
93
+ case "event":
94
+ abiMap.set(abiElement.name, abiElement);
95
+ break;
96
+ case "function":
97
+ abiMap.set(abiElement.name, abiElement);
98
+ break;
99
+ }
100
+ }
101
+ const errors = [];
102
+ const events = [];
103
+ const methods = [];
104
+ if (deploymentOrArfifact.userdoc?.errors) {
105
+ for (const errorSignature of Object.keys(deploymentOrArfifact.userdoc.errors)) {
106
+ const errorName = errorSignature.indexOf("(") > 0 ? errorSignature.slice(0, errorSignature.indexOf("(")) : errorSignature;
107
+ const abi2 = abiMap.get(errorName);
108
+ if (!abi2) {
109
+ continue;
110
+ }
111
+ const fullFormat = Fragment.from(abi2).format("full");
112
+ const paramNames = abi2.inputs.map((v, index) => v.name || `_${index}`);
113
+ const errorFromUserDoc = deploymentOrArfifact.userdoc.errors[errorSignature];
114
+ const errorFromDevDoc = deploymentOrArfifact.devdoc?.errors?.[errorSignature];
115
+ const params = [];
116
+ if (errorFromDevDoc) {
117
+ for (const doc of errorFromDevDoc) {
118
+ if (doc.params) {
119
+ for (const paramName of paramNames || Object.keys(doc.params)) {
120
+ params.push({ name: paramName, description: doc.params[paramName] });
121
+ }
122
+ }
123
+ }
124
+ }
125
+ const notice = [];
126
+ if (errorFromUserDoc) {
127
+ for (const doc of errorFromUserDoc) {
128
+ if (doc.notice) {
129
+ const notes = doc.notice.split("\\");
130
+ for (const note of notes) {
131
+ if (note != "") {
132
+ notice.push(note);
133
+ }
134
+ }
135
+ }
136
+ }
137
+ }
138
+ errors.push({
139
+ name: errorName,
140
+ signature: errorSignature,
141
+ abi: abi2,
142
+ fullFormat,
143
+ notice,
144
+ params
145
+ });
146
+ }
147
+ }
148
+ if (deploymentOrArfifact.userdoc?.events) {
149
+ for (const eventSignature of Object.keys(deploymentOrArfifact.userdoc.events)) {
150
+ const eventName = eventSignature.indexOf("(") > 0 ? eventSignature.slice(0, eventSignature.indexOf("(")) : eventSignature;
151
+ const abi2 = abiMap.get(eventName);
152
+ if (!abi2) {
153
+ continue;
154
+ }
155
+ const fullFormat = Fragment.from(abi2).format("full");
156
+ const paramNames = abi2.inputs.map((v, index) => v.name || `_${index}`);
157
+ const eventFromUserDoc = deploymentOrArfifact.userdoc.events[eventSignature];
158
+ const eventFromDevDoc = deploymentOrArfifact.devdoc?.events?.[eventSignature];
159
+ const params = [];
160
+ if (eventFromDevDoc?.params) {
161
+ for (const paramName of paramNames || Object.keys(eventFromDevDoc.params)) {
162
+ params.push({ name: paramName, description: eventFromDevDoc.params[paramName] });
163
+ }
164
+ }
165
+ events.push({
166
+ name: eventName,
167
+ signature: eventSignature,
168
+ abi: abi2,
169
+ fullFormat,
170
+ notice: eventFromUserDoc.notice,
171
+ params
172
+ });
173
+ }
174
+ }
175
+ if (deploymentOrArfifact.userdoc?.methods) {
176
+ for (const methodSignature of Object.keys(deploymentOrArfifact.userdoc.methods)) {
177
+ const methodName = methodSignature.indexOf("(") > 0 ? methodSignature.slice(0, methodSignature.indexOf("(")) : methodSignature;
178
+ const abi2 = abiMap.get(methodName);
179
+ if (!abi2) {
180
+ continue;
181
+ }
182
+ const fullFormat = Fragment.from(abi2).format("full");
183
+ const paramNames = abi2 ? abi2.inputs.map((v, index) => v.name || `_${index}`) : void 0;
184
+ const returnNames = abi2 && "outputs" in abi2 ? abi2.outputs.map((v, index) => v.name || `_${index}`) : void 0;
185
+ const methodFromUserDoc = deploymentOrArfifact.userdoc.methods[methodSignature];
186
+ const methodFromDevDoc = deploymentOrArfifact.devdoc?.methods?.[methodSignature];
187
+ const params = [];
188
+ if (methodFromDevDoc?.params) {
189
+ for (const paramName of paramNames || Object.keys(methodFromDevDoc.params)) {
190
+ params.push({ name: paramName, description: methodFromDevDoc.params[paramName] });
191
+ }
192
+ }
193
+ const returns = [];
194
+ if (methodFromDevDoc?.returns) {
195
+ for (const returnName of returnNames || Object.keys(methodFromDevDoc.returns)) {
196
+ returns.push({ name: returnName, description: methodFromDevDoc.returns[returnName] });
197
+ }
198
+ }
199
+ if (methodName === "constructor") {
200
+ methods.push({
201
+ type: "constructor",
202
+ name: "constructor",
203
+ abi: abi2,
204
+ signature: methodSignature,
205
+ fullFormat,
206
+ notice: methodFromUserDoc.notice,
207
+ params,
208
+ returns
209
+ });
210
+ } else {
211
+ const selector = FunctionFragment.from(abi2).selector;
212
+ methods.push({
213
+ type: "function",
214
+ name: methodName,
215
+ abi: abi2,
216
+ signature: methodSignature,
217
+ fullFormat,
218
+ bytes4: selector,
219
+ notice: methodFromUserDoc.notice,
220
+ params,
221
+ returns
222
+ });
223
+ }
224
+ }
225
+ }
226
+ const data = {
227
+ name,
228
+ address: deploymentOrArfifact.address,
229
+ abi,
230
+ author: deploymentOrArfifact.devdoc?.author,
231
+ title: deploymentOrArfifact.devdoc?.title,
232
+ notice: deploymentOrArfifact.userdoc?.notice,
233
+ errors,
234
+ events,
235
+ methods
236
+ };
237
+ return data;
238
+ }
239
+
240
+ export { generate, generateDocumentationData, generateFromDeployments, run, runFromFolder };
241
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport type {\n\tDeployment,\n\tResolvedConfig,\n\tNoticeUserDoc,\n\tArtifact,\n\tAbi,\n\tUnknownDeployments,\n\tAbiConstructor,\n\tAbiFunction,\n\tAbiError,\n\tAbiEvent,\n} from 'rocketh';\nimport {loadDeployments} from 'rocketh';\nimport Handlebars from 'handlebars';\nimport path from 'path';\nimport {Fragment, FunctionFragment} from 'ethers';\nimport {dirname} from 'path';\nimport {fileURLToPath} from 'url';\n\nimport {DocumentationData, ErrorDoc, EventDoc, MethodDoc, ParamDoc, ReturnDoc} from './types';\n\nexport * from './types';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport type RunOptions = {template?: string; output?: string; exceptSuffix?: string[]};\n\nfunction filter(options: RunOptions, name: string): boolean {\n\tif (options.exceptSuffix) {\n\t\tfor (const suffix of options.exceptSuffix) {\n\t\t\tif (name.endsWith(suffix)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\treturn true;\n}\n\nexport async function run(config: ResolvedConfig, options: RunOptions) {\n\tconst {deployments, chainId} = loadDeployments(config.deployments, config.network.name);\n\tif (!chainId) {\n\t\tthrow new Error(`no chainId found for ${config.network.name}`);\n\t}\n\tgenerate({deployments}, options);\n}\n\nexport async function generate(\n\t{deployments}: {deployments: UnknownDeployments; chainId?: string},\n\toptions: RunOptions\n) {\n\tif (!deployments || Object.keys(deployments).length === 0) {\n\t\tconsole.log(`no deployments to export`);\n\t\treturn;\n\t}\n\n\tconst toDocument: UnknownDeployments = {};\n\tfor (const name of Object.keys(deployments)) {\n\t\tif (!filter(options, name)) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst deployment = deployments[name];\n\t\ttoDocument[name] = deployment;\n\t}\n\n\treturn generateFromDeployments(toDocument, options);\n}\n\nexport async function runFromFolder(folder: string, options: RunOptions) {\n\tconst files = fs.readdirSync(folder);\n\tconst deployments: UnknownDeployments = {};\n\tfor (const file of files) {\n\t\tif (file.endsWith('.json')) {\n\t\t\tconst name = path.basename(file, '.json');\n\t\t\tif (!filter(options, name)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst deploymentString = fs.readFileSync(path.join(folder, file), 'utf-8');\n\t\t\tconst deployment = JSON.parse(deploymentString);\n\t\t\tdeployments[name] = deployment;\n\t\t}\n\t}\n\n\treturn generateFromDeployments(deployments, options);\n}\n\n// export async function runFromArtifacts(folder: string, options: {template?: string; outputFolder?: string}) {\n// \tconst files = fs.readdirSync(folder);\n// \tconst deployments: UnknownDeployments = {};\n// \tfor (const file of files) {\n// \t\tif (file.endsWith('.json')) {\n// \t\t\tconst deploymentString = fs.readFileSync(path.join(folder, file), 'utf-8');\n// \t\t\tconst deployment = JSON.parse(deploymentString);\n// \t\t\tdeployments[path.basename(file, '.json')] = deployment;\n// \t\t}\n// \t}\n\n// \treturn generateFromDeployments(deployments, options);\n// }\n\nexport async function generateFromDeployments(deployments: UnknownDeployments, options: RunOptions) {\n\tconst outputFolder = options.output || 'docs';\n\tconst templateFilepath = options.template || path.join(__dirname, 'default_templates/{{contracts}}.hbs');\n\tconst templateName = path.basename(templateFilepath, '.hbs');\n\tconst templateContent = fs.readFileSync(templateFilepath, 'utf-8');\n\tconst template = Handlebars.compile(templateContent);\n\n\tconst deploymentsList: DocumentationData[] = [];\n\tfor (const name of Object.keys(deployments)) {\n\t\tconst deployment = deployments[name];\n\t\tconst data = generateDocumentationData(name, deployment);\n\t\tdeploymentsList.push(data);\n\t}\n\n\tfs.emptyDirSync(outputFolder);\n\tif (templateName === '{{contracts}}') {\n\t\tfor (const deployment of deploymentsList) {\n\t\t\tconst generated = template(deployment);\n\t\t\tif (generated.trim() !== '') {\n\t\t\t\tfs.writeFileSync(path.join(outputFolder, deployment.name + '.md'), generated);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst generated = template({contracts: deploymentsList});\n\t\tfs.writeFileSync(path.join(outputFolder, templateName + '.md'), generated);\n\t}\n}\n\nexport function generateDocumentationData(\n\tname: string,\n\tdeploymentOrArfifact: Partial<Deployment<Abi>> & Artifact<Abi>\n): DocumentationData {\n\tconst abi = deploymentOrArfifact.abi;\n\tconst abiMap = new Map<string, AbiConstructor | AbiError | AbiEvent | AbiFunction>();\n\tfor (const abiElement of abi) {\n\t\tswitch (abiElement.type) {\n\t\t\tcase 'constructor':\n\t\t\t\tabiMap.set('constructor', abiElement);\n\t\t\t\tbreak;\n\t\t\tcase 'error':\n\t\t\t\tabiMap.set(abiElement.name, abiElement);\n\t\t\t\tbreak;\n\t\t\tcase 'event':\n\t\t\t\tabiMap.set(abiElement.name, abiElement);\n\t\t\t\tbreak;\n\t\t\tcase 'function':\n\t\t\t\tabiMap.set(abiElement.name, abiElement);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tconst errors: ErrorDoc[] = [];\n\tconst events: EventDoc[] = [];\n\tconst methods: MethodDoc[] = [];\n\n\tif (deploymentOrArfifact.userdoc?.errors) {\n\t\t// we loop only through userdoc\n\t\tfor (const errorSignature of Object.keys(deploymentOrArfifact.userdoc.errors)) {\n\t\t\tconst errorName =\n\t\t\t\terrorSignature.indexOf('(') > 0 ? errorSignature.slice(0, errorSignature.indexOf('(')) : errorSignature;\n\n\t\t\tconst abi = abiMap.get(errorName) as AbiError;\n\t\t\tif (!abi) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst fullFormat = Fragment.from(abi).format('full');\n\t\t\tconst paramNames = abi.inputs.map((v, index) => v.name || `_${index}`);\n\n\t\t\tconst errorFromUserDoc = deploymentOrArfifact.userdoc.errors[errorSignature];\n\t\t\tconst errorFromDevDoc = deploymentOrArfifact.devdoc?.errors?.[errorSignature];\n\t\t\tconst params: ParamDoc[] = [];\n\t\t\tif (errorFromDevDoc) {\n\t\t\t\tfor (const doc of errorFromDevDoc) {\n\t\t\t\t\tif (doc.params) {\n\t\t\t\t\t\tfor (const paramName of paramNames || Object.keys(doc.params)) {\n\t\t\t\t\t\t\tparams.push({name: paramName, description: doc.params[paramName]});\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// TODO what if same name\n\t\t\t\t\t\t// TODO what is the array for ? (look at solidity doc)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst notice: string[] = [];\n\t\t\tif (errorFromUserDoc) {\n\t\t\t\tfor (const doc of errorFromUserDoc) {\n\t\t\t\t\tif (doc.notice) {\n\t\t\t\t\t\tconst notes = doc.notice.split('\\\\');\n\t\t\t\t\t\tfor (const note of notes) {\n\t\t\t\t\t\t\tif (note != '') {\n\t\t\t\t\t\t\t\tnotice.push(note);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\terrors.push({\n\t\t\t\tname: errorName,\n\t\t\t\tsignature: errorSignature,\n\t\t\t\tabi: abi,\n\t\t\t\tfullFormat,\n\t\t\t\tnotice,\n\t\t\t\tparams,\n\t\t\t});\n\t\t}\n\t}\n\n\tif (deploymentOrArfifact.userdoc?.events) {\n\t\t// we loop only through userdoc\n\t\tfor (const eventSignature of Object.keys(deploymentOrArfifact.userdoc.events)) {\n\t\t\tconst eventName =\n\t\t\t\teventSignature.indexOf('(') > 0 ? eventSignature.slice(0, eventSignature.indexOf('(')) : eventSignature;\n\n\t\t\tconst abi = abiMap.get(eventName) as AbiEvent;\n\t\t\tif (!abi) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst fullFormat = Fragment.from(abi).format('full');\n\t\t\tconst paramNames = abi.inputs.map((v, index) => v.name || `_${index}`);\n\n\t\t\tconst eventFromUserDoc = deploymentOrArfifact.userdoc.events[eventSignature];\n\t\t\tconst eventFromDevDoc = deploymentOrArfifact.devdoc?.events?.[eventSignature];\n\t\t\tconst params: ParamDoc[] = [];\n\t\t\tif (eventFromDevDoc?.params) {\n\t\t\t\tfor (const paramName of paramNames || Object.keys(eventFromDevDoc.params)) {\n\t\t\t\t\tparams.push({name: paramName, description: eventFromDevDoc.params[paramName]});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tevents.push({\n\t\t\t\tname: eventName,\n\t\t\t\tsignature: eventSignature,\n\t\t\t\tabi: abi as AbiEvent,\n\t\t\t\tfullFormat,\n\t\t\t\tnotice: eventFromUserDoc.notice,\n\t\t\t\tparams,\n\t\t\t});\n\t\t}\n\t}\n\n\tif (deploymentOrArfifact.userdoc?.methods) {\n\t\t// we loop only through userdoc\n\t\tfor (const methodSignature of Object.keys(deploymentOrArfifact.userdoc.methods)) {\n\t\t\tconst methodName =\n\t\t\t\tmethodSignature.indexOf('(') > 0 ? methodSignature.slice(0, methodSignature.indexOf('(')) : methodSignature;\n\n\t\t\tconst abi = abiMap.get(methodName) as AbiFunction | AbiConstructor;\n\t\t\tif (!abi) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst fullFormat = Fragment.from(abi).format('full');\n\t\t\tconst paramNames = abi ? abi.inputs.map((v, index) => v.name || `_${index}`) : undefined;\n\t\t\tconst returnNames = abi && 'outputs' in abi ? abi.outputs.map((v, index) => v.name || `_${index}`) : undefined;\n\n\t\t\tconst methodFromUserDoc = deploymentOrArfifact.userdoc.methods[methodSignature];\n\t\t\tconst methodFromDevDoc = deploymentOrArfifact.devdoc?.methods?.[methodSignature];\n\t\t\tconst params: ParamDoc[] = [];\n\t\t\tif (methodFromDevDoc?.params) {\n\t\t\t\tfor (const paramName of paramNames || Object.keys(methodFromDevDoc.params)) {\n\t\t\t\t\tparams.push({name: paramName, description: methodFromDevDoc.params[paramName]});\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst returns: ReturnDoc[] = [];\n\t\t\tif (methodFromDevDoc?.returns) {\n\t\t\t\tfor (const returnName of returnNames || Object.keys(methodFromDevDoc.returns)) {\n\t\t\t\t\treturns.push({name: returnName, description: methodFromDevDoc.returns[returnName]});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (methodName === 'constructor') {\n\t\t\t\tmethods.push({\n\t\t\t\t\ttype: 'constructor',\n\t\t\t\t\tname: 'constructor',\n\t\t\t\t\tabi: abi as AbiConstructor,\n\t\t\t\t\tsignature: methodSignature,\n\t\t\t\t\tfullFormat,\n\t\t\t\t\tnotice: methodFromUserDoc.notice,\n\t\t\t\t\tparams,\n\t\t\t\t\treturns,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst selector = FunctionFragment.from(abi).selector as `0x${string}`;\n\t\t\t\tmethods.push({\n\t\t\t\t\ttype: 'function',\n\t\t\t\t\tname: methodName,\n\t\t\t\t\tabi: abi as AbiFunction,\n\t\t\t\t\tsignature: methodSignature,\n\t\t\t\t\tfullFormat,\n\t\t\t\t\tbytes4: selector,\n\t\t\t\t\tnotice: methodFromUserDoc.notice,\n\t\t\t\t\tparams,\n\t\t\t\t\treturns,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tconst data: DocumentationData = {\n\t\tname,\n\t\taddress: deploymentOrArfifact.address,\n\t\tabi,\n\t\tauthor: deploymentOrArfifact.devdoc?.author,\n\t\ttitle: deploymentOrArfifact.devdoc?.title,\n\t\tnotice: deploymentOrArfifact.userdoc?.notice,\n\t\terrors,\n\t\tevents,\n\t\tmethods,\n\t};\n\treturn data;\n}\n"],"names":[],"mappings":";;;;;;;AASA,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,SAAS,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE;AAC/B,EAAE,IAAI,OAAO,CAAC,YAAY,EAAE;AAC5B,IAAI,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,YAAY,EAAE;AAC/C,MAAM,IAAI,IAAI,CAAC,QAAQ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@rocketh/doc",
3
+ "version": "0.10.1",
4
+ "description": "can generate doc from rocketh deployments and provided template",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "type": "module",
9
+ "main": "dist/index.cjs",
10
+ "module": "dist/index.mjs",
11
+ "types": "dist/index.d.ts",
12
+ ".": {
13
+ "require": {
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.cjs"
16
+ },
17
+ "import": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.mjs"
20
+ }
21
+ },
22
+ "bin": {
23
+ "rocketh-doc": "dist/cli.cjs"
24
+ },
25
+ "devDependencies": {
26
+ "@types/node": "^20.12.7",
27
+ "pkgroll": "^2.0.2",
28
+ "rimraf": "^5.0.5",
29
+ "typescript": "^5.4.5",
30
+ "rocketh": "0.10.9"
31
+ },
32
+ "peerDependencies": {
33
+ "rocketh": "0.10.9"
34
+ },
35
+ "dependencies": {
36
+ "@types/fs-extra": "^11.0.4",
37
+ "commander": "^12.0.0",
38
+ "ethers": "^6.11.1",
39
+ "fs-extra": "^11.2.0",
40
+ "handlebars": "^4.7.8"
41
+ },
42
+ "scripts": {
43
+ "build": "rimraf dist && pkgroll --sourcemap",
44
+ "dev": "pkgroll --watch"
45
+ }
46
+ }
@@ -0,0 +1,77 @@
1
+ # {{{name}}}
2
+
3
+
4
+ {{#if notice}}
5
+ ### **Description**
6
+
7
+ {{{notice}}}
8
+ {{/if}}
9
+
10
+ {{#if methods.length}}
11
+ ## Functions
12
+
13
+ {{#each methods}}
14
+ ### **{{{name}}}**
15
+
16
+ {{{notice}}}
17
+
18
+ *sig hash*: `{{{bytes4}}}`
19
+
20
+ *Signature*: {{{signature}}}
21
+
22
+ {{{fullFormat}}}
23
+
24
+ {{#if params.length}}
25
+ | Name | Description
26
+ | ---- | -----------
27
+ {{#each params}}
28
+ {{#if description}}
29
+ | {{{name}}} | {{{description}}}
30
+ {{/if}}
31
+ {{/each}}
32
+
33
+ {{/if}}
34
+ {{/each}}
35
+ {{/if}}
36
+
37
+ {{#if events.length}}
38
+ {{#each events}}
39
+ ### **{{{name}}}**
40
+
41
+ {{{notice}}}
42
+
43
+ {{{fullFormat}}}
44
+
45
+ {{#if params.length}}
46
+ | Name | Description
47
+ | ---- | -----------
48
+ {{#each params}}
49
+ {{#if description}}
50
+ | {{{name}}} | {{{description}}}
51
+ {{/if}}
52
+ {{/each}}
53
+
54
+ {{/if}}
55
+ {{/each}}
56
+ {{/if}}
57
+
58
+ {{#if errors.length}}
59
+ {{#each errors}}
60
+ ### **{{{name}}}**
61
+
62
+ {{{notice}}}
63
+
64
+ {{{fullFormat}}}
65
+
66
+ {{#if params.length}}
67
+ | Name | Description
68
+ | ---- | -----------
69
+ {{#each params}}
70
+ {{#if description}}
71
+ | {{{name}}} | {{{description}}}
72
+ {{/if}}
73
+ {{/each}}
74
+
75
+ {{/if}}
76
+ {{/each}}
77
+ {{/if}}
package/src/cli.ts ADDED
@@ -0,0 +1,26 @@
1
+ #! /usr/bin/env node
2
+ import {readAndResolveConfig} from 'rocketh';
3
+ import {run} from '.';
4
+ import {Command} from 'commander';
5
+ import pkg from '../package.json';
6
+ import {ConfigOptions} from 'rocketh';
7
+ import {RunOptions} from '.';
8
+
9
+ const commandName = pkg.name;
10
+
11
+ const program = new Command();
12
+ program
13
+ .name(commandName)
14
+ .description('generate doc from deployments and provided templates')
15
+ .version(pkg.version)
16
+ .option('-d, --deployments <value>', 'folder where deployments are saved')
17
+ .option('-o, --output <value>', 'folder where to generate docs')
18
+ .option('-t, --template <value>', 'template used to generate docs')
19
+ .option('--except-suffix <suffix, suffix....>', 'ignore contract that ends with the provided suffixes')
20
+ .requiredOption('-n, --network <value>', 'network context to use')
21
+ .parse(process.argv);
22
+
23
+ const options = program.opts();
24
+ options.exceptSuffix = options.exceptSuffix.split(',');
25
+ const resolvedConfig = readAndResolveConfig(options as ConfigOptions);
26
+ run(resolvedConfig, options as RunOptions);