mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
add version (#455)
This commit is contained in:
parent
d87fbed5b5
commit
28979c8c79
@ -28,6 +28,7 @@
|
||||
"lint:fix": "eslint --ignore-path .gitignore --ext .js,.ts,.tsx . --fix",
|
||||
"format": "prettier --ignore-path .gitignore './**/*.{css,yml,js,ts,tsx,json,yaml}' --write",
|
||||
"type-check": "tsc --noEmit",
|
||||
"replaceVersion": "node ./scripts/replaceVersion.js",
|
||||
"release": "release-it --non-interactive",
|
||||
"changelog": "auto-changelog -p"
|
||||
},
|
||||
@ -68,7 +69,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"release-it": {
|
||||
"hooks": {
|
||||
"after:bump": "npm run changelog"
|
||||
"after:bump": "npm run changelog && npm run replaceVersion"
|
||||
},
|
||||
"plugins": {},
|
||||
"git": {
|
||||
|
@ -492,6 +492,9 @@ type GlobalStatistic @entity {
|
||||
|
||||
"number of dispensers created"
|
||||
dispenserCount: Int!
|
||||
|
||||
"current version"
|
||||
version: String
|
||||
}
|
||||
|
||||
type OPC @entity {
|
||||
|
17
scripts/replaceVersion.js
Normal file
17
scripts/replaceVersion.js
Normal file
@ -0,0 +1,17 @@
|
||||
const fs = require('fs')
|
||||
const packageJson = require('../package.json')
|
||||
|
||||
async function replaceVersion() {
|
||||
let globalUtils = fs.readFileSync(
|
||||
'./src/mappings/utils/globalUtils.ts',
|
||||
'utf8'
|
||||
)
|
||||
globalUtils = globalUtils.replace(
|
||||
/.*globalStats\.version.*\n/,
|
||||
" globalStats.version = '" + packageJson.version + "'\n"
|
||||
)
|
||||
|
||||
fs.writeFileSync('./src/mappings/utils/globalUtils.ts', globalUtils, 'utf8')
|
||||
}
|
||||
|
||||
replaceVersion()
|
@ -14,6 +14,7 @@ export function getGlobalStats(): GlobalStatistic {
|
||||
let globalStats = GlobalStatistic.load(GLOBAL_ID)
|
||||
if (!globalStats) {
|
||||
globalStats = new GlobalStatistic(GLOBAL_ID)
|
||||
globalStats.version = '1.2.0'
|
||||
globalStats.save()
|
||||
}
|
||||
return globalStats
|
||||
|
Loading…
Reference in New Issue
Block a user