From 19870a2974bc30f51cb4ceb9d3daae45a9e7e841 Mon Sep 17 00:00:00 2001 From: Christopher Pappas Date: Tue, 10 Dec 2024 10:13:10 -0800 Subject: [PATCH] ci: fix review app --- Dockerfile | 5 +++-- package.json | 5 ++++- rsbuild.config.ts | 2 +- scripts/start.sh | 3 ++- scripts/uploadToS3.js | 6 ++++-- src/Server/webpackPublicPath.ts | 2 +- yarn.lock | 32 +++++--------------------------- 7 files changed, 20 insertions(+), 35 deletions(-) diff --git a/Dockerfile b/Dockerfile index 113f55996e3..9d65652f6c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,15 +47,16 @@ COPY --chown=deploy:deploy --from=builder-base /opt/node_modules.prod ./node_mod # Base code COPY --chown=deploy:deploy --from=builder-base /app/data ./data +COPY --chown=deploy:deploy --from=builder-base /app/dist ./dist COPY --chown=deploy:deploy --from=builder-base /app/src ./src COPY --chown=deploy:deploy --from=builder-base /app/scripts ./scripts COPY --chown=deploy:deploy --from=builder-base /app/package.json . COPY --chown=deploy:deploy --from=builder-base /app/yarn.lock . -# App artifacts -COPY --chown=deploy:deploy --from=builder-base /app/dist ./dist ENTRYPOINT ["/usr/bin/dumb-init", "./scripts/load_secrets_and_run.sh"] +ENV NODE_PATH=/app/src + # TODO: Reduce production memory, this is not a concern CMD ["node", "--max_old_space_size=2048", "--heapsnapshot-signal=SIGUSR2", "--no-experimental-fetch", "-r @swc-node/register", "./src/prod.ts"] diff --git a/package.json b/package.json index 630caa0d6c6..db4a1011839 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "sync-env": "aws s3 cp s3://artsy-citadel/force/.env.shared ./ && echo 'ENV sync complete.'", "start": "scripts/start.sh", "start:prod": "yarn build && SESSION_LOCAL_INSECURE=true NODE_ENV=production yarn start", - "start:prod:debug": "SESSION_LOCAL_INSECURE=true NODE_ENV=production node --inspect --max_old_space_size=3072 -r @swc-node/register ./src/index.ts", + "start:prod:debug": "SESSION_LOCAL_INSECURE=true NODE_ENV=production NODE_PATH=src node --inspect --max_old_space_size=3072 -r @swc-node/register ./src/prod.ts", "sync-schema": "scripts/sync-schema-pull.sh", "sync-schema-local": "scripts/sync-schema-local.sh", "test": "scripts/jest.sh", @@ -64,6 +64,8 @@ "@types/react-dom": "^18.3.1", "@types/react-relay": "^16.0.6", "@types/relay-runtime": "18.1.1", + "graceful-fs": "4.x.x", + "regenerator-runtime": "0.13.5", "styled-components": "^6.1.13" }, "dependencies": { @@ -90,6 +92,7 @@ "@stripe/stripe-js": "^4.1.0", "@styled-system/theme-get": "5.1.2", "@swc-node/register": "^1.10.9", + "@swc/helpers": "^0.5.15", "actioncable": "^5.2.7-1", "analytics-node": "2.4.1", "async": "^3.2.4", diff --git a/rsbuild.config.ts b/rsbuild.config.ts index 5dc5b6d5cef..b85afe49abe 100644 --- a/rsbuild.config.ts +++ b/rsbuild.config.ts @@ -76,7 +76,7 @@ export default defineConfig({ writeToDisk: true, }, performance: { - // FIXME: Uncomment and play around with different bundle split strategies, + // TODO: Uncomment and play around with different bundle split strategies, // along with stats below: // chunkSplit: { // strategy: "split-by-size", diff --git a/scripts/start.sh b/scripts/start.sh index b81e37fbac9..f1241db2d04 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -20,5 +20,6 @@ if [ "${NODE_ENV}" != "production" ]; then fi # Prod else - exec node "${OPT[@]}" --no-experimental-fetch -r @swc-node/register ./src/prod.ts + export NODE_PATH=src + exec node "${OPT[@]}" --no-experimental-fetch -r @swc-node/register ./src/prod.ts fi diff --git a/scripts/uploadToS3.js b/scripts/uploadToS3.js index f6e5c864a1b..ae2a31ad65e 100644 --- a/scripts/uploadToS3.js +++ b/scripts/uploadToS3.js @@ -10,8 +10,8 @@ const s3 = require("s3") const { last } = require("lodash") const options = { - root: "public", - files: path.join(__dirname, "../dist/**"), + root: "dist", + files: path.join(process.cwd(), "./dist/**"), key: process.env.S3_KEY, secret: process.env.S3_SECRET, bucket: process.env.S3_BUCKET, @@ -30,6 +30,8 @@ const files = glob.sync(options.files, { nodir: true, }) +console.log(files) + const generateHeaders = file => { const extension = path.extname(file) const contentType = mime.getType(extension) diff --git a/src/Server/webpackPublicPath.ts b/src/Server/webpackPublicPath.ts index f5354a4c733..2a7de4e9831 100644 --- a/src/Server/webpackPublicPath.ts +++ b/src/Server/webpackPublicPath.ts @@ -26,7 +26,7 @@ if (process.env.NODE_ENV === "production") { // webpack pathing client side. // @ts-expect-error - webpack magic var - __webpack_public_path__ = cdnUrl + "/assets/" + __webpack_public_path__ = cdnUrl + "/" // @ts-expect-error - webpack magic var window.__getPublicPath = () => __webpack_public_path__ diff --git a/yarn.lock b/yarn.lock index 424392c09c3..734e6dd1be6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8317,17 +8317,10 @@ got@^9.6.0: to-readable-stream "^1.0.0" url-parse-lax "^3.0.0" -graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.9: - version "4.2.10" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" - integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== - -graceful-fs@~3.0.5: - version "3.0.12" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-3.0.12.tgz#0034947ce9ed695ec8ab0b854bc919e82b1ffaef" - integrity sha512-J55gaCS4iTTJfTXIxSVw3EMQckcqkpdRv3IR7gu6sq0+tbC363Zx6KH/SEwXASK9JRbhyZmVjJEVJIOxYsB3Qg== - dependencies: - natives "^1.1.3" +graceful-fs@4.x.x, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.9, graceful-fs@~3.0.5: + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== graphql-tools@^4.0.2: version "4.0.3" @@ -11602,11 +11595,6 @@ nanomatch@^1.2.9: snapdragon "^0.8.1" to-regex "^3.0.1" -natives@^1.1.3: - version "1.1.6" - resolved "https://registry.yarnpkg.com/natives/-/natives-1.1.6.tgz#a603b4a498ab77173612b9ea1acdec4d980f00bb" - integrity sha512-6+TDFewD4yxY14ptjKaS63GVdtKiES1pTPyxn9Jb0rBqPMZ7VcCiooEhPNsr+mqHtMGxa/5c/HhcC4uPEUw/nA== - natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -13482,21 +13470,11 @@ reflect.getprototypeof@^1.0.4: globalthis "^1.0.3" which-builtin-type "^1.1.3" -regenerator-runtime@^0.11.0: - version "0.11.1" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" - integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== - -regenerator-runtime@^0.13.2, regenerator-runtime@^0.13.4: +regenerator-runtime@0.13.5, regenerator-runtime@^0.11.0, regenerator-runtime@^0.13.2, regenerator-runtime@^0.13.4, regenerator-runtime@^0.14.0: version "0.13.5" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz#d878a1d094b4306d10b9096484b33ebd55e26697" integrity sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA== -regenerator-runtime@^0.14.0: - version "0.14.1" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz#356ade10263f685dda125100cd862c1db895327f" - integrity sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw== - regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c"