-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: dev dep and move to esm build
- Loading branch information
Showing
5 changed files
with
548 additions
and
547 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
VITE_API_URL=https://api-knowledge.demo.insee.io | ||
VITE_API_URL= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
/* eslint-disable */ | ||
var fs = require('fs'); | ||
import { promises as fs } from 'fs'; | ||
|
||
fs.readFile('.env', 'utf8', function (_, contents) { | ||
const content = contents | ||
.split('\n') | ||
.filter((line) => !line.startsWith('#')) | ||
.map((line) => line.split('=')) | ||
.filter((data) => data.length === 2) | ||
.map( | ||
([key]) => | ||
`echo "window._env_['${key.replace( | ||
'REACT_APP_', | ||
'' | ||
)}'] = '\$${key.replace( | ||
'REACT_APP_', | ||
'' | ||
)}';" >> /usr/share/nginx/html/env-config.js` | ||
); | ||
fs.readFile('.env', 'utf8') | ||
.then((contents) => { | ||
const content = contents | ||
.split('\n') | ||
.filter((line) => !line.startsWith('#')) | ||
.map((line) => line.split('=')) | ||
.filter((data) => data.length === 2) | ||
.map( | ||
([key]) => | ||
`echo "window._env_['${key.replace( | ||
'REACT_APP_', | ||
'' | ||
)}'] = '\$${key.replace( | ||
'REACT_APP_', | ||
'' | ||
)}';" >> /usr/share/nginx/html/env-config.js` | ||
); | ||
|
||
const fullFile = ['#!/bin/sh', ...content, 'exec "$@"'].join('\n'); | ||
fs.writeFileSync('entrypoint.sh', fullFile, 'utf8'); | ||
}); | ||
const fullFile = ['#!/bin/sh', ...content, 'exec "$@"'].join('\n'); | ||
return fs.writeFile('entrypoint.sh', fullFile, 'utf8'); | ||
}) | ||
.catch((error) => console.error('Error:', error)); |
Oops, something went wrong.