Switch to double quotes and reformat codebase with Biome

This commit is contained in:
Mohamed Boudra
2026-03-21 20:22:15 +07:00
parent ab40786882
commit f6579dbeb4
805 changed files with 38132 additions and 40175 deletions
+36 -36
View File
@@ -1,73 +1,73 @@
import { existsSync, readFileSync, writeFileSync } from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { existsSync, readFileSync, writeFileSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const rootDir = path.resolve(__dirname, '..')
const rootPackagePath = path.join(rootDir, 'package.json')
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const rootDir = path.resolve(__dirname, "..");
const rootPackagePath = path.join(rootDir, "package.json");
const rootPackage = JSON.parse(readFileSync(rootPackagePath, 'utf8'))
const rootVersion = rootPackage.version
const workspacePaths = Array.isArray(rootPackage.workspaces) ? rootPackage.workspaces : []
const rootPackage = JSON.parse(readFileSync(rootPackagePath, "utf8"));
const rootVersion = rootPackage.version;
const workspacePaths = Array.isArray(rootPackage.workspaces) ? rootPackage.workspaces : [];
if (typeof rootVersion !== 'string' || rootVersion.length === 0) {
throw new Error('Root package.json must contain a valid "version"')
if (typeof rootVersion !== "string" || rootVersion.length === 0) {
throw new Error('Root package.json must contain a valid "version"');
}
const dependencySections = [
'dependencies',
'devDependencies',
'peerDependencies',
'optionalDependencies',
]
"dependencies",
"devDependencies",
"peerDependencies",
"optionalDependencies",
];
const touched = []
const touched = [];
for (const workspacePath of workspacePaths) {
const packagePath = path.join(rootDir, workspacePath, 'package.json')
const packagePath = path.join(rootDir, workspacePath, "package.json");
if (!existsSync(packagePath)) {
continue
continue;
}
const pkg = JSON.parse(readFileSync(packagePath, 'utf8'))
let changed = false
const pkg = JSON.parse(readFileSync(packagePath, "utf8"));
let changed = false;
if (pkg.version !== rootVersion) {
pkg.version = rootVersion
changed = true
pkg.version = rootVersion;
changed = true;
}
for (const section of dependencySections) {
const deps = pkg[section]
if (!deps || typeof deps !== 'object') {
continue
const deps = pkg[section];
if (!deps || typeof deps !== "object") {
continue;
}
for (const name of Object.keys(deps)) {
if (!name.startsWith('@getpaseo/')) {
continue
if (!name.startsWith("@getpaseo/")) {
continue;
}
if (name === pkg.name) {
continue
continue;
}
if (deps[name] !== rootVersion) {
deps[name] = rootVersion
changed = true
deps[name] = rootVersion;
changed = true;
}
}
}
if (changed) {
writeFileSync(packagePath, `${JSON.stringify(pkg, null, 2)}\n`)
touched.push(path.relative(rootDir, packagePath))
writeFileSync(packagePath, `${JSON.stringify(pkg, null, 2)}\n`);
touched.push(path.relative(rootDir, packagePath));
}
}
if (touched.length === 0) {
console.log(`Workspace versions and internal deps already synced to ${rootVersion}`)
console.log(`Workspace versions and internal deps already synced to ${rootVersion}`);
} else {
console.log(`Synced to ${rootVersion}:`)
console.log(`Synced to ${rootVersion}:`);
for (const file of touched) {
console.log(`- ${file}`)
console.log(`- ${file}`);
}
}