diff --git a/api/package-lock.json b/api/package-lock.json index 0be78fbd..12fddb88 100644 --- a/api/package-lock.json +++ b/api/package-lock.json @@ -2579,7 +2579,7 @@ "version": "15.7.15", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz", "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==", - "dev": true + "devOptional": true }, "node_modules/@types/qs": { "version": "6.14.0", @@ -2595,7 +2595,7 @@ "version": "18.3.28", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.28.tgz", "integrity": "sha512-z9VXpC7MWrhfWipitjNdgCauoMLRdIILQsAEV+ZesIzBq/oUlxk0m3ApZuMFCXdnS4U7KrI+l3WRUEGQ8K1QKw==", - "dev": true, + "devOptional": true, "dependencies": { "@types/prop-types": "*", "csstype": "^3.2.2" @@ -4739,7 +4739,7 @@ "version": "3.2.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", - "dev": true + "devOptional": true }, "node_modules/csv": { "version": "5.5.3", @@ -5216,7 +5216,7 @@ "version": "0.1.13", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", - "dev": true, + "devOptional": true, "dependencies": { "iconv-lite": "^0.6.2" } @@ -5248,7 +5248,7 @@ "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "dev": true, + "devOptional": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" }, @@ -5988,17 +5988,6 @@ "node": ">=0.10.0" } }, - "node_modules/external-editor/node_modules/tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dependencies": { - "os-tmpdir": "~1.0.2" - }, - "engines": { - "node": ">=0.6.0" - } - }, "node_modules/eyes": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", @@ -12238,14 +12227,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/otplib": { "version": "12.0.1", "resolved": "https://registry.npmjs.org/otplib/-/otplib-12.0.1.tgz", @@ -12926,7 +12907,7 @@ "version": "18.3.1", "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", - "dev": true, + "devOptional": true, "dependencies": { "loose-envify": "^1.1.0" }, @@ -12948,7 +12929,7 @@ "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", - "dev": true, + "devOptional": true, "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.2" @@ -13494,7 +13475,7 @@ "version": "0.23.2", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", - "dev": true, + "devOptional": true, "dependencies": { "loose-envify": "^1.1.0" } @@ -14621,7 +14602,6 @@ "version": "5.9.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/docker-compose.yml b/docker-compose.yml index 72ececfa..39bffeae 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -55,8 +55,8 @@ services: restart: unless-stopped environment: - NODE_ENV=${NODE_ENV:-production} - - REACT_APP_API_URL=${REACT_APP_API_URL:-http://localhost:5001} - - REACT_APP_UPLOAD_API_URL=${REACT_APP_UPLOAD_API_URL:-http://localhost:4002} + - VITE_BASE_API_URL=${VITE_BASE_API_URL:-http://localhost:5001/} + - VITE_UPLOAD_SERVER=${VITE_UPLOAD_SERVER:-http://localhost:4002/} networks: - migration-network security_opt: diff --git a/index.js b/index.js index 8a84d4eb..0ee6bf83 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const apiEnvContent = `APP_TOKEN_KEY=MIGRATION_V2\nPORT=5001\n`; -const uiEnvContent = `REACT_APP_WEBSITE_BASE_URL="http://localhost:3000/"\nREACT_APP_BASE_API_URL="http://localhost:5001/"\nREACT_APP_API_VERSION=v2\nREACT_APP_HOST="http://localhost:3000"\nREACT_APP_UPLOAD_SERVER="http://localhost:4002/"\nREACT_APP_OFFLINE_CMS=true\n`; +const uiEnvContent = `VITE_WEBSITE_BASE_URL="http://localhost:3000/"\nVITE_BASE_API_URL="http://localhost:5001/"\nVITE_API_VERSION=v2\nVITE_HOST="http://localhost:3000"\nVITE_UPLOAD_SERVER="http://localhost:4002/"\nVITE_OFFLINE_CMS=true\n`; const uploadAPIEnvContent = `PORT=4002\nNODE_BACKEND_API=http://localhost:5001\n`; const envFilePaths = { diff --git a/ui/.env.local b/ui/.env.local index 0e333fd3..0b01759e 100644 --- a/ui/.env.local +++ b/ui/.env.local @@ -1,6 +1,6 @@ -REACT_APP_WEBSITE_BASE_URL="http://localhost:3000/" -REACT_APP_BASE_API_URL="http://localhost:5001/" -REACT_APP_API_VERSION=v2 -REACT_APP_HOST="http://localhost:3000" -REACT_APP_UPLOAD_SERVER="http://localhost:4002/" -REACT_APP_OFFLINE_CMS=true +VITE_WEBSITE_BASE_URL="http://localhost:3000/" +VITE_BASE_API_URL="http://localhost:5001/" +VITE_API_VERSION=v2 +VITE_HOST="http://localhost:3000" +VITE_UPLOAD_SERVER="http://localhost:4002/" +VITE_OFFLINE_CMS=true diff --git a/ui/.gitignore b/ui/.gitignore index 8747becf..e1578a29 100644 --- a/ui/.gitignore +++ b/ui/.gitignore @@ -24,6 +24,4 @@ yarn-error.log* # .npmrc -.npmrc - -!.env.local \ No newline at end of file +.npmrc \ No newline at end of file diff --git a/ui/Dockerfile b/ui/Dockerfile index ceb6ce9d..28bae182 100644 --- a/ui/Dockerfile +++ b/ui/Dockerfile @@ -20,4 +20,5 @@ USER nodeapp EXPOSE 3000 -CMD [ "npm", "run", "start" ] \ No newline at end of file +# Build at container startup so VITE_* env vars from docker-compose +CMD [ "sh", "-c", "npm run build && npx vite preview --port 3000 --host" ] \ No newline at end of file diff --git a/ui/public/index.html b/ui/index.html similarity index 92% rename from ui/public/index.html rename to ui/index.html index 5fc754fb..9fc3e0df 100644 --- a/ui/public/index.html +++ b/ui/index.html @@ -9,9 +9,9 @@ name="description" content="Contentstack Migrations tool for easily migrate content between stacks or from other CMS platforms to Contentstack." /> - + - +