Skip to content

Commit

Permalink
refactor(parcel): rename environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyckahn committed Feb 9, 2024
1 parent 2da065a commit 63e17ee
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -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"
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Room/Room.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Shell/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export const Drawer = ({ isDrawerOpen, onDrawerClose, theme }: DrawerProps) => {
<MuiLink
target="_blank"
rel="noopener"
href={`${process.env.REACT_APP_GITHUB_REPO}/commit/${commit.hash}`}
href={`${process.env.GITHUB_REPO}/commit/${commit.hash}`}
>
{commit.shortHash}
</MuiLink>
Expand Down
2 changes: 1 addition & 1 deletion src/config/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/'
)
2 changes: 1 addition & 1 deletion src/config/streamSaverUrl.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 3 additions & 3 deletions src/config/trackerUrls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 63e17ee

Please sign in to comment.