Skip to content

Commit 6f67beb

Browse files
feat!: Migrate the package to ESM (#312)
BREAKING CHANGE: Consumers using require('node-simctl') must switch to import/dynamic import() — the package no longer ships a CommonJS entry point.
1 parent 7172d3e commit 6f67beb

32 files changed

Lines changed: 87 additions & 76 deletions

lib/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Simctl} from './simctl';
1+
import {Simctl} from './simctl.js';
22
export type {
33
SimctlOpts,
44
DeviceInfo,
@@ -7,7 +7,7 @@ export type {
77
CertOptions,
88
XCRun,
99
AppInfo,
10-
} from './types';
10+
} from './types.js';
1111

1212
export {Simctl};
1313
export default Simctl;

lib/logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import appiumLogger from '@appium/logger';
1+
import {log as appiumLogger} from '@appium/logger';
22

33
export const LOG_PREFIX = 'simctl';
44

lib/simctl.ts

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
import which from 'which';
2-
import {log, LOG_PREFIX} from './logger';
3-
import {DEFAULT_EXEC_TIMEOUT, getXcrunBinary} from './helpers';
2+
import {log, LOG_PREFIX} from './logger.js';
3+
import {DEFAULT_EXEC_TIMEOUT, getXcrunBinary} from './helpers.js';
44
import {exec as tpExec, SubProcess} from 'teen_process';
5-
import * as addmediaCommands from './subcommands/addmedia';
6-
import * as appinfoCommands from './subcommands/appinfo';
7-
import * as bootCommands from './subcommands/boot';
8-
import * as bootstatusCommands from './subcommands/bootstatus';
9-
import * as createCommands from './subcommands/create';
10-
import * as deleteCommands from './subcommands/delete';
11-
import * as eraseCommands from './subcommands/erase';
12-
import * as getappcontainerCommands from './subcommands/get_app_container';
13-
import * as installCommands from './subcommands/install';
14-
import * as ioCommands from './subcommands/io';
15-
import * as keychainCommands from './subcommands/keychain';
16-
import * as launchCommands from './subcommands/launch';
17-
import * as listCommands from './subcommands/list';
18-
import * as openurlCommands from './subcommands/openurl';
19-
import * as pbcopyCommands from './subcommands/pbcopy';
20-
import * as pbpasteCommands from './subcommands/pbpaste';
21-
import * as privacyCommands from './subcommands/privacy';
22-
import * as pushCommands from './subcommands/push';
23-
import * as envCommands from './subcommands/getenv';
24-
import * as shutdownCommands from './subcommands/shutdown';
25-
import * as spawnCommands from './subcommands/spawn';
26-
import * as terminateCommands from './subcommands/terminate';
27-
import * as uiCommands from './subcommands/ui';
28-
import * as uninstallCommands from './subcommands/uninstall';
29-
import * as locationCommands from './subcommands/location';
30-
import type {XCRun, ExecOpts, SimctlOpts, ExecResult} from './types';
5+
import * as addmediaCommands from './subcommands/addmedia.js';
6+
import * as appinfoCommands from './subcommands/appinfo.js';
7+
import * as bootCommands from './subcommands/boot.js';
8+
import * as bootstatusCommands from './subcommands/bootstatus.js';
9+
import * as createCommands from './subcommands/create.js';
10+
import * as deleteCommands from './subcommands/delete.js';
11+
import * as eraseCommands from './subcommands/erase.js';
12+
import * as getappcontainerCommands from './subcommands/get_app_container.js';
13+
import * as installCommands from './subcommands/install.js';
14+
import * as ioCommands from './subcommands/io.js';
15+
import * as keychainCommands from './subcommands/keychain.js';
16+
import * as launchCommands from './subcommands/launch.js';
17+
import * as listCommands from './subcommands/list.js';
18+
import * as openurlCommands from './subcommands/openurl.js';
19+
import * as pbcopyCommands from './subcommands/pbcopy.js';
20+
import * as pbpasteCommands from './subcommands/pbpaste.js';
21+
import * as privacyCommands from './subcommands/privacy.js';
22+
import * as pushCommands from './subcommands/push.js';
23+
import * as envCommands from './subcommands/getenv.js';
24+
import * as shutdownCommands from './subcommands/shutdown.js';
25+
import * as spawnCommands from './subcommands/spawn.js';
26+
import * as terminateCommands from './subcommands/terminate.js';
27+
import * as uiCommands from './subcommands/ui.js';
28+
import * as uninstallCommands from './subcommands/uninstall.js';
29+
import * as locationCommands from './subcommands/location.js';
30+
import type {XCRun, ExecOpts, SimctlOpts, ExecResult} from './types.js';
3131

3232
const SIMCTL_ENV_PREFIX = 'SIMCTL_CHILD_';
3333

lib/subcommands/addmedia.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {Simctl} from '../simctl';
1+
import type {Simctl} from '../simctl.js';
22
import type {TeenProcessExecResult} from 'teen_process';
33

44
/**

lib/subcommands/appinfo.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type {Simctl} from '../simctl';
2-
import type {AppInfo} from '../types';
3-
import {convertPlistToJson} from '../helpers';
1+
import type {Simctl} from '../simctl.js';
2+
import type {AppInfo} from '../types.js';
3+
import {convertPlistToJson} from '../helpers.js';
44

55
/**
66
* Get information about an app installed on the simulator

lib/subcommands/boot.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {log, LOG_PREFIX} from '../logger';
2-
import type {Simctl} from '../simctl';
1+
import {log, LOG_PREFIX} from '../logger.js';
2+
import type {Simctl} from '../simctl.js';
33

44
/**
55
* Boot the particular Simulator if it is not running.

lib/subcommands/bootstatus.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {log, LOG_PREFIX} from '../logger';
1+
import {log, LOG_PREFIX} from '../logger.js';
22
import {waitForCondition} from 'asyncbox';
3-
import type {Simctl} from '../simctl';
4-
import type {BootMonitorOptions} from '../types';
3+
import type {Simctl} from '../simctl.js';
4+
import type {BootMonitorOptions} from '../types.js';
55
import type {SubProcess} from 'teen_process';
66

77
/**

lib/subcommands/create.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import {log, LOG_PREFIX} from '../logger';
1+
import {log, LOG_PREFIX} from '../logger.js';
22
import {retryInterval} from 'asyncbox';
3-
import {SIM_RUNTIME_NAME, normalizeVersion} from '../helpers';
4-
import type {Simctl} from '../simctl';
5-
import type {SimCreationOpts} from '../types';
3+
import {SIM_RUNTIME_NAME, normalizeVersion} from '../helpers.js';
4+
import type {Simctl} from '../simctl.js';
5+
import type {SimCreationOpts} from '../types.js';
66

77
const SIM_RUNTIME_NAME_SUFFIX_IOS = 'iOS';
88
const DEFAULT_CREATE_SIMULATOR_TIMEOUT = 10000;

lib/subcommands/delete.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {Simctl} from '../simctl';
1+
import type {Simctl} from '../simctl.js';
22

33
/**
44
* Delete the particular Simulator from available devices list.

lib/subcommands/erase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {retryInterval} from 'asyncbox';
2-
import type {Simctl} from '../simctl';
2+
import type {Simctl} from '../simctl.js';
33

44
/**
55
* Reset the content and settings of the particular Simulator.

0 commit comments

Comments
 (0)