Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// transpile:main
import {getPath, getVersion, getMaxIOSSDK, getMaxTVOSSDK, getClangVersion} from './xcode';
import {getPath, getVersion, getMaxIOSSDK, getMaxTVOSSDK, getClangVersion} from './xcode.js';

const xcode = {
getPath,
Expand All @@ -12,4 +11,4 @@ const xcode = {
export {getPath, getVersion, getMaxIOSSDK, getMaxTVOSSDK, getClangVersion};
export default xcode;

export type {XcodeVersion} from './types';
export type {XcodeVersion} from './types.js';
6 changes: 6 additions & 0 deletions lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
export interface XcodeVersion {
/** The Xcode version as a string, e.g. '10.0' or '10.0.1' */
versionString: string;
/** The Xcode version as a float, e.g. 10.0 or 10.1 */
versionFloat: number;
/** The major version number, e.g. 10 */
major: number;
/** The minor version number, e.g. 1 */
minor: number;
/** The patch version number, if present in the version string */
patch?: number;
/** Returns {@link versionString} */
toString(): string;
}
6 changes: 3 additions & 3 deletions lib/xcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import path from 'node:path';
import {retry} from 'asyncbox';
import {exec} from 'teen_process';
import * as semver from 'semver';
import {runXcrunCommand, findAppPaths, XCRUN_TIMEOUT, readXcodePlist} from './helpers';
import type {XcodeVersion} from './types';
import {runXcrunCommand, findAppPaths, XCRUN_TIMEOUT, readXcodePlist} from './helpers.js';
import type {XcodeVersion} from './types.js';

const DEFAULT_NUMBER_OF_RETRIES = 2;
const XCODE_BUNDLE_ID = 'com.apple.dt.Xcode';
Expand Down Expand Up @@ -44,7 +44,7 @@ export async function getPathFromXcodeSelect(timeout: number = XCRUN_TIMEOUT): P
const msg =
`Cannot determine the path to Xcode by running 'xcode-select -p' command. ` +
`Original error: ${stderr || message}`;
throw new Error(msg);
throw new Error(msg, {cause: e});
}
// trim and remove trailing slash
const developerRoot = String(stdout).replace(/\/$/, '').trim();
Expand Down
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
"format": "prettier -w ./lib ./test",
"format:check": "prettier --check ./lib ./test",
"prepare": "npm run build",
"test": "node --test --test-timeout=60000 \"./build/test/unit/**/*.spec.js\"",
"e2e-test": "node --test --test-force-exit --test-concurrency=1 --test-timeout=300000 \"./build/test/e2e/**/*.spec.js\""
"test": "node --enable-source-maps --test --test-timeout=60000 \"./build/test/unit/**/*.spec.js\"",
"e2e-test": "node --enable-source-maps --test --test-force-exit --test-concurrency=1 --test-timeout=300000 \"./build/test/e2e/**/*.spec.js\""
},
"prettier": {
"bracketSpacing": false,
Expand All @@ -63,5 +63,13 @@
"prettier": "^3.9.3",
"semantic-release": "^25.0.2",
"typescript": "^6.0.2"
},
"type": "module",
"exports": {
".": {
"types": "./build/lib/index.d.ts",
"import": "./build/lib/index.js"
},
"./package.json": "./package.json"
}
}
2 changes: 1 addition & 1 deletion test/e2e/xcode.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {fs, util} from '@appium/support';
import assert from 'node:assert/strict';
import * as xcode from '../../lib/xcode';
import * as xcode from '../../lib/xcode.js';
import {describe, it} from 'node:test';

// on slow machines and busy CI systems these can be slow and flakey
Expand Down
2 changes: 1 addition & 1 deletion test/unit/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from 'node:assert/strict';
import xcode from '../../lib/index';
import xcode from '../../lib/index.js';
import {describe, it} from 'node:test';

describe('index', function () {
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"outDir": "build",
"types": ["node"],
"checkJs": true,
"strict": true
"strict": true,
"module": "NodeNext",
"moduleResolution": "NodeNext"
},
"include": [
"lib",
Expand Down