Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamically set protocol CLI version #139

Merged
merged 2 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/gold-insects-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gov4git-desktop-app': patch
---

Dynamically set protocol CLI version
3 changes: 3 additions & 0 deletions src/electron/configs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { resolve } from 'node:path'

import * as pkgJson from '../../package.json'
import { toResolvedPath } from './lib/paths.js'

export const CONFIG_PATH = toResolvedPath(
Expand All @@ -13,3 +14,5 @@ export const COMMUNITY_REPO_NAME =
process.env['GOV4GIT_COMMUNITY_REPO_NAME'] ?? 'gov4git-identity'

export const GITHUB_OAUTH_CLIENT_ID = '912c0ab18e0f0b4a1abe'

export const CLI_VERSION = pkgJson['dependencies']['@gov4git/js-client']
2 changes: 2 additions & 0 deletions src/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import type { InvokeServiceProps } from '~/shared'

import {
CLI_VERSION,
COMMUNITY_REPO_NAME,
CONFIG_PATH,
DB_PATH,
Expand Down Expand Up @@ -39,6 +40,7 @@ const logService = new LogService(resolve(CONFIG_PATH, 'logs.txt'))
services.register('log', logService)

logService.info(`Gov4Git Version ${logService.getAppVersion()}`)
logService.info(`CLI_VERSION of protocol: ${CLI_VERSION}`)

async function setup(): Promise<void> {
try {
Expand Down
3 changes: 2 additions & 1 deletion src/electron/services/CommunityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { resolve } from 'path'

import { AbstractCommunityService, Expand, ServiceResponse } from '~/shared'

import { CLI_VERSION } from '../configs.js'
import { DB } from '../db/db.js'
import {
communities,
Expand Down Expand Up @@ -428,7 +429,7 @@ ${user.memberPublicBranch}`
'--project',
`${org}/${repo}`,
'--release',
'v2.2.5',
`v${CLI_VERSION}`,
]
await this.govService.mustRun(command, undefined, true)

Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"resolveJsonModule": true
}
}
}
Loading