Skip to content

Commit 8ae2b64

Browse files
feat: Integrate oxc and release configs (#32)
1 parent 5cc2885 commit 8ae2b64

15 files changed

Lines changed: 84 additions & 145 deletions

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
max_line_length = 120
12+
13+
[*.md]
14+
trim_trailing_whitespace = false

.github/workflows/unit-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ jobs:
3939
- run: npm run lint
4040
name: Run linter
4141
- run: npm run format:check
42-
name: Run Prettier check
42+
name: Run format check
4343
- run: npm run test
4444
name: Run unit tests

.releaserc

Lines changed: 0 additions & 37 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 0 additions & 15 deletions
This file was deleted.

lib/devicectl.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import {exec, SubProcess} from 'teen_process';
21
import {log as logger} from '@appium/logger';
3-
import type {DevicectlOptions, ExecuteOptions, ExecuteResult} from './types.js';
4-
import * as processMixins from './mixins/process.js';
5-
import * as infoMixins from './mixins/info.js';
2+
import {exec, SubProcess} from 'teen_process';
3+
64
import * as copyMixins from './mixins/copy.js';
5+
import * as infoMixins from './mixins/info.js';
76
import * as listMixins from './mixins/list.js';
7+
import * as processMixins from './mixins/process.js';
8+
import type {DevicectlOptions, ExecuteOptions, ExecuteResult} from './types.js';
89

910
const XCRUN = 'xcrun';
1011
const LOG_TAG = 'Devicectl';
@@ -55,10 +56,7 @@ export class Devicectl {
5556
* @param opts - Execution options
5657
* @returns Promise that resolves to the command result
5758
*/
58-
async execute<T extends ExecuteOptions>(
59-
subcommand: string[],
60-
opts?: T,
61-
): Promise<ExecuteResult<T>> {
59+
async execute<T extends ExecuteOptions>(subcommand: string[], opts?: T): Promise<ExecuteResult<T>> {
6260
const {
6361
logStdout = false,
6462
asynchronous = false,
@@ -72,9 +70,7 @@ export class Devicectl {
7270
const finalArgs = ['devicectl', ...subcommand, ...(noDevice ? [] : ['--device', this.udid])];
7371

7472
if (subcommandOptions && subcommandOptions.length > 0) {
75-
finalArgs.push(
76-
...(Array.isArray(subcommandOptions) ? subcommandOptions : [subcommandOptions]),
77-
);
73+
finalArgs.push(...(Array.isArray(subcommandOptions) ? subcommandOptions : [subcommandOptions]));
7874
}
7975

8076
if (asJson) {

lib/mixins/copy.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type {ListFilesOptions, PullFileOptions} from '../types.js';
21
import type {Devicectl} from '../devicectl.js';
2+
import type {ListFilesOptions, PullFileOptions} from '../types.js';
33

44
/**
55
* Lists files at a specified path on the device
@@ -30,12 +30,7 @@ export async function listFiles(
3030
/**
3131
* Pulls a file from the specified path on the device to a local file system
3232
*/
33-
export async function pullFile(
34-
this: Devicectl,
35-
from: string,
36-
to: string,
37-
opts: PullFileOptions,
38-
): Promise<string> {
33+
export async function pullFile(this: Devicectl, from: string, to: string, opts: PullFileOptions): Promise<string> {
3934
const subcommandOptions = [
4035
'--domain-type',
4136
opts.domainType,

lib/mixins/info.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type {AppInfo, ProcessInfo} from '../types.js';
21
import type {Devicectl} from '../devicectl.js';
2+
import type {AppInfo, ProcessInfo} from '../types.js';
33

44
/**
55
* Retrieves the list of installed apps from the device

lib/mixins/list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type {DeviceInfo} from '../types.js';
21
import type {Devicectl} from '../devicectl.js';
2+
import type {DeviceInfo} from '../types.js';
33

44
/**
55
* Retrieves the list of connected device infos.

lib/mixins/process.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type {LaunchAppOptions, ProcessInfo, TerminateAppOptions} from '../types.js';
21
import type {Devicectl} from '../devicectl.js';
2+
import type {LaunchAppOptions, ProcessInfo, TerminateAppOptions} from '../types.js';
33

44
/**
55
* Simulates memory warning for the process with the given PID
@@ -28,11 +28,7 @@ export async function sendSignalToProcess(
2828
* This method is over devicectl command, this it may take additional seconds to launch the app.
2929
* Please use via WDA or via appium-ios-device as primary method to launch app if possible.
3030
*/
31-
export async function launchApp(
32-
this: Devicectl,
33-
bundleId: string,
34-
opts: LaunchAppOptions = {},
35-
): Promise<void> {
31+
export async function launchApp(this: Devicectl, bundleId: string, opts: LaunchAppOptions = {}): Promise<void> {
3632
const {env, terminateExisting = false} = opts;
3733

3834
const subcommandOptions: string[] = [];
@@ -44,9 +40,7 @@ export async function launchApp(
4440
if (env && Object.keys(env).length > 0) {
4541
subcommandOptions.push(
4642
'--environment-variables',
47-
JSON.stringify(
48-
Object.fromEntries(Object.entries(env).map(([key, value]) => [key, String(value)])),
49-
),
43+
JSON.stringify(Object.fromEntries(Object.entries(env).map(([key, value]) => [key, String(value)]))),
5044
);
5145
}
5246

@@ -112,10 +106,7 @@ export function escapeProcessFilterValue(value: string): string {
112106
return value.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
113107
}
114108

115-
async function listProcessesForAppPath(
116-
devicectl: Devicectl,
117-
appPath: string,
118-
): Promise<ProcessInfo[]> {
109+
async function listProcessesForAppPath(devicectl: Devicectl, appPath: string): Promise<ProcessInfo[]> {
119110
const filter = `executable.path BEGINSWITH "${escapeProcessFilterValue(appPath)}"`;
120111
const {stdout} = await devicectl.execute(['device', 'info', 'processes'], {
121112
subcommandOptions: ['--filter', filter],

oxfmt.config.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import appiumConfig, {defineConfig, ignorePatterns} from '@appium/oxc-config/oxfmt';
2+
3+
export default defineConfig({
4+
...appiumConfig,
5+
ignorePatterns: [...ignorePatterns],
6+
});

0 commit comments

Comments
 (0)