@graphprotocol/graph-cli 0.23.1 → 0.23.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/init.js +1 -0
- package/src/commands/test.js +37 -27
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -262,6 +262,7 @@ const getEtherscanLikeAPIUrl = (network) => {
|
|
|
262
262
|
case "mainnet": return `https://api.etherscan.io/api`;
|
|
263
263
|
case "bsc": return `https://api.bscscan.com/api`;
|
|
264
264
|
case "matic": return `https://api.polygonscan.com/api`;
|
|
265
|
+
case "mumbai": return `https://api-testnet.polygonscan.com/api`;
|
|
265
266
|
default: return `https://api-${network}.etherscan.io/api`;
|
|
266
267
|
}
|
|
267
268
|
}
|
package/src/commands/test.js
CHANGED
|
@@ -11,6 +11,7 @@ ${chalk.dim('Options:')}
|
|
|
11
11
|
|
|
12
12
|
-f --force Overwrite folder + file when downloading
|
|
13
13
|
-h, --help Show usage information
|
|
14
|
+
-l, --logs Logs to the console information about the OS, CPU model and download url (debugging purposes)
|
|
14
15
|
-v, --version <tag> Choose the version of the rust binary that you want to be downloaded/used
|
|
15
16
|
`
|
|
16
17
|
|
|
@@ -21,12 +22,13 @@ module.exports = {
|
|
|
21
22
|
let { print } = toolbox
|
|
22
23
|
|
|
23
24
|
// Read CLI parameters
|
|
24
|
-
let { f, force, h, help, v, version } = toolbox.parameters.options
|
|
25
|
+
let { f, force, h, help, l, logs, v, version } = toolbox.parameters.options
|
|
25
26
|
let datasource = toolbox.parameters.first
|
|
26
27
|
|
|
27
28
|
// Support both long and short option variants
|
|
28
29
|
force = force || f
|
|
29
30
|
help = help || h
|
|
31
|
+
logs = logs || l
|
|
30
32
|
version = version || v
|
|
31
33
|
|
|
32
34
|
// Show help text if requested
|
|
@@ -35,48 +37,56 @@ module.exports = {
|
|
|
35
37
|
return
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
const platform = getPlatform()
|
|
40
|
+
const platform = getPlatform(logs)
|
|
39
41
|
if (!version) {
|
|
40
|
-
let result = await fetch('https://api.github.com/repos/LimeChain/matchstick/releases/latest')
|
|
41
|
-
let json = await result.json()
|
|
42
|
-
version = json.tag_name
|
|
42
|
+
let result = await fetch('https://api.github.com/repos/LimeChain/matchstick/releases/latest')
|
|
43
|
+
let json = await result.json()
|
|
44
|
+
version = json.tag_name
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
const url = `https://github.com/LimeChain/matchstick/releases/download/${version}/${platform}
|
|
47
|
+
const url = `https://github.com/LimeChain/matchstick/releases/download/${version}/${platform}`
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
if (logs) {
|
|
50
|
+
console.log(`Download link: ${url}`)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let binary = new Binary(platform, url, version)
|
|
54
|
+
await binary.install(force)
|
|
55
|
+
datasource ? binary.run(datasource) : binary.run()
|
|
50
56
|
}
|
|
51
57
|
}
|
|
52
58
|
|
|
53
|
-
function getPlatform() {
|
|
54
|
-
const type = os.type()
|
|
55
|
-
const arch = os.arch()
|
|
56
|
-
const release = os.release()
|
|
57
|
-
const cpuCore = os.cpus()[0]
|
|
58
|
-
const majorVersion = semver.major(release)
|
|
59
|
-
const isM1 = cpuCore.model.includes("Apple M1")
|
|
59
|
+
function getPlatform(logs) {
|
|
60
|
+
const type = os.type()
|
|
61
|
+
const arch = os.arch()
|
|
62
|
+
const release = os.release()
|
|
63
|
+
const cpuCore = os.cpus()[0]
|
|
64
|
+
const majorVersion = semver.major(release)
|
|
65
|
+
const isM1 = cpuCore.model.includes("Apple M1")
|
|
66
|
+
|
|
67
|
+
if (logs) {
|
|
68
|
+
console.log(`OS type: ${type}\nOS arch: ${arch}\nOS release: ${release}\nOS major version: ${majorVersion}\nCPU model: ${cpuCore.model}`)
|
|
69
|
+
}
|
|
60
70
|
|
|
61
71
|
if (arch === 'x64' || (arch === 'arm64' && isM1)) {
|
|
62
72
|
if (type === 'Darwin') {
|
|
63
|
-
if (majorVersion ===
|
|
64
|
-
return 'binary-macos-10.15'
|
|
65
|
-
} else if (majorVersion ===
|
|
66
|
-
return 'binary-macos-10.14'
|
|
73
|
+
if (majorVersion === 19) {
|
|
74
|
+
return 'binary-macos-10.15'
|
|
75
|
+
} else if (majorVersion === 18) {
|
|
76
|
+
return 'binary-macos-10.14'
|
|
67
77
|
} else if (isM1) {
|
|
68
|
-
return 'binary-macos-11-m1'
|
|
78
|
+
return 'binary-macos-11-m1'
|
|
69
79
|
}
|
|
70
|
-
return 'binary-macos-11'
|
|
80
|
+
return 'binary-macos-11'
|
|
71
81
|
} else if (type === 'Linux') {
|
|
72
|
-
if (majorVersion ===
|
|
73
|
-
return 'binary-linux-18'
|
|
82
|
+
if (majorVersion === 18) {
|
|
83
|
+
return 'binary-linux-18'
|
|
74
84
|
}
|
|
75
|
-
return 'binary-linux-20'
|
|
85
|
+
return 'binary-linux-20'
|
|
76
86
|
} else if (type === 'Windows_NT') {
|
|
77
|
-
return 'binary-windows'
|
|
87
|
+
return 'binary-windows'
|
|
78
88
|
}
|
|
79
89
|
}
|
|
80
90
|
|
|
81
|
-
throw new Error(`Unsupported platform: ${type} ${arch} ${majorVersion}`)
|
|
91
|
+
throw new Error(`Unsupported platform: ${type} ${arch} ${majorVersion}`)
|
|
82
92
|
}
|