CRA 는 .env 의 ${VAR} 를 이미 있는 환경 변수로 채운다(dotenv-expand)1 — turbo 가 태스크마다 넣어주는 TURBO_HASH2 를 그대로 받아 쓴다.
# .env
REACT_APP_VERSION=0.0.0-${TURBO_HASH}
REACT_APP_VERSION을 자동으로 입력할 방법을 찾다가 결국 hash값을 추가했다.
- Adding Custom Environment Variables | Create React App
- GitHub - motdotla/dotenv-expand: Variable expansion for dotenv. Expand variables already on your machine for use in your .env file.
- Create timestamp variable in bash script - Stack Overflow
Footnotes
-
Adding Custom Environment Variables | Create React App: “Expand variables already on your machine for use in your
.envfile (using dotenv-expand).” ↩ -
System environment variables | Turborepo: “Turborepo will make the following environment variables available within your tasks while they are executing” —
TURBO_HASH: “The hash of the currently running task.” ↩