diff --git a/package-lock.json b/package-lock.json index 7045849948..6ba74659ee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,8 +16,8 @@ "@types/fs-extra": "^11.0.4", "@types/minimist": "^1.2.5", "@types/node": ">=20.11.19", - "@types/ps-tree": "^1.1.6", "@types/which": "^3.0.3", + "@webpod/ps": "^0.0.0-beta.2", "c8": "^7.13.0", "chalk": "^5.3.0", "dts-bundle-generator": "^9.3.1", @@ -31,13 +31,12 @@ "minimist": "^1.2.8", "node-fetch-native": "^1.6.2", "prettier": "^2.8.8", - "ps-tree": "^1.2.0", "tsd": "^0.30.7", - "typescript": "^5.0.4", + "typescript": "^5.4.3", "webpod": "^0", "which": "^3.0.0", "yaml": "^2.4.1", - "zurk": "^0.0.31" + "zurk": "^0.0.32" }, "engines": { "node": ">= 16.0.0" @@ -1143,12 +1142,6 @@ "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", "dev": true }, - "node_modules/@types/ps-tree": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/@types/ps-tree/-/ps-tree-1.1.6.tgz", - "integrity": "sha512-PtrlVaOaI44/3pl3cvnlK+GxOM3re2526TJvPvh7W+keHIXdV4TE0ylpPBAcvFQCbGitaTXwL9u+RF7qtVeazQ==", - "dev": true - }, "node_modules/@types/which": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/which/-/which-3.0.3.tgz", @@ -1241,6 +1234,22 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@webpod/ingrid": { + "version": "0.0.0-beta.2", + "resolved": "https://registry.npmjs.org/@webpod/ingrid/-/ingrid-0.0.0-beta.2.tgz", + "integrity": "sha512-TaA6xC1+lCkvPHSdD55fMF1mKe3xLy5NZpwbjoq3Zi1n0LU6XSFF2sD5SHAgnEHEzDxx8hDArNPvzZbF6uApdg==", + "dev": true + }, + "node_modules/@webpod/ps": { + "version": "0.0.0-beta.2", + "resolved": "https://registry.npmjs.org/@webpod/ps/-/ps-0.0.0-beta.2.tgz", + "integrity": "sha512-vN7MQWZ3kaEulflp17ySPHjkIlEMfIP2KDMekiTazgAJQxHCY+QyZ+wJ120LJ/t/h4aGxv8u3Z6amBGeurF5iQ==", + "dev": true, + "dependencies": { + "@webpod/ingrid": "^0.0.0-beta.2", + "zurk": "^0.0.32" + } + }, "node_modules/ajv": { "version": "8.12.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", @@ -2272,12 +2281,6 @@ "node": ">=12" } }, - "node_modules/duplexer": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", - "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==", - "dev": true - }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -2644,21 +2647,6 @@ "node": ">=0.10.0" } }, - "node_modules/event-stream": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", - "integrity": "sha512-QHpkERcGsR0T7Qm3HNJSyXKEEj8AHNxkY3PK8TS2KJvQ7NiSHe3DDpwVKKtoYprL/AreyzFBeIkBIWChAqn60g==", - "dev": true, - "dependencies": { - "duplexer": "~0.1.1", - "from": "~0", - "map-stream": "~0.1.0", - "pause-stream": "0.0.11", - "split": "0.3", - "stream-combiner": "~0.0.4", - "through": "~2.3.1" - } - }, "node_modules/execa": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-7.1.1.tgz", @@ -2861,12 +2849,6 @@ "node": ">=8.0.0" } }, - "node_modules/from": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", - "integrity": "sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g==", - "dev": true - }, "node_modules/fs-extra": { "version": "11.2.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", @@ -3257,6 +3239,12 @@ "node": ">=12.0.0" } }, + "node_modules/inquirer/node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, "node_modules/irregular-plurals": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-3.3.0.tgz", @@ -3616,12 +3604,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, "node_modules/lodash.flatmap": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.flatmap/-/lodash.flatmap-4.5.0.tgz", @@ -3979,12 +3961,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/map-stream": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", - "integrity": "sha512-CkYQrPYZfWnu/DAmVCpTSX/xHpKZ80eKh2lAkyA6AJTef6bW+6JpbQZN5rofum7da+SyN1bi5ctTm+lTfcCW3g==", - "dev": true - }, "node_modules/meow": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz", @@ -4555,15 +4531,6 @@ "node": ">=8" } }, - "node_modules/pause-stream": { - "version": "0.0.11", - "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", - "integrity": "sha512-e3FBlXLmN/D1S+zHzanP4E/4Z60oFAa3O051qt1pxa7DEJWKAyil6upYVXCWadEnuoqa4Pkc9oUx9zsxYeRv8A==", - "dev": true, - "dependencies": { - "through": "~2.3" - } - }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -5016,21 +4983,6 @@ "node": ">=0.4.0" } }, - "node_modules/ps-tree": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/ps-tree/-/ps-tree-1.2.0.tgz", - "integrity": "sha512-0VnamPPYHl4uaU/nSFeZZpR21QAWRz+sRv4iW9+v/GS/J5U5iZB5BNN6J0RMoOvdx2gWM2+ZFMIm58q24e4UYA==", - "dev": true, - "dependencies": { - "event-stream": "=3.3.4" - }, - "bin": { - "ps-tree": "bin/ps-tree.js" - }, - "engines": { - "node": ">= 0.10" - } - }, "node_modules/punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", @@ -5642,27 +5594,6 @@ "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==", "dev": true }, - "node_modules/split": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", - "integrity": "sha512-wD2AeVmxXRBoX44wAycgjVpMhvbwdI2aZjCkvfNcH1YqHQvJVa1duWc73OyVGJUc05fhFaTZeQ/PYsrmyH0JVA==", - "dev": true, - "dependencies": { - "through": "2" - }, - "engines": { - "node": "*" - } - }, - "node_modules/stream-combiner": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", - "integrity": "sha512-rT00SPnTVyRsaSz5zgSPma/aHSOic5U1prhYdRy5HS2kTZviFpmDgzilbtsJsxiroqACmayynDN/9VzIbX5DOw==", - "dev": true, - "dependencies": { - "duplexer": "~0.1.1" - } - }, "node_modules/stream-to-array": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/stream-to-array/-/stream-to-array-2.3.0.tgz", @@ -6184,16 +6115,16 @@ } }, "node_modules/typescript": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", - "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz", + "integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=12.20" + "node": ">=14.17" } }, "node_modules/underscore": { @@ -6492,9 +6423,9 @@ } }, "node_modules/zurk": { - "version": "0.0.31", - "resolved": "https://registry.npmjs.org/zurk/-/zurk-0.0.31.tgz", - "integrity": "sha512-rYp8YgJFaNgTEe9/s607CqIxhJtls8Uik6hQGiPOus+5iyKphc5Xk5stLzE1bO+JnY73T/6MXI8DbnpkJQXYpA==", + "version": "0.0.32", + "resolved": "https://registry.npmjs.org/zurk/-/zurk-0.0.32.tgz", + "integrity": "sha512-KouorYeuxuZORUiDoOMUCgpjgHgMP+ks9MpEPOT/JE5/df9bIr6DjqIiaQGhzH9ZLG00bWBZJazCpwO0zSqq7g==", "dev": true } } diff --git a/package.json b/package.json index 8b3c075af8..95dedbeb50 100644 --- a/package.json +++ b/package.json @@ -62,8 +62,8 @@ "@types/fs-extra": "^11.0.4", "@types/minimist": "^1.2.5", "@types/node": ">=20.11.19", - "@types/ps-tree": "^1.1.6", "@types/which": "^3.0.3", + "@webpod/ps": "^0.0.0-beta.2", "c8": "^7.13.0", "chalk": "^5.3.0", "dts-bundle-generator": "^9.3.1", @@ -77,13 +77,12 @@ "minimist": "^1.2.8", "node-fetch-native": "^1.6.2", "prettier": "^2.8.8", - "ps-tree": "^1.2.0", "tsd": "^0.30.7", - "typescript": "^5.0.4", + "typescript": "^5.4.3", "webpod": "^0", "which": "^3.0.0", "yaml": "^2.4.1", - "zurk": "^0.0.31" + "zurk": "^0.0.32" }, "publishConfig": { "registry": "https://wombat-dressing-room.appspot.com" diff --git a/src/core.ts b/src/core.ts index ab14c14f65..156089f3fe 100644 --- a/src/core.ts +++ b/src/core.ts @@ -22,6 +22,7 @@ import { buildCmd, chalk, which, + ps, type ChalkInstance, RequestInfo, RequestInit, @@ -33,7 +34,6 @@ import { formatCmd, noop, parseDuration, - psTree, quote, quotePowerShell, } from './util.js' @@ -412,10 +412,10 @@ export class ProcessPromise extends Promise { throw new Error('Trying to kill a process without creating one.') if (!this.child.pid) throw new Error('The process pid is undefined.') - let children = await psTree(this.child.pid) + let children = await ps.tree({ pid: this.child.pid, recursive: true }) for (const p of children) { try { - process.kill(+p.PID, signal) + process.kill(+p.pid, signal) } catch (e) {} } try { diff --git a/src/index.ts b/src/index.ts index ffc250b48b..4dccfde412 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,7 +16,7 @@ import { ProcessPromise } from './core.js' export * from './core.js' export * from './goods.js' -export { minimist, chalk, fs, which, YAML, ssh } from './vendor.js' +export { minimist, chalk, fs, which, YAML, ssh, ps } from './vendor.js' export { type Duration, quote, quotePowerShell } from './util.js' diff --git a/src/util.ts b/src/util.ts index 344b45a52e..787035d6cd 100644 --- a/src/util.ts +++ b/src/util.ts @@ -13,9 +13,7 @@ // limitations under the License. import { promisify } from 'node:util' -import { chalk, psTreeModule } from './vendor.js' - -export const psTree = promisify(psTreeModule) +import { chalk } from './vendor.js' export function noop() {} diff --git a/src/vendor.ts b/src/vendor.ts index 941ffabe66..c86b1545b2 100644 --- a/src/vendor.ts +++ b/src/vendor.ts @@ -54,5 +54,5 @@ export { type Options as GlobbyOptions } from 'globby' export { default as chalk, type ChalkInstance } from 'chalk' export { default as which } from 'which' export { default as minimist } from 'minimist' -export { default as psTreeModule } from 'ps-tree' +export { default as ps } from '@webpod/ps' export { ssh } from 'webpod' diff --git a/test/fixtures/ts-project/package.json b/test/fixtures/ts-project/package.json index b323a7d5e6..a6a9a2a29c 100644 --- a/test/fixtures/ts-project/package.json +++ b/test/fixtures/ts-project/package.json @@ -2,7 +2,7 @@ "private": true, "type": "module", "dependencies": { - "typescript": "^4.7.3", + "typescript": "^5.0.0", "zx": "*" } } diff --git a/test/fixtures/ts-project/tsconfig.json b/test/fixtures/ts-project/tsconfig.json index f6f8513dd2..4d66d32cc1 100644 --- a/test/fixtures/ts-project/tsconfig.json +++ b/test/fixtures/ts-project/tsconfig.json @@ -2,8 +2,8 @@ "compilerOptions": { "outDir": "./build", "target": "es2021", - "module": "esnext", - "moduleResolution": "node16", + "module": "nodenext", + "moduleResolution": "nodenext", "allowSyntheticDefaultImports": true, "strict": true },