diff --git a/app/rts/.gitignore b/app/rts/.gitignore index e6367a1fed0..58984f7a994 100644 --- a/app/rts/.gitignore +++ b/app/rts/.gitignore @@ -1,3 +1,4 @@ node_modules +node_modules_bkp .env dist diff --git a/app/rts/build.sh b/app/rts/build.sh index c40011e91ed..01a6d0bf9d5 100755 --- a/app/rts/build.sh +++ b/app/rts/build.sh @@ -4,12 +4,19 @@ set -o errexit cd "$(dirname "$0")" rm -rf dist/ +# This is required for the first time build as node_modules is not present in the image yarn install --frozen-lockfile npx tsc && npx tsc-alias -tsc_exit_code=$? +# Keep copy of all dependencies in node_modules_bkp +mv node_modules node_modules_bkp +# Install only production dependencies +yarn install --production --frozen-lockfile -# Copying node_modules directory into dist as rts server requires node_modules to run server build properly. +# Copying node_modules directory into dist as rts server requires production dependencies to run server build properly. # This was previously being done in dockerfile which was copying the symlinks to image rather than the whole directory of shared modules (e.g. AST) # Also, we copy node_modules with -L flag in order to follow the symlinks for @shared folder and copy the contents instead of just the symlink cp -RL node_modules ./dist -exit $tsc_exit_code +# Delete production dependencies +rm -rf node_modules +# Restore all dependencies +mv node_modules_bkp node_modules diff --git a/app/rts/package.json b/app/rts/package.json index 4b90405f01b..e2f51d8282e 100644 --- a/app/rts/package.json +++ b/app/rts/package.json @@ -13,9 +13,7 @@ "devDependencies": { "@types/express": "^4.17.14", "@types/jest": "^29.2.3", - "axios": "^1.2.0", "jest": "^29.3.1", - "source-map-support": "^0.5.19", "supertest": "^6.3.3", "ts-jest": "^29.0.3", "tsc-alias": "^1.8.2", @@ -31,6 +29,7 @@ }, "dependencies": { "@babel/runtime": "^7.21.0", + "axios": "^1.2.0", "astravel": "^0.6.1", "escodegen": "^2.0.0", "express": "^4.18.2", @@ -39,6 +38,7 @@ "klona": "^2.0.5", "loglevel": "^1.8.1", "socket.io": "^4.5.4", - "socket.io-adapter": "^2.4.0" + "socket.io-adapter": "^2.4.0", + "source-map-support": "^0.5.19" } } diff --git a/app/shared/ast/package.json b/app/shared/ast/package.json index f1c789a8905..926f7a24374 100644 --- a/app/shared/ast/package.json +++ b/app/shared/ast/package.json @@ -21,6 +21,9 @@ }, "dependencies": { "@babel/runtime": "^7.21.0", + "@rollup/plugin-commonjs": "^22.0.0", + "@types/escodegen": "^0.0.7", + "@types/lodash": "^4.14.120", "acorn": "^8.8.0", "acorn-walk": "^8.2.0", "astravel": "^0.6.1", @@ -29,21 +32,18 @@ "escodegen": "^2.0.0", "lodash": "^4.17.21", "rollup": "^2.77.0", + "rollup-plugin-generate-package-json": "^3.2.0", + "rollup-plugin-peer-deps-external": "^2.2.4", + "rollup-plugin-typescript2": "^0.32.0", "typescript": "4.5.5", "unescape-js": "^1.1.4" }, "devDependencies": { "@babel/preset-typescript": "^7.17.12", - "@rollup/plugin-commonjs": "^22.0.0", - "@types/escodegen": "^0.0.7", "@types/jest": "29.0.3", - "@types/lodash": "^4.14.120", "@typescript-eslint/eslint-plugin": "^5.25.0", "@typescript-eslint/parser": "^5.25.0", "jest": "29.0.3", - "rollup-plugin-generate-package-json": "^3.2.0", - "rollup-plugin-peer-deps-external": "^2.2.4", - "rollup-plugin-typescript2": "^0.32.0", "ts-jest": "29.0.1" }, "author": "",