From 219e8f9c107c5069acae02261c3af05f48d6bcef Mon Sep 17 00:00:00 2001 From: Erisu Date: Tue, 18 Nov 2025 16:40:10 +0900 Subject: [PATCH 1/2] feat!: remove SimCtlExtensions.log & tail dependency --- lib/simctl-extensions.js | 27 --------------------------- package-lock.json | 14 -------------- package.json | 3 --- test/simctl-extensions.js | 1 - 4 files changed, 45 deletions(-) diff --git a/lib/simctl-extensions.js b/lib/simctl-extensions.js index c64b9e4..e0b607c 100644 --- a/lib/simctl-extensions.js +++ b/lib/simctl-extensions.js @@ -23,9 +23,7 @@ THE SOFTWARE. */ const path = require('path') -const fs = require('fs') const { spawnSync } = require('child_process') -const { Tail } = require('tail') const extensions = { start: function (deviceid) { @@ -78,31 +76,6 @@ const extensions = { // Xcode 8 or older return spawnSync('xcrun', ['instruments', '-w', deviceid]) } - }, - - log: function (deviceid, filepath) { - const tail = new Tail( - path.join(process.env.HOME, 'Library', 'Logs', 'CoreSimulator', deviceid, 'system.log') - ) - - tail.on('line', function (data) { - if (filepath) { - fs.appendFile(filepath, data + '\n', function (error) { - if (error) { - console.error('ERROR: ', error) - throw error - } - }) - } else { - console.log(data) - } - }) - - tail.on('error', function (error) { - console.error('ERROR: ', error) - }) - - return tail } } diff --git a/package-lock.json b/package-lock.json index 0854b8e..486dafc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,9 +8,6 @@ "name": "simctl", "version": "3.0.0-dev", "license": "MIT", - "dependencies": { - "tail": "^2.2.6" - }, "devDependencies": { "@cordova/eslint-config": "^6.0.0" }, @@ -278,7 +275,6 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -946,7 +942,6 @@ "integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -2942,15 +2937,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/tail": { - "version": "2.2.6", - "resolved": "https://registry.npmjs.org/tail/-/tail-2.2.6.tgz", - "integrity": "sha512-IQ6G4wK/t8VBauYiGPLx+d3fA5XjSVagjWV5SIYzvEvglbQjwEcukeYI68JOPpdydjxhZ9sIgzRlSmwSpphHyw==", - "license": "MIT", - "engines": { - "node": ">= 6.0.0" - } - }, "node_modules/tapable": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz", diff --git a/package.json b/package.json index 7aa5442..bb21e5e 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,6 @@ "url": "https://github.com/ios-control/simctl.git" }, "main": "simctl.js", - "dependencies": { - "tail": "^2.2.6" - }, "scripts": { "test": "node --test --experimental-test-coverage", "posttest": "npm run eslint", diff --git a/test/simctl-extensions.js b/test/simctl-extensions.js index 90ea539..62f77b1 100644 --- a/test/simctl-extensions.js +++ b/test/simctl-extensions.js @@ -33,7 +33,6 @@ test('exports', (t) => { t.assert ||= require('node:assert') t.assert.equal(typeof SimCtlExtensions.start, 'function') - t.assert.equal(typeof SimCtlExtensions.log, 'function') }) test('start', async (ctx) => { From 432862e360cc49e7ba2711744811a21621f6d731 Mon Sep 17 00:00:00 2001 From: Erisu Date: Tue, 18 Nov 2025 16:41:47 +0900 Subject: [PATCH 2/2] feat!: restructured launch method 1. Removed 'waitForDebugger' launch param. (Moved to 'options') 2. Added param 'options' for the launch options. Valid Options: - waitForDebugger (boolean) - stderr (string) - path to the log file - stdout (string) - path to the log file - arch (string) --- simctl.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/simctl.js b/simctl.js index 89e2cc2..1b10cd2 100644 --- a/simctl.js +++ b/simctl.js @@ -102,17 +102,27 @@ module.exports = { return spawnSync('xcrun', ['simctl', 'uninstall', device, appIdentifier]) }, - launch: function (waitForDebugger, device, appIdentifier, argv) { + launch: function (device, appIdentifier, argv = [], options = {}) { const args = ['simctl', 'launch'] - if (waitForDebugger) { + if (options.waitForDebugger) { args.push('--wait-for-debugger') } + if (options.stderr) { + args.push(`--stderr=${options.stderr}`) + } + if (options.stdout) { + args.push(`--stderr=${options.stdout}`) + } + if (options.arch) { + args.push(`--arch=${options.arch}`) + } args.push(device) args.push(appIdentifier) + args.push(...argv) - return spawnSync('xcrun', args.concat(argv)) + return spawnSync('xcrun', args) }, spawn: function (waitForDebugger, arch, device, pathToExecutable, argv) {