diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7579d5115..c7a0f9a61 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,7 @@ jobs: - run: npm ci - run: npm run build - run: npm run lint + - run: npm run check-webviews - run: npm run test - run: npm run create-package - name: Upload coverage to Coveralls diff --git a/.vscode/settings.json b/.vscode/settings.json index 275e9b585..9b49f5619 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -21,30 +21,5 @@ "editor.tabSize": 4, "js/ts.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": false, "html.format.unformatted": "wbr,%", - "js/ts.tsdk.path": "node_modules\\typescript\\lib", - "svelte.plugin.svelte.compilerWarnings": { - "a11y-aria-attributes": "ignore", - "a11y-incorrect-aria-attribute-type": "ignore", - "a11y-unknown-aria-attribute": "ignore", - "a11y-hidden": "ignore", - "a11y-misplaced-role": "ignore", - "a11y-unknown-role": "ignore", - "a11y-no-abstract-role": "ignore", - "a11y-no-redundant-roles": "ignore", - "a11y-role-has-required-aria-props": "ignore", - "a11y-accesskey": "ignore", - "a11y-autofocus": "ignore", - "a11y-misplaced-scope": "ignore", - "a11y-positive-tabindex": "ignore", - "a11y-invalid-attribute": "ignore", - "a11y-missing-attribute": "ignore", - "a11y-img-redundant-alt": "ignore", - "a11y-label-has-associated-control": "ignore", - "a11y-media-has-caption": "ignore", - "a11y-distracting-elements": "ignore", - "a11y-structure": "ignore", - "a11y-mouse-events-have-key-events": "ignore", - "a11y-missing-content": "ignore", - "a11y-click-events-have-key-events": "ignore" - }, + "js/ts.tsdk.path": "node_modules\\typescript\\lib" } diff --git a/package.json b/package.json index 5f8dd230f..e1beb37db 100644 --- a/package.json +++ b/package.json @@ -26,12 +26,13 @@ }, "scripts": { "postinstall": "cd webviews && npm install", - "preversion": "npm run build && npm run lint && npm run test && npm run check-extraneous && npm run audit", + "preversion": "npm run build && npm run lint && npm run check-webviews && npm run test && npm run check-extraneous && npm run audit", "vscode:prepublish": "npm run build", "copy-schema": "cpx ./node_modules/brighterscript/bsconfig.schema.json ./dist -L", "build": "npm run copy-schema && tsc -p ./ && npm run build-webviews", "build-webviews": "cd ./webviews && npm run build && cd ..", "lint": "eslint \"./src/**/*.ts\"", + "check-webviews": "cd webviews && npm run check", "audit": "npm audit --audit-level=high || audit-ci --config ./audit-ci.jsonc && cd webviews && npm run audit", "watch": "npm run copy-schema && tsc -w -p ./", "watch-webviews": "cd ./webviews && npm run watch", diff --git a/src/viewProviders/RceManagementViewContract.ts b/src/viewProviders/RceManagementViewContract.ts new file mode 100644 index 000000000..80f8bead4 --- /dev/null +++ b/src/viewProviders/RceManagementViewContract.ts @@ -0,0 +1,30 @@ +import type { DeviceStatus, DeviceType } from 'roku-deploy'; + +/** + * Lives in its own file (rather than inside RceManagementViewProvider.ts) so the webview can import + * RceStateDevice without pulling the provider's extension-side import graph into its typecheck program. + */ + +/* eslint-disable camelcase -- the RCE management api uses snake_case fields */ +/** + * The device fields the management webview renders - a projection of roku-deploy's RceDevice that + * leaves the instance's stream credentials behind (see projectDeviceForWebview). + */ +export interface RceStateDevice { + id: number; + name: string; + note?: string | null; + device_type: DeviceType; + status?: DeviceStatus; + serial_number?: string | null; + created_at: string; + last_snapshot_id?: number | null; + last_snapshot_name?: string | null; + snapshots?: number[]; + firmware_version_id?: string | null; + running_device?: { + started_at?: string | null; + max_runtime: number; + } | null; +} +/* eslint-enable camelcase */ diff --git a/src/viewProviders/RceManagementViewProvider.ts b/src/viewProviders/RceManagementViewProvider.ts index 5a203f9de..8035aa973 100644 --- a/src/viewProviders/RceManagementViewProvider.ts +++ b/src/viewProviders/RceManagementViewProvider.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode'; -import type { RceDevice, DeviceRun, DeviceStatus, DeviceType, FirmwareVersion, RceDeviceConfig, RceManagementClient, Snapshot } from 'roku-deploy'; +import type { RceDevice, DeviceRun, FirmwareVersion, RceDeviceConfig, RceManagementClient, Snapshot } from 'roku-deploy'; import { rokuDeploy } from 'roku-deploy'; import { BaseWebviewViewProvider } from './BaseWebviewViewProvider'; import { ViewProviderId } from './ViewProviderId'; @@ -9,6 +9,9 @@ import { WorkspaceStateKey } from './WorkspaceStateKey'; import { VscodeCommand } from '../commands/VscodeCommand'; import type { RceManager } from '../managers/RceManager'; import type { RceFinder } from '../deviceDiscovery/RceFinder'; +import type { RceStateDevice } from './RceManagementViewContract'; + +export type { RceStateDevice } from './RceManagementViewContract'; export class RceManagementViewProvider extends BaseWebviewViewProvider { public readonly id = ViewProviderId.rceManagementView; @@ -561,30 +564,6 @@ interface RceManagementViewState { error?: string; } -/* eslint-disable camelcase -- the RCE management api uses snake_case fields */ -/** - * The device fields the management webview renders - a projection of roku-deploy's RceDevice that - * leaves the instance's stream credentials behind (see projectDeviceForWebview). - */ -export interface RceStateDevice { - id: number; - name: string; - note?: string | null; - device_type: DeviceType; - status?: DeviceStatus; - serial_number?: string | null; - created_at: string; - last_snapshot_id?: number | null; - last_snapshot_name?: string | null; - snapshots?: number[]; - firmware_version_id?: string | null; - running_device?: { - started_at?: string | null; - max_runtime: number; - } | null; -} -/* eslint-enable camelcase */ - interface RceDeviceDetailsPayload { snapshots: Snapshot[] | undefined; runs: DeviceRun[] | undefined; diff --git a/webviews/src/shared/Loader.svelte b/webviews/src/shared/Loader.svelte index 2ded18084..6612507e7 100644 --- a/webviews/src/shared/Loader.svelte +++ b/webviews/src/shared/Loader.svelte @@ -14,5 +14,5 @@
- +
diff --git a/webviews/src/shared/NumberField.svelte b/webviews/src/shared/NumberField.svelte index 57d9cc4e2..e4650f83b 100644 --- a/webviews/src/shared/NumberField.svelte +++ b/webviews/src/shared/NumberField.svelte @@ -43,4 +43,4 @@ } - + diff --git a/webviews/src/shared/RceStreamView.svelte b/webviews/src/shared/RceStreamView.svelte index f2d4f0c12..87da657fd 100644 --- a/webviews/src/shared/RceStreamView.svelte +++ b/webviews/src/shared/RceStreamView.svelte @@ -311,7 +311,7 @@ {:else} -