first commit

This commit is contained in:
Nicola Spadari
2024-06-16 01:35:44 +02:00
commit 93877e5f1f
39 changed files with 16397 additions and 0 deletions

11
.gitignore vendored Normal file
View File

@@ -0,0 +1,11 @@
node_modules
.DS_Store
*.log*
.nuxt
.nitro
.cache
.output
.env
.cargo
dist
src-tauri/target

2
.npmrc Normal file
View File

@@ -0,0 +1,2 @@
shamefully-hoist=true
strict-peer-dependencies=false

1
.nvmrc Normal file
View File

@@ -0,0 +1 @@
20.10.0

31
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,31 @@
{
// Enable the ESlint flat config support
"eslint.experimental.useFlatConfig": true,
// Use eslint as default formatter
"editor.formatOnSave": false,
// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},
// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"typescript",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml"
],
// Use .config directory
"eslint.options": {
"overrideConfigFile": ".config/eslint.mjs"
}
}

26
README.md Normal file
View File

@@ -0,0 +1,26 @@
<h1 align="center">Nuxtor</h1>
<hr />
## Usage
Clone to local:
```sh
$ npx degit NicolaSpadari/nuxtor
```
Install dependencies:
```sh
$ pnpm install
```
Run project:
```sh
$ pnpm run dev
```
<!--
TODO:
- Fix eslint
- Complete app
- Better readme
-->

44
eslint.config.mjs Normal file
View File

@@ -0,0 +1,44 @@
import { antfu as eslintConfig } from "@antfu/eslint-config";
import withNuxt from "./.nuxt/eslint.config.mjs";
export default withNuxt(
eslintConfig(
// General
{
typescript: true,
vue: true,
unocss: true,
stylistic: {
indent: "tab",
quotes: "double"
},
rules: {
curly: "off",
"no-console": "off",
"no-new-func": "off",
"style/semi": ["error", "always"],
"style/indent": ["error", "tab"],
"style/quote-props": ["warn", "as-needed"],
"style/comma-dangle": ["warn", "never"],
"style/brace-style": ["warn", "1tbs"],
"style/arrow-parens": ["error", "always"],
"vue/block-order": ["error", {
order: ["template", "script", "style"]
}],
"vue/script-indent": ["error", "tab", {
baseIndent: 1
}],
"antfu/top-level-function": "off",
"node/prefer-global/process": ["off"]
}
},
// Vue
{
files: ["**/*.vue"],
rules: {
"style/indent": "off"
}
}
)
)

86
nuxt.config.ts Normal file
View File

@@ -0,0 +1,86 @@
export default defineNuxtConfig({
modules: [
"@vueuse/nuxt",
"@unocss/nuxt",
"@nuxt/eslint"
],
app: {
head: {
title: "Nuxtor",
charset: "utf-8",
viewport: "width=device-width, initial-scale=1",
meta: [
{ name: "format-detection", content: "no" }
],
bodyAttrs: {
class: "font-text antialiased"
},
link: [
{ rel: "shortcut-icon", href: "/favicon.svg" }
],
noscript: [
{ children: "JavaScript is required to run this project" }
]
}
},
experimental: {
typedPages: true
},
css: [
"@unocss/reset/tailwind.css"
],
imports: {
presets: [
{
from: "@tauri-apps/api/app",
imports: ["getName", "getVersion", "getTauriVersion"]
},
{
from: "@tauri-apps/api/shell",
imports: ["Command"]
},
{
from: "@tauri-apps/api/os",
imports: ["platform"]
},
{
from: "@tauri-apps/api/notification",
imports: ["sendNotification", "requestPermission", "isPermissionGranted"]
}
]
},
vite: {
clearScreen: false,
envPrefix: ["VITE_", "TAURI_"],
server: {
strictPort: true,
hmr: {
protocol: "ws",
host: "0.0.0.0",
port: 3001
},
watch: {
ignored: ["**/src-tauri/**"]
}
}
},
vue: {
compilerOptions: {
isCustomElement: (tag: string) => tag.startsWith("i-")
}
},
srcDir: "src/",
ssr: false,
devServer: {
host: "0.0.0.0"
},
nitro: {
prerender: {
routes: ["/"]
}
},
// sourcemap: {
// server: true,
// client: false
// }
});

40
package.json Normal file
View File

@@ -0,0 +1,40 @@
{
"name": "nuxtor",
"type": "module",
"version": "1.0.0",
"private": true,
"packageManager": "pnpm@9.3.0",
"description": "Starter template for Nuxt 3 with Tauri",
"author": "Nicola Spadari",
"engines": {
"node": ">=20"
},
"scripts": {
"dev": "nuxt dev",
"generate": "nuxt generate",
"preinstall": "npx only-allow pnpm",
"postinstall": "nuxt prepare",
"lint": "eslint . --fix",
"tauri": "tauri",
"tauri:dev": "tauri dev",
"tauri:build": "tauri build"
},
"dependencies": {
"@tauri-apps/api": "^1"
},
"devDependencies": {
"@antfu/eslint-config": "^2.21.1",
"@iconify-json/heroicons-solid": "^1.1.11",
"@unocss/eslint-plugin": "^0.61.0",
"@unocss/nuxt": "^0.61.0",
"@vueuse/core": "^10.11.0",
"@vueuse/nuxt": "^10.11.0",
"eslint": "8.57.0",
"@nuxt/eslint": "^0.3.13",
"nuxt": "^3.12.1",
"sass": "^1.77.5",
"typescript": "^5.4.5",
"unplugin-auto-import": "^0.17.6",
"@tauri-apps/cli": "^1"
}
}

11168
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

4718
src-tauri/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

19
src-tauri/Cargo.toml Normal file
View File

@@ -0,0 +1,19 @@
[package]
name = "nuxtor"
version = "1.0.0"
description = "Starter template for Nuxt 3 with Tauri"
authors = ["NicolaSpadari"]
license = "MIT"
repository = "https://github.com/NicolaSpadari/nuxtor"
edition = "2021"
[build-dependencies]
tauri-build = { version = "1", features = [] }
[dependencies]
tauri = { version = "1", features = ["notification-all", "shell-all", "system-tray"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
[features]
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: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 974 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 903 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 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: 85 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

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

@@ -0,0 +1,28 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use tauri::{CustomMenuItem, SystemTray, SystemTrayMenu, SystemTrayEvent};
fn main() {
let opt_quit = CustomMenuItem::new("quit", "Quit");
let tray_menu = SystemTrayMenu::new()
.add_item(opt_quit);
let system_tray = SystemTray::new()
.with_menu(tray_menu);
tauri::Builder::default()
.system_tray(system_tray)
.on_system_tray_event(| _app, event | match event {
SystemTrayEvent::MenuItemClick { id, .. } => {
match id.as_str() {
"quit" => {
std::process::exit(0)
}
_ => {}
}
}
_ => {}
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}

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

@@ -0,0 +1,79 @@
{
"package": {
"productName": "nuxtor",
"version": "1.0.0"
},
"build": {
"distDir": "../dist",
"devPath": "http://localhost:3000",
"beforeDevCommand": "pnpm dev",
"beforeBuildCommand": "pnpm generate"
},
"tauri": {
"systemTray": {
"iconPath": "./icons/icon.png",
"iconAsTemplate": true
},
"bundle": {
"active": true,
"targets": "all",
"identifier": "com.nicolaspadari.nuxtor",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"resources": [],
"externalBin": [],
"copyright": "",
"category": "DeveloperTool",
"shortDescription": "",
"longDescription": "",
"deb": {},
"macOS": {},
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
}
},
"updater": {
"active": false
},
"allowlist": {
"shell": {
"all": true,
"open": true,
"scope": [
{
"name": "cmd",
"cmd": "cmd",
"args": ["/C", { "validator": "\\S+" }]
},
{
"name": "pwsh",
"cmd": "pwsh",
"args": ["-Command", { "validator": "\\S+" }]
}
]
},
"notification": {
"all": true
}
},
"windows": [
{
"title": "Nuxtor",
"width": 1920,
"height": 1080,
"resizable": true,
"fullscreen": false
}
],
"security": {
"csp": null
}
}
}

30
src/app.vue Normal file
View File

@@ -0,0 +1,30 @@
<template>
<Body bg-dark-800 text-white>
<NuxtPage />
</Body>
</template>
<style lang="scss">
html {
-webkit-tap-highlight-color: transparent;
scroll-behavior: smooth;
@apply min-h-screen;
}
body {
@apply overflow-x-hidden;
}
img {
-webkit-user-drag: none;
@apply select-none;
}
// Transitions
.fade-enter-active,
.fade-leave-active {
@apply transition-opacity ease-in-out duration-300;
}
.fade-enter-from,
.fade-leave-to {
@apply opacity-0;
}
</style>

9
src/components/Test.vue Normal file
View File

@@ -0,0 +1,9 @@
<template>
<div text-center space-y-5>
Hello from Nuxtor {{ version }}
</div>
</template>
<script lang="ts" setup>
const version = await getTauriVersion();
</script>

14
src/composables/test.ts Normal file
View File

@@ -0,0 +1,14 @@
const test = ref("Text from composable");
export const useTest = () => {
const setValue = async () => {
const { data } = await useFetch<MyTest>("/api/test");
test.value = data.value!.text;
};
return {
test,
setValue
};
};

5
src/pages/[...all].vue Normal file
View File

@@ -0,0 +1,5 @@
<template>
<div>
<p>404</p>
</div>
</template>

11
src/pages/index.vue Normal file
View File

@@ -0,0 +1,11 @@
<template>
<div grid h-screen place-content-center>
<Test />
{{ data }}
</div>
</template>
<script lang="ts" setup>
const { data } = await useFetch("https://jsonplaceholder.typicode.com/todos/1");
</script>

3
src/public/favicon.svg Normal file
View File

@@ -0,0 +1,3 @@
<svg width="900" height="900" viewBox="0 0 900 900" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M504.908 750H839.476C850.103 750.001 860.542 747.229 869.745 741.963C878.948 736.696 886.589 729.121 891.9 719.999C897.211 710.876 900.005 700.529 900 689.997C899.995 679.465 897.193 669.12 891.873 660.002L667.187 274.289C661.876 265.169 654.237 257.595 645.036 252.329C635.835 247.064 625.398 244.291 614.773 244.291C604.149 244.291 593.711 247.064 584.511 252.329C575.31 257.595 567.67 265.169 562.36 274.289L504.908 372.979L392.581 179.993C387.266 170.874 379.623 163.301 370.42 158.036C361.216 152.772 350.777 150 340.151 150C329.525 150 319.086 152.772 309.883 158.036C300.679 163.301 293.036 170.874 287.721 179.993L8.12649 660.002C2.80743 669.12 0.00462935 679.465 5.72978e-06 689.997C-0.00461789 700.529 2.78909 710.876 8.10015 719.999C13.4112 729.121 21.0523 736.696 30.255 741.963C39.4576 747.229 49.8973 750.001 60.524 750H270.538C353.748 750 415.112 713.775 457.336 643.101L559.849 467.145L614.757 372.979L779.547 655.834H559.849L504.908 750ZM267.114 655.737L120.551 655.704L340.249 278.586L449.87 467.145L376.474 593.175C348.433 639.03 316.577 655.737 267.114 655.737Z" fill="#00DC82"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

13
tsconfig.json Normal file
View File

@@ -0,0 +1,13 @@
{
"extends": "./.nuxt/tsconfig.json",
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"strict": true
},
"include": [
".nuxt/nuxt.d.ts",
"env.d.ts",
"**/*"
]
}

3
types/global.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
declare interface MyTest {
text: string
}

53
uno.config.ts Normal file
View File

@@ -0,0 +1,53 @@
import {
defineConfig,
presetAttributify,
presetIcons,
presetTagify,
presetTypography,
presetUno,
presetWebFonts,
transformerDirectives,
transformerVariantGroup
} from "unocss";
export default defineConfig({
shortcuts: [
["crate", "mx-auto max-w-7xl px-4 lg:px-8 sm:px-6"],
["flex-center", "flex justify-center items-center"]
],
presets: [
presetUno(),
presetTagify(),
presetAttributify(),
presetIcons({
extraProperties: {
display: "inline-block",
"vertical-align": "middle"
}
}),
presetTypography(),
presetWebFonts({
fonts: {
heading: {
name: "Montserrat",
weights: ["200", "400", "700"]
},
text: "Inter"
}
})
],
theme: {
breakpoints: {
sm: "576px",
md: "768px",
lg: "992px",
xl: "1200px",
xxl: "1400px",
uw: "2000px"
}
},
transformers: [
transformerDirectives(),
transformerVariantGroup()
]
});