Skip to content

Commit

Permalink
update TruffleProject#fileBelongs
Browse files Browse the repository at this point in the history
  • Loading branch information
antico5 authored and kanej committed Apr 13, 2023
1 parent 2ac6291 commit c30b9bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 0 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"workspaceContains:**/hardhat.config.{ts,js}",
"workspaceContains:**/foundry.toml",
"workspaceContains:**/truffle-config.js"

],
"scripts": {
"build": "tsc -b",
Expand Down
14 changes: 10 additions & 4 deletions server/src/frameworks/Truffle/TruffleProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { isRelativeImport } from "../../utils";
import { directoryContains } from "../../utils/directoryContains";
import { CompilationDetails } from "../base/CompilationDetails";
import { BuildInputError } from "../base/Errors";
import { Project } from "../base/Project";
import { FileBelongsResult, Project } from "../base/Project";
import { Remapping } from "../base/Remapping";
import { getDependenciesAndPragmas } from "../shared/crawlDependencies";

Expand Down Expand Up @@ -96,15 +96,21 @@ export class TruffleProject extends Project {
}
}

public async fileBelongs(file: string): Promise<boolean> {
public async fileBelongs(file: string): Promise<FileBelongsResult> {
let belongs: boolean;
if (this.status === Status.INITIALIZED_SUCCESS) {
return [this.sourcesPath, this.testsPath].some((dir) =>
belongs = [this.sourcesPath, this.testsPath].some((dir) =>
directoryContains(dir, path.dirname(file))
);
} else {
// Claim ownership under all contracts on the base folder if initialization failed
return directoryContains(this.basePath, file);
belongs = directoryContains(this.basePath, file);
}

return {
belongs,
isLocal: true,
};
}

public async resolveImportPath(
Expand Down

0 comments on commit c30b9bb

Please sign in to comment.