diff options
author | 2024-08-28 22:52:49 +0800 | |
---|---|---|
committer | 2024-08-28 22:52:49 +0800 | |
commit | 440a4be0a6ca135e47b0d37124c1be03735ba7ff (patch) | |
tree | 0dc30d5fb2fc00cc71ec49b3aa967233789a9471 /scripts | |
parent | 6272e6cec07778e81f853754bffaac40e658c700 (diff) | |
download | astro-440a4be0a6ca135e47b0d37124c1be03735ba7ff.tar.gz astro-440a4be0a6ca135e47b0d37124c1be03735ba7ff.tar.zst astro-440a4be0a6ca135e47b0d37124c1be03735ba7ff.zip |
Use tinyexec (#11845)
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/package.json | 2 | ||||
-rw-r--r-- | scripts/smoke/cleanup.js | 6 | ||||
-rw-r--r-- | scripts/smoke/index.js | 14 |
3 files changed, 13 insertions, 9 deletions
diff --git a/scripts/package.json b/scripts/package.json index 35bf517a6..bbf3e9706 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -10,10 +10,10 @@ "dependencies": { "esbuild": "^0.21.5", "esbuild-plugin-copy": "^2.1.1", - "execa": "^8.0.1", "fast-glob": "^3.3.2", "kleur": "^4.1.5", "p-limit": "^6.1.0", + "tinyexec": "^0.3.0", "tsconfck": "^3.1.1" } } diff --git a/scripts/smoke/cleanup.js b/scripts/smoke/cleanup.js index 3b03951f9..1bb398d9e 100644 --- a/scripts/smoke/cleanup.js +++ b/scripts/smoke/cleanup.js @@ -2,7 +2,7 @@ // @ts-check -import { execa } from 'execa'; +import { exec } from 'tinyexec'; import { promises as fs } from 'node:fs'; import { fileURLToPath } from 'node:url'; @@ -36,7 +36,9 @@ async function run() { console.log('🤖', 'Resetting', 'pnpm'); - await execa('pnpm', ['install'], { cwd: fileURLToPath(rootDir), stdout: 'inherit', stderr: 'inherit' }); + await exec('pnpm', ['install'], { + nodeOptions: { cwd: fileURLToPath(rootDir), stdio: ['pipe', 'inherit', 'inherit'] }, + }); } /* Functionality diff --git a/scripts/smoke/index.js b/scripts/smoke/index.js index 7ab78e286..49887cd2e 100644 --- a/scripts/smoke/index.js +++ b/scripts/smoke/index.js @@ -2,7 +2,7 @@ // @ts-check -import { execa } from 'execa'; +import { exec } from 'tinyexec'; import { promises as fs } from 'node:fs'; import { fileURLToPath } from 'node:url'; @@ -32,10 +32,12 @@ async function run() { console.log(''); const directories = [...(await getChildDirectories(smokeDir)), ...(await getChildDirectories(exampleDir))]; + /** @type {Partial<import('tinyexec').Options>} */ + const execOptions = { nodeOptions: { cwd: fileURLToPath(rootDir), stdio: 'inherit' }}; console.log('🤖', 'Preparing', 'pnpm'); - - await execa('pnpm', ['install', '--frozen-lockfile=false'], { cwd: fileURLToPath(rootDir), stdio: 'inherit' }); + + await exec('pnpm', ['install', '--frozen-lockfile=false'], execOptions); for (const directory of directories) { const name = directory.pathname.split('/').at(-1) ?? ""; @@ -43,9 +45,9 @@ async function run() { console.log('🤖', 'Testing', name); try { - await execa('pnpm', ['install', '--ignore-scripts', '--frozen-lockfile=false'].filter(x => x), { cwd: fileURLToPath(directory), stdio: 'inherit' }); - await execa('pnpm', ['astro', 'telemetry', 'disable']); - await execa('pnpm', ['run', 'build'], { cwd: fileURLToPath(directory), stdio: 'inherit' }); + await exec('pnpm', ['install', '--ignore-scripts', '--frozen-lockfile=false'], execOptions); + await exec('pnpm', ['astro', 'telemetry', 'disable']); + await exec('pnpm', ['run', 'build'], execOptions); } catch (err) { console.log(err); process.exit(1); |