Skip to content

Commit

Permalink
Merge pull request #2057 from okTurtles/release-0.5.1
Browse files Browse the repository at this point in the history
v0.5.1 - also update page refresh logic on new version
  • Loading branch information
taoeffect authored Jun 11, 2024
2 parents b266d4c + 586e0dd commit e7ea0c3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
5 changes: 2 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ if (!['development', 'production'].includes(NODE_ENV)) {
throw new TypeError(`Invalid NODE_ENV value: ${NODE_ENV}.`)
}
const CONTRACTS_VERSION = packageJSON.contractsVersion
// In production, append a timestamp so that browsers will detect a new version
// In development, append a timestamp so that browsers will detect a new version
// and reload whenever the live server is restarted.
// TODO: get rid of this timestamp and just bump the package version when necessary.
const GI_VERSION = packageJSON.version + (NODE_ENV === 'production' ? `@${new Date().toISOString()}` : '')
const GI_VERSION = packageJSON.version + (NODE_ENV === 'development' ? `@${new Date().toISOString()}` : '')

// Make version info available to subprocesses.
Object.assign(process.env, { CONTRACTS_VERSION, GI_VERSION })
Expand Down
9 changes: 7 additions & 2 deletions frontend/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ async function startApp () {
sbp('okTurtles.data/set', PUBSUB_INSTANCE, sbp('chelonia/connect', {
messageHandlers: {
[NOTIFICATION_TYPE.VERSION_INFO] (msg) {
const isDevelopment = process.env.NODE_ENV === 'development'
const ourVersion = process.env.GI_VERSION
const theirVersion = msg.data.GI_VERSION

Expand All @@ -218,7 +217,13 @@ async function startApp () {
// We only compare GI_VERSION in development mode so that the page auto-refreshes if `grunt dev` is re-run
// This check cannot be done in production mode as it would lead to an infinite page refresh bug
// when using `grunt deploy` with `grunt serve`
if (isContractVersionDiff || (isDevelopment && isGIVersionDiff)) {
console.info('VERSION_INFO received:', {
ourVersion,
theirVersion,
ourContractsVersion,
theirContractsVersion
})
if (isContractVersionDiff || isGIVersionDiff) {
sbp('okTurtles.events/emit', NOTIFICATION_TYPE.VERSION_INFO, { ...msg.data })
}
},
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "group-income",
"version": "0.5.0",
"version": "0.5.1",
"contractsVersion": "0.5.0",
"private": true,
"description": "",
Expand Down

0 comments on commit e7ea0c3

Please sign in to comment.