forked from airbytehq/airbyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🪟 🔧 Improve Output when overwriting experiments (airbytehq#22409)
* Improve Output when overwriting experiments * FIx file name in log * Update pnpm lockfile
- Loading branch information
1 parent
0ce6f03
commit a64567f
Showing
4 changed files
with
14 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters