From d2ae02d0665e3806d67c57e84c33d2b9188baacc Mon Sep 17 00:00:00 2001 From: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com> Date: Thu, 8 Aug 2024 11:57:32 -0700 Subject: [PATCH] Mobile: Include commit information in version information screen (#10829) --- .eslintignore | 1 + packages/app-mobile/.gitignore | 2 ++ packages/app-mobile/gulpfile.ts | 8 ++++++++ packages/app-mobile/utils/getPackageInfo.ts | 8 ++++++-- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.eslintignore b/.eslintignore index e7b2eddf3..2ecef6ba8 100644 --- a/.eslintignore +++ b/.eslintignore @@ -51,6 +51,7 @@ packages/app-desktop/node_modules packages/app-desktop/packageInfo.js packages/app-desktop/services/electron-context-menu.js packages/app-desktop/vendor/lib/ +packages/app-mobile/packageInfo.js packages/app-mobile/android packages/app-mobile/**/*.bundle.js packages/app-mobile/web/public/pluginAssets/**/* diff --git a/packages/app-mobile/.gitignore b/packages/app-mobile/.gitignore index ce3aecaa3..ae6a50d98 100644 --- a/packages/app-mobile/.gitignore +++ b/packages/app-mobile/.gitignore @@ -74,3 +74,5 @@ web/public/pluginAssets/* utils/fs-driver-android.js android/app/build-* + +packageInfo.js diff --git a/packages/app-mobile/gulpfile.ts b/packages/app-mobile/gulpfile.ts index 10d262459..eb0ff08cf 100644 --- a/packages/app-mobile/gulpfile.ts +++ b/packages/app-mobile/gulpfile.ts @@ -1,5 +1,6 @@ const gulp = require('gulp'); const utils = require('@joplin/tools/gulp/utils'); +const compilePackageInfo = require('@joplin/tools/compilePackageInfo'); import injectedJsGulpTasks from './tools/buildInjectedJs/gulpTasks'; @@ -10,6 +11,12 @@ const tasks = { copyWebAssets: { fn: require('./tools/copyAssets').default, }, + compilePackageInfo: { + fn: async () => { + await compilePackageInfo(`${__dirname}/package.json`, `${__dirname}/packageInfo.js`); + }, + }, + ...injectedJsGulpTasks, podInstall: { fn: require('./tools/podInstall'), @@ -39,6 +46,7 @@ gulp.task('watchInjectedJs', gulp.series( )); gulp.task('build', gulp.series( + 'compilePackageInfo', 'buildInjectedJs', 'copyWebAssets', 'encodeAssets', diff --git a/packages/app-mobile/utils/getPackageInfo.ts b/packages/app-mobile/utils/getPackageInfo.ts index 33cdb9ef5..00c6b664a 100644 --- a/packages/app-mobile/utils/getPackageInfo.ts +++ b/packages/app-mobile/utils/getPackageInfo.ts @@ -1,12 +1,16 @@ import shim from '@joplin/lib/shim'; import { PackageInfo } from '@joplin/lib/versionInfo'; import ReactNativeVersionInfo from 'react-native-version-info'; +const basePackageInfo = require('../packageInfo.js'); const getPackageInfo = (): PackageInfo => { const version = shim.appVersion(); return { - description: 'Joplin for Mobile', - name: 'Joplin', + ...basePackageInfo, + + // Android, iOS, and Web have independent versions -- fetch this + // information at runtime: + name: 'Joplin Mobile', version, build: { appId: ReactNativeVersionInfo.bundleIdentifier,