mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
Improve how is get the version data of the squid.
This commit is contained in:
parent
0ca5dae306
commit
ba9dc0930d
2
.gitignore
vendored
2
.gitignore
vendored
@ -5,3 +5,5 @@ coverage/
|
|||||||
doc/
|
doc/
|
||||||
test/**/*.js
|
test/**/*.js
|
||||||
src/**/*.js
|
src/**/*.js
|
||||||
|
|
||||||
|
src/metadata\.json
|
||||||
|
5
package-lock.json
generated
5
package-lock.json
generated
@ -5327,11 +5327,6 @@
|
|||||||
"pinkie": "^2.0.0"
|
"pinkie": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pjson": {
|
|
||||||
"version": "1.0.9",
|
|
||||||
"resolved": "https://registry.npmjs.org/pjson/-/pjson-1.0.9.tgz",
|
|
||||||
"integrity": "sha512-4hRJH3YzkUpOlShRzhyxAmThSNnAaIlWZCAb27hd0pVUAXNUAHAO7XZbsPPvsCYwBFEScTmCCL6DGE8NyZ8BdQ=="
|
|
||||||
},
|
|
||||||
"pkg-dir": {
|
"pkg-dir": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz",
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
"start": "npm link @oceanprotocol/keeper-contracts @oceanprotocol/secret-store-client && npm run build:watch",
|
"start": "npm link @oceanprotocol/keeper-contracts @oceanprotocol/secret-store-client && npm run build:watch",
|
||||||
"build": "npm run clean && npm run build:tsc && npm run build:dist",
|
"build": "npm run clean && npm run build:tsc && npm run build:dist",
|
||||||
"build:tsc": "tsc --sourceMap",
|
"build:tsc": "tsc --sourceMap",
|
||||||
|
"build:metadata": "./scripts/get-metadata.js > src/metadata.json",
|
||||||
"build:dist": "cross-env NODE_ENV=production webpack",
|
"build:dist": "cross-env NODE_ENV=production webpack",
|
||||||
"build:watch": "tsc -w",
|
"build:watch": "tsc -w",
|
||||||
"doc": "typedoc --mode modules --out ./doc/ ./src/",
|
"doc": "typedoc --mode modules --out ./doc/ ./src/",
|
||||||
@ -30,7 +31,9 @@
|
|||||||
"release": "./node_modules/release-it/bin/release-it.js --src.tagName='v%s' --github.release --npm.publish --non-interactive",
|
"release": "./node_modules/release-it/bin/release-it.js --src.tagName='v%s' --github.release --npm.publish --non-interactive",
|
||||||
"release-minor": "./node_modules/release-it/bin/release-it.js minor --src.tagName='v%s' --github.release --npm.publish --non-interactive",
|
"release-minor": "./node_modules/release-it/bin/release-it.js minor --src.tagName='v%s' --github.release --npm.publish --non-interactive",
|
||||||
"release-major": "./node_modules/release-it/bin/release-it.js major --src.tagName='v%s' --github.release --npm.publish --non-interactive",
|
"release-major": "./node_modules/release-it/bin/release-it.js major --src.tagName='v%s' --github.release --npm.publish --non-interactive",
|
||||||
"prepublishOnly": "npm run build"
|
"prepublishOnly": "npm run build",
|
||||||
|
"prebuild": "npm run build:metadata",
|
||||||
|
"postinstall": "npm run build:metadata"
|
||||||
},
|
},
|
||||||
"nyc": {
|
"nyc": {
|
||||||
"include": [
|
"include": [
|
||||||
@ -69,7 +72,6 @@
|
|||||||
"bignumber.js": "^8.1.1",
|
"bignumber.js": "^8.1.1",
|
||||||
"deprecated-decorator": "^0.1.6",
|
"deprecated-decorator": "^0.1.6",
|
||||||
"node-fetch": "^2.6.0",
|
"node-fetch": "^2.6.0",
|
||||||
"pjson": "^1.0.9",
|
|
||||||
"save-file": "^2.3.1",
|
"save-file": "^2.3.1",
|
||||||
"uuid": "^3.3.2",
|
"uuid": "^3.3.2",
|
||||||
"web3": "1.0.0-beta.37",
|
"web3": "1.0.0-beta.37",
|
||||||
|
14
scripts/get-metadata.js
Executable file
14
scripts/get-metadata.js
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const packageInfo = require('../package.json');
|
||||||
|
|
||||||
|
const execSync = require('child_process').execSync;
|
||||||
|
|
||||||
|
process.stdout.write(
|
||||||
|
JSON
|
||||||
|
.stringify({
|
||||||
|
version: require('../package.json').version,
|
||||||
|
commit: execSync(`git rev-parse HEAD`).toString().trim(),
|
||||||
|
}, null, ' ')
|
||||||
|
);
|
@ -1,5 +1,5 @@
|
|||||||
import * as keeperPackageJson from "@oceanprotocol/keeper-contracts/package.json"
|
import * as keeperPackageJson from "@oceanprotocol/keeper-contracts/package.json"
|
||||||
import * as packageJson from "pjson"
|
import * as metadata from "../metadata.json"
|
||||||
|
|
||||||
import { Instantiable, InstantiableConfig } from "../Instantiable.abstract"
|
import { Instantiable, InstantiableConfig } from "../Instantiable.abstract"
|
||||||
|
|
||||||
@ -10,19 +10,20 @@ export enum OceanPlatformTechStatus {
|
|||||||
Working = "Working",
|
Working = "Working",
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OceanPlatformTech {
|
export interface OceanPlatformTech {
|
||||||
name: string
|
name: string
|
||||||
version?: string
|
version?: string
|
||||||
|
commit?: string
|
||||||
status: OceanPlatformTechStatus
|
status: OceanPlatformTechStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OceanPlatformKeeperTech extends OceanPlatformTech {
|
export interface OceanPlatformKeeperTech extends OceanPlatformTech {
|
||||||
network?: string
|
network?: string
|
||||||
keeperVersion?: string
|
keeperVersion?: string
|
||||||
contracts?: {[contractName: string]: string}
|
contracts?: {[contractName: string]: string}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OceanPlatformVersions extends Array<OceanPlatformKeeperTech | OceanPlatformTech> {
|
export interface OceanPlatformVersions {
|
||||||
squid: OceanPlatformKeeperTech
|
squid: OceanPlatformKeeperTech
|
||||||
aquarius: OceanPlatformTech
|
aquarius: OceanPlatformTech
|
||||||
brizo: OceanPlatformKeeperTech
|
brizo: OceanPlatformKeeperTech
|
||||||
@ -50,12 +51,13 @@ export class OceanVersions extends Instantiable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async get(): Promise<OceanPlatformVersions> {
|
public async get(): Promise<OceanPlatformVersions> {
|
||||||
const versions = ([] as any) as OceanPlatformVersions
|
const versions = {} as OceanPlatformVersions
|
||||||
|
|
||||||
// Squid
|
// Squid
|
||||||
versions.squid = {
|
versions.squid = {
|
||||||
name: "Squid-js",
|
name: "Squid-js",
|
||||||
version: packageJson.version,
|
version: metadata.version,
|
||||||
|
commit: metadata.commit,
|
||||||
status: OceanPlatformTechStatus.Working,
|
status: OceanPlatformTechStatus.Working,
|
||||||
network: (await this.ocean.keeper.getNetworkName()).toLowerCase(),
|
network: (await this.ocean.keeper.getNetworkName()).toLowerCase(),
|
||||||
keeperVersion: keeperPackageJson.version,
|
keeperVersion: keeperPackageJson.version,
|
||||||
@ -102,7 +104,6 @@ export class OceanVersions extends Instantiable {
|
|||||||
|
|
||||||
// Status
|
// Status
|
||||||
const techs: OceanPlatformKeeperTech[] = Object.values(versions as any)
|
const techs: OceanPlatformKeeperTech[] = Object.values(versions as any)
|
||||||
versions.push(...techs)
|
|
||||||
|
|
||||||
const networks = techs
|
const networks = techs
|
||||||
.map(({network}) => network)
|
.map(({network}) => network)
|
||||||
|
@ -14,7 +14,7 @@ export * from "./ddo/DDO"
|
|||||||
export * from "./ddo/MetaData"
|
export * from "./ddo/MetaData"
|
||||||
|
|
||||||
export { OrderProgressStep, CreateProgressStep } from "./ocean/OceanAssets"
|
export { OrderProgressStep, CreateProgressStep } from "./ocean/OceanAssets"
|
||||||
export { OceanPlatformTechStatus } from "./ocean/OceanVersions"
|
export { OceanPlatformTechStatus, OceanPlatformTech, OceanPlatformKeeperTech, OceanPlatformVersions } from "./ocean/OceanVersions"
|
||||||
|
|
||||||
export { AgreementTemplate } from "./keeper/contracts/templates"
|
export { AgreementTemplate } from "./keeper/contracts/templates"
|
||||||
export { Condition, ConditionState } from "./keeper/contracts/conditions"
|
export { Condition, ConditionState } from "./keeper/contracts/conditions"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user