@graphprotocol/graph-cli 0.30.0 → 0.30.1
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
CHANGED
package/src/migrations.js
CHANGED
|
@@ -6,10 +6,8 @@ const MIGRATIONS = [
|
|
|
6
6
|
require('./migrations/mapping_api_version_0_0_3'),
|
|
7
7
|
require('./migrations/mapping_api_version_0_0_4'),
|
|
8
8
|
require('./migrations/mapping_api_version_0_0_5'),
|
|
9
|
-
require('./migrations/mapping_api_version_0_0_6'),
|
|
10
9
|
require('./migrations/spec_version_0_0_2'),
|
|
11
10
|
require('./migrations/spec_version_0_0_3'),
|
|
12
|
-
require('./migrations/spec_version_0_0_4'),
|
|
13
11
|
]
|
|
14
12
|
|
|
15
13
|
const applyMigrations = async options =>
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
const fs = require('fs-extra')
|
|
2
|
-
const semver = require('semver')
|
|
3
|
-
const toolbox = require('gluegun/toolbox')
|
|
4
|
-
const yaml = require('js-yaml')
|
|
5
|
-
const { loadManifest } = require('./util/load-manifest')
|
|
6
|
-
const { getGraphTsVersion } = require('./util/versions')
|
|
7
|
-
|
|
8
|
-
// If any of the manifest apiVersions are 0.0.6, replace them with 0.0.7
|
|
9
|
-
module.exports = {
|
|
10
|
-
name: 'Bump mapping apiVersion from 0.0.6 to 0.0.7',
|
|
11
|
-
predicate: async ({ sourceDir, manifestFile }) => {
|
|
12
|
-
// Obtain the graph-ts version, if possible
|
|
13
|
-
let graphTsVersion
|
|
14
|
-
try {
|
|
15
|
-
graphTsVersion = await getGraphTsVersion(sourceDir)
|
|
16
|
-
} catch (_) {
|
|
17
|
-
// If we cannot obtain the version, return a hint that the graph-ts
|
|
18
|
-
// hasn't been installed yet
|
|
19
|
-
return 'graph-ts dependency not installed yet'
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
let manifest = loadManifest(manifestFile)
|
|
23
|
-
return (
|
|
24
|
-
// Only migrate if the graph-ts version is >= 0.27.0...
|
|
25
|
-
// Coerce needed because we may be dealing with an alpha version
|
|
26
|
-
// and in the `semver` library this would not return true on equality.
|
|
27
|
-
semver.gte(semver.coerce(graphTsVersion), '0.27.0') &&
|
|
28
|
-
// ...and we have a manifest with mapping > apiVersion = 0.0.6
|
|
29
|
-
manifest &&
|
|
30
|
-
typeof manifest === 'object' &&
|
|
31
|
-
Array.isArray(manifest.dataSources) &&
|
|
32
|
-
(manifest.dataSources.reduce(
|
|
33
|
-
(hasOldMappings, dataSource) =>
|
|
34
|
-
hasOldMappings ||
|
|
35
|
-
(typeof dataSource === 'object' &&
|
|
36
|
-
dataSource.mapping &&
|
|
37
|
-
typeof dataSource.mapping === 'object' &&
|
|
38
|
-
dataSource.mapping.apiVersion === '0.0.6'),
|
|
39
|
-
false,
|
|
40
|
-
) ||
|
|
41
|
-
(Array.isArray(manifest.templates) &&
|
|
42
|
-
manifest.templates.reduce(
|
|
43
|
-
(hasOldMappings, template) =>
|
|
44
|
-
hasOldMappings ||
|
|
45
|
-
(typeof template === 'object' &&
|
|
46
|
-
template.mapping &&
|
|
47
|
-
typeof template.mapping === 'object' &&
|
|
48
|
-
template.mapping.apiVersion === '0.0.6'),
|
|
49
|
-
false,
|
|
50
|
-
)))
|
|
51
|
-
)
|
|
52
|
-
},
|
|
53
|
-
apply: async ({ manifestFile }) => {
|
|
54
|
-
// Make sure we catch all variants; we could load the manifest
|
|
55
|
-
// and replace the values in the data structures here; unfortunately
|
|
56
|
-
// writing that back to the file messes with the formatting more than
|
|
57
|
-
// we'd like; that's why for now, we use a simple patching approach
|
|
58
|
-
await toolbox.patching.replace(
|
|
59
|
-
manifestFile,
|
|
60
|
-
new RegExp('apiVersion: 0.0.6', 'g'),
|
|
61
|
-
'apiVersion: 0.0.7',
|
|
62
|
-
)
|
|
63
|
-
await toolbox.patching.replace(
|
|
64
|
-
manifestFile,
|
|
65
|
-
new RegExp("apiVersion: '0.0.6'", 'g'),
|
|
66
|
-
"apiVersion: '0.0.7'",
|
|
67
|
-
)
|
|
68
|
-
await toolbox.patching.replace(
|
|
69
|
-
manifestFile,
|
|
70
|
-
new RegExp('apiVersion: "0.0.6"', 'g'),
|
|
71
|
-
'apiVersion: "0.0.7"',
|
|
72
|
-
)
|
|
73
|
-
},
|
|
74
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const fs = require('fs-extra')
|
|
2
|
-
const toolbox = require('gluegun/toolbox')
|
|
3
|
-
const yaml = require('js-yaml')
|
|
4
|
-
const { loadManifest } = require('./util/load-manifest')
|
|
5
|
-
|
|
6
|
-
// Spec version 0.0.5 let event handlers require transaction receipt
|
|
7
|
-
// data to be accessed in the runtime.
|
|
8
|
-
module.exports = {
|
|
9
|
-
name: 'Bump manifest specVersion from 0.0.4 to 0.0.5',
|
|
10
|
-
predicate: async ({ sourceDir, manifestFile }) => {
|
|
11
|
-
let manifest = await loadManifest(manifestFile)
|
|
12
|
-
return (
|
|
13
|
-
manifest &&
|
|
14
|
-
typeof manifest === 'object' &&
|
|
15
|
-
manifest.specVersion &&
|
|
16
|
-
manifest.specVersion === '0.0.4'
|
|
17
|
-
)
|
|
18
|
-
},
|
|
19
|
-
apply: async ({ manifestFile }) => {
|
|
20
|
-
await toolbox.patching.patch(manifestFile, {
|
|
21
|
-
insert: 'specVersion: 0.0.5',
|
|
22
|
-
replace: new RegExp(`specVersion: ['"]?0.0.4['"]?`),
|
|
23
|
-
})
|
|
24
|
-
},
|
|
25
|
-
}
|