From a64567f5a71863dc2bc19885f4c9588a991ad3ce Mon Sep 17 00:00:00 2001 From: Tim Roes Date: Tue, 7 Feb 2023 11:38:22 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=9F=20=F0=9F=94=A7=20Improve=20Output?= =?UTF-8?q?=20when=20overwriting=20experiments=20(#22409)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Improve Output when overwriting experiments * FIx file name in log * Update pnpm lockfile --- airbyte-webapp/package.json | 1 + airbyte-webapp/pnpm-lock.yaml | 2 ++ airbyte-webapp/scripts/dev-overwrites.js | 12 ++++++++++-- airbyte-webapp/vite.config.ts | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/airbyte-webapp/package.json b/airbyte-webapp/package.json index f2820911ce55..b78949a6225b 100644 --- a/airbyte-webapp/package.json +++ b/airbyte-webapp/package.json @@ -133,6 +133,7 @@ "@vitejs/plugin-basic-ssl": "^1.0.1", "@vitejs/plugin-react": "^3.0.1", "babel-jest": "^29.3.1", + "chalk": "^4.1.2", "dotenv": "^16.0.3", "eslint": "^8.32.0", "eslint-config-prettier": "^8.6.0", diff --git a/airbyte-webapp/pnpm-lock.yaml b/airbyte-webapp/pnpm-lock.yaml index 7da02e59f119..17f5e1af4a31 100644 --- a/airbyte-webapp/pnpm-lock.yaml +++ b/airbyte-webapp/pnpm-lock.yaml @@ -61,6 +61,7 @@ specifiers: '@vitejs/plugin-basic-ssl': ^1.0.1 '@vitejs/plugin-react': ^3.0.1 babel-jest: ^29.3.1 + chalk: ^4.1.2 classnames: ^2.3.1 date-fns: ^2.29.3 dayjs: ^1.11.3 @@ -252,6 +253,7 @@ devDependencies: '@vitejs/plugin-basic-ssl': 1.0.1_vite@4.0.4 '@vitejs/plugin-react': 3.0.1_vite@4.0.4 babel-jest: 29.3.1_@babel+core@7.20.12 + chalk: 4.1.2 dotenv: 16.0.3 eslint: 8.32.0 eslint-config-prettier: 8.6.0_eslint@8.32.0 diff --git a/airbyte-webapp/scripts/dev-overwrites.js b/airbyte-webapp/scripts/dev-overwrites.js index 9633cc484699..6ec83d1df1b2 100644 --- a/airbyte-webapp/scripts/dev-overwrites.js +++ b/airbyte-webapp/scripts/dev-overwrites.js @@ -1,14 +1,22 @@ const fs = require("fs"); +const { isMainThread } = require("node:worker_threads"); const path = require("path"); +const chalk = require("chalk"); + const EXPERIMENTS_FILE = path.resolve(__dirname, "../.experiments.json"); if (fs.existsSync(EXPERIMENTS_FILE)) { - console.log("\nOverwriting experiments from .experiments.json ..."); const overwrites = require(EXPERIMENTS_FILE); if (Object.keys(overwrites).length) { - console.log(`Overwriting experiments with the following values:\n\n${JSON.stringify(overwrites, null, 2)}`); + if (isMainThread) { + // Only print the message in the main thread, so it's not showing up in all the worker threads of vite-plugin-checker + console.log(chalk.bold(`🧪 Overwriting experiments via ${chalk.green(".experiments.json")}`)); + Object.entries(overwrites).forEach(([key, value]) => { + console.log(` ➜ ${chalk.cyan(key)}: ${JSON.stringify(value)}`); + }); + } process.env.REACT_APP_EXPERIMENT_OVERWRITES = JSON.stringify(overwrites); } } diff --git a/airbyte-webapp/vite.config.ts b/airbyte-webapp/vite.config.ts index e69af7049696..64501710720e 100644 --- a/airbyte-webapp/vite.config.ts +++ b/airbyte-webapp/vite.config.ts @@ -55,6 +55,7 @@ export default defineConfig(({ mode }) => { ], // Use `REACT_APP_` as a prefix for environment variables that should be accessible from within FE code. envPrefix: ["REACT_APP_"], + clearScreen: false, build: { outDir: "build/app", },