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",
|
"lint:fix": "eslint --ignore-path .gitignore --ext .js,.ts,.tsx . --fix",
|
||||||
"format": "prettier --ignore-path .gitignore './**/*.{css,yml,js,ts,tsx,json,yaml}' --write",
|
"format": "prettier --ignore-path .gitignore './**/*.{css,yml,js,ts,tsx,json,yaml}' --write",
|
||||||
"type-check": "tsc --noEmit",
|
"type-check": "tsc --noEmit",
|
||||||
|
"replaceVersion": "node ./scripts/replaceVersion.js",
|
||||||
"release": "release-it --non-interactive",
|
"release": "release-it --non-interactive",
|
||||||
"changelog": "auto-changelog -p"
|
"changelog": "auto-changelog -p"
|
||||||
},
|
},
|
||||||
@ -68,7 +69,7 @@
|
|||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"release-it": {
|
"release-it": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
"after:bump": "npm run changelog"
|
"after:bump": "npm run changelog && npm run replaceVersion"
|
||||||
},
|
},
|
||||||
"plugins": {},
|
"plugins": {},
|
||||||
"git": {
|
"git": {
|
||||||
|
@ -492,6 +492,9 @@ type GlobalStatistic @entity {
|
|||||||
|
|
||||||
"number of dispensers created"
|
"number of dispensers created"
|
||||||
dispenserCount: Int!
|
dispenserCount: Int!
|
||||||
|
|
||||||
|
"current version"
|
||||||
|
version: String
|
||||||
}
|
}
|
||||||
|
|
||||||
type OPC @entity {
|
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)
|
let globalStats = GlobalStatistic.load(GLOBAL_ID)
|
||||||
if (!globalStats) {
|
if (!globalStats) {
|
||||||
globalStats = new GlobalStatistic(GLOBAL_ID)
|
globalStats = new GlobalStatistic(GLOBAL_ID)
|
||||||
|
globalStats.version = '1.2.0'
|
||||||
globalStats.save()
|
globalStats.save()
|
||||||
}
|
}
|
||||||
return globalStats
|
return globalStats
|
||||||
|
Loading…
Reference in New Issue
Block a user