diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28ebc8bb..bcdfa7ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -132,11 +132,11 @@ jobs: - name: Build env: - DEMO: true NODE_ENV: production + PR_NUMBER: ${{ github.event.number }} run: | npm run generate-dictionary - npx webpack --config webpack.config.prod.js + npm run build - name: Publish to Cloudflare Pages id: deploy diff --git a/build-manifest.js b/build-manifest.js new file mode 100644 index 00000000..4d111d58 --- /dev/null +++ b/build-manifest.js @@ -0,0 +1,8 @@ +const fs = require('fs'); +const manifest = require('./src/manifest.json'); + +if (process.env.PR_NUMBER && process.env.PR_NUMBER.length) { + manifest.name = manifest.short_name =`Test ${process.env.PR_NUMBER}` +} + +fs.writeFileSync('./dist/manifest.json', JSON.stringify(manifest)); diff --git a/package.json b/package.json index d08fd74d..8c04c04a 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ }, "main": "./dist/worker.js", "scripts": { - "build": "cross-env NODE_ENV=production webpack --config webpack.config.prod.js", + "build": "cross-env NODE_ENV=production webpack --config webpack.config.prod.js && node build-manifest.js", "build-storybook": "storybook build", "deploy-api": "wrangler deploy ./src/server/index.ts --name api --compatibility-date 2024-11-12", "dev": "cross-env NODE_ENV=development webpack serve --config webpack.config.dev.js --progress", diff --git a/src/components/Pages/About/About.tsx b/src/components/Pages/About/About.tsx index d353330d..f57d2ff2 100644 --- a/src/components/Pages/About/About.tsx +++ b/src/components/Pages/About/About.tsx @@ -14,6 +14,7 @@ export const About = const worksheetUrl = getTablePublicUrl(tablesData[0].spreadsheetId, tablesData[0].sheetId); const email = 'cherebedov.sergey@gmail.com'; const source = 'http://steen.free.fr/interslavic'; + const version = [VERSION, PR_NUMBER].filter((item) => item && item.length).join('-') return (
@@ -113,40 +114,8 @@ export const About =

-
- {/* - Get it on Google Play - */} - - {IS_COM && ( - - Get it on Discord - - )} -
-
v{VERSION}
+
v{version}
); diff --git a/src/custom.d.ts b/src/custom.d.ts index b11a7a24..3ff210d2 100644 --- a/src/custom.d.ts +++ b/src/custom.d.ts @@ -6,3 +6,5 @@ declare module '*.svg' { declare const FB: any; declare const IS_COM: boolean; +declare const PR_NUMBER: string; +declare const Az: any; diff --git a/static/manifest.json b/src/manifest.json similarity index 100% rename from static/manifest.json rename to src/manifest.json diff --git a/webpack.config.dev.js b/webpack.config.dev.js index f36fa9c2..772396a7 100644 --- a/webpack.config.dev.js +++ b/webpack.config.dev.js @@ -79,6 +79,7 @@ module.exports = { 'process.env.NODE_ENV': JSON.stringify('development'), IS_COM: true, VERSION: JSON.stringify(require('./package.json').version), + PR_NUMBER: '123', }), new CopyWebpackPlugin({ patterns: [ diff --git a/webpack.config.prod.js b/webpack.config.prod.js index 8eb62751..18b823ad 100644 --- a/webpack.config.prod.js +++ b/webpack.config.prod.js @@ -88,6 +88,7 @@ module.exports = { new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production'), VERSION: JSON.stringify(require('./package.json').version), + PR_NUMBER: JSON.stringify(process.env.PR_NUMBER), }), new CopyWebpackPlugin({ patterns: [