feat: Ajout de la case à cocher pour l'environement test
continuous-integration/drone/push Build is failing Details
continuous-integration/drone Build is failing Details

This commit is contained in:
Simon 2024-03-06 14:43:32 +01:00
parent c0a0fda9c2
commit 398d0f6957
2 changed files with 8 additions and 3 deletions

View File

@ -62,6 +62,8 @@ steps:
- npm run fetchData
- npm run lint
- npm run build
environment:
NODE_ENV: 'production'
- name: deploy on s3
image: minio/mc
@ -152,8 +154,8 @@ steps:
- npm run fetchData
- npm run lint
- npm run build
- apk add --no-cache jq
- echo $(cat src/data.json | jq -c '[.[0]]') > src/data.json
environment:
NODE_ENV: 'test'
- name: deploy on s3
image: minio/mc

View File

@ -48,9 +48,12 @@ async function fetchScoresData() {
.map((item) => `fields[]=${item}`)
.join("&")}`;
let scores = (await fetchJSONApi(url)).data;
if (process.env.NODE_ENV != "staging") {
if (process.env.NODE_ENV == "production") {
console.log("Suppresion des scores avec le mode brouillon en production");
scores = scores.filter((score) => !score.draft);
} else if (process.env.NODE_ENV == "test") {
console.log("Suppresion des scores sans l'environnement test");
scores = scores.filter((score) => score.env_test);
}
await fs.writeFile("./src/data.json", JSON.stringify(scores), "utf8");