node-devicectl 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/build/lib/devicectl.d.ts +8 -8
- package/build/lib/devicectl.d.ts.map +1 -1
- package/build/lib/devicectl.js +10 -11
- package/build/lib/devicectl.js.map +1 -1
- package/build/lib/mixins/process.d.ts.map +1 -1
- package/build/lib/mixins/process.js +2 -6
- package/build/lib/mixins/process.js.map +1 -1
- package/lib/devicectl.ts +15 -15
- package/lib/mixins/process.ts +4 -3
- package/package.json +2 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [1.3.0](https://github.com/appium/node-devicectl/compare/v1.2.1...v1.3.0) (2026-04-25)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* Ditch lodash ([#16](https://github.com/appium/node-devicectl/issues/16)) ([0370889](https://github.com/appium/node-devicectl/commit/03708896fca2b4fd706e7665f64c6c7f522be99c))
|
|
6
|
+
|
|
7
|
+
## [1.2.1](https://github.com/appium/node-devicectl/compare/v1.2.0...v1.2.1) (2026-04-10)
|
|
8
|
+
|
|
9
|
+
### Miscellaneous Chores
|
|
10
|
+
|
|
11
|
+
* **deps-dev:** bump typescript from 5.9.3 to 6.0.2 ([#15](https://github.com/appium/node-devicectl/issues/15)) ([9b60022](https://github.com/appium/node-devicectl/commit/9b6002244310ffc318c101cebcc05c897b8f3154))
|
|
12
|
+
|
|
1
13
|
## [1.2.0](https://github.com/appium/node-devicectl/compare/v1.1.5...v1.2.0) (2026-03-20)
|
|
2
14
|
|
|
3
15
|
### Features
|
package/build/lib/devicectl.d.ts
CHANGED
|
@@ -13,6 +13,14 @@ import * as listMixins from './mixins/list';
|
|
|
13
13
|
export declare class Devicectl {
|
|
14
14
|
/** The unique device identifier */
|
|
15
15
|
readonly udid: string;
|
|
16
|
+
sendMemoryWarning: typeof processMixins.sendMemoryWarning;
|
|
17
|
+
sendSignalToProcess: typeof processMixins.sendSignalToProcess;
|
|
18
|
+
launchApp: typeof processMixins.launchApp;
|
|
19
|
+
listProcesses: typeof infoMixins.listProcesses;
|
|
20
|
+
listApps: typeof infoMixins.listApps;
|
|
21
|
+
listFiles: typeof copyMixins.listFiles;
|
|
22
|
+
pullFile: typeof copyMixins.pullFile;
|
|
23
|
+
listDevices: typeof listMixins.listDevices;
|
|
16
24
|
private readonly preferNonRootWhenSudo;
|
|
17
25
|
private readonly sudoUser;
|
|
18
26
|
/**
|
|
@@ -29,14 +37,6 @@ export declare class Devicectl {
|
|
|
29
37
|
* @returns Promise that resolves to the command result
|
|
30
38
|
*/
|
|
31
39
|
execute<T extends ExecuteOptions>(subcommand: string[], opts?: T): Promise<ExecuteResult<T>>;
|
|
32
|
-
sendMemoryWarning: typeof processMixins.sendMemoryWarning;
|
|
33
|
-
sendSignalToProcess: typeof processMixins.sendSignalToProcess;
|
|
34
|
-
launchApp: typeof processMixins.launchApp;
|
|
35
|
-
listProcesses: typeof infoMixins.listProcesses;
|
|
36
|
-
listApps: typeof infoMixins.listApps;
|
|
37
|
-
listFiles: typeof copyMixins.listFiles;
|
|
38
|
-
pullFile: typeof copyMixins.pullFile;
|
|
39
|
-
listDevices: typeof listMixins.listDevices;
|
|
40
40
|
private resolveSudoUser;
|
|
41
41
|
}
|
|
42
42
|
//# sourceMappingURL=devicectl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devicectl.d.ts","sourceRoot":"","sources":["../../lib/devicectl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"devicectl.d.ts","sourceRoot":"","sources":["../../lib/devicectl.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAC,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAM5C;;;;;;GAMG;AACH,qBAAa,SAAS;IACpB,mCAAmC;IACnC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAE7B,iBAAiB,yCAAmC;IACpD,mBAAmB,2CAAqC;IACxD,SAAS,iCAA2B;IAEpC,aAAa,kCAA4B;IACzC,QAAQ,6BAAuB;IAE/B,SAAS,8BAAwB;IACjC,QAAQ,6BAAuB;IAE/B,WAAW,gCAA0B;IAErC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAU;IAChD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkB;IAE3C;;;;OAIG;gBACS,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB;IAMjD;;;;;;OAMG;IACG,OAAO,CAAC,CAAC,SAAS,cAAc,EACpC,UAAU,EAAE,MAAM,EAAE,EACpB,IAAI,CAAC,EAAE,CAAC,GACP,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAkD5B,OAAO,CAAC,eAAe;CAYxB"}
|
package/build/lib/devicectl.js
CHANGED
|
@@ -38,7 +38,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.Devicectl = void 0;
|
|
40
40
|
const teen_process_1 = require("teen_process");
|
|
41
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
42
41
|
const logger_1 = __importDefault(require("@appium/logger"));
|
|
43
42
|
const processMixins = __importStar(require("./mixins/process"));
|
|
44
43
|
const infoMixins = __importStar(require("./mixins/info"));
|
|
@@ -56,6 +55,14 @@ const LOG_TAG = 'Devicectl';
|
|
|
56
55
|
class Devicectl {
|
|
57
56
|
/** The unique device identifier */
|
|
58
57
|
udid;
|
|
58
|
+
sendMemoryWarning = processMixins.sendMemoryWarning;
|
|
59
|
+
sendSignalToProcess = processMixins.sendSignalToProcess;
|
|
60
|
+
launchApp = processMixins.launchApp;
|
|
61
|
+
listProcesses = infoMixins.listProcesses;
|
|
62
|
+
listApps = infoMixins.listApps;
|
|
63
|
+
listFiles = copyMixins.listFiles;
|
|
64
|
+
pullFile = copyMixins.pullFile;
|
|
65
|
+
listDevices = listMixins.listDevices;
|
|
59
66
|
preferNonRootWhenSudo;
|
|
60
67
|
sudoUser;
|
|
61
68
|
/**
|
|
@@ -78,7 +85,7 @@ class Devicectl {
|
|
|
78
85
|
async execute(subcommand, opts) {
|
|
79
86
|
const { logStdout = false, asynchronous = false, asJson = true, noDevice = false, subcommandOptions, timeout, runAsNonRootWhenSudo = this.preferNonRootWhenSudo, } = opts ?? {};
|
|
80
87
|
const finalArgs = ['devicectl', ...subcommand, ...(noDevice ? [] : ['--device', this.udid])];
|
|
81
|
-
if (subcommandOptions &&
|
|
88
|
+
if (subcommandOptions && subcommandOptions.length > 0) {
|
|
82
89
|
finalArgs.push(...(Array.isArray(subcommandOptions) ? subcommandOptions : [subcommandOptions]));
|
|
83
90
|
}
|
|
84
91
|
if (asJson) {
|
|
@@ -95,7 +102,7 @@ class Devicectl {
|
|
|
95
102
|
}
|
|
96
103
|
const execOpts = {
|
|
97
104
|
...userOpts,
|
|
98
|
-
...(
|
|
105
|
+
...(typeof timeout === 'number' ? { timeout } : {}),
|
|
99
106
|
};
|
|
100
107
|
const result = await (0, teen_process_1.exec)(XCRUN, finalArgs, execOpts);
|
|
101
108
|
if (logStdout) {
|
|
@@ -107,14 +114,6 @@ class Devicectl {
|
|
|
107
114
|
throw new Error(`'${cmdStr}' failed. Original error: ${e.stderr || e.stdout || e.message}`);
|
|
108
115
|
}
|
|
109
116
|
}
|
|
110
|
-
sendMemoryWarning = processMixins.sendMemoryWarning;
|
|
111
|
-
sendSignalToProcess = processMixins.sendSignalToProcess;
|
|
112
|
-
launchApp = processMixins.launchApp;
|
|
113
|
-
listProcesses = infoMixins.listProcesses;
|
|
114
|
-
listApps = infoMixins.listApps;
|
|
115
|
-
listFiles = copyMixins.listFiles;
|
|
116
|
-
pullFile = copyMixins.pullFile;
|
|
117
|
-
listDevices = listMixins.listDevices;
|
|
118
117
|
resolveSudoUser() {
|
|
119
118
|
if (!process.geteuid || process.geteuid() !== 0) {
|
|
120
119
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devicectl.js","sourceRoot":"","sources":["../../lib/devicectl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA8C;AAC9C,
|
|
1
|
+
{"version":3,"file":"devicectl.js","sourceRoot":"","sources":["../../lib/devicectl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA8C;AAC9C,4DAAoC;AAEpC,gEAAkD;AAClD,0DAA4C;AAC5C,0DAA4C;AAC5C,0DAA4C;AAE5C,MAAM,KAAK,GAAG,OAAO,CAAC;AACtB,MAAM,OAAO,GAAG,WAAW,CAAC;AAG5B;;;;;;GAMG;AACH,MAAa,SAAS;IACpB,mCAAmC;IACnB,IAAI,CAAS;IAE7B,iBAAiB,GAAG,aAAa,CAAC,iBAAiB,CAAC;IACpD,mBAAmB,GAAG,aAAa,CAAC,mBAAmB,CAAC;IACxD,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC;IAEpC,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;IACzC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;IAE/B,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;IACjC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;IAE/B,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;IAEpB,qBAAqB,CAAU;IAC/B,QAAQ,CAAkB;IAE3C;;;;OAIG;IACH,YAAY,IAAY,EAAE,IAAuB;QAC/C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IA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IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;YACrD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,EAAC,GAAG,EAAE,GAAG,EAAC,CAAC;IACpB,CAAC;CACF;AAtGD,8BAsGC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../../lib/mixins/process.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../../lib/mixins/process.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI5F;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,SAAS,EACf,GAAG,EAAE,MAAM,GAAG,MAAM,EACpB,MAAM,EAAE,MAAM,GAAG,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC,CAIf;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,gBAAqB,GAC1B,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.sendMemoryWarning = sendMemoryWarning;
|
|
7
4
|
exports.sendSignalToProcess = sendSignalToProcess;
|
|
8
5
|
exports.launchApp = launchApp;
|
|
9
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
10
6
|
/**
|
|
11
7
|
* Simulates memory warning for the process with the given PID
|
|
12
8
|
*/
|
|
@@ -34,8 +30,8 @@ async function launchApp(bundleId, opts = {}) {
|
|
|
34
30
|
if (terminateExisting) {
|
|
35
31
|
subcommandOptions.push('--terminate-existing');
|
|
36
32
|
}
|
|
37
|
-
if (
|
|
38
|
-
subcommandOptions.push('--environment-variables', JSON.stringify(
|
|
33
|
+
if (env && Object.keys(env).length > 0) {
|
|
34
|
+
subcommandOptions.push('--environment-variables', JSON.stringify(Object.fromEntries(Object.entries(env).map(([key, value]) => [key, String(value)]))));
|
|
39
35
|
}
|
|
40
36
|
// The bundle id should be the last to apply arguments properly.
|
|
41
37
|
// devicectl command might not raise exception while the order is wrong.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../../lib/mixins/process.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../../lib/mixins/process.ts"],"names":[],"mappings":";;AAMA,8CAIC;AAKD,kDAQC;AAOD,8BA8BC;AAzDD;;GAEG;AACI,KAAK,UAAU,iBAAiB,CAAkB,GAAoB;IAC3E,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,mBAAmB,CAAC,EAAE;QAC7D,iBAAiB,EAAE,CAAC,OAAO,EAAE,GAAG,GAAG,EAAE,CAAC;KACvC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,mBAAmB,CAEvC,GAAoB,EACpB,MAAuB;IAEvB,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE;QAClD,iBAAiB,EAAE,CAAC,UAAU,EAAE,GAAG,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,GAAG,EAAE,CAAC;KAChE,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,SAAS,CAE7B,QAAgB,EAChB,OAAyB,EAAE;IAE3B,MAAM,EAAC,GAAG,EAAE,iBAAiB,GAAG,KAAK,EAAC,GAAG,IAAI,CAAC;IAE9C,MAAM,iBAAiB,GAAa,EAAE,CAAC;IAEvC,IAAI,iBAAiB,EAAE,CAAC;QACtB,iBAAiB,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvC,iBAAiB,CAAC,IAAI,CACpB,yBAAyB,EACzB,IAAI,CAAC,SAAS,CACZ,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CACpF,CACF,CAAC;IACJ,CAAC;IAED,gEAAgE;IAChE,wEAAwE;IACxE,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAEjC,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE;QAClD,iBAAiB;QACjB,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;AACL,CAAC"}
|
package/lib/devicectl.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {exec, SubProcess} from 'teen_process';
|
|
2
|
-
import _ from 'lodash';
|
|
3
2
|
import logger from '@appium/logger';
|
|
4
3
|
import type {DevicectlOptions, ExecuteOptions, ExecuteResult} from './types';
|
|
5
4
|
import * as processMixins from './mixins/process';
|
|
@@ -21,6 +20,19 @@ type SudoUser = {uid: number; gid: number};
|
|
|
21
20
|
export class Devicectl {
|
|
22
21
|
/** The unique device identifier */
|
|
23
22
|
public readonly udid: string;
|
|
23
|
+
|
|
24
|
+
sendMemoryWarning = processMixins.sendMemoryWarning;
|
|
25
|
+
sendSignalToProcess = processMixins.sendSignalToProcess;
|
|
26
|
+
launchApp = processMixins.launchApp;
|
|
27
|
+
|
|
28
|
+
listProcesses = infoMixins.listProcesses;
|
|
29
|
+
listApps = infoMixins.listApps;
|
|
30
|
+
|
|
31
|
+
listFiles = copyMixins.listFiles;
|
|
32
|
+
pullFile = copyMixins.pullFile;
|
|
33
|
+
|
|
34
|
+
listDevices = listMixins.listDevices;
|
|
35
|
+
|
|
24
36
|
private readonly preferNonRootWhenSudo: boolean;
|
|
25
37
|
private readonly sudoUser: SudoUser | null;
|
|
26
38
|
|
|
@@ -58,7 +70,7 @@ export class Devicectl {
|
|
|
58
70
|
|
|
59
71
|
const finalArgs = ['devicectl', ...subcommand, ...(noDevice ? [] : ['--device', this.udid])];
|
|
60
72
|
|
|
61
|
-
if (subcommandOptions &&
|
|
73
|
+
if (subcommandOptions && subcommandOptions.length > 0) {
|
|
62
74
|
finalArgs.push(
|
|
63
75
|
...(Array.isArray(subcommandOptions) ? subcommandOptions : [subcommandOptions]),
|
|
64
76
|
);
|
|
@@ -81,7 +93,7 @@ export class Devicectl {
|
|
|
81
93
|
|
|
82
94
|
const execOpts = {
|
|
83
95
|
...userOpts,
|
|
84
|
-
...(
|
|
96
|
+
...(typeof timeout === 'number' ? {timeout} : {}),
|
|
85
97
|
};
|
|
86
98
|
const result = await exec(XCRUN, finalArgs, execOpts);
|
|
87
99
|
|
|
@@ -95,18 +107,6 @@ export class Devicectl {
|
|
|
95
107
|
}
|
|
96
108
|
}
|
|
97
109
|
|
|
98
|
-
sendMemoryWarning = processMixins.sendMemoryWarning;
|
|
99
|
-
sendSignalToProcess = processMixins.sendSignalToProcess;
|
|
100
|
-
launchApp = processMixins.launchApp;
|
|
101
|
-
|
|
102
|
-
listProcesses = infoMixins.listProcesses;
|
|
103
|
-
listApps = infoMixins.listApps;
|
|
104
|
-
|
|
105
|
-
listFiles = copyMixins.listFiles;
|
|
106
|
-
pullFile = copyMixins.pullFile;
|
|
107
|
-
|
|
108
|
-
listDevices = listMixins.listDevices;
|
|
109
|
-
|
|
110
110
|
private resolveSudoUser(): SudoUser | null {
|
|
111
111
|
if (!process.geteuid || process.geteuid() !== 0) {
|
|
112
112
|
return null;
|
package/lib/mixins/process.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
1
|
import type {LaunchAppOptions} from '../types';
|
|
3
2
|
import type {Devicectl} from '../devicectl';
|
|
4
3
|
|
|
@@ -42,10 +41,12 @@ export async function launchApp(
|
|
|
42
41
|
subcommandOptions.push('--terminate-existing');
|
|
43
42
|
}
|
|
44
43
|
|
|
45
|
-
if (
|
|
44
|
+
if (env && Object.keys(env).length > 0) {
|
|
46
45
|
subcommandOptions.push(
|
|
47
46
|
'--environment-variables',
|
|
48
|
-
JSON.stringify(
|
|
47
|
+
JSON.stringify(
|
|
48
|
+
Object.fromEntries(Object.entries(env).map(([key, value]) => [key, String(value)])),
|
|
49
|
+
),
|
|
49
50
|
);
|
|
50
51
|
}
|
|
51
52
|
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"device",
|
|
9
9
|
"xcode"
|
|
10
10
|
],
|
|
11
|
-
"version": "1.
|
|
11
|
+
"version": "1.3.0",
|
|
12
12
|
"author": "Appium Contributors",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"repository": {
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@appium/logger": "^2.0.0-rc.1",
|
|
38
|
-
"lodash": "^4.2.1",
|
|
39
38
|
"teen_process": "^4.1.0"
|
|
40
39
|
},
|
|
41
40
|
"scripts": {
|
|
@@ -63,7 +62,6 @@
|
|
|
63
62
|
"@semantic-release/changelog": "^6.0.1",
|
|
64
63
|
"@semantic-release/git": "^10.0.1",
|
|
65
64
|
"@types/chai": "^5.2.3",
|
|
66
|
-
"@types/lodash": "^4.14.196",
|
|
67
65
|
"@types/mocha": "^10.0.1",
|
|
68
66
|
"@types/node": "^25.0.3",
|
|
69
67
|
"chai": "^6.0.0",
|
|
@@ -73,6 +71,6 @@
|
|
|
73
71
|
"prettier": "^3.0.0",
|
|
74
72
|
"semantic-release": "^25.0.2",
|
|
75
73
|
"ts-node": "^10.9.1",
|
|
76
|
-
"typescript": "^
|
|
74
|
+
"typescript": "^6.0.2"
|
|
77
75
|
}
|
|
78
76
|
}
|