feat: initial tauri commit

This commit is contained in:
DaOfficialWizard 2023-05-03 13:04:52 +01:00
parent 1022163889
commit 0a0bb5485e
34 changed files with 11378 additions and 26123 deletions

162
.github/workflows/ci.yaml vendored Normal file
View file

@ -0,0 +1,162 @@
name: Produce Desktop Binary Builds
on:
workflow_dispatch:
push:
tags:
- "v*"
branches:
- dev
- master
- main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
build:
#defaults:
# run:
# working-directory: GUI/ETVR
strategy:
fail-fast: false
matrix:
node-version: [18.x]
platform: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
rust_target: x86_64-unknown-linux-gnu
- os: windows-latest
rust_target: x86_64-pc-windows-msvc
- os: macos-latest
rust_target: x86_64-apple-darwin
- os: macos-latest
rust_target: aarch64-apple-darwin
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ env.GITHUB_TOKEN }}
- name: Node.js setup ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
# node-version-file: '.nvmrc'
- name: "Setup Rust"
uses: actions-rs/toolchain@v1
with:
default: true
override: true
profile: minimal
toolchain: stable
target: ${{ matrix.platform.rust_target }}
- uses: Swatinem/rust-cache@v2
with:
workspaces: "./src-tauri -> target"
- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: Install dependencies (PNPM)
run: |
npm install -g pnpm
npm install -g typescript
cd GUI/ETVR
pnpm install
- uses: JonasKruckenberg/tauri-build@v1.2.3
id: tauri_build
env:
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
ENABLE_CODE_SIGNING: ${{ env.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE: ${{ env.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ env.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ env.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ env.APPLE_ID }}
APPLE_PASSWORD: ${{ env.APPLE_PASSWORD }}
with:
target: ${{ matrix.platform.rust_target }}
- uses: actions/upload-artifact@v3
with:
name: production-files
path: "${{ join(fromJSON(steps.tauri_build.outputs.artifacts), '\n') }}"
#- name: Build the app
# uses: tauri-apps/tauri-action@v0
# env:
# GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
# TAURI_PRIVATE_KEY: ${{ env.TAURI_PRIVATE_KEY }}
# TAURI_KEY_PASSWORD: ${{ env.TAURI_KEY_PASSWORD }}
# with:
# # tauri-action replaces \_\_VERSION\_\_ with the app version
# tagName: eyetrackvr-v__VERSION__
# releaseName: "EyeTrackApp v__VERSION__" # name of the release
# releaseBody: "See the assets to download this version and install." # message to include in the release
# releaseDraft: true # set to false to publish the release as a finished product
# prerelease: false # set to true to mark the release as a pre-release
deploy:
runs-on: ubuntu-latest
name: Deploy
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create Directory
run: mkdir -p dist
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: production-files
path: ./dist
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install -g conventional-changelog-conventionalcommits
- run: npm install -g semantic-release@v19.0.5
- run: npm install -g @semantic-release/exec
- run: npm install -g @semantic-release/git
- run: npm install -g @semantic-release/release-notes-generator
- run: npm install -g @semantic-release/changelog
- run: npm install -g @semantic-release/github
- name: Release
env:
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
run: |
sudo apt-get install -y jq
chmod +x ./scripts/prepareCMD.sh
semantic-release
cleanup:
name: Cleanup actions
needs:
- deploy
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: "♻️ remove build artifacts"
uses: geekyeggo/delete-artifact@v1
with:
name: production-files

3
.gitignore vendored
View file

@ -13,5 +13,4 @@
/node_modules
/dist
/.vs
/web/docs/
pnpm-lock.yaml
/web/docs/

190
.releaserc Normal file
View file

@ -0,0 +1,190 @@
{
"branches": [
"main",
"master",
"release",
{
"name": "SolidJSGUI",
"prerelease": true
}
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES",
"BREAKING"
]
},
"releaseRules": [
{
"breaking": true,
"release": "major"
},
{
"type": "feat",
"release": "minor"
},
{
"type": "fix",
"release": "patch"
},
{
"type": "perf",
"release": "patch"
},
{
"type": "revert",
"release": "patch"
},
{
"type": "docs",
"scope": "docs-*",
"release": "minor"
},
{
"type": "docs",
"release": false
},
{
"type": "style",
"release": "patch"
},
{
"type": "refactor",
"release": "patch"
},
{
"type": "test",
"release": "patch"
},
{
"type": "build",
"release": "patch"
},
{
"type": "ci",
"scope": "ci-*",
"release": "patch"
},
{
"type": "chore",
"release": false
},
{
"type": "no-release",
"release": false
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES",
"BREAKING"
]
},
"writerOpts": {
"commitsSort": [
"subject",
"scope"
]
},
"presetConfig": {
"types": [
{
"type": "feat",
"section": "🍕 Features"
},
{
"type": "feature",
"section": "🍕 Features"
},
{
"type": "fix",
"section": "🐛 Bug Fixes"
},
{
"type": "perf",
"section": "🔥 Performance Improvements"
},
{
"type": "revert",
"section": "⏩ Reverts"
},
{
"type": "docs",
"section": "📝 Documentation"
},
{
"type": "style",
"section": "🎨 Styles"
},
{
"type": "refactor",
"section": "🧑‍💻 Code Refactoring"
},
{
"type": "test",
"section": "✅ Tests"
},
{
"type": "build",
"section": "🤖 Build System"
},
{
"type": "ci",
"section": "🔁 Continuous Integration"
}
]
}
}
],
[
"@semantic-release/changelog",
{
"changelogTitle": "# 📦 Changelog \n[![conventional commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n[![semantic versioning](https://img.shields.io/badge/semantic%20versioning-2.0.0-green.svg)](https://semver.org)\n> All notable changes to this project will be documented in this file"
}
],
[
"@semantic-release/exec",
{
"prepareCmd": "./repo-tools/scripts/prepareCMD.sh ${nextRelease.version}",
"publishCmd": "echo Publishing ${nextRelease.version}"
}
],
[
"@semantic-release/github",
{
"addReleases": "bottom",
"assets": [
{
"path": "./dist/**/*.msi"
}
]
}
],
[
"@semantic-release/git",
{
"assets": [
"GUI/ETVR/package.json",
"GUI/ETVR/src-tauri/tauri.conf.json",
"GUI/ETVR/src-tauri/Cargo.toml",
"LICENSE*",
"CHANGELOG.md"
],
"message": "chore(${nextRelease.type}): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}

3
.vscode/extensions.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
"recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer", "esbenp.prettier-vscode"]
}

6
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": true
},
"cSpell.words": ["clippy", "shakram", "tamasfe"]
}

View file

@ -1,102 +0,0 @@
// Modules to control application life and create native browser window
// Module to control the application lifecycle and the native browser window.
const { app, BrowserWindow, protocol } = require("electron");
const path = require("path");
const url = require("url");
// Create the native browser window.
function createWindow() {
const mainWindow = new BrowserWindow({
width: 1300 ,
height: 850,
minWidth: 500,
minHeight: 500,
autoHideMenuBar:false,
webPreferences: {
nodeIntegration: true,
contextIsolation: true,
devTools: true,
},
});
// In production, set the initial browser path to the local bundle generated
// by the Create React App build process.
// In development, set it to localhost to allow live/hot-reloading.
const appURL = app.isPackaged
? url.format({
pathname: path.join(__dirname, "/dist/index.html"),
protocol: "file:",
slashes: true,
})
: "http://localhost:3000";
mainWindow.loadURL(appURL);
mainWindow.maximize()
// Automatically open Chrome's DevTools in development mode.
if (!app.isPackaged) {
mainWindow.webContents.openDevTools();
}
}
// Setup a local proxy to adjust the paths of requested files when loading
// them from the local production bundle (e.g.: local fonts, etc...).
function setupLocalFilesNormalizerProxy() {
protocol.registerHttpProtocol(
"file",
(request, callback) => {
const url = request.url.substr(8);
callback({ path: path.normalize(`${__dirname}/${url}`) });
},
(error) => {
if (error) console.error("Failed to register protocol");
}
);
}
// This method will be called when Electron has finished its initialization and
// is ready to create the browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
createWindow();
setupLocalFilesNormalizerProxy();
app.on("activate", function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
});
// Quit when all windows are closed, except on macOS.
// There, it's common for applications and their menu bar to stay active until
// the user quits explicitly with Cmd + Q.
app.on("window-all-closed", function () {
if (process.platform !== "darwin") {
app.quit();
}
});
// If your app has no need to navigate or only needs to navigate to known pages,
// it is a good idea to limit navigation outright to that known scope,
// disallowing any other kinds of navigation.
const allowedNavigationDestinations = "https://my-electron-app.com";
app.on("web-contents-created", (event, contents) => {
contents.on("will-navigate", (event, navigationUrl) => {
const parsedUrl = new URL(navigationUrl);
if (!allowedNavigationDestinations.includes(parsedUrl.origin)) {
event.preventDefault();
}
});
});
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
/*
const mainWindow = new BrowserWindow({
})*/

93
jsketcher.code-workspace Normal file
View file

@ -0,0 +1,93 @@
{
"folders": [
{
"name": "modules",
"path": "./modules"
},
{
"name": "web",
"path": "./web"
},
{
"name": "repo",
"path": "."
}
],
"settings": {
"files.autoSave": "afterDelay",
"rust-analyzer.checkOnSave.enable": true,
"rust-analyzer.checkOnSave.command": "clippy",
"rust-analyzer.checkOnSave.allTargets": true,
"rust-analyzer.files.watcher": "client",
"rust-analyzer.files.excludeDirs": [
"**/target",
"**/node_modules",
"**/dist",
"**/build",
"**/public",
"**/assets",
"**/src-tauri/target",
"**/scripts",
"**/src/components",
"**/src/interfaces",
"**/src/pages",
"**/src/static",
"**/src/styles",
"**/src/utils"
],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[toml]": {
"editor.defaultFormatter": "tamasfe.even-better-toml"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"liveServer.settings.multiRootWorkspaceName": "ETVR",
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[css]": {
"editor.defaultFormatter": "vscode.css-language-features"
},
"[shellscript]": {
"editor.defaultFormatter": "shakram02.bash-beautify"
},
"cSpell.words": [
"APPCONFIG",
"APPDATA",
"clippy",
"clsx",
"Coeff",
"dnsquery",
"esbenp",
"eyetrack",
"fullname",
"hashset",
"hookable",
"Iinternal",
"iocp",
"kobalte",
"nanos",
"notif",
"notififcation",
"notifs",
"partytown",
"ratelimit",
"reqwest",
"shakram",
"solidjs",
"soundfile",
"tamasfe",
"undici",
"vorbis",
"webserial",
"Xmark"
]
}
}

25945
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,68 +1,10 @@
{
"name": "jsketcher",
"version": "0.1.0",
"main": "electron.js",
"private": true,
"description": "JS.Sketcher is a parametric 2D and 3D CAD modeler written in pure javascript",
"build": {
"appId": "jsketcher",
"linux": {
"category": "Utility",
"icon": "icon.png",
"target": [
"deb",
"appImage"
]
},
"deb": {
"depends": [
"gconf2",
"gconf-service",
"libnotify4",
"libappindicator1",
"libxtst6",
"libnss3"
]
},
"win": {
"icon": "icon.png"
},
"mac": {
"icon": "icon.icns",
"category": "public.app-category.utilities"
},
"files": [
"build/*",
"dev-guide",
"misc/*",
"modules/**/**/*",
"node_modules/**/**/*",
"public/*",
"test/**/**/*",
"web/**/**/*",
".babelrc",
".eslintrc.json",
".gitignore",
"externals.d.ts",
"Gruntfile.js",
"cypress.json",
"package.json",
"package-lock.json",
"tsconfig.json",
"electron.js",
"dist/**/*",
"webpack.config.js"
],
"extraMetadata": {
"main": "public/electron.js"
},
"directories": {
"buildResources": "build"
}
},
"scripts": {
"start": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --config webpack.config.js --port 3000 --host 0.0.0.0",
"electron": "concurrently \"cross-env BROWSER=none yarn start\" \"wait-on http://localhost:3000 && electron .\"",
"pack": "node ./node_modules/webpack/bin/webpack.js --config webpack.config.js --progress --profile --colors",
"start-with-docs": "concurrently --kill-others 'npm start' './node_modules/grunt/bin/grunt docs-start'",
"build": "grunt",
@ -72,9 +14,8 @@
"checks-passed-banner": "echo 'All conditions passed. Ready to go to the main branch. Good job!'",
"before-main-branch-merge": "npm run lint && npm run check-code && npm run checks-passed-banner",
"cypress": "npx cypress open",
"electron:package:mac": "npm run build && electron-builder -m -c.extraMetadata.main=electron.js",
"electron:package:win": "npm run build && electron-builder -w -c.extraMetadata.main=electron.js",
"electron:package:linux": "npm run build && electron-builder -l -c.extraMetadata.main=electron.js"
"tauri:dev": "tauri dev",
"tauri:build": "tauri build"
},
"repository": {
"type": "git",
@ -103,6 +44,7 @@
"@babel/preset-react": "^7.18.6",
"@babel/preset-stage-2": "^7.8.3",
"@babel/preset-typescript": "^7.18.6",
"@tauri-apps/cli": "^1.2.3",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9",
"@typescript-eslint/eslint-plugin": "^5.45.1",
@ -117,8 +59,6 @@
"cypress": "^12.0.1",
"cypress-wait-until": "^1.7.1",
"del": "^6.0.0",
"electron": "^22.0.0",
"electron-builder": "^22.10.3",
"eslint": "^8.29.0",
"eslint-plugin-import": "^2.26.0",
"file-loader": "^6.2.0",
@ -141,6 +81,7 @@
"dependencies": {
"@dxfjs/parser": "^0.2.0",
"@tarikjabiri/dxf": "^2.6.2",
"@tauri-apps/api": "^1.2.0",
"@types/three": "^0.146.0",
"browser-xml2js": "^0.4.19",
"classnames": "^2.3.2",
@ -168,4 +109,4 @@
"url": "^0.11.0"
},
"proxy": "http://localhost:3000"
}
}

7473
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,10 +0,0 @@
// All of the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
const { contextBridge } = require("electron");
// As an example, here we use the exposeInMainWorld API to expose the browsers
// and node versions to the main window.
// They'll be accessible at "window.versions".
process.once("loaded", () => {
contextBridge.exposeInMainWorld("versions", process.versions);
});

3
src-tauri/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
# Generated by Cargo
# will have compiled files and executables
/target/

3319
src-tauri/Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

28
src-tauri/Cargo.toml Normal file
View file

@ -0,0 +1,28 @@
[package]
name = "app"
version = "0.1.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
default-run = "app"
edition = "2021"
rust-version = "1.59"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
tauri-build = { version = "1.2.1", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.2.4", features = [] }
[features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = [ "custom-protocol" ]
# this feature is used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = [ "tauri/custom-protocol" ]

3
src-tauri/build.rs Normal file
View file

@ -0,0 +1,3 @@
fn main() {
tauri_build::build()
}

BIN
src-tauri/icons/128x128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
src-tauri/icons/32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
src-tauri/icons/icon.icns Normal file

Binary file not shown.

BIN
src-tauri/icons/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
src-tauri/icons/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

14
src-tauri/rustfmt.toml Normal file
View file

@ -0,0 +1,14 @@
max_width = 100
hard_tabs = false
tab_spaces = 2
newline_style = "Auto"
use_small_heuristics = "Default"
reorder_imports = true
reorder_modules = true
remove_nested_parens = true
edition = "2018"
merge_derives = true
use_try_shorthand = false
use_field_init_shorthand = false
force_explicit_abi = true
imports_granularity = "Crate"

11
src-tauri/src/main.rs Normal file
View file

@ -0,0 +1,11 @@
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
fn main() {
tauri::Builder::default()
// Don't worry about this error, it's just the rust analyzer.
.run(tauri::generate_context!())
.expect("error while running tauri application");
}

67
src-tauri/tauri.conf.json Normal file
View file

@ -0,0 +1,67 @@
{
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
"build": {
"beforeBuildCommand": "pnpm build",
"beforeDevCommand": "pnpm start",
"devPath": "http://localhost:3000",
"distDir": "../build"
},
"package": {
"productName": "jsketcher",
"version": "0.1.0"
},
"tauri": {
"allowlist": {
"all": false
},
"bundle": {
"active": true,
"category": "DeveloperTool",
"copyright": "",
"deb": {
"depends": []
},
"externalBin": [],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"identifier": "com.jsketcher.dev",
"longDescription": "",
"macOS": {
"entitlements": null,
"exceptionDomain": "",
"frameworks": [],
"providerShortName": null,
"signingIdentity": null
},
"resources": [],
"shortDescription": "",
"targets": "all",
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
}
},
"security": {
"csp": null
},
"updater": {
"active": false
},
"windows": [
{
"fullscreen": false,
"height": 600,
"resizable": true,
"title": "jsketcher",
"width": 800
}
]
}
}