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
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
45 changes: 12 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,19 @@
name: CI

on:
push:
branches: ['main']
branches: [main]
pull_request:
branches: ['main']

branches: [main]
jobs:
build-and-test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]

runs-on: ${{ matrix.os }}

ci:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Run linter
run: npm run lint

- name: Check formatting
run: npm run format:check

- name: Run tests
run: npm run test

- name: Build project
run: npm run build
node-version: '20'
- run: npm ci
- run: npm run typecheck
- run: npm run lint
- run: npm run format:check
- run: npm run test
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release
on:
push:
branches: [main]
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- run: npm run build
- run: npm run package
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
files: |
release/*.zip
release/*.dmg
release/*.exe
release/*.AppImage
release/*.deb
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
6 changes: 3 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"printWidth": 100
"trailingComma": "es5",
"printWidth": 100,
"tabWidth": 2
}
14 changes: 14 additions & 0 deletions electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
nativeTheme,
shell,
dialog,
safeStorage,
} from 'electron'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
Expand Down Expand Up @@ -637,3 +638,16 @@ ipcMain.on('open-file', (_, filePath) => {
const absolutePath = path.isAbsolute(filePath) ? filePath : path.join(NOTES_DIR, filePath)
shell.openPath(absolutePath)
})

ipcMain.handle('safe-storage-encrypt', (_, val: string) => {
return safeStorage.isEncryptionAvailable() ? safeStorage.encryptString(val).toString('base64') : val
})

ipcMain.handle('safe-storage-decrypt', (_, val: string) => {
if (!safeStorage.isEncryptionAvailable()) return val
try {
return safeStorage.decryptString(Buffer.from(val, 'base64'))
} catch (e) {
return val
}
})
2 changes: 2 additions & 0 deletions electron/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ contextBridge.exposeInMainWorld('electronAPI', {
onTriggerTasks: (callback: () => void) => {
ipcRenderer.on('trigger-tasks', () => callback())
},
safeStorageEncrypt: (val: string) => ipcRenderer.invoke('safe-storage-encrypt', val),
safeStorageDecrypt: (val: string) => ipcRenderer.invoke('safe-storage-decrypt', val),
})
4 changes: 3 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ export default defineConfig([
globals: globals.browser,
},
rules: {
'no-console': 'warn',
'prefer-const': 'error',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-require-imports': 'warn',
'no-empty': 'warn',
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
Expand Down
Loading
Loading