Replace REACT_APP env with VITE

This commit is contained in:
Nabarun 2024-04-25 16:55:39 +05:30
parent 5f4be30799
commit 8b39f664ad
4 changed files with 17 additions and 17 deletions

View File

@ -145,14 +145,14 @@ Let us assume the following domains for backend and frontend
- Copy the GitHub OAuth app client ID from previous steps and set it in frontend [.env](packages/frontend/.env) file - Copy the GitHub OAuth app client ID from previous steps and set it in frontend [.env](packages/frontend/.env) file
```env ```env
REACT_APP_GITHUB_CLIENT_ID = <CLIENT_ID> VITE_GITHUB_CLIENT_ID = <CLIENT_ID>
``` ```
- Set `REACT_APP_GITHUB_PWA_TEMPLATE_REPO` and `REACT_APP_GITHUB_IMAGE_UPLOAD_PWA_TEMPLATE_REPO` in [.env](packages/frontend/.env) file - Set `VITE_GITHUB_PWA_TEMPLATE_REPO` and `VITE_GITHUB_IMAGE_UPLOAD_PWA_TEMPLATE_REPO` in [.env](packages/frontend/.env) file
```env ```env
REACT_APP_GITHUB_PWA_TEMPLATE_REPO = 'cerc-io/test-progressive-web-app' # Set actual owner/name of the template repo that will be used for creating new repo VITE_GITHUB_PWA_TEMPLATE_REPO = 'cerc-io/test-progressive-web-app' # Set actual owner/name of the template repo that will be used for creating new repo
REACT_APP_GITHUB_IMAGE_UPLOAD_PWA_TEMPLATE_REPO = 'cerc-io/image-upload-pwa-example' # Set actual owner/name of the template repo that will be used for creating new repo VITE_GITHUB_IMAGE_UPLOAD_PWA_TEMPLATE_REPO = 'cerc-io/image-upload-pwa-example' # Set actual owner/name of the template repo that will be used for creating new repo
``` ```
- Production - Production
@ -160,17 +160,17 @@ Let us assume the following domains for backend and frontend
- Set the following values in [.env](packages/frontend/.env) file - Set the following values in [.env](packages/frontend/.env) file
```env ```env
REACT_APP_SERVER_URL = 'https://api.snowballtools.com' # Backend server endpoint VITE_SERVER_URL = 'https://api.snowballtools.com' # Backend server endpoint
``` ```
- Sign in to [wallet connect](https://cloud.walletconnect.com/sign-in) to create a project ID - Sign in to [wallet connect](https://cloud.walletconnect.com/sign-in) to create a project ID
- Create a project and add information to use wallet connect SDK - Create a project and add information to use wallet connect SDK
- Add project name and select project type as `App` - Add project name and select project type as `App`
- Set project home page URL to `https://dashboard.snowballtools.com` - Set project home page URL to `https://dashboard.snowballtools.com`
- On creation of project, use the `Project ID` and set it in `REACT_APP_WALLET_CONNECT_ID` in [.env](packages/frontend/.env) file - On creation of project, use the `Project ID` and set it in `VITE_WALLET_CONNECT_ID` in [.env](packages/frontend/.env) file
```env ```env
REACT_APP_WALLET_CONNECT_ID = <PROJECT_ID> VITE_WALLET_CONNECT_ID = <PROJECT_ID>
``` ```
- Build the React application - Build the React application
@ -190,17 +190,17 @@ Let us assume the following domains for backend and frontend
- Copy the graphQL endpoint from terminal and add the endpoint in the [.env](packages/frontend/.env) file present in `packages/frontend` - Copy the graphQL endpoint from terminal and add the endpoint in the [.env](packages/frontend/.env) file present in `packages/frontend`
```env ```env
REACT_APP_SERVER_URL = 'http://localhost:8000' VITE_SERVER_URL = 'http://localhost:8000'
``` ```
- Sign in to [wallet connect](https://cloud.walletconnect.com/sign-in) to create a project ID. - Sign in to [wallet connect](https://cloud.walletconnect.com/sign-in) to create a project ID.
- Create a project and add information to use wallet connect SDK - Create a project and add information to use wallet connect SDK
- Add project name and select project type as `App` - Add project name and select project type as `App`
- Project home page URL is not required to be set - Project home page URL is not required to be set
- On creation of project, use the `Project ID` and set it in `REACT_APP_WALLET_CONNECT_ID` in [.env](packages/frontend/.env) file - On creation of project, use the `Project ID` and set it in `VITE_WALLET_CONNECT_ID` in [.env](packages/frontend/.env) file
```env ```env
REACT_APP_WALLET_CONNECT_ID = <Project_ID> VITE_WALLET_CONNECT_ID = <Project_ID>
``` ```
- The React application will be running in `http://localhost:3000/` - The React application will be running in `http://localhost:3000/`

View File

@ -10,11 +10,11 @@ if [[ -d "$DEST_DIR" ]]; then
fi fi
cat > $PKG_DIR/.env <<EOF cat > $PKG_DIR/.env <<EOF
REACT_APP_SERVER_URL = 'LACONIC_HOSTED_CONFIG_app_server_url' VITE_SERVER_URL = 'LACONIC_HOSTED_CONFIG_app_server_url'
REACT_APP_GITHUB_CLIENT_ID = 'LACONIC_HOSTED_CONFIG_app_github_clientid' VITE_GITHUB_CLIENT_ID = 'LACONIC_HOSTED_CONFIG_app_github_clientid'
REACT_APP_GITHUB_PWA_TEMPLATE_REPO = 'LACONIC_HOSTED_CONFIG_app_github_pwa_templaterepo' VITE_GITHUB_PWA_TEMPLATE_REPO = 'LACONIC_HOSTED_CONFIG_app_github_pwa_templaterepo'
REACT_APP_GITHUB_IMAGE_UPLOAD_PWA_TEMPLATE_REPO = 'LACONIC_HOSTED_CONFIG_app_github_image_upload_templaterepo' VITE_GITHUB_IMAGE_UPLOAD_PWA_TEMPLATE_REPO = 'LACONIC_HOSTED_CONFIG_app_github_image_upload_templaterepo'
REACT_APP_WALLET_CONNECT_ID = 'LACONIC_HOSTED_CONFIG_app_wallet_connect_id' VITE_WALLET_CONNECT_ID = 'LACONIC_HOSTED_CONFIG_app_wallet_connect_id'
EOF EOF
yarn || exit 1 yarn || exit 1

View File

@ -105,7 +105,7 @@ const siweConfig = createSIWEConfig({
}); });
if (!import.meta.env.VITE_WALLET_CONNECT_ID) { if (!import.meta.env.VITE_WALLET_CONNECT_ID) {
throw new Error('Error: REACT_APP_WALLET_CONNECT_ID env config is not set'); throw new Error('Error: VITE_WALLET_CONNECT_ID env config is not set');
} }
createWeb3Modal({ createWeb3Modal({

View File

@ -20,7 +20,7 @@ const root = ReactDOM.createRoot(
assert( assert(
import.meta.env.VITE_SERVER_URL, import.meta.env.VITE_SERVER_URL,
'REACT_APP_SERVER_URL is not set in env', 'VITE_SERVER_URL is not set in env',
); );
const gqlEndpoint = `${import.meta.env.VITE_SERVER_URL}/${SERVER_GQL_PATH}`; const gqlEndpoint = `${import.meta.env.VITE_SERVER_URL}/${SERVER_GQL_PATH}`;