Skip to content

Commit

Permalink
Merge pull request #20 from 39zde/dev
Browse files Browse the repository at this point in the history
v2.1.2
  • Loading branch information
39zde authored Sep 26, 2024
2 parents 6fb1bba + 52df5ac commit 13a84d7
Show file tree
Hide file tree
Showing 37 changed files with 528 additions and 755 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 150

[*.yml]
indent_size = 2
indent_style = space
28 changes: 15 additions & 13 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,34 @@ on:
types: [closed]
branches: [ "master" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: 'pages'
cancel-in-progress: true

jobs:
# Single deploy job since we're just deploying
deploy:
if_merged:
if: github.event.pull_request.merged == true
permissions:
contents: read
pages: write
id-token: write
strategy:
matrix:
include:
- platform: 'ubuntu-latest'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest

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

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: |
corepack enable
Expand Down
17 changes: 11 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# Frontend
node_modules/
dist/
bundle-prod/
bundle-demo/
bundle-dev/
.DS_Store
*.log*
.yarn
.perf/
!resources/data/*.sample.csv
*.csv
#a different index.html will be copied to root folder depending, on what package.json script is run
index.html
# Backend
src-tauri/target/
src-tauri/gen/schemas
*.csv
!resources/data/*.sample.csv
#a different tauri.conf.json will be copied to ./src-tauri/ folder, depending on what package.json script is run
src-tauri/tauri.conf.json
# other
.DS_Store
*.log*
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"aaron-bond.better-comments",
"ms-vscode.vscode-typescript-next",
"esbenp.prettier-vscode",
"vadimcn.vscode-lldb"
"vadimcn.vscode-lldb",
"rust-lang.rust-analyzer"
]
}
9 changes: 6 additions & 3 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
enableTelemetry: 0
enableGlobalCache: false
nmMode: "classic"
nodeLinker: "node-modules"

enableTelemetry: 0

nmMode: classic

nodeLinker: node-modules
20 changes: 10 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ Anyone can contribute. This is not a Pet-Project nor do I follow any agenda with
- [articles_db](#articles_db)
- [documents_db](#documents_db)
- [Local Storage](#local-storage)
- [Session Storage](#session-storage)
- [Sample Data](#sample-data)
- [Build](#build)
- [Versioning](#versioning)

## Getting Started

Expand All @@ -36,7 +36,8 @@ corepack enable
git clone https://github.com/39zde/factor.git
cd factor
yarn install
yarn dev
yarn dev:tauri
yarn action:devtools
```

## Workspace
Expand All @@ -55,13 +56,9 @@ To use yarn the official way [corepack](https://nodejs.org/api/corepack.html) mu
Run
```bash
npm install -g react-devtools
yarn devtools
yarn dev:tauri
yarn action:devtool
```
and uncomment
```html
<script src="http://localhost:8097"></script>
```
in [index.html](./index.html)

## Theming

Expand Down Expand Up @@ -120,7 +117,7 @@ Ratings:

Here is an Example made with [DrawDB](https://github.com/drawdb-io/drawdb) of the customers_db database. Each "table" is an oStore. `row` is always the keyPath. The data types don't match entirely. Fields with a key icon are indexed fields, where indexed means [IDBIndex](https://developer.mozilla.org/en-US/docs/Web/API/IDBIndex). Every field, from which a `1->n` connection originates, is of type `ArrayBuffer`. The `ArrayBuffer`, when decoded with `Uint32`, has n = `ArrayBuffer.byteLength` / `2` references. The reference (the `Uint32` number) is then the row number in the other oStore. The other oStore name is always the key. Thats how relations are stored.

![customers_db](./resources/img/customers_db.png)
![customers_db](./resources/images//customers_db.png)

Also have a look at [`./src/renderer/src/util/types/database`](./src/renderer/src/util/types/database/)

Expand All @@ -132,7 +129,7 @@ Index Names have the following structure:

There is a way to generate sample data, which is ready for importing. The script is located at [`./resources/data/genData.cli.js`](./resources/data/genData.cli.js).
```bash
node genData.cli.js
yarn gen:sample-customers
```
After calling the script you will be asked, how many rows you want. Shortly after a file will appear, ready to be used.

Expand All @@ -142,3 +139,6 @@ node genData.cli.js
yarn build
```
This command does the trick. For further details consult the official docs. Also keep in mind [Tauri v2](https://v2.tauri.app/) is very young

## Versioning
This project aims to follow [Semantic Versioning 2.0.0](https://semver.org/)
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ I have not run any benchmarks yet, but scrolling in a Table with:
- column-count: 12 columns
- column with of 250px
- 5 dereferencing operations per row
- in dev mode (2x the number of hooks are beeing called)
- in dev mode (2x the number of hooks are being called)
- on old hardware
- Memory usage at 3MB
- small memory profile

works without problems. WebWorkers[^4] do most of the heavy lifting. Certainly more performant, than using `useLiveQuery` from Dexie.js[^5]. That being said there is much more performance to be gained at various places. Looking at what already is accomplished, this approach looks very promising. With this in mind, if the only goal was performance, React would not be the best choice. To my understanding the purpose of React is to make the development easy and comprehensible, not to archive the best possible performance.

Expand All @@ -31,10 +31,7 @@ There are also some major performance gains everywhere, which is really nice to

## Screen Shots

<img src="./resources/img/screenshots/contextMenu.png" alt="Context Menu" height="300">
<img src="./resources/img/screenshots/settings.png" alt="Settings Page" height="300">
<img src="./resources/img/screenshots/upload.png" alt="Settings Page" height="300">

see [Screenshots Folder](./resources/images/screenshots/SCREENSHOT.md)

## Quick Start

Expand Down
3 changes: 3 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release Notes

## Version v2.1.2
- bugfixes and polishing

## Version v2.1.1
- sanding and optimizations
- github pages demo
Expand Down
6 changes: 4 additions & 2 deletions factor.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
".gitignore": true,
".prettierignore": true,
".prettierrc.yaml": true,
"vite.config.ts":false,
"eslint.config.mjs": false,
"eslint.config.mjs": true,
"vite.demo.config.ts": true,
"vite.dev.config.ts": true,
"vite.prod.config.ts": true,
"tsconfig.json": true,
"tsconfig.node.json": true,
"yarn.lock": true,
Expand Down
12 changes: 0 additions & 12 deletions index.html

This file was deleted.

34 changes: 18 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
{
"name": "factor",
"version": "v2.1.1",
"version": "2.1.2",
"description": "An invoicing application built with TypeScript:React on top of IndexDB packaged with Tauri",
"author": "39zde",
"type": "module",
"homepage": "https://github.com/39zde/factor",
"repository": "https://github.com/39zde/factor",
"license": "Apache-2.0",
"scripts": {
"action:devtools": "react-devtools",
"action:format": "prettier --write .",
"action:lint": "eslint ./src -c ./eslint.config.mjs --fix",
"action:devtools": "react-devtools",
"action:format": "prettier --write .",
"action:lint": "eslint ./src -c ./eslint.config.mjs --fix",
"action:version": "node ./scripts/upgradeVersion.js",
"action:check-types": "tsc",
"build": "node ./scripts/preTauriBuild.mjs && tauri build",
"bundle:dev": "vite build -c ./vite.dev.config.ts",
"bundle:demo": "node ./scripts/preDemoBundle.mjs && vite build -c ./vite.demo.config.ts && node ./scripts/includeFiles.mjs ",
"bundle:prod": "tsc && vite build -c ./vite.prod.config.ts",
"dev:vite": "vite -c ./vite.dev.config.ts",
"dev:demo": "node ./scripts/preDemoBundle.mjs && vite -c ./vite.demo.config.ts",
"dev:demo": "node ./scripts/preDemoBundle.mjs && vite -c ./vite.demo.config.ts",
"dev:tauri": "node ./scripts/preTauriDev.mjs && tauri dev",
"gen:sample-customers": "node ./scripts/genData.cli.js"
},
Expand All @@ -27,35 +29,35 @@
"@tauri-apps/plugin-notification": "^2.0.0-rc.1",
"@tauri-apps/plugin-shell": "^2.0.0-rc.1",
"@tauri-apps/plugin-window-state": "^2.0.0-rc.1",
"lucide-react": "^0.445.0",
"lucide-react": "^0.446.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@eslint/js": "^9.11.0",
"@eslint/js": "^9.11.1",
"@tauri-apps/cli": "^2.0.0-rc.16",
"@types/eslint__js": "^8.42.3",
"@types/node": "^20.16.5",
"@types/react": "^18.3.8",
"@types/node": "^20.16.8",
"@types/react": "^18.3.9",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^8.6.0",
"@typescript-eslint/parser": "^8.6.0",
"@typescript-eslint/eslint-plugin": "^8.7.0",
"@typescript-eslint/parser": "^8.7.0",
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^9.11.0",
"eslint": "^9.11.1",
"eslint-plugin-react": "^7.36.1",
"globals": "^15.9.0",
"prettier": "^3.3.3",
"typescript": "^5.6.2",
"typescript-eslint": "^8.6.0",
"vite": "^5.4.7",
"typescript-eslint": "^8.7.0",
"vite": "^5.4.8",
"vite-plugin-mkcert": "^1.17.6"
},
"packageManager": "yarn@4.1.1+sha512.ec40d0639bb307441b945d9467139cbb88d14394baac760b52eca038b330d16542d66fef61574271534ace5a200518dabf3b53a85f1f9e4bfa37141b538a9590",
"packageManager": "yarn@4.5.0",
"engines": {
"node": "v20.17.0"
},
"resolutions": {
"micromatch": "4.0.8"
"rollup": "4.22.4"
},
"readme": "./README.md"
}
5 changes: 5 additions & 0 deletions resources/images/screenshots/SCREENSHOT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Screenshots

![screenshot1](./contextMenu.png)
![screenshot2](./settings.png)
![screenshot3](./upload.png)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
86 changes: 86 additions & 0 deletions scripts/upgradeVersion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { readFileSync, writeFileSync } from 'fs';
const args = process.argv;
// relative to root
const packageJsonPath = './package.json';
const cargoTomlPath = './src-tauri/Cargo.toml';
const tauriDevConfPath = './src-tauri/conf/tauri.dev.conf.json';
const tauriProdConfPath = './src-tauri/conf/tauri.prod.conf.json';

const version = {
major: 0,
minor: 0,
patch: 0,
};

const displayHelp = () =>
console.log(
`
upgradeVersion.js
A help script to increase the the version numbers across all files
Scheme: a.b.c
--major overwrites --minor overwrites --patch
====================================
-h --help Shows this message
--usage
-M --major Increase the version to [a+1].0.0
-m --minor Increase the version to a.[b+1].0
-p --patch Increase the version to a.b.[c+1]
`
);

const versionJsonMatcher = /(?<=\"version\"\:[\s]{0,}\")[\d]{1,}\.[\d]{1,}\.[\d]{1,}(?=\"\,)/gm;
const versionTomlMatcher = /(?<=version\s\=\s\")[\d]{1,}\.[\d]{1,}\.[\d]{1,}(?=\")/gm;

function main() {
if (args.includes('-h') || args.includes('--help') || args.includes('--usage')) {
displayHelp();
} else {
if (
args.includes('-M') ||
args.includes('-m') ||
args.includes('-p') ||
args.includes('--major') ||
args.includes('--minor') ||
args.includes('--patch')
) {
const packageJsonFile = readFileSync(packageJsonPath, 'utf8');
const currentVersion = packageJsonFile.match(versionJsonMatcher);
if (currentVersion !== null) {
const versions = currentVersion[0].split('.');
version.major = parseInt(versions[0]);
version.minor = parseInt(versions[1]);
version.patch = parseInt(versions[2]);
if (args.includes('--patch') || args.includes('-p')) {
version.patch += 1;
}
if (args.includes('--minor') || args.includes('-m')) {
version.minor += 1;
version.patch = 0;
}
if (args.includes('--major') || args.includes('-M')) {
version.major += 1;
version.minor = 0;
version.patch = 0;
}
const newVersion = `${version.major}.${version.minor}.${version.patch}`;
const newPackageJsonFile = packageJsonFile.replace(versionJsonMatcher, newVersion);
writeFileSync(packageJsonPath, newPackageJsonFile, 'utf8');
const cargoTomlFile = readFileSync(cargoTomlPath, 'utf8');
const newTauriDevConfigFile = cargoTomlFile.replace(versionTomlMatcher, newVersion);
writeFileSync(cargoTomlPath, newTauriDevConfigFile, 'utf8');
const tauriDevConfFile = readFileSync(tauriDevConfPath, 'utf8');
const newTauriDevConfFile = tauriDevConfFile.replace(versionJsonMatcher, newVersion);
writeFileSync(tauriDevConfPath, newTauriDevConfFile, 'utf8');
const tauriProdConfFile = readFileSync(tauriProdConfPath, 'utf8');
const newTauriProdConfFile = tauriProdConfFile.replace(versionJsonMatcher, newVersion);
writeFileSync(tauriProdConfPath, newTauriProdConfFile, 'utf8');
}
} else {
displayHelp();
}
}
}
main();
Loading

0 comments on commit 13a84d7

Please sign in to comment.