Skip to content

Commit

Permalink
feat(pwa-helper): add build short sha to alwatr version
Browse files Browse the repository at this point in the history
  • Loading branch information
AliMD committed May 8, 2023
1 parent 5560857 commit 0411b9c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions ui/pwa-helper/esbuild.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/* eslint-disable no-undef */
/* eslint-disable @typescript-eslint/explicit-function-return-type */

import {execSync} from 'child_process';
import {promises as fs, existsSync} from 'node:fs';

import {createLogger} from '@alwatr/logger';
Expand All @@ -23,6 +23,8 @@ const watchMode = process.argv.includes('--watch');
const debugMode = process.argv.includes('--debug');
const prettyMode = process.argv.includes('--pretty');

const gitShortSha = execSync('git rev-parse --short HEAD').toString().trim();

logger.logOther?.(banner);

logger.logProperty?.('cleanMode', cleanMode);
Expand Down Expand Up @@ -57,7 +59,7 @@ const esbuildContext = await esbuild.context({
metafile: true,

define: {
_ALWATR_VERSION_: `'${packageJson.pwaVersion}'`,
_ALWATR_VERSION_: `'${packageJson.version}+${gitShortSha}'`,
},
// drop: ['debugger'],

Expand Down
1 change: 0 additions & 1 deletion ui/pwa-helper/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "@alwatr/pwa-helper",
"version": "0.30.0",
"pwaVersion": "0.31.0-beta.6",
"description": "Alwatr PWA Helper",
"keywords": [
"element",
Expand Down
2 changes: 1 addition & 1 deletion ui/pwa-helper/src/signal/sw-user-notify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ eventListener.subscribe('service_worker_registered', async () => {
}
localStorage.removeItem('notify_new_version');
snackbarSignalTrigger.request({
message: `به نسخه ${replaceNumber(_ALWATR_VERSION_.replace('-beta.', ' بتا '))} خوش‌آمدید.`,
message: `به نسخه ${replaceNumber(_ALWATR_VERSION_.split('+')[0].replace('-beta.', ' بتا '))} خوش‌آمدید.`,
});
}
});
Expand Down

0 comments on commit 0411b9c

Please sign in to comment.