Skip to content

Commit 1579491

Browse files
ci-bothsy822
authored andcommitted
fix: support root level noir projects
1 parent 271769d commit 1579491

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

apps/noir-compiler/src/app/services/noirPluginClient.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,17 @@ export class NoirPluginClient extends PluginClient {
8181
async findProjectRoot(filePath: string): Promise<string | null> {
8282
const srcIndex = filePath.lastIndexOf('/src/')
8383

84-
if (srcIndex === -1) {
84+
let potentialRoot = null
85+
86+
if (srcIndex > -1) {
87+
potentialRoot = filePath.substring(0, srcIndex)
88+
} else if (filePath.startsWith('src/')) {
89+
potentialRoot = ''
90+
} else {
8591
console.error(`File is not located within a 'src' directory: ${filePath}`)
8692
return null
8793
}
8894

89-
const potentialRoot = filePath.substring(0, srcIndex)
9095
const tomlPath = potentialRoot ? `${potentialRoot}/Nargo.toml` : 'Nargo.toml'
9196

9297
// @ts-ignore

0 commit comments

Comments
 (0)