From 41d6726beda89a50a3d2c1232451226cabf174e3 Mon Sep 17 00:00:00 2001
From: Matthias Kretschmann
Date: Tue, 28 May 2019 01:54:27 +0200
Subject: [PATCH 1/6] simplify release tasks, automatic changelog
---
README.md | 27 +++++++--------------------
package.json | 24 ++++++++++++++++++------
2 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/README.md b/README.md
index d6b96d7..1d386fc 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@ If you're a developer and want to contribute to, or want to utilize this marketp
- [✨ Code Style](#-code-style)
- [🛳 Production](#-production)
- [⬆️ Releases](#️-releases)
-- [Changelog](#changelog)
+- [📜 Changelog](#-changelog)
- [🎁 Contributing](#-contributing)
- [🏛 License](#-license)
@@ -125,6 +125,7 @@ Builds the client for production to the `./client/build` folder, and the server
From a clean `master` branch you can run any release task doing the following:
- bumps the project version
+- auto-generates and updates the CHANGELOG.md file from commit messages
- creates a Git tag
- commits and pushes everything
- creates a GitHub release with commit messages as description
@@ -132,30 +133,16 @@ From a clean `master` branch you can run any release task doing the following:
You can execute the script using {major|minor|patch} as first argument to bump the version accordingly:
- To bump a patch version: `npm run release`
-- To bump a minor version: `npm run release-minor`
-- To bump a major version: `npm run release-major`
+- To bump a minor version: `npm run release minor`
+- To bump a major version: `npm run release major`
-By creating the Git tag with these tasks, Travis will trigger a new Kubernetes deployment automatically aftr a successful tag build.
+By creating the Git tag with these tasks, Travis will trigger a new Kubernetes live deployment automatically, after a successful tag build.
For the GitHub releases steps a GitHub personal access token, exported as `GITHUB_TOKEN` is required. [Setup](https://github.com/release-it/release-it#github-releases)
-## Changelog
+## 📜 Changelog
-See the [CHANGELOG.md](./CHANGELOG.md) file.
-
-This file is auto-generated from commit & PR messages upon running:
-
-```bash
-npm run changelog
-```
-
-This will update the CHANGELOG.md file with commit messages in a nice format. Doing a release will not automatically update that changelog file. So after every release this needs to done with the above command and simply committed back into `master`.
-
-For convenience, you can use this command which updates the CHANGELOG.md file, commits the result, and pushes changes to `master`:
-
-```bash
-npm run changelog:commit
-```
+See the [CHANGELOG.md](./CHANGELOG.md) file. This file is auto-generated during the above mentioned release process.
## 🎁 Contributing
diff --git a/package.json b/package.json
index 2c6b30b..5acadb2 100644
--- a/package.json
+++ b/package.json
@@ -16,12 +16,8 @@
"lint:js": "eslint --ignore-path .gitignore --ignore-path .prettierignore --ext .ts,.tsx .",
"lint:fix": "eslint --fix --ignore-path .gitignore --ignore-path .prettierignore --ext .ts,.tsx .",
"lint": "npm run lint:js && npm run lint:css",
- "release": "./node_modules/release-it/bin/release-it.js --git.tagName='v${version}' --github.release --non-interactive --no-npm.publish",
- "release-minor": "./node_modules/release-it/bin/release-it.js minor --git.tagName='v${version}' --github.release --non-interactive --no-npm.publish",
- "release-major": "./node_modules/release-it/bin/release-it.js major --git.tagName='v${version}' --github.release --non-interactive --no-npm.publish",
- "changelog": "auto-changelog",
- "changelog:commit": "npm run changelog && git add CHANGELOG.md && git commit -m 'update changelog' && git push",
- "beforeStage": "npm run changelog"
+ "release": "release-it --non-interactive",
+ "changelog": "auto-changelog -p"
},
"dependencies": {},
"devDependencies": {
@@ -45,5 +41,21 @@
"repository": {
"type": "git",
"url": "https://github.com/oceanprotocol/commons"
+ },
+ "release-it": {
+ "scripts": {
+ "beforeStart": "npm test",
+ "beforeStage": "npm run changelog",
+ "afterRelease": "echo Successfully released ${name} v${version} to ${repo.repository}."
+ },
+ "git": {
+ "tagName": "v${version}"
+ },
+ "github": {
+ "release": true
+ },
+ "npm": {
+ "publish": false
+ }
}
}
From a65be11c076fe0ff5d30801b98a37be00a795fc4 Mon Sep 17 00:00:00 2001
From: Matthias Kretschmann
Date: Tue, 28 May 2019 11:41:36 +0200
Subject: [PATCH 2/6] bump version in all package.json
---
client/package.json | 2 +-
package.json | 10 ++++++++++
server/package.json | 2 +-
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/client/package.json b/client/package.json
index f26fc90..2056546 100644
--- a/client/package.json
+++ b/client/package.json
@@ -1,7 +1,7 @@
{
"name": "commons-client",
"description": "Ocean Protocol marketplace frontend to explore, download, and publish open data sets.",
- "version": "0.1.0",
+ "version": "0.4.0",
"license": "Apache-2.0",
"scripts": {
"start": "react-scripts start",
diff --git a/package.json b/package.json
index 5acadb2..f87b8f9 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,7 @@
},
"dependencies": {},
"devDependencies": {
+ "@release-it/bumper": "^1.0.2",
"@typescript-eslint/eslint-plugin": "^1.7.0",
"@typescript-eslint/parser": "^1.7.0",
"auto-changelog": "^1.13.0",
@@ -48,6 +49,15 @@
"beforeStage": "npm run changelog",
"afterRelease": "echo Successfully released ${name} v${version} to ${repo.repository}."
},
+ "plugins": {
+ "@release-it/bumper": {
+ "out": [
+ "package.json",
+ "client/package.json",
+ "server/package.json"
+ ]
+ }
+ },
"git": {
"tagName": "v${version}"
},
diff --git a/server/package.json b/server/package.json
index a489d39..cda8f96 100644
--- a/server/package.json
+++ b/server/package.json
@@ -1,7 +1,7 @@
{
"name": "commons-server",
"description": "Ocean Protocol marketplace backend.",
- "version": "1.0.0",
+ "version": "0.4.0",
"license": "Apache-2.0",
"main": "dist/server.js",
"scripts": {
From 321ae3742ca05fea7638113ac8f394466a7e95a9 Mon Sep 17 00:00:00 2001
From: Matthias Kretschmann
Date: Tue, 28 May 2019 11:44:35 +0200
Subject: [PATCH 3/6] update docs
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 1d386fc..71b2a8e 100644
--- a/README.md
+++ b/README.md
@@ -124,7 +124,7 @@ Builds the client for production to the `./client/build` folder, and the server
From a clean `master` branch you can run any release task doing the following:
-- bumps the project version
+- bumps the project version in `package.json`, `client/package.json`, `server/package.json`
- auto-generates and updates the CHANGELOG.md file from commit messages
- creates a Git tag
- commits and pushes everything
From c742426b1a00a1f5776458dda133742256f4bdd9 Mon Sep 17 00:00:00 2001
From: Matthias Kretschmann
Date: Tue, 28 May 2019 12:11:48 +0200
Subject: [PATCH 4/6] package-locks
---
client/package-lock.json | 2 +-
package-lock.json | 31 +++++++++++++++++++++++++++++++
server/package-lock.json | 2 +-
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/client/package-lock.json b/client/package-lock.json
index c52039f..40af072 100644
--- a/client/package-lock.json
+++ b/client/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "commons-client",
- "version": "0.1.0",
+ "version": "0.4.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package-lock.json b/package-lock.json
index 3b82b2b..970e154 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -249,6 +249,19 @@
"url-template": "^2.0.8"
}
},
+ "@release-it/bumper": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@release-it/bumper/-/bumper-1.0.2.tgz",
+ "integrity": "sha512-bcBiXVmnBMhb6LjyRPqyyWGCT89RQpszqMm376k/hbLAClWaX+LXX+05IFmScbWZe51K/tr6Gwq5UEwhio8+oQ==",
+ "dev": true,
+ "requires": {
+ "detect-indent": "^6.0.0",
+ "lodash.castarray": "^4.4.0",
+ "lodash.get": "^4.4.2",
+ "mock-fs": "^4.9.0",
+ "release-it": "^11.0.1"
+ }
+ },
"@sindresorhus/is": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
@@ -1347,6 +1360,12 @@
"integrity": "sha512-ccVHpE72+tcIKaGMql33x5MAjKQIZrk+3x2GbJ7TeraUCZWHoT+KSZpoC+JQFsUBlSTXUrBaGiF0j6zVTepPLg==",
"dev": true
},
+ "detect-indent": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.0.0.tgz",
+ "integrity": "sha512-oSyFlqaTHCItVRGK5RmrmjB+CmaMOW7IaNA/kdxqhoa6d17j/5ce9O9eWXmV/KEdRwqpQA+Vqe8a8Bsybu4YnA==",
+ "dev": true
+ },
"detect-repo-changelog": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/detect-repo-changelog/-/detect-repo-changelog-1.0.1.tgz",
@@ -3494,6 +3513,12 @@
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==",
"dev": true
},
+ "lodash.castarray": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/lodash.castarray/-/lodash.castarray-4.4.0.tgz",
+ "integrity": "sha1-wCUTUV4wna3dTCTGDP3c9ZdtkRU=",
+ "dev": true
+ },
"lodash.find": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/lodash.find/-/lodash.find-4.6.0.tgz",
@@ -3900,6 +3925,12 @@
}
}
},
+ "mock-fs": {
+ "version": "4.10.0",
+ "resolved": "https://registry.npmjs.org/mock-fs/-/mock-fs-4.10.0.tgz",
+ "integrity": "sha512-eBpLEjI6tK4RKK44BbUBQu89lrNh+5WeX3wf2U6Uwo6RtRGAQ77qvKeuuQh3lVXHF1aPndVww9VcjqmLThIdtA==",
+ "dev": true
+ },
"ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
diff --git a/server/package-lock.json b/server/package-lock.json
index 121bdee..65f7f7c 100644
--- a/server/package-lock.json
+++ b/server/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "commons-server",
- "version": "1.0.0",
+ "version": "0.4.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
From 2395c3ff21f27bda898d8dfeeb87c4c2b91e9577 Mon Sep 17 00:00:00 2001
From: Matthias Kretschmann
Date: Tue, 28 May 2019 12:30:57 +0200
Subject: [PATCH 5/6] output version number in footer
---
.../components/organisms/Footer.module.scss | 6 ++++
client/src/components/organisms/Footer.tsx | 28 +++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/client/src/components/organisms/Footer.module.scss b/client/src/components/organisms/Footer.module.scss
index 6f933ed..72407d9 100644
--- a/client/src/components/organisms/Footer.module.scss
+++ b/client/src/components/organisms/Footer.module.scss
@@ -91,3 +91,9 @@
}
}
}
+
+.version {
+ font-family: $font-family-monospace;
+ font-size: $font-size-mini;
+ margin-top: $spacer;
+}
diff --git a/client/src/components/organisms/Footer.tsx b/client/src/components/organisms/Footer.tsx
index 99b5f99..cbcf60d 100644
--- a/client/src/components/organisms/Footer.tsx
+++ b/client/src/components/organisms/Footer.tsx
@@ -5,6 +5,33 @@ import { ReactComponent as AiCommons } from '../../img/aicommons.svg'
import styles from './Footer.module.scss'
import meta from '../../data/meta.json'
+import { version } from '../../../package.json'
+import { version as versionSquid } from '@oceanprotocol/squid/package.json'
+
+const VersionNumber = () => {
+ const versionOutput =
+ process.env.NODE_ENV === 'production'
+ ? `v${version}`
+ : `v${version}-dev`
+
+ return (
+
+
+ {versionOutput}
+ {' '}
+ —{' '}
+
+ squid-js v{versionSquid}
+
+
+ )
+}
const Footer = () => (
+
From 043d9429ac76fe4af8099f46d73986e0e488a055 Mon Sep 17 00:00:00 2001
From: Matthias Kretschmann
Date: Tue, 28 May 2019 13:37:47 +0200
Subject: [PATCH 6/6] version numbers as component, fetch Brizo & Aquarius
---
.../atoms/VersionNumbers.module.scss | 21 ++++++
.../src/components/atoms/VersionNumbers.tsx | 73 +++++++++++++++++++
.../components/organisms/Footer.module.scss | 6 --
client/src/components/organisms/Footer.tsx | 30 +-------
4 files changed, 96 insertions(+), 34 deletions(-)
create mode 100644 client/src/components/atoms/VersionNumbers.module.scss
create mode 100644 client/src/components/atoms/VersionNumbers.tsx
diff --git a/client/src/components/atoms/VersionNumbers.module.scss b/client/src/components/atoms/VersionNumbers.module.scss
new file mode 100644
index 0000000..4b7f97e
--- /dev/null
+++ b/client/src/components/atoms/VersionNumbers.module.scss
@@ -0,0 +1,21 @@
+@import '../../styles/variables';
+
+.version {
+ font-family: $font-family-monospace;
+ font-size: $font-size-mini;
+ margin-top: $spacer;
+}
+
+.more {
+ cursor: help;
+ display: inline-block;
+ margin-left: $spacer / 4;
+ margin-bottom: -.1rem;
+ vertical-align: middle;
+
+ svg {
+ width: $font-size-mini;
+ height: $font-size-mini;
+ fill: currentColor;
+ }
+}
diff --git a/client/src/components/atoms/VersionNumbers.tsx b/client/src/components/atoms/VersionNumbers.tsx
new file mode 100644
index 0000000..47ddc4e
--- /dev/null
+++ b/client/src/components/atoms/VersionNumbers.tsx
@@ -0,0 +1,73 @@
+import React, { PureComponent } from 'react'
+import { version } from '../../../package.json'
+import { version as versionSquid } from '@oceanprotocol/squid/package.json'
+import styles from './VersionNumbers.module.scss'
+
+import {
+ aquariusHost,
+ aquariusPort,
+ aquariusScheme,
+ brizoHost,
+ brizoPort,
+ brizoScheme
+} from '../../config'
+import { Logger } from '@oceanprotocol/squid'
+
+const commonsVersion =
+ process.env.NODE_ENV === 'production' ? `v${version}` : `v${version}-dev`
+
+export default class VersionNumbers extends PureComponent {
+ public state = {
+ commons: commonsVersion,
+ squidJs: `v${versionSquid}`,
+ aquarius: 'v0.0.0',
+ brizo: 'v0.0.0'
+ }
+
+ public async componentDidMount() {
+ try {
+ const {
+ versionAquarius,
+ versionBrizo
+ } = await this.getComponentVersions()
+
+ this.setState({
+ aquarius: `v${versionAquarius}`,
+ brizo: `v${versionBrizo}`
+ })
+ } catch (error) {
+ Logger.error(error.message)
+ }
+ }
+
+ private async getComponentVersions() {
+ const responseAquarius = await fetch(
+ `${aquariusScheme}://${aquariusHost}:${aquariusPort}`
+ )
+ const jsonAquarius = await responseAquarius.json()
+ const versionAquarius = jsonAquarius.version
+
+ const responseBrizo = await fetch(
+ `${brizoScheme}://${brizoHost}:${brizoPort}`
+ )
+ const jsonBrizo = await responseBrizo.json()
+ const versionBrizo = jsonBrizo.version
+
+ return { versionAquarius, versionBrizo }
+ }
+
+ public render() {
+ const { commons, squidJs, brizo, aquarius } = this.state
+
+ return (
+
+
+ {commons}
+
+
+ )
+ }
+}
diff --git a/client/src/components/organisms/Footer.module.scss b/client/src/components/organisms/Footer.module.scss
index 72407d9..6f933ed 100644
--- a/client/src/components/organisms/Footer.module.scss
+++ b/client/src/components/organisms/Footer.module.scss
@@ -91,9 +91,3 @@
}
}
}
-
-.version {
- font-family: $font-family-monospace;
- font-size: $font-size-mini;
- margin-top: $spacer;
-}
diff --git a/client/src/components/organisms/Footer.tsx b/client/src/components/organisms/Footer.tsx
index cbcf60d..3fe9f56 100644
--- a/client/src/components/organisms/Footer.tsx
+++ b/client/src/components/organisms/Footer.tsx
@@ -5,33 +5,7 @@ import { ReactComponent as AiCommons } from '../../img/aicommons.svg'
import styles from './Footer.module.scss'
import meta from '../../data/meta.json'
-import { version } from '../../../package.json'
-import { version as versionSquid } from '@oceanprotocol/squid/package.json'
-
-const VersionNumber = () => {
- const versionOutput =
- process.env.NODE_ENV === 'production'
- ? `v${version}`
- : `v${version}-dev`
-
- return (
-
-
- {versionOutput}
- {' '}
- —{' '}
-
- squid-js v{versionSquid}
-
-
- )
-}
+import VersionNumbers from '../atoms/VersionNumbers'
const Footer = () => (