Skip to content

Commit 9b39958

Browse files
authored
Bug fix on ipfs validation for studio (#761)
* compiler: Remove 'async' from function that should be syncronous Without this, the thrown error by the function would happen on the `UNCAUGHT EXCEPTION` log, which is unwanted, since we want this to block the hole compilation step. * compiler: Use absolute file path for ipfs validation Without this the CLI would break trying to open the mapping file using the relative path, that only works when passing to the AS compiler. Eg: Error: Failed to compile data source mapping: ENOENT: no such file or directory, open '../src/xxxx.ts' * 0.22.4
1 parent 266b9f6 commit 9b39958

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphprotocol/graph-cli",
3-
"version": "0.22.3",
3+
"version": "0.22.4",
44
"description": "CLI for building for and deploying to The Graph",
55
"dependencies": {
66
"assemblyscript": "0.19.10",

src/compiler/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class Compiler {
243243
let baseDir = this.sourceDir
244244
let absoluteMappingPath = path.resolve(baseDir, mappingPath)
245245
let inputFile = path.relative(baseDir, absoluteMappingPath)
246-
this._validateMappingContent(inputFile)
246+
this._validateMappingContent(absoluteMappingPath)
247247

248248
// If the file has already been compiled elsewhere, just use that output
249249
// file and return early
@@ -308,7 +308,7 @@ class Compiler {
308308
let baseDir = this.sourceDir
309309
let absoluteMappingPath = path.resolve(baseDir, mappingPath)
310310
let inputFile = path.relative(baseDir, absoluteMappingPath)
311-
this._validateMappingContent(inputFile)
311+
this._validateMappingContent(absoluteMappingPath)
312312

313313
// If the file has already been compiled elsewhere, just use that output
314314
// file and return early
@@ -368,7 +368,7 @@ class Compiler {
368368
}
369369
}
370370

371-
async _validateMappingContent(filePath) {
371+
_validateMappingContent(filePath) {
372372
const data = fs.readFileSync(filePath)
373373
if (
374374
this.blockIpfsMethods &&

0 commit comments

Comments
 (0)