Skip to content

Commit

Permalink
Added a helper fn to stripTrailingSlash
Browse files Browse the repository at this point in the history
  • Loading branch information
Case-E committed Aug 12, 2024
1 parent 9c138d7 commit 632b7f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion waspc/packages/deploy/src/providers/fly/deploy/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
makeIdempotent,
getCommandHelp,
waspSays,
stripTrailingSlash,
} from '../helpers/helpers.js';
import {
clientTomlExistsInProject,
Expand Down Expand Up @@ -105,7 +106,7 @@ async function deployClient(deploymentInfo: DeploymentInfo<DeployOptions>, { bui
waspSays('Building web client for production...');
waspSays('If you configured a custom domain for the server, please run the command with an env variable: REACT_APP_API_URL=https://serverUrl.com wasp deploy fly deploy');

const serverUrl = process.env.REACT_APP_API_URL || deploymentInfo.serverUrl;
const serverUrl = stripTrailingSlash(process.env.REACT_APP_API_URL ?? '') || deploymentInfo.serverUrl;
await $`npm install`;
await $`REACT_APP_API_URL=${serverUrl} npm run build`;

Expand Down
7 changes: 7 additions & 0 deletions waspc/packages/deploy/src/providers/fly/helpers/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,10 @@ export async function silence(
$.verbose = verboseSetting;
return proc;
}

export function stripTrailingSlash(url: string): string {
if (url.endsWith('/')) {
return url.slice(0, -1);
}
return url;
}

0 comments on commit 632b7f2

Please sign in to comment.