From 63e17ee2ff8b78c524c19e7d6a38771822ddcb98 Mon Sep 17 00:00:00 2001 From: Jeremy Kahn Date: Thu, 8 Feb 2024 21:01:31 -0600 Subject: [PATCH] refactor(parcel): rename environment variables --- .env | 4 ++-- package.json | 6 +++--- src/components/Room/Room.tsx | 2 +- src/components/Shell/Drawer.tsx | 2 +- src/config/routes.ts | 2 +- src/config/streamSaverUrl.ts | 2 +- src/config/trackerUrls.ts | 6 +++--- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.env b/.env index 650b487ec..1e8f718f8 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ -REACT_APP_NAME=$npm_package_name -REACT_APP_GITHUB_REPO="https://github.com/jeremyckahn/chitchatter" +APP_NAME=$npm_package_name +GITHUB_REPO="https://github.com/jeremyckahn/chitchatter" diff --git a/package.json b/package.json index ffa92abac..74a1ae3b0 100644 --- a/package.json +++ b/package.json @@ -54,12 +54,12 @@ }, "scripts": { "analyze": "source-map-explorer 'build/static/js/*.js'", - "start": "cross-env REACT_APP_HOMEPAGE=$(npm pkg get homepage) parcel --port 3000 src/index.html", + "start": "cross-env HOMEPAGE=$(npm pkg get homepage) parcel --port 3000 src/index.html", "start:tracker": "bittorrent-tracker", "start:streamsaver": "serve -p 3015 node_modules/streamsaver", - "dev": "mprocs \"npx cross-env REACT_APP_TRACKER_URL=\"ws://localhost:8000\" REACT_APP_STREAMSAVER_URL=\"http://localhost:3015/mitm.html\" npm run start\" \"npm run start:tracker\" \"npm run start:streamsaver\"", + "dev": "mprocs \"npx cross-env TRACKER_URL=\"ws://localhost:8000\" STREAMSAVER_URL=\"http://localhost:3015/mitm.html\" npm run start\" \"npm run start:tracker\" \"npm run start:streamsaver\"", "build": "npm run build:app && npm run build:sdk", - "build:app": "cross-env REACT_APP_HOMEPAGE=$(npm pkg get homepage) parcel build src/index.html", + "build:app": "cross-env HOMEPAGE=$(npm pkg get homepage) parcel build src/index.html", "build:sdk": "parcel build sdk/sdk.ts --dist-dir build --no-content-hash", "build:sdk:watch": "nodemon --exec \"npm run build:sdk\"", "test": "react-scripts test", diff --git a/src/components/Room/Room.tsx b/src/components/Room/Room.tsx index e583acbaa..2ec236e85 100644 --- a/src/components/Room/Room.tsx +++ b/src/components/Room/Room.tsx @@ -34,7 +34,7 @@ export interface RoomProps { } export function Room({ - appId = `${encodeURI(window.location.origin)}_${process.env.REACT_APP_NAME}`, + appId = `${encodeURI(window.location.origin)}_${process.env.APP_NAME}`, getUuid = uuid, encryptionService = encryption, roomId, diff --git a/src/components/Shell/Drawer.tsx b/src/components/Shell/Drawer.tsx index 7a35c500b..6daa60eb4 100644 --- a/src/components/Shell/Drawer.tsx +++ b/src/components/Shell/Drawer.tsx @@ -145,7 +145,7 @@ export const Drawer = ({ isDrawerOpen, onDrawerClose, theme }: DrawerProps) => { {commit.shortHash} diff --git a/src/config/routes.ts b/src/config/routes.ts index b8e77b46e..f14f16c6b 100644 --- a/src/config/routes.ts +++ b/src/config/routes.ts @@ -9,5 +9,5 @@ export enum routes { } export const homepageUrl = new URL( - process.env.REACT_APP_HOMEPAGE ?? 'https://chitchatter.im/' + process.env.HOMEPAGE ?? 'https://chitchatter.im/' ) diff --git a/src/config/streamSaverUrl.ts b/src/config/streamSaverUrl.ts index 083a744d6..ce557a1c2 100644 --- a/src/config/streamSaverUrl.ts +++ b/src/config/streamSaverUrl.ts @@ -1,5 +1,5 @@ export const streamSaverUrl = - process.env.REACT_APP_STREAMSAVER_URL ?? + process.env.STREAMSAVER_URL ?? // If you would like to host your own Chitchatter instance with an // alternative StreamSaver fork to facilitate file sharing, change this // string to its respective .mitm.html URL. diff --git a/src/config/trackerUrls.ts b/src/config/trackerUrls.ts index fd42f27ba..2604e27c0 100644 --- a/src/config/trackerUrls.ts +++ b/src/config/trackerUrls.ts @@ -8,12 +8,12 @@ let trackerUrls: string[] | undefined = [ // https://github.com/dmotz/trystero/blob/694f49974974cc9df8b621db09215d6df10fad09/src/torrent.js#L27-L33 ] -// If a tracker URL has been provided via the REACT_APP_TRACKER_URL environment +// If a tracker URL has been provided via the TRACKER_URL environment // variable, prioritize using it. This is mainly relevant for local development // when using the `npm run dev` script. If you are hosting your own Chitchatter // instance, consider populating the trackerUrls above instead. -if (process.env.REACT_APP_TRACKER_URL) { - trackerUrls.unshift(process.env.REACT_APP_TRACKER_URL) +if (process.env.TRACKER_URL) { + trackerUrls.unshift(process.env.TRACKER_URL) } // If no tracker URL overrides have been provided, set trackerUrls to undefined