Skip to content

Commit 5ddff29

Browse files
authored
Fix search (#75)
Closes #74
1 parent 21699e3 commit 5ddff29

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

packages/ethereum-viewer/src/openContractSource.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,14 @@ async function saveSingleContractFilesToFs(
105105
const withPrefix = (file: string) =>
106106
options.prefix ? options.prefix + file : file;
107107

108-
const entries = Object.entries(result.files);
109-
for (const [path, content] of entries) {
110-
fs.writeFile(withPrefix(path), content);
111-
}
112-
108+
let entries = Object.entries(result.files);
113109
const mainFile = getMainContractFile(entries, result.info);
114-
115110
if (options.includeMainInfo) {
116-
fs.writeFile(withPrefix("main.md"), `Main file: ${mainFile}`);
111+
entries.push(["main.md", `Main file: ${mainFile}`]);
112+
}
113+
entries = entries.map((x) => [withPrefix(x[0]), x[1]]);
114+
for (const [path, content] of entries) {
115+
fs.writeFile(path, content);
117116
}
118117

119118
return {

0 commit comments

Comments
 (0)