Skip to content
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
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
node_modules/
dist/
release/
coverage/
package-lock.json
coverage/
22 changes: 0 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,6 @@ Knowte is a note taking application that allows you to quickly and easily organi
- Import and export notes, and print notes or export them as PDF.
- Choose light or dark themes, adjust text size, and use spell checking.

## Performance diagnostics

To investigate delays, enable **Settings > Advanced > Diagnostics > Enable performance diagnostics** and restart Knowte.
Use **Open log folder** in the same section to find the log. Disable the setting and restart to stop the additional logging.
To compare note opening without the hidden spare window, disable **Settings > Advanced > Note window performance >
Preload note windows** and restart Knowte. Preloading is enabled by default; re-enable it and restart to restore it.

Note-opening entries include the note ID, process ID and timestamps. `NoteOpen.dispatch` records the request from the main
window; `[noteOpen]` entries record window selection, spare loading and the wait for it; and `NoteOpen.initialize` and its
individual stages record work in the note window. A `nextAnimationFrame` entry records a browser animation-frame callback,
not proof that the note has been painted or is responsive. Unlock timing may include time spent entering a password.
An operation with a start but no finish may still be running, or its window may have closed.

`rendererStartup` records elapsed time from navigation to the application entry point (after static imports are evaluated),
Angular bootstrap duration, browser navigation milestones and up to five slow script or link resources (identified by bundle
category only). Navigation milestones are measured from navigation and can overlap with bootstrap and other timings; do not
add them together. These measurements can help narrow down slow startup, but cannot attribute the cause to a specific process.
`NoteOpen.detailsClient` and `NoteOpen.detailsServer` separate collection initialization, IPC callback, polling and server work.

The log can contain note IDs, collection paths and other diagnostic information. Review it before sharing; these timing
entries do not include note contents. Background-window timer throttling or system sleep can also produce event-loop warnings.

## Build prerequisites

- wine: required to build Windows package
Expand Down
20 changes: 13 additions & 7 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
"scripts": [
"./node_modules/quill/dist/quill.js",
"./node_modules/marked/marked.min.js",
"./node_modules/marked/lib/marked.umd.js",
"./node_modules/prismjs/prism.js",
"./node_modules/prismjs/components/prism-bash.min.js",
"./node_modules/prismjs/components/prism-batch.min.js",
Expand Down Expand Up @@ -120,22 +120,28 @@
"serve": {
"builder": "@angular-builders/custom-webpack:dev-server",
"options": {
"browserTarget": "knowte:build"
"buildTarget": "knowte:build"
},
"configurations": {
"dev": {
"browserTarget": "knowte:build:dev"
"buildTarget": "knowte:build:dev"
},
"production": {
"browserTarget": "knowte:build:production"
"buildTarget": "knowte:build:production"
}
},
"defaultConfiguration": "dev"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"builder": "@angular/build:extract-i18n",
"options": {
"browserTarget": "knowte:build"
"buildTarget": "knowte:build"
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html", "main.ts"]
}
}
}
Expand All @@ -151,6 +157,6 @@
}
},
"cli": {
"analytics": false
"analytics": false
}
}
25 changes: 25 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// @ts-check
const eslint = require('@eslint/js');
const tseslint = require('typescript-eslint');
const angular = require('angular-eslint');

module.exports = tseslint.config(
{ ignores: ['dist/**', 'release/**', 'coverage/**', 'main.js'] },
{
files: ['**/*.ts'],
extends: [eslint.configs.recommended, ...tseslint.configs.recommended, ...angular.configs.tsRecommended],
processor: angular.processInlineTemplates,
rules: {
'@angular-eslint/prefer-inject': 'off',
'@angular-eslint/prefer-standalone': 'off',
},
},
{
files: ['**/*.html'],
extends: [...angular.configs.templateRecommended, ...angular.configs.templateAccessibility],
rules: {
'@angular-eslint/template/click-events-have-key-events': 'off',
'@angular-eslint/template/interactive-supports-focus': 'off',
},
},
);
3 changes: 3 additions & 0 deletions get-package-information.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function getName(): string;
export function getFullVersion(): string;
export function getCopyright(): string;
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
roots: ['<rootDir>/'],
testMatch: ['<rootDir>/src/**/*(*.)+(spec).+(ts)', '<rootDir>/main/**/*(*.)+(spec).+(js)'],
setupFilesAfterEnv: ['<rootDir>/src/test.ts'],
transformIgnorePatterns: ['node_modules/(?!(.*\\.mjs$|@angular/common/locales/.*\\.js$|marked/))'],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths || {}, {
prefix: '<rootDir>/',
}),
Expand Down
14 changes: 8 additions & 6 deletions main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion main.js.map

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-require-imports */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { app, BrowserWindow, ipcMain, Menu, screen, shell } from 'electron';
// Logging needs to be imported in main.ts also. Otherwise it just doesn't work anywhere else.
// See post by megahertz: https://github.com/megahertz/electron-log/issues/60
Expand All @@ -15,9 +17,10 @@ app.commandLine.appendSwitch('disable-color-correct-rendering');
log.create('main');
log.transports.file.resolvePath = () => path.join(app.getPath('userData'), 'logs', 'Knowte.log');

let mainWindow, serve;
let mainWindow: BrowserWindow | undefined;

const args = process.argv.slice(1);
serve = args.some((val) => val === '--serve');
const serve = args.some((val) => val === '--serve');

// Workaround: Global does not allow setting custom properties.
// We need to cast it to "any" first.
Expand Down Expand Up @@ -56,7 +59,7 @@ function createMainWindow(): void {
require('./main/linux-accent-monitor').startLinuxAccentMonitor({ app, BrowserWindow, log });
}

app.on('second-instance', (event, commandLine, workingDirectory) => {
app.on('second-instance', () => {
// Someone tried to run a second instance, we should focus our window.
if (mainWindow) {
if (mainWindow.isMinimized()) {
Expand Down Expand Up @@ -277,10 +280,12 @@ function readNoteWindowSettingsSnapshot(): string | undefined {
return '';
}
// Backup status and the restart-only preloading preference do not affect a spare's cached settings.

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { backupLastSuccess, backupLastError, noteWindowPreloadingEnabled: preloading, ...relevantSettings } =
JSON.parse(fs.readFileSync(settingsFile, 'utf-8'));
return JSON.stringify(relevantSettings);
} catch (error) {
} catch {
return undefined;
}
}
Expand Down Expand Up @@ -665,7 +670,6 @@ try {
createMainWindow();
}
});
} catch (error) {
} catch {
// Catch Error
// throw error;
}
Loading
Loading