Skip to content

Commit

Permalink
WebView restructuring (#421)
Browse files Browse the repository at this point in the history
* rename views to panels where applicable, remove rdb subfolder in ui folder

* Rename `ui` to `webViews`, move code to `src`, move rollup config into `webViews`

* Fix rollup build issues.

* lowercase the `v` in webViews folder

* Rename panels to views. Refactored other files

* fix unit tests

* fix case-sensitive bug

* another 'nix fix

* more 'nix fixes

Co-authored-by: Brian Leighty <bleighty@tubi.tv>
Co-authored-by: Bronley Plumb <bronley@gmail.com>
  • Loading branch information
3 people committed Aug 8, 2022
1 parent 16bc185 commit 323de88
Show file tree
Hide file tree
Showing 52 changed files with 11,836 additions and 372 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"--timeout",
"999999",
"./src/**/*.spec.ts",
"./ui/**/*.spec.ts"
"./webviews/**/*.spec.ts"
],
"internalConsoleOptions": "openOnSessionStart"
}
Expand Down
11,405 changes: 11,392 additions & 13 deletions package-lock.json

Large diffs are not rendered by default.

23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"build": "npm run copy-schema && tsc -p ./ && npm run svelte-build",
"lint": "eslint \"./src/**/*.ts\"",
"watch": "npm run copy-schema && tsc -w -p ./",
"test": "nyc mocha \"src/**/*.spec.ts\" \"ui/**/*.spec.ts\" --full-trace --bail",
"test:nocover": "mocha \"src/**/*.spec.ts\" \"ui/**/*.spec.ts\" --full-trace",
"test": "nyc mocha \"src/**/*.spec.ts\" \"webviews/**/*.spec.ts\" --full-trace --bail",
"test:nocover": "mocha \"src/**/*.spec.ts\" \"webviews/**/*.spec.ts\" --full-trace",
"publish-coverage": "nyc report --reporter=text-lcov | coveralls",
"check-extraneous": "npm list --production --parseable --depth=99999",
"package": "vsce package",
Expand All @@ -44,9 +44,8 @@
"uninstall-local": "node scripts/uninstall-local.js",
"build-docs": "statigen -s docs -o .tmp/docs",
"watch-docs": "npm run build-docs -- --watch",
"validate": "svelte-check",
"svelte-build": "rollup -c",
"svelte-watch": "rollup -c -w",
"svelte-build": "cd ./webviews && rollup --config ./rollup.config.js && cd ..",
"svelte-watch": "cd ./webviews && rollup --config ./rollup.config.js --watch",
"releases": "ts-node scripts/releases.ts"
},
"dependencies": {
Expand Down Expand Up @@ -201,21 +200,21 @@
"when": "debugType == 'brightscript'"
},
{
"type": "webview",
"id": "SceneGraphInspector",
"id": "sceneGraphInspectorView",
"name": "SceneGraph Inspector",
"type": "webview",
"when": "debugType == 'brightscript'"
},
{
"id": "rokuRegistryView",
"name": "Roku Registry",
"type": "webview",
"id": "RDBRegistryView",
"name": "Registry",
"when": "debugType == 'brightscript'"
},
{
"id": "rokuCommandsView",
"name": "Roku Commands",
"type": "webview",
"id": "RDBCommandsView",
"name": "Commands",
"when": "debugType == 'brightscript'"
}
]
Expand Down Expand Up @@ -2927,7 +2926,7 @@
"nyc": {
"include": [
"src/**/!(*.spec).ts",
"ui/**/!(*.spec).ts"
"webviews/**/!(*.spec).ts"
],
"extension": [
".ts"
Expand Down
206 changes: 0 additions & 206 deletions src/RDBViewProviders.ts

This file was deleted.

12 changes: 6 additions & 6 deletions src/extension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,18 @@ describe('extension', () => {
const extensionInstance = extension.extension as any;
const config = {} as BrightScriptLaunchConfiguration;
let context;
let originalRdbViews;
let originalWebviews;
beforeEach(() => {
context = { ...vscode.context };
config.host = '86.75.30.9';
config.password = 'jenny';
originalRdbViews = extensionInstance.rdbViews;
extensionInstance.rdbViews = {};
originalWebviews = extensionInstance.webviews;
extensionInstance.webviews = {};
});

afterEach(() => {
extensionInstance.odc = undefined;
extensionInstance.rdbViews = originalRdbViews;
extensionInstance.webviews = originalWebviews;
});

describe('setupODC', () => {
Expand All @@ -127,10 +127,10 @@ describe('extension', () => {

describe('registerWebViewProviders', () => {
it('initializes webview providers and calls registerWebviewViewProvider for each', () => {
extensionInstance.rdbViews = originalRdbViews;
extensionInstance.webviews = originalWebviews;
const spy = sinon.spy(vscode.window, 'registerWebviewViewProvider');
extensionInstance.registerWebViewProviders(context);
expect(spy.callCount).to.equal(Object.keys(originalRdbViews).length);
expect(spy.callCount).to.equal(Object.keys(originalWebviews).length);
});
});

Expand Down

0 comments on commit 323de88

Please sign in to comment.