Skip to content

Commit

Permalink
feat: link to current release version using package name, version, an…
Browse files Browse the repository at this point in the history
…d repository URL
  • Loading branch information
samshara committed Aug 13, 2024
1 parent 90868f6 commit 2ff7940
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/chatty-toes-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"go-ui-storybook": patch
---

Link version number to release notes on GitHub
6 changes: 6 additions & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
"version": "7.4.0",
"type": "module",
"private": true,
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/IFRCGo/go-web-app.git",
"directory": "app"
},
"scripts": {
"translatte": "tsx scripts/translatte/main.ts",
"translatte:generate": "yarn translatte generate-migration ../translationMigrations ./src/**/i18n.json ../packages/ui/src/**/i18n.json",
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/GlobalFooter/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"footerOpenSourceCode":"Open Source Code",
"footerApiDocumentation":"API Documentation",
"footerOtherResources":"Other Resources",
"footerGoWiki":"Go-Wiki",
"footerGoWiki":"GO Wiki",
"footerContactUs":"Contact Us",
"footerIFRC":"© IFRC {year} v{appVersion}",
"globalFindOut": "Find Out More",
Expand Down
6 changes: 4 additions & 2 deletions app/src/components/GlobalFooter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import Link from '#components/Link';
import {
api,
appCommitHash,
appPackageName,
appRepositoryUrl,
appVersion,
} from '#config';
import { resolveUrl } from '#utils/resolveUrl';
Expand All @@ -35,8 +37,8 @@ function GlobalFooter(props: Props) {
} = props;

const strings = useTranslation(i18n);
const versionTag = `go-web-app@${appVersion}`;
const versionUrl = `https://github.com/IFRCGo/go-web-app/releases/tag/${versionTag}`;
const versionTag = `${appPackageName}@${appVersion}`;
const versionUrl = `${appRepositoryUrl}/releases/tag/${versionTag}`;
const copyrightText = resolveToComponent(
strings.footerIFRC,
{
Expand Down
4 changes: 4 additions & 0 deletions app/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ const {
APP_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE,
APP_COMMIT_HASH,
APP_VERSION,
APP_PACKAGE_NAME,
APP_REPOSITORY_URL,
} = import.meta.env;

export const environment = APP_ENVIRONMENT;

export const appTitle = APP_TITLE;
export const appCommitHash = APP_COMMIT_HASH;
export const appVersion = APP_VERSION;
export const appPackageName = APP_PACKAGE_NAME;
export const appRepositoryUrl = APP_REPOSITORY_URL;

export const api = APP_API_ENDPOINT;
export const adminUrl = APP_ADMIN_URL ?? api;
Expand Down
2 changes: 2 additions & 0 deletions app/src/declarations/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ interface ImportMetaEnv extends ImportMetaEnvAugmented {
// The custom environment variables that are passed through the vite
APP_COMMIT_HASH: string;
APP_VERSION: string;
APP_PACKAGE_NAME: string;
APP_REPOSITORY_URL: string;
}

interface ImportMeta {
Expand Down
3 changes: 3 additions & 0 deletions app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import checker from 'vite-plugin-checker';
import { compression } from 'vite-plugin-compression2';
import { VitePluginRadar } from 'vite-plugin-radar';
import svgr from 'vite-plugin-svgr';
import pkg from './package.json';

import envConfig from './env';

Expand All @@ -23,6 +24,8 @@ export default defineConfig(({ mode }) => {
define: {
'import.meta.env.APP_COMMIT_HASH': JSON.stringify(commitHash),
'import.meta.env.APP_VERSION': JSON.stringify(env.npm_package_version),
'import.meta.env.APP_PACKAGE_NAME': JSON.stringify(env.npm_package_name),
'import.meta.env.APP_REPOSITORY_URL': JSON.stringify(pkg.repository.url.match(/https:\/\/github\.com\/[^ ]+/)?.[0].replace(/\.git$/, '')),
},
plugins: [
isProd ? checker({
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
"name": "go-web-app-workspace",
"version": "1.0.0",
"type": "module",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/IFRCGo/go-web-app.git"
},
"private": true,
"scripts": {
"postinstall": "patch-package",
Expand Down
8 changes: 7 additions & 1 deletion packages/go-ui-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{
"name": "go-ui-storybook",
"private": true,
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/IFRCGo/go-web-app.git",
"directory": "packages/go-ui-storybook"
},
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
Expand Down
8 changes: 5 additions & 3 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"name": "@ifrc-go/ui",
"description": "IFRC-GO UI Components Library",
"version": "1.1.5",
"type": "module",
"license": "MIT",
"author": {
"name": "ifrc"
"repository": {
"type": "git",
"url": "git+https://github.com/IFRCGo/go-web-app.git",
"directory": "packages/ui"
},
"description": "IFRC-GO UI Components Library",
"keywords": [
"ifrc-go",
"ui",
Expand Down

0 comments on commit 2ff7940

Please sign in to comment.