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`
This commit is contained in:
Christopher Hiller
2022-03-31 13:54:09 -07:00
parent c8227d8ab8
commit f33b87bbf9
31 changed files with 562 additions and 205 deletions
+21 -10
View File
@@ -1,20 +1,31 @@
{
"exclude": ["packages/**/test/**", "packages/**/build/**"],
"compilerOptions": {
"baseUrl": "./packages",
"paths": {
"@appium/support": ["support"],
"@appium/base-driver": ["base-driver"],
"appium": ["appium"],
"@appium/types": ["types"]
},
"noEmit": true
"@appium/schema": ["schema"],
"@appium/support": ["support"],
"@appium/types": ["types"],
"appium": ["appium"]
}
},
"exclude": ["packages/**/test/**", "packages/**/build/**"],
"files": [],
"references": [
{"path": "packages/types"},
{"path": "packages/support"},
{"path": "packages/base-driver"},
{"path": "packages/appium"}
{
"path": "packages/types"
},
{
"path": "packages/support"
},
{
"path": "packages/base-driver"
},
{
"path": "packages/appium"
},
{
"path": "packages/schema"
}
]
}