Skip to content

Commit

Permalink
Merge branch 'release/2.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
6XGate committed Nov 9, 2024
2 parents 2f87e1d + 28ec872 commit dac8916
Show file tree
Hide file tree
Showing 167 changed files with 5,016 additions and 5,313 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = defineConfig(({ useVue, useNode, useTypeScript }) => {
}
},
{
files: ['src/renderer/**/*.ts', 'src/renderer/**/*.js', 'src/renderer/**/*.vue'],
files: ['src/renderer/**/*.ts', 'src/renderer/**/*.tsx', 'src/renderer/**/*.js', 'src/renderer/**/*.vue'],
parserOptions: {
project: './tsconfig.web.json'
}
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test and coverage checks

on:
push:
branches: [$default-branch, $protected-branches]
pull_request: {}

jobs:
eslint:
name: Run coverage scanning
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: 'Install Node'
uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
- name: Setup yarn
run: |
corepack enable yarn
corepack install
- name: Install dependencies
run: |
yarn --frozen-lockfile
- name: Check test coverage
run: |
mkdir logs
yarn coverage
34 changes: 34 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Style and form checks

on:
push:
branches: [$default-branch, $protected-branches]
pull_request: {}

jobs:
eslint:
name: Run eslint scanning
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: 'Install Node'
uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
- name: Setup yarn
run: |
corepack enable yarn
corepack install
- name: Install dependencies
run: |
yarn --frozen-lockfile --ignore-scripts
- name: Check code style
run: |
yarn check:prettier
yarn check:lint
36 changes: 36 additions & 0 deletions .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: TypeScript checks

on:
push:
branches: [$default-branch, $protected-branches]
pull_request: {}

jobs:
eslint:
name: Run type scanning
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: 'Install Node'
uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
- name: Setup yarn
run: |
corepack enable yarn
corepack install
- name: Install dependencies
run: |
yarn --frozen-lockfile --ignore-scripts
- name: Check types
run: |
yarn typecheck:config
yarn typecheck:node
yarn typecheck:web
yarn typecheck:test
28 changes: 18 additions & 10 deletions PLAN.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
- Milestones
- v2.1
- Switch the majority of the IPC using tRPC.
- Level uses a streaming IPC, so leave it be for now.
- Anything passing a file may still require some custom hanlding.
- More drivers.
- v2.2
- Move more modules to core.
- tRPC over Electron IPC.
- Wrap some Electron APIs as services for easier mocking without electron itself.
- (#74) Rearrangeable dashboard icons.
- Determine which drivers are being using by the public at large to remove the experimental mark; options:
- Add a opt-in telemetry feature to see which drivers are being used, should be an ask to send survey sort of thing.
- Ask users to submit survey somewhere, likely with a pop-up in the app to the direct them to the survey.
- More drivers.
- Monoprice Blackbird
- v3.0
- (#92) Remote UI support
- Need settings toggle to control it's activation.
- Need security or authentication method, preferrably just a PIN code.
- Need a means to identify it's URL via the local UI.
- May need a way to disable the power-off button in the remote UI.
- Drivers
- Shinybow
- Monoprice Blackbird
- J-Tech Digital
- ASHATA
- TESmart
- No Hassle AV
- J-Tech Digital -- Need to find actual command list.
- ASHATA -- Now unable to find.
- No Hassle AV -- Need to contact.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ AppImage file.

### Releasing

- Start a the build docker conatiner: `docker compose run --build -it --rm build`
- Fresh install the packages: `yarn --force`
- Start the build docker conatiner: `docker compose run --build -it --rm build`
- Fresh install the packages: `yarn --force --frozen-lockfile`
- Package the application: `yarn make`
- Land and tag the release.
- Create a release from the tag and copy the following files to the release assets:
Expand Down
83 changes: 38 additions & 45 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bridgecmdr",
"productName": "BridgeCmdr",
"version": "2.0.1",
"version": "2.1.0",
"description": "Controller for professional A/V monitors and switches",
"packageManager": "[email protected]",
"type": "module",
Expand Down Expand Up @@ -34,10 +34,8 @@
"dev": "electron-vite dev",
"build": "run-p -l typecheck build-only",
"build-only": "electron-vite build",
"package:linux": "electron-builder --linux --dir --config",
"package": "run-s -l build package:linux",
"make:linux": "electron-builder --linux --config",
"make": "run-s -l build make:linux",
"package": "electron-builder --dir --config",
"make": "electron-builder --config",
"ncu:update": "ncu -u",
"ncu:check": "ncu",
"ncu": "ncu",
Expand All @@ -60,44 +58,41 @@
},
"homepage": "https://github.com/6XGate/bridgecmdr#readme",
"devDependencies": {
"@intlify/core-base": "^9.14.1",
"@intlify/unplugin-vue-i18n": "^4.0.0",
"@intlify/core-base": "^10.0.4",
"@intlify/unplugin-vue-i18n": "^5.2.0",
"@mdi/js": "^7.4.47",
"@mdi/svg": "^7.4.47",
"@sindresorhus/is": "^7.0.1",
"@sixxgate/lint": "^3.2.1",
"@sixxgate/lint": "^3.3.2",
"@trpc/client": "^10.45.2",
"@trpc/server": "^10.45.2",
"@tsconfig/node20": "^20.1.4",
"@tsconfig/strictest": "^2.0.5",
"@types/abstract-leveldown": "^7.2.5",
"@types/duplexify": "^3.6.4",
"@types/eslint": "^8.56.12",
"@types/ini": "^4.1.1",
"@types/level": "^6.0.3",
"@types/leveldown": "^4.0.6",
"@types/levelup": "^5.1.5",
"@types/node": "^20.16.15",
"@types/node": "^20.17.6",
"@types/pouchdb-core": "^7.0.15",
"@types/pouchdb-find": "^7.3.3",
"@types/setimmediate": "^1.0.4",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^8.7.0",
"@typescript-eslint/parser": "^8.7.0",
"@types/ws": "^8.5.13",
"@typescript-eslint/eslint-plugin": "^8.12.2",
"@typescript-eslint/parser": "^8.12.2",
"@vitejs/plugin-vue": "^5.1.4",
"@vitejs/plugin-vue-jsx": "^4.0.1",
"@vitest/coverage-v8": "^2.1.3",
"@vitest/coverage-v8": "^2.1.4",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
"@vue/tsconfig": "^0.5.1",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
"@vueuse/core": "^11.1.0",
"@vueuse/shared": "^11.1.0",
"@zip.js/zip.js": "^2.7.52",
"abstract-leveldown": "^7.2.0",
"@vueuse/core": "^11.2.0",
"@vueuse/shared": "^11.2.0",
"@zip.js/zip.js": "^2.7.53",
"assert": "^2.1.0",
"auto-bind": "^5.0.1",
"buffer": "^6.0.3",
"duplexify": "^4.1.3",
"electron": "^31.6.0",
"bufferutil": "^4.0.8",
"electron": "^31.7.3",
"electron-builder": "^24.13.3",
"electron-unhandled": "^5.0.0",
"electron-updater": "^6.3.9",
Expand All @@ -106,53 +101,51 @@
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-n": "^17.10.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-n": "^17.12.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-promise": "^7.1.0",
"eslint-plugin-vue": "^9.28.0",
"events": "^3.3.0",
"execa": "^9.4.1",
"eslint-plugin-vue": "^9.30.0",
"execa": "^9.5.1",
"husky": "^9.1.6",
"ini": "^4.1.3",
"ini": "^5.0.0",
"js-base64": "^3.7.7",
"levelup": "^5.1.1",
"mime": "^4.0.4",
"multileveldown": "^5.0.1",
"npm-check-updates": "^17.1.6",
"npm-run-all2": "^6.2.6",
"pinia": "^2.2.4",
"npm-check-updates": "^17.1.10",
"npm-run-all2": "^7.0.1",
"pinia": "^2.2.6",
"pouchdb-adapter-leveldb-core": "^9.0.0",
"pouchdb-core": "^9.0.0",
"pouchdb-find": "^9.0.0",
"prettier": "^3.3.3",
"radash": "^12.1.0",
"sass": "^1.79.6",
"setimmediate": "^1.0.5",
"stream-browserify": "^3.0.0",
"tslib": "^2.7.0",
"sass": "^1.80.6",
"superjson": "^2.2.1",
"tslib": "^2.8.1",
"type-fest": "^4.26.1",
"typescript": "^5.6.3",
"typescript-eslint-parser-for-extra-files": "^0.7.0",
"util": "^0.12.5",
"uuid": "^10.0.0",
"utf-8-validate": "^6.0.5",
"vite": "^5.4.10",
"vite-plugin-vue-devtools": "^7.4.6",
"vite-plugin-vue-devtools": "^7.6.2",
"vite-plugin-vuetify": "^2.0.4",
"vite-tsconfig-paths": "^5.0.1",
"vitest": "^2.1.3",
"vitest": "^2.1.4",
"vue": "^3.5.12",
"vue-eslint-parser": "^9.4.3",
"vue-i18n": "^9.14.1",
"vue-i18n": "^10.0.4",
"vue-router": "^4.4.5",
"vue-tsc": "^2.1.8",
"vue-tsc": "^2.1.10",
"vuetify": "^3.7.3",
"ws": "^8.18.0",
"xdg-basedir": "^5.1.0",
"zod": "^3.23.8"
},
"dependencies": {
"@electron-toolkit/utils": "^3.0.0",
"electron-log": "^5.2.0",
"level": "^7.0.1",
"leveldown": "^6.1.1",
"serialport": "^12.0.0"
}
}
27 changes: 27 additions & 0 deletions src/core/attachments.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export class Attachment extends Uint8Array {
readonly name
readonly type

static async fromFile(file: File) {
return new Attachment(file.name, file.type, await file.arrayBuffer())
}

static async fromPouchAttachment(name: string, attachment: PouchDB.Core.FullAttachment) {
if (Buffer.isBuffer(attachment.data)) {
return new Attachment(name, attachment.content_type, attachment.data.buffer)
}

if (attachment.data instanceof Blob) {
return new Attachment(name, attachment.content_type, await attachment.data.arrayBuffer())
}

const textEncoder = new TextEncoder()
return new Attachment(name, attachment.content_type, textEncoder.encode(attachment.data))
}

constructor(name: string, type: string, data: ArrayBufferLike) {
super(data)
this.name = name
this.type = type
}
}
39 changes: 34 additions & 5 deletions src/core/basics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,40 @@ export function toArray<T>(value: T): T extends unknown[] ? T : T[] {
}

/**
* Wait a specified amount of time.
* @param timeout - The amount of time to wait in milliseconds.
* Creates a new promise with externally accessible fulfillment operations.
*
* This is a polyfill for
* [Promise.withResolver](https://developer.mozilla.org/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers).
*
* @returns An object with a Promise and its fulfillment operations.
*/
export async function waitTill(timeout: number) {
await new Promise<void>((resolve) => {
setTimeout(resolve, timeout)
export function withResolvers<T>() {
let resolve: (value: T | PromiseLike<T>) => void = () => undefined
let reject: (reason?: unknown) => void = () => undefined

const promise = new Promise<T>((_resolve, _reject) => {
resolve = _resolve
reject = _reject
})

return { resolve, reject, promise }
}

/**
* Run an operation asynchronously as a microtask.
* @param op - The operation to run as a micro-task.
* @returns The result of the operation.
*/
export async function asMicrotask<Result>(op: () => MaybePromise<Result>) {
return await new Promise<Result>((resolve, reject) => {
queueMicrotask(() => {
try {
// eslint-disable-next-line @typescript-eslint/use-unknown-in-catch-callback-variable -- Proxied
Promise.resolve(op()).then(resolve).catch(reject)
} catch (cause) {
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors -- Proxied
reject(cause)
}
})
})
}
2 changes: 1 addition & 1 deletion src/core/error-handling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function getMessage(cause: unknown) {
if (cause instanceof Error) return cause.message
if (cause == null) return `BadError: ${cause}`
if (typeof cause === 'string') return cause
if (typeof cause !== 'object') return String(cause)
if (typeof cause !== 'object') return String(cause as never)
if (!('message' in cause)) return `BadError: ${Object.prototype.toString.call(cause)}`
if (typeof cause.message !== 'string') return String(cause.message)
return cause.message
Expand Down
Loading

0 comments on commit dac8916

Please sign in to comment.