Skip to content

Commit

Permalink
CDE-40 feat: Replace node script with shell script
Browse files Browse the repository at this point in the history
  • Loading branch information
afonsobspinto committed Feb 23, 2024
1 parent a4101e0 commit a8ad7c1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 42 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ RUN npm install

# user node
ADD --chown=node:node . ${APP_DIR}
RUN npm run build:demo
COPY replace_env_vars.sh /usr/local/bin/replace_env_vars.sh
RUN chmod +x /usr/local/bin/replace_env_vars.sh
RUN /usr/local/bin/replace_env_vars.sh
RUN npm run build

FROM ${PARENT}
Expand Down
38 changes: 0 additions & 38 deletions build_demo.js

This file was deleted.

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"scripts": {
"dev": "vite",
"build": "tsc --p ./tsconfig-build.json && vite build && cp -f dist/cde-mapper.js demo",
"build:demo": "node build_demo.js",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"prepublishOnly": "npm run build"
Expand All @@ -33,12 +32,10 @@
"@typescript-eslint/eslint-plugin": "^6.14.0",
"@typescript-eslint/parser": "^6.14.0",
"@vitejs/plugin-react": "^4.2.1",
"dotenv": "^16.4.5",
"eslint": "^8.55.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"react-dropzone": "^14.2.3",
"replace-in-file": "^7.1.0",
"typescript": "^5.2.2",
"vite": "^5.0.8",
"vite-plugin-dts": "^3.6.4"
Expand Down
6 changes: 6 additions & 0 deletions replace_env_vars.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
# replace_env_vars.sh

for var in $(printenv | grep VITE_ | awk -F= '{print $1}'); do
sed -i 's|import.meta.env.'$var'|"'$(printenv $var)'"|g' ./demo/*.js
done

0 comments on commit a8ad7c1

Please sign in to comment.