Skip to content

Commit

Permalink
build: dev dep and move to esm build
Browse files Browse the repository at this point in the history
  • Loading branch information
ddecrulle committed Dec 4, 2023
1 parent 108ac1c commit a5b6341
Show file tree
Hide file tree
Showing 5 changed files with 548 additions and 547 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VITE_API_URL=https://api-knowledge.demo.insee.io
VITE_API_URL=
3 changes: 1 addition & 2 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// eslint-disable-next-line no-undef
module.exports = {
export default {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "The user interface that presents the service offer of the INSEE survey information system",
"author": "u/ddecrulle",
"license": "MIT",
"type": "module",
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
Expand All @@ -16,7 +17,7 @@
"@testing-library/user-event": "^14.5.1",
"aos": "^2.3.4",
"lodash.groupby": "^4.6.0",
"powerhooks": "^0.27.2",
"powerhooks": "^1.0.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-markdown": "^9.0.1",
Expand All @@ -42,17 +43,17 @@
]
},
"devDependencies": {
"@commitlint/cli": "^17.8.1",
"@commitlint/config-conventional": "^17.8.1",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@vitejs/plugin-react": "^4.2.0",
"eslint": "^8.54.0",
"eslint": "^8.55.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.4",
"eslint-plugin-react-refresh": "^0.4.5",
"husky": "^8.0.3",
"lint-staged": "^15.1.0",
"lint-staged": "^15.2.0",
"prettier": "^3.1.0",
"vite": "^4.5.0",
"vite": "^5.0.4",
"vite-tsconfig-paths": "^4.2.1"
}
}
42 changes: 22 additions & 20 deletions scripts/generate-entrypoint.js
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));
Loading

0 comments on commit a5b6341

Please sign in to comment.