Skip to content

Commit b69b490

Browse files
committed
build: update dist files
1 parent 47da4e7 commit b69b490

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

dist/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,8 @@ const address = core.getInput("address");
367367
const rpcUrl = core.getInput("rpcUrl");
368368
const failOnRemoval = core.getInput("failOnRemoval") === "true";
369369
const workingDirectory = core.getInput("workingDirectory");
370-
const contractEscaped = contract.replace(/\//g, "_").replace(/:/g, "-");
370+
const contractAbs = (0, path_1.join)(workingDirectory, contract);
371+
const contractEscaped = contractAbs.replace(/\//g, "_").replace(/:/g, "-");
371372
const getReportPath = (branch, baseName) => `${branch.replace(/[/\\]/g, "-")}.${baseName}.json`;
372373
const baseReport = getReportPath(baseBranch, contractEscaped);
373374
const outReport = getReportPath(headBranch, contractEscaped);
@@ -457,7 +458,7 @@ async function run() {
457458
});
458459
if (diffs.length > 0) {
459460
core.info(`Parse source code`);
460-
const cmpDef = (0, input_1.parseSource)(contract);
461+
const cmpDef = (0, input_1.parseSource)(contractAbs);
461462
const formattedDiffs = diffs.map((diff) => {
462463
const formattedDiff = (0, format_1.formatDiff)(cmpDef, diff);
463464
const title = format_1.diffTitles[formattedDiff.type];

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Zip from "adm-zip";
22
import * as fs from "fs";
3-
import { dirname, resolve } from "path";
3+
import { dirname, join, resolve } from "path";
44

55
import * as artifact from "@actions/artifact";
66
import * as core from "@actions/core";
@@ -21,7 +21,8 @@ const rpcUrl = core.getInput("rpcUrl");
2121
const failOnRemoval = core.getInput("failOnRemoval") === "true";
2222
const workingDirectory = core.getInput("workingDirectory");
2323

24-
const contractEscaped = contract.replace(/\//g, "_").replace(/:/g, "-");
24+
const contractAbs = join(workingDirectory, contract);
25+
const contractEscaped = contractAbs.replace(/\//g, "_").replace(/:/g, "-");
2526
const getReportPath = (branch: string, baseName: string) =>
2627
`${branch.replace(/[/\\]/g, "-")}.${baseName}.json`;
2728

@@ -140,7 +141,7 @@ async function run() {
140141

141142
if (diffs.length > 0) {
142143
core.info(`Parse source code`);
143-
const cmpDef = parseSource(contract, workingDirectory);
144+
const cmpDef = parseSource(contractAbs);
144145

145146
const formattedDiffs = diffs.map((diff) => {
146147
const formattedDiff = formatDiff(cmpDef, diff);

src/input.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { execSync } from "child_process";
22
import fs from "fs";
3-
import { join } from "path";
43

54
import * as parser from "@solidity-parser/parser";
65
import { ContractDefinition } from "@solidity-parser/parser/src/ast-types";
@@ -50,9 +49,8 @@ export const parseLayout = (content: string): StorageLayoutReportExact => {
5049
}
5150
};
5251

53-
export const parseSource = (contract: string, cwd = ""): ParsedSource => {
54-
const [relPath, contractName] = contract.split(":");
55-
const path = join(cwd, relPath);
52+
export const parseSource = (contract: string): ParsedSource => {
53+
const [path, contractName] = contract.split(":");
5654

5755
const { children, tokens = [] } = parser.parse(fs.readFileSync(path, { encoding: "utf-8" }), {
5856
tolerant: true,

tests/input.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ describe("Input checks", () => {
1010
expect(Object.keys(layout.types)).toHaveLength(9);
1111
});
1212

13-
it("should execute parseLayout from a custom working directory", async () => {
14-
const source = parseSource("StorageRef.sol:Storage", "tests/mocks/basic");
13+
it("should execute parseLayout", async () => {
14+
const source = parseSource("tests/mocks/basic/StorageRef.sol:Storage");
1515

1616
expect(source.def.name).toBe("Storage");
1717
expect(source.def.baseContracts).toHaveLength(0);

0 commit comments

Comments
 (0)