Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.2.0 #99

Merged
merged 7 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 74 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,46 +1,119 @@
/* eslint-env node */
'use strict'
const { defineConfig } = require('@sixxgate/lint')
const { memo } = require('radash')

module.exports = defineConfig(({ useVue, useNode, useTypeScript }) => {
useVue({ version: '3.4', style: 'sass' })
useNode()
useTypeScript()

/** @type {() => Partial<import('eslint').Linter.RulesRecord>} */
const useCommonJsDocRules = memo(() => ({
// Don't require all sections to be filled out.
'jsdoc/require-returns': 'off',
'jsdoc/require-yields': 'off',
// Requires too much configuration to worry about.
'jsdoc/tag-lines': 'off',
// Don't require DocComments.
'jsdoc/require-jsdoc': 'off'
}))

/** @type {() => Partial<import('eslint').Linter.RulesRecord>} */
const useJsDocRules = memo(() => ({
...useCommonJsDocRules(),
// Only require the parameters if we want them.
'jsdoc/require-param': ['error', { ignoreWhenAllParamsMissing: true }]
}))

/** @type {() => Partial<import('eslint').Linter.RulesRecord>} */
const useTsDocRules = memo(() => ({
...useCommonJsDocRules(),
// Only require the parameters if we want them.
'jsdoc/require-param': [
'error',
{
ignoreWhenAllParamsMissing: true,
// Has issues with TSDoc
checkDestructuredRoots: false
}
],
// Has issues with JSDOc.
'jsdoc/check-param-names': ['error', { checkDestructured: false }],
// TSDoc itself.
'tsdoc/syntax': 'error'
}))

return {
root: true,
env: { es2023: true },
plugins: ['eslint-plugin-tsdoc'],
reportUnusedDisableDirectives: true,
overrides: [
// CommonJS JavaScript
{
files: ['*.cjs'],
extends: ['plugin:jsdoc/recommended-error'],
rules: {
'@typescript-eslint/no-require-imports': 'off'
'@typescript-eslint/no-require-imports': 'off',
...useJsDocRules()
},
parserOptions: {
project: './tsconfig.config.json'
}
},
// Main and preload
{
files: ['src/core/**/*.ts', 'src/main/**/*.ts', 'src/main/**/*.js', 'src/preload/**/*.ts'],
parserOptions: {
project: './tsconfig.node.json'
}
},
// Main and preload TypeScript
{
files: ['src/core/**/*.ts', 'src/main/**/*.ts', 'src/preload/**/*.ts'],
extends: ['plugin:jsdoc/recommended-typescript-error'],
rules: { ...useTsDocRules() }
},
// Main and preload JavaScript
{
files: ['src/main/**/*.js'],
extends: ['plugin:jsdoc/recommended-error'],
rules: { ...useJsDocRules() }
},
// Renderer
{
files: ['src/renderer/**/*.ts', 'src/renderer/**/*.tsx', 'src/renderer/**/*.js', 'src/renderer/**/*.vue'],
parserOptions: {
project: './tsconfig.web.json'
}
},
// Renderer TypeScript
{
files: ['src/renderer/**/*.ts', 'src/renderer/**/*.tsx', 'src/renderer/**/*.vue'],
extends: ['plugin:jsdoc/recommended-typescript-error'],
rules: { ...useTsDocRules() }
},
// Renderer JavaScript
{
files: ['src/renderer/**/*.js'],
extends: ['plugin:jsdoc/recommended-error'],
rules: { ...useJsDocRules() }
},
// Vite configuration
{
files: ['electron.vite.config.ts', 'vite.config.ts'],
extends: ['plugin:jsdoc/recommended-typescript-error'],
rules: { ...useTsDocRules() },
parserOptions: {
project: './tsconfig.config.json'
}
},
// Tests
{
files: ['src/tests/**/*.ts'],
extends: ['plugin:jsdoc/recommended-typescript-error'],
rules: { ...useTsDocRules() },
parserOptions: {
project: './tsconfig.test.json'
}
Expand Down
15 changes: 14 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
{
"i18n-ally.localesPaths": ["src/renderer/locales"],
"vitest.disableWorkspaceWarning": true,
"i18n-ally.keystyle": "nested"
"i18n-ally.keystyle": "nested",
"cSpell.words": [
"bridgecmdr",
"extron",
"fgpa",
"pinia",
"radash",
"shinybow",
"sindresorhus",
"sixxgate",
"snes",
"vuelidate",
"vuetify"
]
}
12 changes: 6 additions & 6 deletions PLAN.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
- Milestones
- 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.
- v2.3
- 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.
- Add test coverage for stream and updater.
- Add test coverage for some rendering process parts.
- Import and export.
- 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 security or authentication method, preferably 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.
- Possible move to 64-bit ARM.
- Drivers
- Monoprice Blackbird
- J-Tech Digital -- Need to find actual command list.
Expand Down
6 changes: 6 additions & 0 deletions electron.vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ export default defineConfig({
stream: fileURLToPath(new URL('./node_modules/stream-browserify', import.meta.url)),
util: fileURLToPath(new URL('./node_modules/util', import.meta.url))
}
},
css: {
preprocessorOptions: {
sass: { api: 'modern-compiler' },
scss: { api: 'modern-compiler' }
}
}
}
})
61 changes: 32 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bridgecmdr",
"productName": "BridgeCmdr",
"version": "2.1.0",
"version": "2.2.0",
"description": "Controller for professional A/V monitors and switches",
"packageManager": "[email protected]",
"type": "module",
Expand Down Expand Up @@ -72,27 +72,27 @@
"@types/ini": "^4.1.1",
"@types/leveldown": "^4.0.6",
"@types/levelup": "^5.1.5",
"@types/node": "^20.17.6",
"@types/node": "^20.17.7",
"@types/pouchdb-core": "^7.0.15",
"@types/pouchdb-find": "^7.3.3",
"@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.4",
"@typescript-eslint/eslint-plugin": "^8.16.0",
"@typescript-eslint/parser": "^8.16.0",
"@vitejs/plugin-vue": "^5.2.0",
"@vitejs/plugin-vue-jsx": "^4.1.0",
"@vitest/coverage-v8": "^2.1.5",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
"@vue/tsconfig": "^0.5.1",
"@vue/tsconfig": "^0.6.0",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
"@vueuse/core": "^11.2.0",
"@vueuse/shared": "^11.2.0",
"@vueuse/core": "^11.3.0",
"@vueuse/shared": "^11.3.0",
"@zip.js/zip.js": "^2.7.53",
"assert": "^2.1.0",
"auto-bind": "^5.0.1",
"bufferutil": "^4.0.8",
"electron": "^31.7.3",
"electron": "^31.7.5",
"electron-builder": "^24.13.3",
"electron-unhandled": "^5.0.0",
"electron-updater": "^6.3.9",
Expand All @@ -102,50 +102,53 @@
"eslint-import-resolver-node": "^0.3.9",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-n": "^17.12.0",
"eslint-plugin-jsdoc": "^50.6.0",
"eslint-plugin-n": "^17.14.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-promise": "^7.1.0",
"eslint-plugin-vue": "^9.30.0",
"eslint-plugin-promise": "^7.2.0",
"eslint-plugin-tsdoc": "^0.4.0",
"eslint-plugin-vue": "^9.31.0",
"execa": "^9.5.1",
"husky": "^9.1.6",
"husky": "^9.1.7",
"ini": "^5.0.0",
"js-base64": "^3.7.7",
"levelup": "^5.1.1",
"mime": "^4.0.4",
"npm-check-updates": "^17.1.10",
"npm-check-updates": "^17.1.11",
"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.80.6",
"sass-embedded": "^1.81.0",
"superjson": "^2.2.1",
"tslib": "^2.8.1",
"type-fest": "^4.26.1",
"typescript": "^5.6.3",
"type-fest": "^4.28.0",
"typescript": "5.6.3",
"typescript-eslint-parser-for-extra-files": "^0.7.0",
"utf-8-validate": "^6.0.5",
"vite": "^5.4.10",
"vite-plugin-vue-devtools": "^7.6.2",
"vite": "^5.4.11",
"vite-plugin-vue-devtools": "^7.6.4",
"vite-plugin-vuetify": "^2.0.4",
"vite-tsconfig-paths": "^5.0.1",
"vitest": "^2.1.4",
"vue": "^3.5.12",
"vite-tsconfig-paths": "^5.1.3",
"vitest": "^2.1.5",
"vue": "^3.5.13",
"vue-eslint-parser": "^9.4.3",
"vue-i18n": "^10.0.4",
"vue-router": "^4.4.5",
"vue-tsc": "^2.1.10",
"vuetify": "^3.7.3",
"vue-router": "^4.5.0",
"vue-tsc": "2.1.10",
"vuetify": "^3.7.4",
"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",
"@types/pouchdb-mapreduce": "^6.1.10",
"electron-log": "^5.2.3",
"leveldown": "^6.1.1",
"pouchdb-mapreduce": "^9.0.0",
"serialport": "^12.0.0"
}
}
2 changes: 1 addition & 1 deletion src/core/attachments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class Attachment extends Uint8Array {

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

if (attachment.data instanceof Blob) {
Expand Down
15 changes: 15 additions & 0 deletions src/core/base64.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/** Converts a byte array into a Base64 string. */
export function toBase64(data: Uint8Array) {
return btoa(String.fromCodePoint(...data))
}

function* codePointsOf(data: string) {
for (let i = 0, cp = data.codePointAt(i); cp != null; ++i, cp = data.codePointAt(i)) {
yield cp
}
}

/** Coverts a Base64 string into a byte array. */
export function fromBase64(data: string) {
return new Uint8Array([...codePointsOf(atob(data))])
}
11 changes: 11 additions & 0 deletions src/core/basics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ export function toArray<T>(value: T): T extends unknown[] ? T : T[] {
return (Array.isArray(value) ? value : [value]) as never
}

/**
* Converts and array of path segments to an object path
* @param path - Path segments.
* @returns Object path akin to radash `get`.
*/
export const toObjectPath = (path: (number | string)[]) =>
path
.map((segment) => (typeof segment === 'number' ? `[${segment}]` : segment))
.reduce((p, c) => (c.startsWith('[') ? `${p}${c}` : `${p}.${c}`))

/**
* Creates a new promise with externally accessible fulfillment operations.
*
Expand All @@ -25,6 +35,7 @@ export function toArray<T>(value: T): T extends unknown[] ? T : T[] {
* @returns An object with a Promise and its fulfillment operations.
*/
export function withResolvers<T>() {
/* v8 ignore next 2 */ // Won't be used.
let resolve: (value: T | PromiseLike<T>) => void = () => undefined
let reject: (reason?: unknown) => void = () => undefined

Expand Down
Loading