From 3c32112c20cbbd870e0cccb1503f40b9421b28c7 Mon Sep 17 00:00:00 2001 From: Christopher Hiller Date: Fri, 2 Dec 2022 13:45:15 -0800 Subject: [PATCH] chore: use tsc for compilation across the board - `@appium/gulp-plugins` does not use `tsc` and continues to use...whatever it uses. - `@appium/doctor` now has generated declarations, though I didn't bother to do anything with the types - rewrote swaths of build scripts: - removed the `fix` and `lint` scripts from each workspace (package) since I don't think they get used and they are of limited value - for tests and autoinstallation of extensions, added `ts-node` for on-the-fly compilation - workspaces _can_ define their own `build` and `clean` scripts (both should be required if either is used). these do not currently get run when running `npm run dev`, but they do occur on a bare `npm install` from the monorepo root or a `npm run reinstall`. - `npm run rebuild` does a fresh rebuild, but does not clean any `node_modules` dirs nor does it reinstall anything. - removed `prepublishOnly` since `preversion` does the same thing - `npm test` now runs `build`/`lint` in parallel - postinstall script of `appium` ("autoinstall") script now must call `npm run build` if in a fresh dev environment. this is because a) lifecycle scripts of packages run before lifecycle scripts in the monorepo root, and b) `postinstall` runs before `prepare`. so there's really no way around it; even using `ts-node` fails because other modules depend on `@appium/support/index.js` which expects the pkg to be built. Closes #17746 Closes #17807 --- babel.config.json | 32 ---- config/tsconfig.base.json | 1 - package-lock.json | 168 +----------------- package.json | 47 +++-- packages/appium/package.json | 11 +- .../appium/scripts/autoinstall-extensions.js | 100 ++++++++--- packages/appium/tsconfig.json | 3 +- packages/base-driver/package.json | 5 - packages/base-plugin/package.json | 5 - packages/doctor/package.json | 7 - packages/doctor/tsconfig.json | 13 ++ packages/docutils/package.json | 7 - packages/driver-test-support/package.json | 5 - packages/eslint-config-appium/package.json | 1 - packages/execute-driver-plugin/package.json | 5 - packages/fake-driver/package.json | 5 - packages/fake-plugin/package.json | 5 - packages/gulp-plugins/package.json | 1 + packages/images-plugin/package.json | 5 - packages/opencv/package.json | 5 - packages/plugin-test-support/package.json | 5 - packages/relaxed-caps-plugin/package.json | 5 - packages/schema/package.json | 9 +- packages/support/package.json | 5 - packages/test-support/package.json | 5 - packages/typedoc-plugin-appium/package.json | 5 - packages/typedoc-plugin-appium/tsconfig.json | 1 - packages/types/package.json | 9 +- packages/universal-xml-plugin/package.json | 5 - test/setup.js | 7 +- tsconfig.json | 6 + 31 files changed, 128 insertions(+), 365 deletions(-) delete mode 100644 babel.config.json create mode 100644 packages/doctor/tsconfig.json diff --git a/babel.config.json b/babel.config.json deleted file mode 100644 index e45baa7c0..000000000 --- a/babel.config.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "presets": [ - [ - "@babel/preset-env", - { - "targets": { - "node": "14" - }, - "shippedProposals": true - } - ] - ], - "plugins": ["source-map-support"], - "comments": false, - "sourceMaps": true, - "env": { - "coverage": { - "plugins": [ - [ - "istanbul", - { - "exclude": ["test", "build"] - } - ] - ] - }, - "test": { - "retainLines": true, - "comments": true - } - } -} diff --git a/config/tsconfig.base.json b/config/tsconfig.base.json index e05eafc4d..3fc8cc33a 100644 --- a/config/tsconfig.base.json +++ b/config/tsconfig.base.json @@ -6,7 +6,6 @@ "composite": true, "declaration": true, "declarationMap": true, - "emitDeclarationOnly": true, "module": "CommonJS", "moduleResolution": "node", "resolveJsonModule": true, diff --git a/package-lock.json b/package-lock.json index c9db61804..aafa9be92 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,10 +13,6 @@ ], "devDependencies": { "@appium/fake-plugin": "1.3.1", - "@babel/cli": "7.19.3", - "@babel/core": "7.20.5", - "@babel/preset-env": "7.20.2", - "@babel/register": "7.18.9", "@colors/colors": "1.5.0", "@commitlint/cli": "17.3.0", "@commitlint/config-conventional": "17.3.0", @@ -30,8 +26,6 @@ "@types/teen_process": "2.0.0", "@types/ws": "8.5.3", "asyncbox": "2.9.4", - "babel-plugin-istanbul": "6.1.1", - "babel-plugin-source-map-support": "2.2.0", "chai": "4.3.7", "chai-as-promised": "7.1.1", "chai-webdriverio-async": "2.7.0", @@ -64,6 +58,7 @@ "sinon-chai": "3.7.0", "sync-monorepo-packages": "1.0.1", "through2": "4.0.2", + "ts-node": "10.9.1", "typedoc": "0.23.21", "typedoc-plugin-markdown": "3.14.0", "typedoc-plugin-resolve-crossmodule-references": "0.3.2", @@ -169,34 +164,6 @@ "resolved": "packages/universal-xml-plugin", "link": true }, - "node_modules/@babel/cli": { - "version": "7.19.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.8", - "commander": "^4.0.1", - "convert-source-map": "^1.1.0", - "fs-readdir-recursive": "^1.1.0", - "glob": "^7.2.0", - "make-dir": "^2.1.0", - "slash": "^2.0.0" - }, - "bin": { - "babel": "bin/babel.js", - "babel-external-helpers": "bin/babel-external-helpers.js" - }, - "engines": { - "node": ">=6.9.0" - }, - "optionalDependencies": { - "@nicolo-ribaudo/chokidar-2": "2.1.8-no-fsevents.3", - "chokidar": "^3.4.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/code-frame": { "version": "7.18.6", "license": "MIT", @@ -1574,24 +1541,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/register": { - "version": "7.18.9", - "dev": true, - "license": "MIT", - "dependencies": { - "clone-deep": "^4.0.1", - "find-cache-dir": "^2.0.0", - "make-dir": "^2.1.0", - "pirates": "^4.0.5", - "source-map-support": "^0.5.16" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/runtime": { "version": "7.20.1", "license": "MIT", @@ -4259,12 +4208,6 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, - "node_modules/@nicolo-ribaudo/chokidar-2": { - "version": "2.1.8-no-fsevents.3", - "dev": true, - "license": "MIT", - "optional": true - }, "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": { "version": "5.1.1-v1", "license": "MIT", @@ -7616,14 +7559,6 @@ "node": ">= 0.8" } }, - "node_modules/commander": { - "version": "4.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, "node_modules/common-ancestor-path": { "version": "1.0.1", "dev": true, @@ -10107,86 +10042,6 @@ "version": "2.0.0", "license": "MIT" }, - "node_modules/find-cache-dir": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "commondir": "^1.0.1", - "make-dir": "^2.0.0", - "pkg-dir": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/find-cache-dir/node_modules/find-up": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/find-cache-dir/node_modules/locate-path": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/find-cache-dir/node_modules/p-limit": { - "version": "2.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/find-cache-dir/node_modules/p-locate": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/find-cache-dir/node_modules/path-exists": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/find-cache-dir/node_modules/pkg-dir": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/find-up": { "version": "5.0.0", "license": "MIT", @@ -10606,11 +10461,6 @@ "xtend": "~4.0.1" } }, - "node_modules/fs-readdir-recursive": { - "version": "1.1.0", - "dev": true, - "license": "MIT" - }, "node_modules/fs.realpath": { "version": "1.0.0", "license": "ISC" @@ -18864,14 +18714,6 @@ "node": ">=0.10.0" } }, - "node_modules/pirates": { - "version": "4.0.5", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, "node_modules/pixelmatch": { "version": "4.0.2", "license": "ISC", @@ -20691,14 +20533,6 @@ "node": ">=8" } }, - "node_modules/slash": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/slice-ansi": { "version": "5.0.0", "dev": true, diff --git a/package.json b/package.json index bdf213e60..fa5ef7d4b 100644 --- a/package.json +++ b/package.json @@ -27,42 +27,42 @@ "packages/*" ], "scripts": { - "build": "run-s build:types build:distfiles", - "build:distfiles": "lerna run build", - "build:types": "tsc -b", - "clean": "run-s clean:artifacts clean:packages clean:monorepo", - "clean:artifacts": "run-s clean:distfiles clean:types && npx rimraf \"packages/*/build\"", - "clean:distfiles": "npx rimraf \"packages/*/build/**/*.js\"", - "clean:monorepo": "npx rimraf node_modules", - "clean:packages": "lerna clean -y", - "clean:types": "tsc -b --clean", - "dev": "run-p dev:*", - "dev:distfiles": "lerna run dev", - "dev:types": "tsc -b --watch", + "build": "tsc -b", + "build:all": "run-s build build:packages", + "build:packages": "lerna run build", + "clean": "run-s \"clean:artifacts:*\" clean:workspaces", + "clean:artifacts": "run-p \"clean:artifacts:*\"", + "clean:artifacts:distfiles": "run-s \"build -- --clean\"", + "clean:artifacts:packages": "lerna run clean || true", + "clean:workspaces": "lerna clean -y", + "ci": "npm ci", + "dev": "run-s \"build -- --watch\"", "doctor": "node ./packages/doctor", - "generate-docs": "lerna run --scope=appium generate-docs", - "prepare": "husky install && npm run build:types || true", + "husky-install": "husky install", + "generate-docs": "npm run --workspace=packages/appium generate-docs", + "prepare": "run-p husky-install build:all || true", "lint": "eslint .", - "lint:fix": "npm run lint -- --fix", + "lint:fix": "run-s \"lint -- --fix\"", "lint:commit": "commitlint", "lint:staged": "lint-staged", - "prepublishOnly": "run-s clean:artifacts build sync-pkgs", - "reinstall": "run-s clean && npm ci", - "rebuild:types": "run-s clean:types build:types", + "prepublishOnly": "run-s rebuild", + "reinstall": "run-s clean ci", + "rebuild": "run-s clean:artifacts build:all", "start": "appium", "sync-pkgs": "run-p sync-pkgs:*", "sync-pkgs:appium-readme": "sync-monorepo-packages --force --no-package-json --packages=packages/appium README.md", "sync-pkgs:common-fields": "sync-monorepo-packages --fields=author,license,bugs,homepage,engines", "sync-pkgs:keywords": "sync-monorepo-packages --field=keywords --packages=\"packages/*\" --packages=\"!packages/eslint-config-appium\" --packages=\"!packages/types\"", "sync-pkgs:license": "sync-monorepo-packages --force --no-package-json LICENSE", - "test": "run-s build test:unit lint", + "stage-synced-pkgs": "git add -A packages/appium/README.md \"packages/*/package.json\"", + "test": "npm-run-all -p lint build -s test:unit", "test:ci": "run-s test:smoke test:unit test:e2e", "test:e2e": "lerna run --concurrency=1 --max-buffer=128 test:e2e", "test:smoke": "smoker --all test:smoke", "test:unit": "lerna run test", "typedoc": "typedoc --logLevel Verbose", "upload": "gulp github-upload", - "preversion": "run-s clean:artifacts build sync-pkgs && git add -A packages/appium/README.md packages/*/package.json", + "preversion": "run-s rebuild sync-pkgs stage-synced-pkgs", "zip": "zip -qr ./appium.zip ./packages/appium", "zip-and-upload": "run-s zip upload" }, @@ -73,10 +73,6 @@ }, "devDependencies": { "@appium/fake-plugin": "1.3.1", - "@babel/cli": "7.19.3", - "@babel/core": "7.20.5", - "@babel/preset-env": "7.20.2", - "@babel/register": "7.18.9", "@colors/colors": "1.5.0", "@commitlint/cli": "17.3.0", "@commitlint/config-conventional": "17.3.0", @@ -90,8 +86,6 @@ "@types/teen_process": "2.0.0", "@types/ws": "8.5.3", "asyncbox": "2.9.4", - "babel-plugin-istanbul": "6.1.1", - "babel-plugin-source-map-support": "2.2.0", "chai": "4.3.7", "chai-as-promised": "7.1.1", "chai-webdriverio-async": "2.7.0", @@ -124,6 +118,7 @@ "sinon-chai": "3.7.0", "sync-monorepo-packages": "1.0.1", "through2": "4.0.2", + "ts-node": "10.9.1", "typedoc": "0.23.21", "typedoc-plugin-markdown": "3.14.0", "typedoc-plugin-resolve-crossmodule-references": "0.3.2", diff --git a/packages/appium/package.json b/packages/appium/package.json index e3f0e12a7..e9e15c90c 100644 --- a/packages/appium/package.json +++ b/packages/appium/package.json @@ -41,19 +41,14 @@ "types" ], "scripts": { - "build": "exit 0", "build:docs": "node docs/scripts/build-docs.js", - "build:docs:cli": "node docs/scripts/gen-cli-args-docs.js", "build:docs:assets": "node docs/scripts/copy-assets.js", - "dev": "npm run build -- --watch", + "build:docs:cli": "node docs/scripts/gen-cli-args-docs.js", "dev:docs": "npm run build:docs:assets && npm run dev:docs:en", "dev:docs:en": "mkdocs serve -f ./docs/mkdocs-en.yml", "dev:docs:ja": "mkdocs serve -f ./docs/mkdocs-ja.yml", "dev:docs:zh": "mkdocs serve -f ./docs/mkdocs-zh.yml", - "fix": "npm run lint -- --fix", "postinstall": "node ./scripts/autoinstall-extensions.js", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "tsc -b", "publish:docs": "cross-env APPIUM_DOCS_PUBLISH=1 npm run build:docs", "test": "npm run test:unit", "test:e2e": "mocha --timeout 1m --slow 30s \"./test/e2e/**/*.spec.js\"", @@ -107,8 +102,8 @@ "access": "public", "tag": "next" }, + "gitHead": "5c7af8ee73078018e4ec52fccf19fe3f77249d72", "typedoc": { "entryPoint": "./build/lib/main.js" - }, - "gitHead": "5c7af8ee73078018e4ec52fccf19fe3f77249d72" + } } diff --git a/packages/appium/scripts/autoinstall-extensions.js b/packages/appium/scripts/autoinstall-extensions.js index cde1156cb..dad84a261 100755 --- a/packages/appium/scripts/autoinstall-extensions.js +++ b/packages/appium/scripts/autoinstall-extensions.js @@ -14,10 +14,24 @@ * code upon failure (which will typically break a build). Otherwise, it * will always exit with code 0, even if errors occur. * + * @module * @example * `npm install -g appium --drivers=uiautomator2,xcuitest --plugins=images` */ +const path = require('path'); +const {exec} = require('teen_process'); +const B = require('bluebird'); + +B.config({ + cancellation: true, +}); + +/** + * This is only used if we're actually in the monorepo + */ +const MONOREPO_ROOT = path.join(__dirname, '..', '..', '..'); + /** @type {import('../lib/cli/extension').runExtensionCommand} */ let runExtensionCommand; /** @type {import('../lib/constants').DRIVER_TYPE} */ @@ -27,44 +41,82 @@ let PLUGIN_TYPE; /** @type {import('../lib/extension').loadExtensions} */ let loadExtensions; -const {env, util, logger} = require('@appium/support'); const _ = require('lodash'); const wrap = _.partial( require('wrap-ansi'), _, - process.stderr.columns ?? process.stdout.columns ?? 25 + process.stderr.columns ?? process.stdout.columns ?? 80 ); - const ora = require('ora'); -const log = (message) => { +let env, util, logger; + +function log(message) { console.error(wrap(`[Appium] ${message}`)); -}; +} -const spinner = ora({ - text: 'Checking Appium installation...', - prefixText: '[Appium]', -}).start(); +async function init() { + /** @type {import('ora').Ora} */ + let spinner; -try { - ({runExtensionCommand} = require('../build/lib/cli/extension')); - ({DRIVER_TYPE, PLUGIN_TYPE} = require('../build/lib/constants')); - ({loadExtensions} = require('../build/lib/extension')); - spinner.succeed('Appium installation OK'); - // suppress logs from Appium, which mess up the script output - logger.getLogger('Appium').level = 'error'; -} catch (e) { - spinner.fail(`Could not load required module(s); has Appium been built? (${e.message})`); - if (process.env.CI) { - console.error('Detected CI environment, exiting with code 1'); - process.exitCode = 1; - } else { - process.exitCode = 0; + try { + ({env, util, logger} = require('@appium/support')); + require('..'); + } catch { + spinner = ora({ + text: 'Building Appium dev environment...', + prefixText: '[Appium]', + }).start(); + + try { + const {stderr, code} = await exec('npm', ['run', 'build'], { + cwd: MONOREPO_ROOT, + encoding: 'utf8', + }); + if (!code) { + spinner.succeed('Appium build successfully.'); + } else { + spinner.fail(`Building Appium failed!`); + log(stderr); + } + } catch (err) { + spinner.fail(`Building Appium failed!`); + log(err); + } } - process.exit(); + + spinner = ora({ + text: 'Checking Appium installation...', + prefixText: '[Appium]', + }).start(); + + try { + ({env, util, logger} = require('@appium/support')); + ({runExtensionCommand} = require('../build/lib/cli/extension')); + ({DRIVER_TYPE, PLUGIN_TYPE} = require('../build/lib/constants')); + ({loadExtensions} = require('../build/lib/extension')); + spinner.succeed('Appium installation OK'); + // suppress logs from Appium, which mess up the script output + logger.getLogger('Appium').level = 'error'; + } catch (e) { + spinner.fail(`Could not load required module(s); has Appium been built? (${e.message})`); + if (process.env.CI) { + log('Detected CI environment, exiting with code 1'); + process.exitCode = 1; + } else { + process.exitCode = 0; + } + return false; + } + + return true; } async function main() { + if (!(await init())) { + return; + } + // if we're doing `npm install -g appium` then we will assume we don't have a local appium. if (!process.env.npm_config_global && (await env.hasAppiumDependency())) { log(`Found local Appium installation; skipping automatic installation of extensions.`); diff --git a/packages/appium/tsconfig.json b/packages/appium/tsconfig.json index 9d2802b9a..b4c651ca9 100644 --- a/packages/appium/tsconfig.json +++ b/packages/appium/tsconfig.json @@ -11,8 +11,7 @@ "@appium/schema": ["../schema"], "appium": ["."] }, - "checkJs": true, - "emitDeclarationOnly": false + "checkJs": true }, "include": ["lib", "types"], "references": [ diff --git a/packages/base-driver/package.json b/packages/base-driver/package.json index 4c78b4465..6ccf1110c 100644 --- a/packages/base-driver/package.json +++ b/packages/base-driver/package.json @@ -35,11 +35,6 @@ "build" ], "scripts": { - "build": "babel lib --source-maps --root-mode=upward --out-dir=build/lib", - "dev": "npm run build -- --watch", - "fix": "npm run lint -- --fix", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "npm run build", "test": "npm run test:unit", "test:e2e": "mocha --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"", "test:smoke": "node ./index.js", diff --git a/packages/base-plugin/package.json b/packages/base-plugin/package.json index 89db54230..409e128b4 100644 --- a/packages/base-plugin/package.json +++ b/packages/base-plugin/package.json @@ -23,11 +23,6 @@ "index.js" ], "scripts": { - "build": "babel lib --source-maps --root-mode=upward --out-dir=build/lib", - "dev": "npm run build -- --watch", - "fix": "npm run lint -- --fix", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "npm run build", "test": "npm run test:unit", "test:smoke": "node ./index.js", "test:unit": "mocha \"./test/unit/**/*.spec.js\"" diff --git a/packages/doctor/package.json b/packages/doctor/package.json index e13def1ec..9a152a03d 100644 --- a/packages/doctor/package.json +++ b/packages/doctor/package.json @@ -37,13 +37,6 @@ "build" ], "scripts": { - "build:lib": "babel lib --source-maps --root-mode=upward --out-dir=build/lib", - "build:bin": "babel bin --source-maps --root-mode=upward --out-dir=build/bin", - "build": "run-s build:*", - "dev": "run-p \"build:lib -- --watch\" \"build:bin -- --watch\"", - "fix": "npm run lint -- --fix", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "npm run build", "test": "npm run test:unit", "test:smoke": "node ./build/lib/index.js", "test:unit": "mocha \"./test/unit/**/*.spec.js\"" diff --git a/packages/doctor/tsconfig.json b/packages/doctor/tsconfig.json new file mode 100644 index 000000000..be79c5fa6 --- /dev/null +++ b/packages/doctor/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../config/tsconfig.base.json", + "compilerOptions": { + "outDir": "build", + "paths": { + "@appium/support": ["../support"], + }, + }, + "include": ["lib", "bin"], + "references": [ + {"path": "../support"} + ] +} diff --git a/packages/docutils/package.json b/packages/docutils/package.json index 921018000..f17a2062c 100644 --- a/packages/docutils/package.json +++ b/packages/docutils/package.json @@ -34,13 +34,6 @@ "build" ], "scripts": { - "build": "npm run build:sources && npm run build:test", - "build:sources": "babel lib --source-maps --root-mode=upward --out-dir=build/lib", - "build:test": "babel test --source-maps --root-mode=upward --out-dir=build/test --copy-files", - "dev": "npm run build:sources -- --watch", - "fix": "npm run lint -- --fix", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "npm run build", "test": "npm run test:unit", "test:e2e": "echo \"No e2e tests for this package\"", "test:smoke": "node ./index.js", diff --git a/packages/driver-test-support/package.json b/packages/driver-test-support/package.json index 65af93ef2..760a84c1d 100644 --- a/packages/driver-test-support/package.json +++ b/packages/driver-test-support/package.json @@ -33,11 +33,6 @@ "build" ], "scripts": { - "build": "babel lib --root-mode=upward --source-maps --out-dir=build/lib", - "dev": "npm run build -- --watch", - "fix": "npm run lint -- --fix", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "npm run build", "test": "npm run test:unit", "test:smoke": "node ./index.js", "test:unit": "mocha \"test/unit/**/*.spec.js\"" diff --git a/packages/eslint-config-appium/package.json b/packages/eslint-config-appium/package.json index 276a0d43d..8e7002258 100644 --- a/packages/eslint-config-appium/package.json +++ b/packages/eslint-config-appium/package.json @@ -27,7 +27,6 @@ "eslint:find:current-rules": "eslint-find-rules -c", "eslint:find:plugin-rules": "eslint-find-rules -p", "eslint:find:unused-rules": "eslint-find-rules -u -n", - "lint": "eslint index.js", "test:smoke": "node ./index.js" }, "peerDependencies": { diff --git a/packages/execute-driver-plugin/package.json b/packages/execute-driver-plugin/package.json index 8f2656c5c..c7cfec47f 100644 --- a/packages/execute-driver-plugin/package.json +++ b/packages/execute-driver-plugin/package.json @@ -29,11 +29,6 @@ "index.js" ], "scripts": { - "build": "babel lib --source-maps --root-mode=upward --out-dir=build/lib", - "dev": "npm run build -- --watch", - "fix": "npm run lint -- --fix", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "npm run build", "test": "npm run test:unit", "test:e2e": "mocha -t 160s --slow 20s \"./test/e2e/**/*.spec.js\"", "test:smoke": "node ./index.js", diff --git a/packages/fake-driver/package.json b/packages/fake-driver/package.json index 7cb074e7e..685fd1f8d 100644 --- a/packages/fake-driver/package.json +++ b/packages/fake-driver/package.json @@ -36,11 +36,6 @@ "test/fixtures" ], "scripts": { - "build": "babel lib --source-maps --root-mode=upward --out-dir=build/lib --copy-files", - "dev": "npm run build -- --watch", - "fix": "npm run lint -- --fix", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "npm run build", "test": "npm run test:unit", "test:e2e": "mocha --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"", "test:smoke": "node ./build/lib/index.js", diff --git a/packages/fake-plugin/package.json b/packages/fake-plugin/package.json index 1cb005ab9..9b222e77f 100644 --- a/packages/fake-plugin/package.json +++ b/packages/fake-plugin/package.json @@ -23,11 +23,6 @@ "build" ], "scripts": { - "build": "babel lib --source-maps --root-mode=upward --out-dir=build/lib", - "dev": "npm run build -- --watch", - "fix": "npm run lint -- --fix", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "npm run build", "test": "npm run test:unit", "test:smoke": "node ./index.js", "test:unit": "mocha \"./test/unit/**/*.spec.js\"" diff --git a/packages/gulp-plugins/package.json b/packages/gulp-plugins/package.json index 8c36bc29e..d0e8f464b 100644 --- a/packages/gulp-plugins/package.json +++ b/packages/gulp-plugins/package.json @@ -35,6 +35,7 @@ "build" ], "scripts": { + "clean": "npx rimraf build", "dev": "gulp dev --no-notif", "build": "gulp transpile", "prepare": "npm run build", diff --git a/packages/images-plugin/package.json b/packages/images-plugin/package.json index 9dad968e7..22988fba3 100644 --- a/packages/images-plugin/package.json +++ b/packages/images-plugin/package.json @@ -29,11 +29,6 @@ "index.js" ], "scripts": { - "build": "babel lib --source-maps --root-mode=upward --out-dir=build/lib", - "dev": "npm run build -- --watch", - "fix": "npm run lint -- --fix", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "npm run build", "test": "npm run test:unit", "test:e2e": "mocha --timeout 40s --slow 20s \"./test/e2e/**/*.spec.js\"", "test:smoke": "node ./index.js", diff --git a/packages/opencv/package.json b/packages/opencv/package.json index 545e660b8..93849440d 100644 --- a/packages/opencv/package.json +++ b/packages/opencv/package.json @@ -33,11 +33,6 @@ "build" ], "scripts": { - "build": "babel lib --source-maps --root-mode=upward --out-dir=build/lib", - "dev": "npm run build -- --watch", - "fix": "npm run lint -- --fix", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "npm run build", "test": "npm run test:unit", "test:e2e": "mocha --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"", "test:smoke": "node ./index.js", diff --git a/packages/plugin-test-support/package.json b/packages/plugin-test-support/package.json index f8ffd3652..14beade77 100644 --- a/packages/plugin-test-support/package.json +++ b/packages/plugin-test-support/package.json @@ -34,11 +34,6 @@ "build" ], "scripts": { - "build": "babel lib --root-mode=upward --source-maps --out-dir=build/lib", - "dev": "npm run build -- --watch", - "fix": "npm run lint -- --fix", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "npm run build", "test": "npm run test:unit", "test:smoke": "node ./index.js", "test:unit": "exit 0" diff --git a/packages/relaxed-caps-plugin/package.json b/packages/relaxed-caps-plugin/package.json index a22ae6e47..6c2798dbc 100644 --- a/packages/relaxed-caps-plugin/package.json +++ b/packages/relaxed-caps-plugin/package.json @@ -21,11 +21,6 @@ "build" ], "scripts": { - "build": "babel lib --source-maps --root-mode=upward --out-dir=build/lib", - "dev": "npm run build -- --watch", - "fix": "npm run lint -- --fix", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "npm run build", "test": "npm run test:unit", "test:smoke": "node ./index.js", "test:unit": "mocha \"./test/unit/**/*.spec.js\"" diff --git a/packages/schema/package.json b/packages/schema/package.json index 7d6972db4..9779b9032 100644 --- a/packages/schema/package.json +++ b/packages/schema/package.json @@ -30,13 +30,8 @@ "index.js" ], "scripts": { - "build": "run-s build:*", - "build:distfiles": "babel lib --source-maps --root-mode=upward --out-dir=build", - "build:schema-json": "node ./scripts/generate-schema-json.js", - "dev": "npm run build:distfiles -- --watch", - "fix": "npm run lint -- --fix", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "npm run build", + "build": "node ./scripts/generate-schema-json.js", + "clean": "git checkout -- ./lib/appium-config.schema.json", "test:smoke": "node ./index.js" }, "dependencies": { diff --git a/packages/support/package.json b/packages/support/package.json index b785a6e07..441e1dfb2 100644 --- a/packages/support/package.json +++ b/packages/support/package.json @@ -33,11 +33,6 @@ "build" ], "scripts": { - "build": "babel lib --source-maps --root-mode=upward --out-dir=build/lib", - "dev": "npm run build -- --watch", - "fix": "npm run lint -- --fix", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "npm run build", "test": "npm run test:unit", "test:e2e": "mocha --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"", "test:smoke": "node ./index.js", diff --git a/packages/test-support/package.json b/packages/test-support/package.json index ce6e3a958..80b9809f8 100644 --- a/packages/test-support/package.json +++ b/packages/test-support/package.json @@ -38,11 +38,6 @@ "build" ], "scripts": { - "build": "babel lib --source-maps --root-mode=upward --out-dir=build/lib", - "dev": "npm run build -- --watch", - "fix": "npm run lint -- --fix", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "npm run build", "test": "npm run test:unit", "test:smoke": "node ./index.js", "test:unit": "mocha \"./test/unit/**/*.spec.js\"" diff --git a/packages/typedoc-plugin-appium/package.json b/packages/typedoc-plugin-appium/package.json index 35720fb8e..52b58d65d 100644 --- a/packages/typedoc-plugin-appium/package.json +++ b/packages/typedoc-plugin-appium/package.json @@ -19,11 +19,6 @@ "author": "https://github.com/appium", "types": "./build/plugin.d.ts", "scripts": { - "build": "tsc -b", - "dev": "exit 0", - "fix": "npm run lint -- --fix", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "npm run build", "test": "exit 0", "test:e2e": "exit 0", "test:smoke": "node ./index.js", diff --git a/packages/typedoc-plugin-appium/tsconfig.json b/packages/typedoc-plugin-appium/tsconfig.json index 18bee1426..2ea0fa78d 100644 --- a/packages/typedoc-plugin-appium/tsconfig.json +++ b/packages/typedoc-plugin-appium/tsconfig.json @@ -4,7 +4,6 @@ "rootDir": "lib", "outDir": "build", "strict": true, - "emitDeclarationOnly": false, "module": "CommonJS", "sourceMap": true, "lib": ["ES2022"], diff --git a/packages/types/package.json b/packages/types/package.json index 4c6eff01b..641d07947 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -25,12 +25,9 @@ "index.js" ], "scripts": { - "build": "babel lib --root-mode=upward --out-dir=build/lib && node ./scripts/generate-schema-types.js", - "dev": "npm run build -- --watch", - "fix": "npm run lint -- --fix", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "npm run build", - "test:smoke": "echo 'No smoke test for this package'" + "build": "node ./scripts/generate-schema-types.js", + "clean": "git checkout -- ./types/lib/appium-config.ts", + "test:smoke": "node ./index.js" }, "dependencies": { "@appium/schema": "^0.0.9", diff --git a/packages/universal-xml-plugin/package.json b/packages/universal-xml-plugin/package.json index 1f64b1efd..7ad3e79dc 100644 --- a/packages/universal-xml-plugin/package.json +++ b/packages/universal-xml-plugin/package.json @@ -29,11 +29,6 @@ "lib" ], "scripts": { - "build": "babel lib --source-maps --root-mode=upward --out-dir=build/lib", - "dev": "npm run build -- --watch", - "fix": "npm run lint -- --fix", - "lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .", - "prepare": "npm run build", "test": "npm run test:unit", "test:smoke": "node ./build/lib/index.js", "test:unit": "mocha \"./test/unit/**/*.spec.js\"" diff --git a/test/setup.js b/test/setup.js index ce4e43b86..1cddd98a8 100644 --- a/test/setup.js +++ b/test/setup.js @@ -13,12 +13,7 @@ * */ -// This configures @babel/register to look for a babel config in parent dir(s) of -// wherever the tests are run. This is required if running tests via `mocha` in a package dir -// instead of the monorepo root. This does not affect `gulp-mocha`, since it has its own `.babelrc`. -// This file is required _in addition to_ the monorepo root's `test/setup.js`. - -require('@babel/register')({rootMode: 'upward'}); +require('ts-node').register({transpileOnly: true}); const chai = require('chai'); const chaiAsPromised = require('chai-as-promised'); diff --git a/tsconfig.json b/tsconfig.json index 3ec89de3f..d930f0064 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -64,6 +64,12 @@ }, { "path": "packages/typedoc-plugin-appium" + }, + { + "path": "packages/typedoc-plugin-appium" + }, + { + "path": "packages/doctor" } ] }