Skip to content

Commit

Permalink
🪟 🔧 Improve Output when overwriting experiments (airbytehq#22409)
Browse files Browse the repository at this point in the history
* Improve Output when overwriting experiments

* FIx file name in log

* Update pnpm lockfile
  • Loading branch information
timroes authored and danidelvalle-frontiers committed Feb 9, 2023
1 parent 0ce6f03 commit a64567f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions airbyte-webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions airbyte-webapp/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions airbyte-webapp/scripts/dev-overwrites.js
Original file line number Diff line number Diff line change
@@ -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);
}
}
1 change: 1 addition & 0 deletions airbyte-webapp/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand Down

0 comments on commit a64567f

Please sign in to comment.