From feef6df060f492b9a1e15c9ce5a8cd17e58c7570 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Mar 2026 06:44:01 +0000 Subject: [PATCH 01/19] Replace `child_process.exec()` with `execFile()` --- CHANGELOG.md | 4 ++++ package.json | 3 ++- src/child-process.ts | 9 ++++++--- src/git.ts | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 799aebf..e6180ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## 0.10.5 +- Replace `child_process.exec()` with `execFile()` + +## 0.10.5 + - Bump `glob` from `^12.0.0` to `^13.0.0` ## 0.10.4 diff --git a/package.json b/package.json index 3daa3b2..ff740e7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@azure/avocado", - "version": "0.10.5", + "version": "0.10.6", "description": "A validator of OpenAPI configurations", "type": "module", "main": "dist/index.js", @@ -18,6 +18,7 @@ }, "scripts": { "build": "tsc --build --verbose", + "check": "npm run build && npm run test:ci && npm run lint && npm run format:check", "format": "prettier \"./src/**/*.ts\" --write", "format:check": "prettier \"./src/**/*.ts\" --check", "format:check:ci": "prettier \"./src/**/*.ts\" --check --log-level debug", diff --git a/src/child-process.ts b/src/child-process.ts index c250056..397369a 100644 --- a/src/child-process.ts +++ b/src/child-process.ts @@ -4,7 +4,7 @@ import * as childProcess from 'child_process' import * as util from 'util' -const nodeJsExec = util.promisify(childProcess.exec) +const nodeJsExecFile = util.promisify(childProcess.execFile) export type ExecResult = { /** @@ -17,5 +17,8 @@ export type ExecResult = { readonly stderr: string } -export const exec = (command: string, options: childProcess.ExecOptionsWithStringEncoding): Promise => - nodeJsExec(command, { maxBuffer: Infinity, ...options }) +export const execFile = ( + file: string, + args: readonly string[], + options: childProcess.ExecOptionsWithStringEncoding, +): Promise => nodeJsExecFile(file, args, { maxBuffer: Infinity, ...options }) diff --git a/src/git.ts b/src/git.ts index 72fc5b2..4d4e418 100644 --- a/src/git.ts +++ b/src/git.ts @@ -34,5 +34,5 @@ export const repository = GIT_TERMINAL_PROMPT: '0', }, } - return childProcess.exec(`git ${cmd} ${args.join(' ')}`, options) + return childProcess.execFile('git', [cmd, ...args], options) } From 47163b8d6b9f99bdc57f88410f191d034330a62e Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Mon, 23 Mar 2026 23:45:32 -0700 Subject: [PATCH 02/19] Apply suggestion from @mikeharder --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6180ec..394317a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 0.10.5 +## 0.10.6 - Replace `child_process.exec()` with `execFile()` From 24506b8c61de360544135883d96a1c48ada6030c Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Mar 2026 06:50:25 +0000 Subject: [PATCH 03/19] use execFile in test --- src/test/child-process-test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/child-process-test.ts b/src/test/child-process-test.ts index c5e5abe..5ce4473 100644 --- a/src/test/child-process-test.ts +++ b/src/test/child-process-test.ts @@ -9,8 +9,9 @@ import { generate } from './generate-stdout.js' describe('child-process', () => { it('exec maxBuffer', async () => { // call `generate-stdout.print()` as a separate process. - const { stdout } = await childProcess.exec( - 'node -e "import { print } from \'./dist/test/generate-stdout.js\'; print();"', + const { stdout } = await childProcess.execFile( + 'node', + ['-e', 'import { print } from "./dist/test/generate-stdout.js"; print();'], {}, ) const expected = generate() From 22ef1839f2f476a87e8136006408a4146d23a7b9 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Mar 2026 06:52:41 +0000 Subject: [PATCH 04/19] single quotes inside string --- src/test/child-process-test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/child-process-test.ts b/src/test/child-process-test.ts index 5ce4473..86d0698 100644 --- a/src/test/child-process-test.ts +++ b/src/test/child-process-test.ts @@ -11,7 +11,7 @@ describe('child-process', () => { // call `generate-stdout.print()` as a separate process. const { stdout } = await childProcess.execFile( 'node', - ['-e', 'import { print } from "./dist/test/generate-stdout.js"; print();'], + ['-e', "import { print } from './dist/test/generate-stdout.js'; print();"], {}, ) const expected = generate() From 40fb8dfa9664942db5f96346b80e1f86dc048b5f Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Mar 2026 07:01:09 +0000 Subject: [PATCH 05/19] [test.yaml] test before lint - align with specs repo convention --- .github/workflows/test.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3bb62f7..2d0ba82 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -52,6 +52,10 @@ jobs: run: npm run build shell: pwsh + - name: Test + run: npm run test:ci + shell: pwsh + - name: Lint run: npm run lint shell: pwsh @@ -59,7 +63,3 @@ jobs: - name: Check Formatting run: npm run format:check:ci shell: pwsh - - - name: Test - run: npm run test:ci - shell: pwsh From 18f2514e3fd000a39ee2e27969dec2d663b57076 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Mar 2026 07:08:20 +0000 Subject: [PATCH 06/19] Revert "[test.yaml] test before lint" This reverts commit 40fb8dfa9664942db5f96346b80e1f86dc048b5f. --- .github/workflows/test.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2d0ba82..3bb62f7 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -52,10 +52,6 @@ jobs: run: npm run build shell: pwsh - - name: Test - run: npm run test:ci - shell: pwsh - - name: Lint run: npm run lint shell: pwsh @@ -63,3 +59,7 @@ jobs: - name: Check Formatting run: npm run format:check:ci shell: pwsh + + - name: Test + run: npm run test:ci + shell: pwsh From f28a02ee90506882aa616bb511acb955a80e4a4e Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Mar 2026 07:09:59 +0000 Subject: [PATCH 07/19] revert check --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index ff740e7..a7a490c 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ }, "scripts": { "build": "tsc --build --verbose", - "check": "npm run build && npm run test:ci && npm run lint && npm run format:check", "format": "prettier \"./src/**/*.ts\" --write", "format:check": "prettier \"./src/**/*.ts\" --check", "format:check:ci": "prettier \"./src/**/*.ts\" --check --log-level debug", From e27eaa4f1e8c22825e358f41da6d057d936d65a3 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Mar 2026 00:10:46 -0700 Subject: [PATCH 08/19] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 394317a..ae23436 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 0.10.6 -- Replace `child_process.exec()` with `execFile()` +- Breaking Change: Replace public `child_process.exec()`-based API with `execFile()` (consumers must use `execFile`) ## 0.10.5 From 76586afb775c43e85a3801076ea480b02fa49e32 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Mar 2026 00:11:08 -0700 Subject: [PATCH 09/19] Apply suggestion from @mikeharder --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae23436..6cf9f46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 0.10.6 +## 0.11.0 - Breaking Change: Replace public `child_process.exec()`-based API with `execFile()` (consumers must use `execFile`) From 08478200a70d40042d74d2fe60eda44cc5597b46 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Mar 2026 00:11:31 -0700 Subject: [PATCH 10/19] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/child-process.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/child-process.ts b/src/child-process.ts index 397369a..6915537 100644 --- a/src/child-process.ts +++ b/src/child-process.ts @@ -20,5 +20,5 @@ export type ExecResult = { export const execFile = ( file: string, args: readonly string[], - options: childProcess.ExecOptionsWithStringEncoding, + options: childProcess.ExecFileOptionsWithStringEncoding, ): Promise => nodeJsExecFile(file, args, { maxBuffer: Infinity, ...options }) From 14449c1da49be6453a3dba317674aafa6a660dff Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Mar 2026 00:11:45 -0700 Subject: [PATCH 11/19] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a7a490c..3b515c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@azure/avocado", - "version": "0.10.6", + "version": "0.11.0", "description": "A validator of OpenAPI configurations", "type": "module", "main": "dist/index.js", From f556812620e9bbdc489433b4d1d8e4250b4638cd Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Mar 2026 00:13:53 -0700 Subject: [PATCH 12/19] Apply suggestion from @mikeharder --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cf9f46..701afa2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 0.11.0 -- Breaking Change: Replace public `child_process.exec()`-based API with `execFile()` (consumers must use `execFile`) +- Breaking Change: Replace export `childProcess.exec()` with `childProcess.execFile()` ## 0.10.5 From 78bc3a219481a0bede57dfdfeba0a22ce7a1210d Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Mar 2026 00:16:16 -0700 Subject: [PATCH 13/19] Update src/test/child-process-test.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/test/child-process-test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/child-process-test.ts b/src/test/child-process-test.ts index 86d0698..0f6a64f 100644 --- a/src/test/child-process-test.ts +++ b/src/test/child-process-test.ts @@ -7,7 +7,7 @@ import { childProcess } from '../index.js' import { generate } from './generate-stdout.js' describe('child-process', () => { - it('exec maxBuffer', async () => { + it('execFile maxBuffer', async () => { // call `generate-stdout.print()` as a separate process. const { stdout } = await childProcess.execFile( 'node', From a54e163a6bef06d9232eb526cee2658a43638086 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Mar 2026 00:26:49 -0700 Subject: [PATCH 14/19] Apply suggestion from @mikeharder --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3b515c1..a7a490c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@azure/avocado", - "version": "0.11.0", + "version": "0.10.6", "description": "A validator of OpenAPI configurations", "type": "module", "main": "dist/index.js", From 5f6efc23006eeff27879e72cc289585ca177a074 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Mar 2026 00:27:13 -0700 Subject: [PATCH 15/19] Apply suggestion from @mikeharder --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 701afa2..2510c64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 0.11.0 +## 0.10.6 - Breaking Change: Replace export `childProcess.exec()` with `childProcess.execFile()` From 777e17f368521e814362f5928f1a5343f1bc660d Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Mar 2026 00:27:59 -0700 Subject: [PATCH 16/19] Apply suggestion from @mikeharder --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2510c64..0e6ef34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 0.10.6 -- Breaking Change: Replace export `childProcess.exec()` with `childProcess.execFile()` +- Add `childProcess.execFile()` ## 0.10.5 From bfb763d7483df0d71ef85a2041e95fbd2062594e Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Mar 2026 07:29:35 +0000 Subject: [PATCH 17/19] restore exported exec() --- src/child-process.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/child-process.ts b/src/child-process.ts index 6915537..5f47d24 100644 --- a/src/child-process.ts +++ b/src/child-process.ts @@ -4,6 +4,7 @@ import * as childProcess from 'child_process' import * as util from 'util' +const nodeJsExec = util.promisify(childProcess.exec) const nodeJsExecFile = util.promisify(childProcess.execFile) export type ExecResult = { @@ -17,6 +18,9 @@ export type ExecResult = { readonly stderr: string } +export const exec = (command: string, options: childProcess.ExecOptionsWithStringEncoding): Promise => + nodeJsExec(command, { maxBuffer: Infinity, ...options }) + export const execFile = ( file: string, args: readonly string[], From d02b7e3740ae99cbcaabbae582c811ddc093df15 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Mar 2026 07:36:14 +0000 Subject: [PATCH 18/19] Revert to 0.11.0 --- CHANGELOG.md | 4 ++-- src/child-process.ts | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e6ef34..701afa2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ # Changelog -## 0.10.6 +## 0.11.0 -- Add `childProcess.execFile()` +- Breaking Change: Replace export `childProcess.exec()` with `childProcess.execFile()` ## 0.10.5 diff --git a/src/child-process.ts b/src/child-process.ts index 5f47d24..6915537 100644 --- a/src/child-process.ts +++ b/src/child-process.ts @@ -4,7 +4,6 @@ import * as childProcess from 'child_process' import * as util from 'util' -const nodeJsExec = util.promisify(childProcess.exec) const nodeJsExecFile = util.promisify(childProcess.execFile) export type ExecResult = { @@ -18,9 +17,6 @@ export type ExecResult = { readonly stderr: string } -export const exec = (command: string, options: childProcess.ExecOptionsWithStringEncoding): Promise => - nodeJsExec(command, { maxBuffer: Infinity, ...options }) - export const execFile = ( file: string, args: readonly string[], From 83fee36c46b01e92880b676bc84c276ffadf2a19 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Mar 2026 00:40:20 -0700 Subject: [PATCH 19/19] Apply suggestion from @mikeharder --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a7a490c..3b515c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@azure/avocado", - "version": "0.10.6", + "version": "0.11.0", "description": "A validator of OpenAPI configurations", "type": "module", "main": "dist/index.js",