This is an automated email from the ASF dual-hosted git repository. erisu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cordova-common.git
The following commit(s) were added to refs/heads/master by this push: new 432579b feat!: remove superspawn & npm packages q & cross-spawn (#231) 432579b is described below commit 432579b10d6193131f1a09933feb5f1755725acf Author: エリス <er...@users.noreply.github.com> AuthorDate: Sat Jul 26 13:50:28 2025 +0900 feat!: remove superspawn & npm packages q & cross-spawn (#231) --- README.md | 18 ------- cordova-common.js | 1 - package-lock.json | 19 +++----- package.json | 2 - spec/superspawn.spec.js | 127 ------------------------------------------------ 5 files changed, 6 insertions(+), 161 deletions(-) diff --git a/README.md b/README.md index 4ce68cc..3a27d9f 100644 --- a/README.md +++ b/README.md @@ -114,24 +114,6 @@ stack.process() }); ``` -### `superspawn` - -Module for spawning child processes with some advanced logic. - -Usage: - -```js -const { superspawn } = require('cordova-common'); - -superspawn.spawn('adb', ['devices']) - .progress(data => { - if (data.stderr) console.error(`"adb devices" raised an error: ${data.stderr}`); - }) - .then(devices => { - // Do something... - }); -``` - ### `xmlHelpers` A set of utility methods for dealing with XML files. diff --git a/cordova-common.js b/cordova-common.js index 1e091cc..f228f5b 100644 --- a/cordova-common.js +++ b/cordova-common.js @@ -19,7 +19,6 @@ module.exports = { get events () { return require('./src/events'); }, - get superspawn () { return require('./src/superspawn'); }, get ActionStack () { return require('./src/ActionStack'); }, get CordovaError () { return require('./src/CordovaError'); }, diff --git a/package-lock.json b/package-lock.json index 0d8d2b7..3133afb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,12 +12,10 @@ "@netflix/nerror": "^1.1.3", "ansi": "^0.3.1", "bplist-parser": "^0.3.2", - "cross-spawn": "^7.0.6", "elementtree": "^0.1.7", "endent": "^2.1.0", "fast-glob": "^3.3.3", "plist": "^3.1.0", - "q": "^1.5.1", "strip-bom": "^4.0.0" }, "devDependencies": { @@ -973,6 +971,7 @@ "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, "license": "MIT", "dependencies": { "path-key": "^3.1.0", @@ -2741,6 +2740,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, "license": "ISC" }, "node_modules/istanbul-lib-coverage": { @@ -3249,6 +3249,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -3334,17 +3335,6 @@ "node": ">=6" } }, - "node_modules/q": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", - "integrity": "sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==", - "deprecated": "You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other.\n\n(For a CapTP with native promises, see @endo/eventual-send and @endo/captp)", - "license": "MIT", - "engines": { - "node": ">=0.6.0", - "teleport": ">=0.2.0" - } - }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -3627,6 +3617,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, "license": "MIT", "dependencies": { "shebang-regex": "^3.0.0" @@ -3639,6 +3630,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -4237,6 +4229,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, "license": "ISC", "dependencies": { "isexe": "^2.0.0" diff --git a/package.json b/package.json index 73666ee..21cb72c 100644 --- a/package.json +++ b/package.json @@ -20,12 +20,10 @@ "@netflix/nerror": "^1.1.3", "ansi": "^0.3.1", "bplist-parser": "^0.3.2", - "cross-spawn": "^7.0.6", "elementtree": "^0.1.7", "endent": "^2.1.0", "fast-glob": "^3.3.3", "plist": "^3.1.0", - "q": "^1.5.1", "strip-bom": "^4.0.0" }, "devDependencies": { diff --git a/spec/superspawn.spec.js b/spec/superspawn.spec.js deleted file mode 100644 index 13e0206..0000000 --- a/spec/superspawn.spec.js +++ /dev/null @@ -1,127 +0,0 @@ -/** - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ - -const path = require('path'); -const superspawn = require('../src/superspawn'); - -const LS = process.platform === 'win32' ? 'dir' : 'ls'; - -describe('spawn method', function () { - let progressSpy; - - beforeEach(function () { - progressSpy = jasmine.createSpy('progress'); - }); - - it('should resolve on success', () => { - return expectAsync(superspawn.spawn(LS)).toBeResolved(); - }); - - it('should reject on failure', () => { - return expectAsync(superspawn.spawn('invalid_command')).toBeRejected(); - }); - - it('Test 002 : should notify about stdout "data" events', () => { - return superspawn.spawn(LS, [], { stdio: 'pipe' }) - .progress(progressSpy) - .then(function () { - expect(progressSpy).toHaveBeenCalledWith({ stdout: jasmine.any(String) }); - }); - }); - - it('Test 003 : should notify about stderr "data" events', () => { - return superspawn.spawn(LS, ['doesnt-exist'], { stdio: 'pipe' }) - .progress(progressSpy) - .then(() => { - fail('Expected promise to be rejected'); - }, () => { - expect(progressSpy).toHaveBeenCalledWith({ stderr: jasmine.any(String) }); - }); - }); - - it('Test 004 : reject handler should pass in Error object with stdout and stderr properties', () => { - const cp = require('child_process'); - spyOn(cp, 'spawn').and.callFake(() => { - return { - stdout: { - setEncoding: function () {}, - on: function (evt, handler) { - // some sample stdout output - handler('business as usual'); - } - }, - stderr: { - setEncoding: function () {}, - on: function (evt, handler) { - // some sample stderr output - handler('mayday mayday'); - } - }, - on: function (evt, handler) { - // What's passed to handler here is the exit code, so we can control - // resolve/reject flow via this argument. - handler(1); // this will trigger error flow - }, - removeListener: function () {} - }; - }); - return superspawn.spawn('this aggression', ['will', 'not', 'stand', 'man'], {}) - .then(() => { - fail('Expected promise to be rejected'); - }, err => { - expect(err).toBeDefined(); - expect(err.stdout).toContain('usual'); - expect(err.stderr).toContain('mayday'); - }); - }); - - it('Test 005 : should not throw but reject', () => { - if (process.platform === 'win32') { - pending('Test should not run on Windows'); - } - - // Our non-executable (as in no execute permission) script - const TEST_SCRIPT = path.join(__dirname, 'fixtures/echo-args.cmd'); - - let promise; - expect(() => { promise = superspawn.spawn(TEST_SCRIPT, []); }).not.toThrow(); - - return promise.then(() => { - fail('Expected promise to be rejected'); - }, err => { - expect(err).toEqual(jasmine.any(Error)); - expect(err.code).toBe('EACCES'); - }); - }); - - describe('operation on windows', () => { - const TEST_SCRIPT = path.join(__dirname, 'fixtures/echo-args.cmd'); - const TEST_ARGS = ['install', 'foo@^1.2.3', 'c o r d o v a']; - - it('should escape arguments if `cmd` is not an *.exe', () => { - if (process.platform !== 'win32') { - pending('test should only run on windows'); - } - - return superspawn.spawn(TEST_SCRIPT, TEST_ARGS).then(output => { - expect(output.split(/\r?\n/)).toEqual(TEST_ARGS); - }); - }); - }); -}); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org