From 4af296e9c308cebfdda63d155ccc6976d86d05cc Mon Sep 17 00:00:00 2001 From: Alec Larson <1925840+aleclarson@users.noreply.github.com> Date: Sat, 23 Nov 2024 16:55:40 -0500 Subject: [PATCH 1/2] chore: avoid console.log in scripts/run.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By using console.warn, we avoid polluting the stdout in case it‘s relied upon (like with "./scripts/bench-file"). --- scripts/run.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/run.js b/scripts/run.js index 20767d70..43cef82f 100644 --- a/scripts/run.js +++ b/scripts/run.js @@ -43,7 +43,7 @@ async function main([command, ...argv]) { return } - console.log( + console.warn( `> Installing dependencies for ${path.relative(process.cwd(), pkgDir)}`, ) @@ -58,7 +58,7 @@ async function main([command, ...argv]) { installer.on('error', reject) }) - console.log() + console.warn() for (const [name, version] of Object.entries(pkg.dependencies)) { if (name === 'radashi') { @@ -86,7 +86,7 @@ async function main([command, ...argv]) { if (major < 22 || (major === 22 && minor < 6)) { const tsxSpecifier = 'tsx@4.19.1' if (process.env.CI) { - console.log(`> pnpm add -g ${tsxSpecifier}`) + console.warn(`> pnpm add -g ${tsxSpecifier}`) await new Promise((resolve, reject) => { const installer = spawn('pnpm', ['install', '-g', tsxSpecifier], { stdio: 'inherit', From e9c274b4514421aba8ad0259d08bec55bd956176 Mon Sep 17 00:00:00 2001 From: Alec Larson <1925840+aleclarson@users.noreply.github.com> Date: Sat, 23 Nov 2024 16:55:57 -0500 Subject: [PATCH 2/2] chore: remove console.warn from ./scripts/bench-file script --- scripts/bench-file/src/main.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/bench-file/src/main.ts b/scripts/bench-file/src/main.ts index 93df81a7..cb8b9afe 100644 --- a/scripts/bench-file/src/main.ts +++ b/scripts/bench-file/src/main.ts @@ -14,20 +14,19 @@ async function main() { const rootDir = new URL('../../../', import.meta.url).pathname const scriptDir = new URL('../', import.meta.url).pathname const nodeModulesDir = path.join(rootDir, 'node_modules') + const vitestDir = path.join(nodeModulesDir, 'vitest') // If the root node_modules directory doesn't contain vitest, link // it to the vitest installed for this script. - fs.mkdirSync(nodeModulesDir, { recursive: true }) - try { + if (!fs.existsSync(vitestDir)) { + fs.mkdirSync(nodeModulesDir, { recursive: true }) fs.symlinkSync( path.relative( nodeModulesDir, path.join(scriptDir, 'node_modules/vitest'), ), - path.join(nodeModulesDir, 'vitest'), + vitestDir, ) - } catch (e) { - console.warn(e) } const vitest = await createVitest('benchmark', {