diff --git a/.gitignore b/.gitignore index 206cd56..2144e24 100644 --- a/.gitignore +++ b/.gitignore @@ -136,10 +136,12 @@ dist /dashboard/ /extension/ /graphics/ +/nodecg/ +/shared/domain/ /shared/dist/ # Local runtime database /db/ *.sqlite3 /scoreko-electron-dev/ -/packs/ \ No newline at end of file +/packs/ diff --git a/docs/refactor/PHASE_1_SUMMARY.md b/docs/refactor/PHASE_1_SUMMARY.md new file mode 100644 index 0000000..74228f0 --- /dev/null +++ b/docs/refactor/PHASE_1_SUMMARY.md @@ -0,0 +1,56 @@ +# Phase 1 Summary + +## Scope + +Executed the base architecture phase only. This phase focused on structure, boundaries, shared contracts and compatibility without changing UX, overlay visuals or large feature logic. + +## Completed + +- Added the `src/nodecg` boundary: + - `src/nodecg/browser` + - `src/nodecg/extension` + - centralized `replicantNames` + - centralized `messageNames` +- Moved browser replicant access out of `src/browser_shared`. +- Moved dashboard stores to `src/dashboard/stores`. +- Moved pure country helpers to `src/shared/domain/players`. +- Moved pack config and pack types to `src/shared/domain/packs`. +- Added pack replicant schemas: + - `installedPacks` + - `packRegistry` + - `downloadStates` + - `availableUpdates` +- Added generated TypeScript declarations for the new pack schemas. +- Removed dead example code: + - `exampleReplicant` schema/type + - `ExampleType` + - `src/extension/example.ts` +- Removed redundant stale JS files from `src/shared`. +- Updated extension bootstrap to use an explicit NodeCG context boundary. +- Routed browser messages through `src/nodecg/browser/messages.ts`. +- Routed extension message registration through `src/nodecg/extension/messages.ts`. +- Routed pack replicant creation through NodeCG pack boundary services. +- Updated build config so generated NodeCG/shared extension outputs are ignored and cleaned. + +## Preserved + +- No overlay UX, CSS, SVG, layout or animation logic was intentionally changed. +- No large dashboard view was split or rewritten. +- `pack-manager.ts` behavior was preserved; only imports, types, replicant/message names and boundaries were normalized. +- Public NodeCG message names were kept unchanged for compatibility. +- Public replicant names and defaults were kept unchanged. + +## Verification + +- `pnpm.cmd exec vue-tsc -p tsconfig.browser.json --noEmit`: passed. +- `pnpm.cmd exec tsc -b tsconfig.extension.json --pretty false`: passed. +- `pnpm.cmd exec eslint`: passed with 0 errors and existing Vue formatting warnings. +- `pnpm.cmd run build`: passed. + +## Remaining For Later Phases + +- Controlled rewrite of `pack-manager.ts`. +- Controlled rewrite of `usePackRegistry` and `fighting-characters.ts`. +- Formal provider module split for Start.gg and Challonge. +- Splitting `Players.vue` and `Settings.vue`. +- Overlay view models and visual baseline work. diff --git a/package.json b/package.json index 48f6928..123162f 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "type": "module", "scripts": { "autofix": "eslint --fix", - "prebuild": "trash ./extension && trash ./node_modules/.vite && trash ./shared/dist && trash ./dashboard && trash ./graphics", + "prebuild": "trash ./extension && trash ./nodecg && trash ./node_modules/.vite && trash ./shared/domain && trash ./shared/dist && trash ./dashboard && trash ./graphics", "build": "vite build && tsc -b tsconfig.extension.json", "lint": "eslint", "schema-types": "nodecg schema-types", diff --git a/schemas/availableUpdates.json b/schemas/availableUpdates.json new file mode 100644 index 0000000..d50c50d --- /dev/null +++ b/schemas/availableUpdates.json @@ -0,0 +1,18 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": false, + "properties": { + "installedVersion": { + "type": "string" + }, + "latestVersion": { + "type": "string" + } + }, + "required": ["installedVersion", "latestVersion"] + }, + "default": {} +} diff --git a/schemas/downloadStates.json b/schemas/downloadStates.json new file mode 100644 index 0000000..cc54f7f --- /dev/null +++ b/schemas/downloadStates.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": false, + "properties": { + "status": { + "type": "string", + "enum": ["idle", "fetching-manifest", "downloading", "done", "error"] + }, + "progress": { + "type": "number" + }, + "error": { + "type": "string" + } + }, + "required": ["status", "progress"] + }, + "default": {} +} diff --git a/schemas/exampleReplicant.json b/schemas/exampleReplicant.json deleted file mode 100644 index 55d7423..0000000 --- a/schemas/exampleReplicant.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "additionalProperties": false, - "properties": { - "exampleProperty": { - "type": "string", - "default": "exampleString" - } - }, - "required": [ - "exampleProperty" - ] -} diff --git a/schemas/installedPacks.json b/schemas/installedPacks.json new file mode 100644 index 0000000..d2da904 --- /dev/null +++ b/schemas/installedPacks.json @@ -0,0 +1,8 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "array", + "items": { + "type": "string" + }, + "default": [] +} diff --git a/schemas/packRegistry.json b/schemas/packRegistry.json new file mode 100644 index 0000000..cda76e7 --- /dev/null +++ b/schemas/packRegistry.json @@ -0,0 +1,50 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": ["object", "null"], + "additionalProperties": false, + "properties": { + "schemaVersion": { + "type": "integer" + }, + "updatedAt": { + "type": "string" + }, + "packs": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "id": { "type": "string" }, + "name": { "type": "string" }, + "version": { "type": "string" }, + "totalSizeBytes": { "type": "number" }, + "logoPath": { "type": "string" }, + "characterCount": { "type": "integer" }, + "palette": { + "type": "object", + "additionalProperties": false, + "properties": { + "start": { "type": "string" }, + "end": { "type": "string" } + }, + "required": ["start", "end"] + }, + "bundled": { "type": "boolean" } + }, + "required": [ + "id", + "name", + "version", + "totalSizeBytes", + "logoPath", + "characterCount", + "palette", + "bundled" + ] + } + } + }, + "required": ["schemaVersion", "updatedAt", "packs"], + "default": null +} diff --git a/src/browser_shared/replicants.ts b/src/browser_shared/replicants.ts deleted file mode 100644 index a161499..0000000 --- a/src/browser_shared/replicants.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { useReplicant } from 'nodecg-vue-composable'; -import type { Schemas } from '../types'; - -// YOU MUST CHANGE THIS TO YOUR BUNDLE'S NAME! -const thisBundle = 'scoreko-dev'; - -/** - * This is where you can declare all of your replicants to import easily into other (browser based) files. - * "useReplicant" is a helper composable to make accessing/modifying replicants easier. - * For more information see https://github.com/Dan-Shields/nodecg-vue-composable - */ -export const exampleReplicant = useReplicant('exampleReplicant', thisBundle); -export const playersReplicant = useReplicant('players', thisBundle); -export const scoreboardReplicant = useReplicant('scoreboard', thisBundle); -export const graphicsSettingsReplicant = useReplicant('graphicsSettings', thisBundle); - -export const commentaryReplicant = useReplicant('commentary', thisBundle); diff --git a/src/dashboard/scoreko-dev/components/BracketPanel.vue b/src/dashboard/scoreko-dev/components/BracketPanel.vue index 5ab69fe..cec2943 100644 --- a/src/dashboard/scoreko-dev/components/BracketPanel.vue +++ b/src/dashboard/scoreko-dev/components/BracketPanel.vue @@ -1,7 +1,7 @@