Skip to content

Commit

Permalink
chore: Update bench baselines (#14687)
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed Jun 24, 2022
1 parent 655990c commit 120c810
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 135 deletions.
12 changes: 6 additions & 6 deletions benchmark/package.json
Expand Up @@ -3,12 +3,12 @@
"private": true,
"type": "module",
"devDependencies": {
"@babel-baseline/core": "npm:@babel/core@7.15.8",
"@babel-baseline/generator": "npm:@babel/generator@7.14.5",
"@babel-baseline/helper-validator-identifier": "npm:@babel/helper-validator-identifier@7.10.4",
"@babel-baseline/parser": "npm:@babel/parser@7.14.8",
"@babel-baseline/traverse": "npm:@babel/traverse@7.15.4",
"@babel-baseline/types": "npm:@babel/types@7.15.6",
"@babel-baseline/core": "npm:@babel/core@7.18.5",
"@babel-baseline/generator": "npm:@babel/generator@7.18.2",
"@babel-baseline/helper-validator-identifier": "npm:@babel/helper-validator-identifier@7.16.7",
"@babel-baseline/parser": "npm:@babel/parser@7.18.5",
"@babel-baseline/traverse": "npm:@babel/traverse@7.18.5",
"@babel-baseline/types": "npm:@babel/types@7.18.4",
"@babel/core": "workspace:^",
"@babel/generator": "workspace:^",
"@babel/helper-validator-identifier": "workspace:^",
Expand Down
37 changes: 37 additions & 0 deletions benchmark/update-baselines.mjs
@@ -0,0 +1,37 @@
import path from "path";
import { readFileSync, writeFileSync } from "fs";
import { fileURLToPath } from "url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const packageFilePath = path.join(__dirname, "package.json");
const packageFile = readFileSync(packageFilePath, "utf8");
const packageFileObj = JSON.parse(packageFile);

for (const name of Object.keys(packageFileObj.devDependencies)) {
const resolution = packageFileObj.devDependencies[name];
const version = resolution.substring(resolution.lastIndexOf("@") + 1);
if (!name.startsWith("@babel-baseline/")) continue;
const lastVersion = JSON.parse(
readFileSync(
path.join(
__dirname,
"../packages",
name.replace("@babel-baseline/", "babel-"),
"package.json"
)
)
).version;
if (version !== lastVersion) {
console.log(`Updating ${name} ${version} -> ${lastVersion}`);
packageFileObj.devDependencies[name] =
resolution.substring(0, resolution.lastIndexOf("@")) + "@" + lastVersion;
}
}

const newFile = JSON.stringify(packageFileObj, null, 2) + "\n";
if (packageFile !== newFile) {
writeFileSync(packageFilePath, newFile, "utf8");
console.log("Please run `yarn` to apply changes.");
}

0 comments on commit 120c810

Please sign in to comment.