Skip to content

Commit

Permalink
chore: build with typescript instead of babel
Browse files Browse the repository at this point in the history
  • Loading branch information
boneskull committed May 24, 2023
1 parent 3ac264a commit cbaf17f
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .mocharc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
require: ['@babel/register'],
require: ['ts-node/register'],
forbidOnly: Boolean(process.env.CI)
};
25 changes: 0 additions & 25 deletions babel.config.json

This file was deleted.

4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env node
// transpile:main
import {install} from 'source-map-support';
install();

import * as driver from './lib/driver';
import * as androidHelperIndex from './lib/android-helpers';
import * as commandIndex from './lib/commands/index';
Expand Down
2 changes: 1 addition & 1 deletion lib/android-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Bootstrap from './bootstrap';
import B from 'bluebird';
import ADB from 'appium-adb';
import {
default as unlocker, PIN_UNLOCK, PIN_UNLOCK_KEY_EVENT,
unlocker, PIN_UNLOCK, PIN_UNLOCK_KEY_EVENT,
PASSWORD_UNLOCK, PATTERN_UNLOCK, FINGERPRINT_UNLOCK
} from './unlock-helpers';
import { EOL } from 'os';
Expand Down
3 changes: 3 additions & 0 deletions lib/stubs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module 'appium-adb';
declare module 'shared-preferences-builder';
declare module 'io.appium.settings';
35 changes: 22 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"CHANGELOG.md"
],
"dependencies": {
"@babel/runtime": "^7.0.0",
"appium-adb": "^9.11.2",
"appium-chromedriver": "^5.2.0",
"asyncbox": "^2.8.0",
Expand All @@ -60,21 +59,23 @@
"moment-timezone": "^0.5.26",
"portfinder": "^1.0.6",
"portscanner": "2.2.0",
"semver": "^7.0.0",
"shared-preferences-builder": "^0.x",
"sharp": "^0.x",
"semver": "^7.0.0",
"source-map-support": "^0.x",
"teen_process": "^2.0.0",
"ws": "^8.0.0"
},
"scripts": {
"build": "rimraf build && babel --out-dir=build/lib lib && babel --out-dir=build index.js",
"build": "tsc -b",
"clean": "npm run build -- --clean",
"dev": "npm run build -- --watch",
"lint": "eslint .",
"lint:fix": "npm run lint -- --fix",
"precommit-msg": "echo 'Pre-commit checks...' && exit 0",
"precommit-lint": "lint-staged",
"prepare": "npm run build",
"prepare": "npm run rebuild",
"rebuild": "npm run clean && npm run build",
"test": "mocha --exit --timeout 1m \"./test/unit/**/*-specs.js\"",
"e2e-test": "mocha --exit --timeout 10m \"./test/functional/**/*-specs.js\""
},
Expand All @@ -86,20 +87,27 @@
"appium": "^2.0.0-beta.40"
},
"devDependencies": {
"@appium/support": "^4.0.0",
"@appium/eslint-config-appium": "^6.0.0",
"@appium/support": "^4.0.0",
"@appium/test-support": "^3.0.0",
"@babel/cli": "^7.18.10",
"@babel/core": "^7.18.10",
"@babel/eslint-parser": "^7.18.9",
"@babel/plugin-transform-runtime": "^7.18.10",
"@babel/preset-env": "^7.18.10",
"@babel/register": "^7.18.9",
"@appium/tsconfig": "^0.3.0",
"@appium/types": "^0.11.1",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/git": "^10.0.1",
"@types/bluebird": "^3.5.38",
"@types/chai": "^4.3.5",
"@types/chai-as-promised": "^7.1.5",
"@types/lodash": "^4.14.194",
"@types/mocha": "^10.0.1",
"@types/node": "^20.2.3",
"@types/portscanner": "^2.1.1",
"@types/semver": "^7.5.0",
"@types/sinon": "^10.0.15",
"@types/source-map-support": "^0.5.6",
"@types/teen_process": "^2.0.0",
"@types/ws": "^8.5.4",
"@xmldom/xmldom": "^0.x",
"android-apidemos": "^4.1.0",
"babel-plugin-source-map-support": "^2.2.0",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"conventional-changelog-conventionalcommits": "^5.0.0",
Expand All @@ -110,11 +118,12 @@
"eslint-plugin-promise": "^6.0.0",
"lint-staged": "^13.0.3",
"mocha": "^10.0.0",
"mock-fs": "^5.0.0",
"pre-commit": "^1.1.3",
"rimraf": "^5.0.0",
"semantic-release": "^20.0.2",
"sinon": "^15.0.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4",
"xpath": "^0.x"
}
}
2 changes: 0 additions & 2 deletions test/functional/bootstrap/bootstrap-e2e-specs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// transpile :mocha

import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { AndroidBootstrap, COMMAND_TYPES } from '../../../lib/bootstrap';
Expand Down
2 changes: 0 additions & 2 deletions test/functional/bootstrap/uiautomator-e2e-specs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// transpile :mocha

import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { UiAutomator } from '../../../lib/uiautomator';
Expand Down
2 changes: 0 additions & 2 deletions test/unit/bootstrap/bootstrap-specs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// transpile :mocha

import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { AndroidBootstrap, COMMAND_TYPES } from '../../../lib/bootstrap';
Expand Down
2 changes: 0 additions & 2 deletions test/unit/bootstrap/uiautomator-specs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// transpile :mocha

import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import sinon from 'sinon';
Expand Down
13 changes: 13 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@appium/tsconfig/tsconfig.json",
"compilerOptions": {
"outDir": "build",
"types": ["node", "mocha", "chai", "chai-as-promised", "sinon"]
},
"include": [
"index.js",
"lib",
"test"
]
}

0 comments on commit cbaf17f

Please sign in to comment.