diff --git a/.changeset/proud-zebras-report.md b/.changeset/proud-zebras-report.md new file mode 100644 index 00000000..946281c9 --- /dev/null +++ b/.changeset/proud-zebras-report.md @@ -0,0 +1,5 @@ +--- +'@graphprotocol/graph-cli': patch +--- + +Fix build files being placed outside the build directory diff --git a/packages/cli/src/compiler/index.ts b/packages/cli/src/compiler/index.ts index d2512dcc..1953928e 100644 --- a/packages/cli/src/compiler/index.ts +++ b/packages/cli/src/compiler/index.ts @@ -231,8 +231,8 @@ export default class Compiler { spinner: Spinner, ) { const absoluteSourceFile = path.resolve(sourceDir, maybeRelativeFile); - const relativeSourceFile = path.relative(sourceDir, absoluteSourceFile); - const targetFile = path.join(targetDir, relativeSourceFile); + const baseName = path.basename(absoluteSourceFile); + const targetFile = path.join(targetDir, baseName); step(spinner, 'Write subgraph file', this.displayPath(targetFile)); fs.mkdirsSync(path.dirname(targetFile)); fs.writeFileSync(targetFile, data);