diff --git a/Taskfile.yaml b/Taskfile.yaml index 00d710b0..9fec72b7 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -30,9 +30,7 @@ tasks: clean: desc: Clean build artifacts cmds: - - rm -rf dist - - rm -rf node_modules - - rm -f package-lock.json + - node -e "for (const p of ['dist', 'node_modules', 'package-lock.json']) require('node:fs').rmSync(p, {recursive:true, force:true})" typecheck: desc: Run TypeScript type checking @@ -91,7 +89,7 @@ tasks: - npm run inspector:dev bump-version: - desc: Bump version in package.json and plugin.json (usage: task bump-version -- 0.9.8) + desc: 'Bump version in package.json and plugin.json (usage: task bump-version -- 0.9.8)' cmds: - node scripts/bump-version.mjs {{.CLI_ARGS}} diff --git a/package.json b/package.json index 796ebfe4..5c3eac36 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "publish:moz": "node scripts/publish-moz-package.mjs", "start": "node dist/index.js", "setup": "node scripts/setup-mcp-config.js", - "clean": "rm -rf dist", + "clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"", "typecheck": "tsc", "typecheck:tests": "tsc -p tests/tsconfig.json", "lint": "eslint src tests --ext .ts", diff --git a/scripts/build-mcpb.mjs b/scripts/build-mcpb.mjs index 3563463d..ef8505c0 100644 --- a/scripts/build-mcpb.mjs +++ b/scripts/build-mcpb.mjs @@ -5,7 +5,7 @@ * manifest.json, then runs `mcpb pack` on it. */ -import { readFileSync, writeFileSync, existsSync, cpSync, mkdtempSync, rmSync } from 'node:fs'; +import { readFileSync, writeFileSync, cpSync, mkdirSync, mkdtempSync, rmSync } from 'node:fs'; import { execSync } from 'node:child_process'; import { resolve, dirname } from 'node:path'; import { fileURLToPath } from 'node:url'; @@ -35,9 +35,7 @@ try { ); const outDir = resolve(root, 'dist-mcpb'); - if (!existsSync(outDir)) { - execSync(`mkdir -p ${outDir}`); - } + mkdirSync(outDir, { recursive: true }); const outFile = resolve(outDir, `firefox-devtools-mcp-${pkg.version}.mcpb`); console.log('Packing .mcpb bundle...'); diff --git a/scripts/test-mozlog.js b/scripts/test-mozlog.js index ae581f02..ba0bb7a2 100755 --- a/scripts/test-mozlog.js +++ b/scripts/test-mozlog.js @@ -2,11 +2,13 @@ import { FirefoxDevTools } from '../dist/index.js'; import { readFileSync, existsSync } from 'fs'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; async function test() { console.log('=== Test: MOZ_LOG and Script Injection (headless) ===\n'); - const logFile = '/tmp/firefox-mozlog-test.log'; + const logFile = join(tmpdir(), 'firefox-mozlog-test.log'); const firefox = new FirefoxDevTools({ headless: true,