From b1340a96e5154c70d1d012b2c7ee139f4b00da80 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Thu, 2 Jan 2025 10:50:41 +0100 Subject: [PATCH] Feature/upgrade replace-in-file to version 8.3.0 (#4167) * Upgrade replace-in-file to version 8.3.0 * Update changelog --- CHANGELOG.md | 1 + Dockerfile | 10 ++--- package-lock.json | 59 +++++++++++++++++---------- package.json | 4 +- replace.build.js => replace.build.mjs | 14 ++++--- 5 files changed, 55 insertions(+), 33 deletions(-) rename replace.build.js => replace.build.mjs (66%) diff --git a/CHANGELOG.md b/CHANGELOG.md index c712f1ffc..382a42d6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Introduced `extends` in the `docker-compose` files - Improved the language localization for German (`de`) - Refreshed the cryptocurrencies list +- Upgraded `replace-in-file` from version `7.0.1` to `8.3.0` ### Fixed diff --git a/Dockerfile b/Dockerfile index e6c38f273..103dc3b9e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,13 +25,13 @@ RUN npm install COPY ./decorate-angular-cli.js decorate-angular-cli.js RUN node decorate-angular-cli.js -COPY ./nx.json nx.json -COPY ./replace.build.js replace.build.js -COPY ./jest.preset.js jest.preset.js +COPY ./apps apps +COPY ./libs libs COPY ./jest.config.ts jest.config.ts +COPY ./jest.preset.js jest.preset.js +COPY ./nx.json nx.json +COPY ./replace.build.mjs replace.build.mjs COPY ./tsconfig.base.json tsconfig.base.json -COPY ./libs libs -COPY ./apps apps RUN npm run build:production diff --git a/package-lock.json b/package-lock.json index 93189ca14..c91bf33b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -152,7 +152,7 @@ "prisma": "6.1.0", "react": "18.2.0", "react-dom": "18.2.0", - "replace-in-file": "7.0.1", + "replace-in-file": "8.3.0", "shx": "0.3.4", "storybook": "8.4.7", "ts-jest": "29.1.0", @@ -28991,54 +28991,71 @@ } }, "node_modules/replace-in-file": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/replace-in-file/-/replace-in-file-7.0.1.tgz", - "integrity": "sha512-KbhgPq04eA+TxXuUxpgWIH9k/TjF+28ofon2PXP7vq6izAILhxOtksCVcLuuQLtyjouBaPdlH6RJYYcSPVxCOA==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/replace-in-file/-/replace-in-file-8.3.0.tgz", + "integrity": "sha512-4VhddQiMCPIuypiwHDTM+XHjZoVu9h7ngBbSCnwGRcwdHwxltjt/m//Ep3GDwqaOx1fDSrKFQ+n7uo4uVcEz9Q==", "dev": true, "license": "MIT", "dependencies": { - "chalk": "^4.1.2", - "glob": "^8.1.0", + "chalk": "^5.3.0", + "glob": "^10.4.2", "yargs": "^17.7.2" }, "bin": { "replace-in-file": "bin/cli.js" }, "engines": { - "node": ">=10" + "node": ">=18" + } + }, + "node_modules/replace-in-file/node_modules/chalk": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz", + "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, "node_modules/replace-in-file/node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", "dev": true, "license": "ISC", "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" }, - "engines": { - "node": ">=12" + "bin": { + "glob": "dist/esm/bin.mjs" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/replace-in-file/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" }, "engines": { - "node": ">=10" + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/request-progress": { diff --git a/package.json b/package.json index 607ec233b..e1ae1aa63 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "postinstall": "prisma generate", "prepare": "husky", "prisma": "prisma", - "replace-placeholders-in-build": "node ./replace.build.js", + "replace-placeholders-in-build": "node ./replace.build.mjs", "start": "node dist/apps/api/main", "start:client": "nx run client:copy-assets && nx run client:serve --configuration=development-en --hmr -o", "start:production": "npm run database:migrate && npm run database:seed && node main", @@ -198,7 +198,7 @@ "prisma": "6.1.0", "react": "18.2.0", "react-dom": "18.2.0", - "replace-in-file": "7.0.1", + "replace-in-file": "8.3.0", "shx": "0.3.4", "storybook": "8.4.7", "ts-jest": "29.1.0", diff --git a/replace.build.js b/replace.build.mjs similarity index 66% rename from replace.build.js rename to replace.build.mjs index 0811fa969..1d714d7a4 100644 --- a/replace.build.js +++ b/replace.build.mjs @@ -1,9 +1,13 @@ -const dotenv = require('dotenv'); -const path = require('path'); -const replace = require('replace-in-file'); +import dotenv from 'dotenv'; +import { dirname, resolve } from 'path'; +import { replaceInFileSync } from 'replace-in-file'; +import { fileURLToPath } from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); dotenv.config({ - path: path.resolve(__dirname, '.env') + path: resolve(__dirname, '.env') }); const now = new Date(); @@ -16,7 +20,7 @@ const buildTimestamp = `${formatWithTwoDigits( )}:${formatWithTwoDigits(now.getMinutes())}`; try { - const changedFiles = replace.sync({ + const changedFiles = replaceInFileSync({ files: './dist/apps/client/main.*.js', from: /{BUILD_TIMESTAMP}/g, to: buildTimestamp,