Okay now Tauri is actually working.

This commit is contained in:
Ada Werefox 2023-03-26 17:26:28 +00:00
parent 6b9e85f7d0
commit a0bcdd87de
46 changed files with 3378 additions and 91 deletions

View File

@ -18,6 +18,10 @@
# misc # misc
.DS_Store .DS_Store
*.pem *.pem
.env.local
.env.development.local
.env.test.local
.env.production.local
# debug # debug
npm-debug.log* npm-debug.log*

35
deploy.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
set -xe
CONTAINER_NAME=letter-werefox-cafe
MODE=$1
x=$(MODE=$MODE docker compose ps | grep $CONTAINER_NAME | wc -l)
if [ "$MODE" == "" ] || [ "$MODE" != "build" && "$MODE" != "dev" && "$MODE" != "start" ]; then
echo "Please use 'dev', 'build', or 'start' as an argument."
exit 1
fi
if [ $x -eq 1 ]; then
MODE=$MODE docker compose rm -sf
fi
#if [ ! -d "$(pwd)/src/$APP_FOLDER" ]; then
# MODE=$MODE docker compose run $CONTAINER_NAME sh -c "npm install --silent create-next-app && \
# npx create-next-app /usr/src/app/$APP_FOLDER --ts --eslint && \
# cd $APP_FOLDER && npm install tailwindcss autoprefixer && npx tailwindcss init -p && \
# cd /usr/src/app && rm -rf node_modules package.json package-lock.json"
#fi
MODE=$MODE docker compose run $CONTAINER_NAME sh -c "npm install --silent"
MODE=$MODE docker compose run $CONTAINER_NAME sh -c "npx next telemetry disable"
if [ "$MODE" == "build" ]; then
MODE=$MODE docker compose run $CONTAINER_NAME sh -c "npm run build && npm run export"
elif [ "$MODE" == "dev" ] || [ "$MODE" == "start" ]; then
MODE=$MODE docker compose up -d
MODE=$MODE docker compose logs -f
fi

View File

@ -5,9 +5,9 @@ services:
"letter-werefox-cafe": "letter-werefox-cafe":
image: node:alpine image: node:alpine
volumes: volumes:
- ./src:/usr/src/app/ - .:/usr/src/app/
ports: ports:
- "3469:3000" - "3469:3000"
user: "1000:1000" user: "1000:1000"
working_dir: "/usr/src/app" working_dir: "/usr/src/app"
command: 'sh -c "cd $APP_FOLDER && npm run $MODE"' command: "npm run $MODE"

23
next-js/.gitignore vendored
View File

@ -1,23 +0,0 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View File

@ -1,36 +0,0 @@
#!/bin/bash
set -xe
APP_FOLDER=letter
CONTAINER_NAME=letter-werefox-cafe
MODE=$1
x=$(APP_FOLDER=$APP_FOLDER MODE=$MODE docker compose ps | grep $CONTAINER_NAME | wc -l)
if [ "$MODE" == "" ] || [ "$MODE" != "build" && "$MODE" != "dev" && "$MODE" != "start" ]; then
echo "Please use 'dev', 'build', or 'start' as an argument."
exit 1
fi
if [ $x -eq 1 ]; then
APP_FOLDER=$APP_FOLDER MODE=$MODE docker compose rm -sf
fi
if [ ! -d "$(pwd)/src/$APP_FOLDER" ]; then
APP_FOLDER=$APP_FOLDER MODE=$MODE docker compose run $CONTAINER_NAME sh -c "npm install --silent create-next-app && \
npx create-next-app /usr/src/app/$APP_FOLDER --ts --eslint && \
cd $APP_FOLDER && npm install tailwindcss autoprefixer && npx tailwindcss init -p && \
cd /usr/src/app && rm -rf node_modules package.json package-lock.json"
fi
APP_FOLDER=$APP_FOLDER MODE=$MODE docker compose run $CONTAINER_NAME sh -c "cd $APP_FOLDER && npm install --silent"
APP_FOLDER=$APP_FOLDER MODE=$MODE docker compose run $CONTAINER_NAME sh -c "cd $APP_FOLDER && npx next telemetry disable"
if [ "$MODE" == "build" ]; then
APP_FOLDER=$APP_FOLDER MODE=$MODE docker compose run $CONTAINER_NAME sh -c "cd $APP_FOLDER && npm run build"
elif [ "$MODE" == "dev" ] || [ "$MODE" == "start" ]; then
APP_FOLDER=$APP_FOLDER MODE=$MODE docker compose up -d
APP_FOLDER=$APP_FOLDER MODE=$MODE docker compose logs -f
fi

View File

@ -1,6 +1,9 @@
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
reactStrictMode: true, reactStrictMode: true,
images: {
unoptimized: true,
},
} }
module.exports = nextConfig module.exports = nextConfig

View File

@ -3,9 +3,11 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev -p 3469",
"build": "next build", "build": "next build",
"start": "next start", "export": "next export",
"start": "next start -p 3469",
"tauri":"tauri",
"lint": "next lint" "lint": "next lint"
}, },
"dependencies": { "dependencies": {

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -1,17 +0,0 @@
# Rust .gitignore
# Generated by Cargo
# will have compiled files and executables
debug/
target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

View File

@ -1,8 +0,0 @@
[package]
name = "rust-letter"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@ -1,3 +0,0 @@
fn main() {
println!("Hello, world!");
}

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

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

3221
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.0 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.0 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

10
src-tauri/src/main.rs Normal file
View File

@ -0,0 +1,10 @@
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
fn main() {
tauri::Builder::default()
.run(tauri::generate_context!())
.expect("error while running tauri application");
}

65
src-tauri/tauri.conf.json Normal file
View File

@ -0,0 +1,65 @@
{
"build": {
"beforeBuildCommand": "npm run build && npm run export",
"beforeDevCommand": "npm run dev",
"devPath": "http://localhost:3469",
"distDir": "../out"
},
"package": {
"productName": "letter",
"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.tauri.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": "A letter for you!",
"width": 800
}
]
}
}