Commit Graph

831 Commits

Author SHA1 Message Date
Jonathan Lipps 04d2b385d2 chore(appium-monorepo): reorder clean scripts so reinstall works
cc @boneskull see my comment on previous commit
2022-04-12 08:46:51 -07:00
Renovate Bot d0f29bda28 chore(): update dependency webdriverio to v7.19.4 2022-04-12 12:41:26 +00:00
Jonathan Lipps f971aa9f1c chore(appium-monorepo): fix preversion script by removing schema reference 2022-04-07 16:09:06 -07:00
Christopher Hiller f33b87bbf9 chore(appium,types,schema): create @appium/schema
`@appium/schema` is a package which was extracted from `appium`.  It _only_ contains the schema.  The impetus here was to avoid cyclical dependencies, since `appium` depends on `@appium/types`, and `@appium/types` depends on the schema.  This package breaks the cycle.

The `scripts/generate-schema-json.js` (which converts the compiled JS schema file into JSON) has moved into this package, and the generated JSON file is now under version control.  This is because the `generate-schema-types.js` script (previously `generate-schema-declarations`) depends on it, and `@appium/types` depends on the generated types.  The generated types are _also_ under version control.  I do not expect the schema to change often, so I believe the tradeoff to be worth it.

## @appium/schema

`lib/appium-config-schema.js` is the "single source of truth" for the schema.

## appium

- Removed schema source
- Removed namespaces from internal types because they suck (see change to `types/index.d.ts`)
- Removed unused `continuation-local-storage`
- Add dep for `@appium/schema`
- Added a TS project dependency on `@appium/schema`

## @appium/types

- The "sources" have moved from `src` to `lib` for consistency.
- `lib/appium-config.ts` (the generated types) are now under version control.
- `lib/schema/` has been removed (it previously held the JSON schema artifact)
- `scripts/generate-schema-declarations.js` becomes `scripts/generate-schema-types.js`
- Updated scripts in `package.json`
- Added dep for `@appium/schema`
- Added a TS project dependency on `@appium/schema`

## Other

- Reorganize root `tsconfig.json`; add `schema` reference; remove unused `noEmit: true`
- Sort root `package.json`
- Remove schema JSON and schema declarations scripts, since those are now both handled in their respective packages
- Remove `lint-staged` config for schema file, since it didn't work right anyway (still need to do something about this, but probably doesn't need to be in a precommit hook)
- Remove stuff from `.gitignore`
2022-04-07 14:05:41 -07:00
Renovate Bot 02706de19d chore(gulp-plugins): update babel monorepo to v7.17.9 2022-04-07 14:51:07 +00:00
Renovate Bot bc36b8dfcc chore(gulp-plugins): update dependency eslint-plugin-import to v2.26.0 2022-04-06 13:39:35 +00:00
Renovate Bot 919d55d1cb chore(gulp-plugins): update dependency fancy-log to v2 2022-04-04 15:25:38 -07:00
renovate[bot] d23907def5 chore: update dependency webdriverio to v7 (#15489)
* chore(): update dependency webdriverio to v7

* chore(fake-driver,appium): upgrade webdriverio to latest

- fixed broken tests in `@appium/fake-driver` and `appium`
- remove unused `appium-base-driver` from root of monorepo

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Christopher Hiller <boneskull@boneskull.com>
2022-04-04 15:14:59 -07:00
Renovate Bot 3f388b935a chore(): update dependency @types/base64-stream to v1.0.2 2022-04-01 23:31:46 +00:00
Renovate Bot a91d283128 chore(support): update dependency type-fest to v2.12.2 2022-04-01 11:55:17 +00:00
Christopher Hiller 7a028c8d9a chore: add types for teen_process
which magically appeared. thanks definitelytyped!
2022-03-30 14:43:21 -07:00
Jonathan Lipps 54f1308a36 chore: fix reinstall script and clean ordering 2022-03-29 17:46:16 -07:00
Christopher Hiller 7498a7ab90 chore: add a script to sync LICENSE files across packages
This will be run before publish, and will copy the root `LICENSE` file to all packages, so that they appear in the published tarballs.

`packages/*/LICENSE` are ignored by Git, since they are redundant with the root `LICENSE` file.
2022-03-29 15:54:55 -07:00
Renovate Bot 25fab42940 chore(test-support): update dependency sinon to v13 2022-03-28 11:28:31 -07:00
Renovate Bot 6cf1590a2d chore(): update dependency @types/json-schema to v7.0.11 2022-03-26 17:39:51 +00:00
Renovate Bot 9b6565b3ba chore(gulp-plugins): update dependency eslint-plugin-promise to v6 2022-03-25 15:25:20 -07:00
Christopher Hiller 72085caa0a feat(types): add new @appium/types package
This changes the TS configuration to to a) emit declarations for supported packages, and b) build declarations incrementally by package.

To begin, we are targeting `appium`, `@appium/base-driver` and `@appium/support` for declarations; these three are intended to be published with declarations generated via their JS.

Both `@appium/support` and `appium` are fully typechecked (sans implicit `any` types), but `@appium/base-driver` is mostly not.  Regardless, declarations are generated for all three.

Each package will have its own `tsconfig.json` which "inherits" from `config/tsconfig.base.json`.  Each will also need to declare relative paths to dependencies. e.g., the `appium` package must configure its `tsconfig.json` so that it depends on the declarations of `@appium/support` and also where to find `@appium/support`. Essentially, a small dependency tree gets built, and those at the "root" get their declarations built first; then the consumers use those declarations.

Also reorganized some scripts and added `npm-run-all` to help and added a "typecheck" job to CI.

Since `npm install` will build, it's pretty inconvenient to have `npm` abort installation if the build fails.  In that case, if any of the build steps fail (see `build:loose`) the installation will continue.  Added a `prepublishOnly` which runs a build in "strict" mode where everything must pass.

_Note: there's still a strong coupling of "what `BaseDriver` provides" and "what an external driver *may* provide".  It's unclear to me if this is a problem, though there seem to be a handful of methods that external drivers *must* implement.  The easiest way to get around this would probably be to extract these required properties and methods into their own interface (duplication) if we cannot otherwise declare methods as "abstract".  As it stands, the `Driver` is basically just `BaseDriver`._

Also:

- Moved some configuration types out of `appium` and into here, since they are used both by `appium` and `base-driver` via `DriverOpts`
- Split `Driver` type into "the thing that BaseDriver is" and "all the other methods external drivers can implement"
- Added missing `proxyCommand` method
- Better generics for `LogType`
- Remove unused `Constructor` type
- Better types for `getSession`/`getSessions`
- Added util `Class` type
- Added many missing typings from DefinitelyTyped
- Added `ts-node` for `@wdio/types` (I need to send a PR to webdriver to eliminate this dependency)
- Type checks in their CI step
2022-03-25 14:54:45 -07:00
Renovate Bot 4ff63e2425 chore(): update dependency serve-static to v1.15.0 2022-03-25 14:43:56 +00:00
Renovate Bot 075eaeb8ce chore(): update dependency typescript to v4.6.3 2022-03-25 09:30:00 +00:00
Renovate Bot 1a73ac0b75 chore(): update dependency finalhandler to v1.2.0 2022-03-23 10:34:34 +00:00
Renovate Bot 9fb03950d6 chore(gulp-plugins): update dependency mocha to v9.2.2 2022-03-22 14:08:48 +00:00
Renovate Bot c8ee934718 chore(): update dependency type-fest to v2.12.1 2022-03-19 15:24:03 +00:00
Renovate Bot 0b4dad2f4c chore(): update dependency eslint-find-rules to v4.1.0 2022-03-19 14:06:16 +00:00
Renovate Bot 799fb87be3 chore(gulp-plugins): update babel monorepo to v7.17.8 2022-03-19 11:13:48 +00:00
Renovate Bot 43d36bb60c chore(): update dependency lint-staged to v12.3.7 2022-03-18 15:17:24 +00:00
Renovate Bot ad0814532b chore(): update dependency @types/json-schema to v7.0.10 2022-03-17 12:35:15 +00:00
Renovate Bot 3add8c0906 chore(gulp-plugins): update dependency eslint-plugin-import to v2.25.4 2022-03-16 18:14:37 +00:00
Renovate Bot 3648ed017b chore(gulp-plugins): update dependency @types/node to v16.11.26 2022-03-16 16:43:48 +00:00
Renovate Bot 11fb7c1a2e chore(): update dependency lint-staged to v12.3.6 2022-03-16 13:29:50 +00:00
Renovate Bot 297a307725 chore(gulp-plugins): update babel monorepo to v7.17.7 2022-03-16 10:55:01 +00:00
Renovate Bot 84eb71fb0f chore(): update dependency serve-static to v1.14.2 2022-03-14 14:26:50 +00:00
Renovate Bot d1e0043e37 chore(): update dependency lint-staged to v12.3.5 2022-03-14 11:13:28 +00:00
Renovate Bot b57115b2f0 chore(): update dependency chai to v4.3.6 2022-03-13 16:37:42 +00:00
Renovate Bot 3a6b3c7788 chore(): update dependency appium-base-driver to v7.11.3 2022-03-13 14:34:57 +00:00
Renovate Bot 92d7359763 chore(): update dependency @types/sinon-chai to v3.2.8 2022-03-13 12:23:56 +00:00
Renovate Bot 9fc213aa7d chore(): update dependency @types/sinon to v10.0.11 2022-03-13 11:06:12 +00:00
Renovate Bot c5560ab238 chore(): update dependency @types/chai-as-promised to v7.1.5 2022-03-12 18:37:49 +00:00
Renovate Bot adcc2a28e9 chore(): update dependency @appium/fake-plugin to v1.3.1 2022-03-12 16:57:57 +00:00
Renovate Bot 94fe0f2ef8 chore(): update babel monorepo 2022-03-12 14:36:43 +00:00
Christopher Hiller 4b9bfb35aa chore: add directory prop to repository prop of package.json
I think npm uses this to link to the correct path of the package in a monorepo.
2022-03-10 11:10:35 -08:00
Christopher Hiller c653d2cf3b chore: lint the code once per build action
Previously, every version of Node.js would run eslint, which is redundant
2022-03-10 10:52:02 -08:00
Christopher Hiller a80e4b85a4 chore: use proper version of typescript 2022-03-09 14:50:45 -08:00
Christopher Hiller 868517b6f4 chore: remove gulp from appium package (#16459)
This change removes `gulp` and replaces it with plain ol' `babel` and `mocha`.

## `appium`

- No gulp.
- `test/` has been re-organized.  All test files now end in the extension `.spec.js`, which is a recognized convention and understood by editors/IDEs.  The tests are further split into `unit` and `e2e` subdirs.  This makes working with both `babel` and `mocha` easier.
- The tests are _not_ run against the transpiled code; code is now transpiled on-the-fly via `@babel/register`. This only affects `appium`.
- `commands-yml/validator.js` moved to `scripts/parse-yml-commands.js`. It has been rewritten as a CJS module.  `commands-yml/` should not contain `.js` files.
- `test/setup.js` is a new test harness specific to Appium, which loads & configures `@babel/register`.  Eventually, the contents of this file can be moved into the root monorepo's `test/setup.js`, but the rest of the packages do not need `@babel/register`, so we avoid the overhead.

## `@appium/gulp-plugins`

- Unfortunately, due to the new `npm test` strategy (see below), we cannot use the `nyan` reporter.  Or rather, we _can_, but will not see the animation.  So the reporter is now set to default to `spec`.
- Modified tests so they didn't overwrite the actual `build` dir with transpiled fixtures, which is what was happening. This was causing failures depending on the transpile/test order.

## All Packages

- All packages now have their own `build`, `test`, `test:e2e` and `dev` (just build + watch mode) npm scripts. This makes running a complete build easier, since each package can now provide its own appropriate command.  This is _mostly_ just `gulp once` (where `gulp` was used before), except for `appium`, where `@babel/cli` is used directly.
- This is what happens when `npm test` is run from the monorepo (in order):
    1. All packages are built (in parallel) by running `npm run build` in each folder (via `lerna`). See `pretest`
    2. All code is linted directly via `eslint`.
    3. All _unit tests_ are run w/ `npm test` in each folder, having assumed transpilation already occurred (if necessary).
- `npm run e2e-test` runs the `npm run test:e2e` in each folder. No transpilation occurs! Careful.
- All scripts are expected to live in `packages/*/scripts`, and this directory enforces CJS via ESLint.  `postinstall.js` moved, as well as `check-npm-pack-files.js`. `generate-schema-declarations.mjs` moved from the root `scripts/` dir into `packages/appium/scripts/`; it's now CJS instead of ESM.
- I had profiled running various things with `lerna run --parallel`, but it turns out this is not faster.  I'm not sure why, but I think it may have something to do with streaming STDOUT/STDERR, or potentially the overhead of running child processes outweighs the time it takes to actually run tests and builds.
- The behavior of `lerna run` now mimicks `lerna exec`, which was "run stuff in serial, streaming the output". The default behavior of `lerna run` is "run stuff in parallel, buffering the output".  Buffered output sucks, and streaming the output from all tasks at once creates chaos.  To override this behavior, you'll see `--parallel --concurrency=8 --prefix` for tasks that can truly be parallelized, like transpilation.  The number 8 is the "maximum", and CI usually won't have more than 2 cores available anyway.
- When run in CI, Mocha runs with `--forbid-only`, which will fail if there's an `.only()` somewhere in the tests. Further, it forces color output.

## Etc.

- Updated Wallaby config, `.gitignore`, `.eslintignore`.
- Sorted `package.json` files
- Removed `watch` and `coverage` scripts which were broken anyway.

chore(appium): fix schema json path issues

- the path to the JSON schema is now correct: `lib/appium-config-schema.json`
- add `log-symbols` to devdeps for niceness. this is already a transitive dep
2022-03-09 14:50:45 -08:00
Christopher Hiller 1954021af9 chore: typescript updates
- Upgrade TS to `next` tag.  It's "safe" to use using bleeding-edge TS here since we don't actually use it to compile anything
- Add a bunch of missing types: `find-root`, `klaw`, `lockfile`, `mv`, `ncp`, `rimraf`
2022-03-09 14:50:45 -08:00
Mykola Mokhnach 16b2e8f14b chore: Switch @dabh/colors to @colors/colors (#16539) 2022-03-09 18:51:24 +01:00
Renovate Bot 2ed1fa8abc chore(): update dependency lint-staged to v12 2022-02-24 14:28:30 -08:00
Jonathan Lipps 555b93bf55 refactor!(support): move opencv related functionality into its own package 2022-01-21 08:52:36 -08:00
Mykola Mokhnach 40a6f054dc fix: Switch colors package to a non-compomised repository (#16317) 2022-01-11 06:45:13 +01:00
Renovate Bot bc86e2800e chore(): update dependency @types/chai to v4.3.0 2021-12-08 10:48:48 +00:00
Renovate Bot 25087c3ee0 chore(gulp-plugins): update dependency @types/node to v16.11.12 2021-12-07 11:30:18 +00:00