diff --git a/package.json b/package.json index cb020fd4f..a33ab6e18 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ }, "scripts": { "postinstall": "rimraf public/virtualbackground && copyfiles -f node_modules/@twilio/video-processors/dist/build/* public/virtualbackground", - "start": "npx cross-env REACT_APP_VERSION=$(node -e \"console.log(require('./package.json').version)\") concurrently npm:server npm:dev", + "start": "concurrently npm:server npm:dev", "dev": "react-scripts start", "build": "node ./scripts/build.js", "test": "cross-env TZ=utc jest --config jest.config.js", diff --git a/scripts/build.js b/scripts/build.js index 9ea0580bc..7feefd2fd 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -40,7 +40,6 @@ class Filter extends Transform { // Colors normally don't work when using spawn(), so here we re-enable colors. process.env.FORCE_COLOR = require('supports-color').stdout.level; -process.env.REACT_APP_VERSION = require(__dirname + "/../package.json").version const buildProcess = spawn('node', [require.resolve('react-scripts/scripts/build')]); diff --git a/src/components/AboutDialog/AboutDialog.test.tsx b/src/components/AboutDialog/AboutDialog.test.tsx index ca2723617..3524d6c83 100644 --- a/src/components/AboutDialog/AboutDialog.test.tsx +++ b/src/components/AboutDialog/AboutDialog.test.tsx @@ -5,6 +5,7 @@ import { useAppState } from '../../state'; jest.mock('twilio-video', () => ({ version: '1.2', isSupported: true })); jest.mock('../../state'); +jest.mock('../../../package.json', () => ({ version: '1.3' })); const mockUseAppState = useAppState as jest.Mock; mockUseAppState.mockImplementation(() => ({ roomType: undefined })); diff --git a/src/components/AboutDialog/AboutDialog.tsx b/src/components/AboutDialog/AboutDialog.tsx index 8c982cb9c..8b0157f97 100644 --- a/src/components/AboutDialog/AboutDialog.tsx +++ b/src/components/AboutDialog/AboutDialog.tsx @@ -6,6 +6,7 @@ import DialogContent from '@material-ui/core/DialogContent'; import DialogContentText from '@material-ui/core/DialogContentText'; import DialogTitle from '@material-ui/core/DialogTitle'; import Divider from '@material-ui/core/Divider'; +import packageJSON from '../../../package.json'; import Video from 'twilio-video'; import { useAppState } from '../../state'; @@ -24,7 +25,7 @@ function AboutDialog({ open, onClose }: PropsWithChildren) { Browser supported: {String(Video.isSupported)} SDK Version: {Video.version} - App Version: {process.env.REACT_APP_VERSION} + App Version: {packageJSON.version} Deployed Tag: {process.env.REACT_APP_GIT_TAG || 'N/A'} Deployed Commit Hash: {process.env.REACT_APP_GIT_COMMIT || 'N/A'} {roomType && Room Type: {roomType}}