Skip to content

Commit

Permalink
build: add postinstall script to setup env (#4)
Browse files Browse the repository at this point in the history
* build: add postinstall script to setup env

* fix: correct naming of env vars

* docs: fix formatting

* fix: correct imports
  • Loading branch information
sbolel authored Jan 29, 2024
1 parent 57b064e commit 326430c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Dummy values for local testing to avoid errors

# AWS
VITE_AWS_REGION='us-east-1'
VITE_CF_DOMAIN='https://localhost:3000'

# AWS Cognito
VITE_COGNITO_DOMAIN='https://cognito-idp.us-east-1.amazonaws.com/us-east-1_abcd1234'
VITE_USER_POOL_ID='us-east-1_abcd1234'
VITE_USER_POOL_CLIENT_ID='12345678901234567890123456'
VITE_COGNITO_REDIRECT_SIGN_IN='http://localhost:3000/signin'
VITE_COGNITO_REDIRECT_SIGN_OUT='http://localhost:3000/signout'
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# environments
.env.*.local
!.env.example

# logs
**/*.log
logs
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ yarn lint

## Developing

First, run the post-install script to create the local development environment file from the example environment file.

```shell
sh ./scripts/post-install.sh
```

To start the local development server, run the following from the root directory:

```shell
Expand Down
4 changes: 4 additions & 0 deletions scripts/post-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
# FILEPATH: /Users/sinanbolel/code/@aquia/template-vite-react/scripts/post-install.sh

cp .env.example .env.development.local
4 changes: 1 addition & 3 deletions src/utils/config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/**
* Set global configuration for the application provided by webpack (craco) at build time.
* Set global configuration for the application provided by Vite environment variables
* @module utils/config
* @exports CONFIG
* @exports storageTokenKeyName
* @see {@link dashboard/craco.config.js}.
*/
import type { AppConfig } from '@/types'

Expand Down

0 comments on commit 326430c

Please sign in to comment.