Skip to content

Commit 71d1277

Browse files
author
Salvatore Laisa
committed
feat: refactoring the project in Nuxt
1 parent 038b312 commit 71d1277

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+9731
-2801
lines changed

.github/workflows/build.yml

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,40 @@
1-
name: Deploy React App to GH pages
1+
name: Build & deploy
22

33
on:
44
push:
55
branches: [main]
66

7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
712
jobs:
813
build:
914
runs-on: ubuntu-latest
1015

1116
strategy:
1217
matrix:
13-
node-version: [20.12]
18+
node-version: [22.10]
1419

1520
steps:
16-
- uses: actions/checkout@v3
17-
- name: Use Node.js ${{ matrix.node-version }}
18-
uses: actions/setup-node@v3
21+
- uses: actions/checkout@v4
22+
- name: 💻 Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v4
1924
with:
2025
node-version: ${{ matrix.node-version }}
21-
- run: npm ci
22-
- run: npm test
23-
- run: npm run build
2426

25-
- name: Deploy
26-
uses: peaceiris/actions-gh-pages@v3
27+
- name: 📦 Install dependencies
28+
run: npm ci
29+
30+
- name: 🏗️ Build static website
31+
run: npm run build:gh
32+
33+
- name: 🚀 Upload artifact
34+
uses: actions/upload-pages-artifact@v3
2735
with:
28-
github_token: ${{ secrets.GITHUB_TOKEN }}
29-
publish_dir: ./dist
36+
path: .output/public
37+
38+
- name: 🏁 Deploy to GitHub Pages
39+
id: gh-pages
40+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1+
# Nuxt dev/build outputs
2+
.output
3+
.data
4+
.nuxt
5+
.nitro
6+
.cache
7+
dist
8+
9+
# Node dependencies
10+
node_modules
11+
112
# Logs
213
logs
314
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
pnpm-debug.log*
8-
lerna-debug.log*
9-
10-
coverage
11-
node_modules
12-
dist
13-
dist-ssr
14-
*.local
1515

16-
# Editor directories and files
17-
.vscode/*
18-
!.vscode/extensions.json
19-
.idea
16+
# Misc
2017
.DS_Store
21-
*.suo
22-
*.ntvs*
23-
*.njsproj
24-
*.sln
25-
*.sw?
18+
.fleet
19+
.idea
20+
21+
# Local env files
22+
.env
23+
.env.*
24+
!.env.example

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,9 @@ open a browser at `http://localhost:3000` and you will see the application.
7070

7171
### What has been used
7272

73-
- [Vue 3](https://vuejs.org/) - component framework
74-
- [Typescript](https://www.typescriptlang.org/) - static typed Javascript
73+
- [Nuxt 3](https://nuxt.com/) - main application framework based on [Vue 3](https://vuejs.org/)
7574
- [Pinia](https://pinia.vuejs.org/) - state management
76-
- [Vite.js](https://vitejs.dev/) - project bootstrap and tooling
77-
- [Vitest](https://vitest.dev/) - unit testing
75+
<!-- - [Vitest](https://vitest.dev/) - unit testing -->
7876
- [TailwindCSS](https://tailwindcss.com/) - CSS as utilility classes
7977
- [DaisyUI](https://daisyui.com/) - UI components built on top of TailwindCSS
8078

app.vue

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<script setup lang="ts">
2+
import { hasData, load } from "./libs/storage";
3+
4+
const app = useMainStore();
5+
6+
onMounted(() => {
7+
if (hasData()) {
8+
app.setState(load());
9+
document.querySelector("html")?.setAttribute("data-theme", app.theme);
10+
}
11+
});
12+
13+
useHead({
14+
title: "Subscriptions Tracker ⚠️",
15+
meta: [
16+
{ name: "description", content: "Webapp to keep track on subscriptions fees and have some math done for you." },
17+
{ name: "theme-color", content: "#ffffff" },
18+
{ name: "viewport", content: "width=device-width, initial-scale=1.0" },
19+
{ name: "title", content: "Subscriptions Tracker ⚠️" },
20+
],
21+
link: [
22+
{
23+
rel: "icon",
24+
type: "image/svg+xml",
25+
href: "/favicon.svg",
26+
},
27+
{
28+
rel: "icon",
29+
type: "image/png",
30+
sizes: "32x32",
31+
href: "/static/favicons/favicon-32x32.png",
32+
},
33+
],
34+
htmlAttrs: {
35+
lang: "it-IT",
36+
"data-theme": "light",
37+
// class: document && document.documentElement.classList.contains("dark") ? "dark" : "light",
38+
}
39+
})
40+
</script>
41+
42+
<template>
43+
<div class="flex flex-col h-screen">
44+
<Header />
45+
<NuxtPage />
46+
<Footer />
47+
</div>
48+
</template>

src/components/Backup.vue renamed to components/Backup.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script setup lang="ts">
2-
import { useMainStore } from "./../store";
32
import { save } from "./../libs/storage";
43
54
const app = useMainStore();
File renamed without changes.

src/components/Dashboard.vue renamed to components/Dashboard.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
<script setup lang="ts">
2-
import Container from "./Container.vue";
3-
import Stat from "./Stat.vue";
4-
5-
import { Subscription } from "../libs/types";
2+
import type { Subscription } from "../libs/types";
63
import { getInactives, getMonthlyCost, getYearlyCost, getTranslation } from "./../libs";
7-
import { useMainStore } from "../store";
84
95
defineProps<{
106
data: Subscription[];

src/components/Empty.vue renamed to components/Empty.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<script setup lang="ts">
2-
import Container from "./Container.vue";
3-
import { useMainStore } from "./../store";
42
import { save } from "./../libs/storage";
53
64
const app = useMainStore();
File renamed without changes.

src/components/Form.vue renamed to components/Form.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<script setup lang="ts">
2-
import { ref, Ref } from "vue";
2+
import { ref, type Ref } from "vue";
33
// import { format } from "date-fns";
4-
54
import { formatDate } from "../libs";
6-
import { Subscription } from "../libs/types";
5+
import type { Subscription } from "../libs/types";
76
87
const emit = defineEmits<{
98
(e: "add-item", item: Subscription): void;

src/components/Header.vue renamed to components/Header.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script setup lang="ts">
2-
import { useMainStore } from "./../store";
32
import { save } from "./../libs/storage";
43
54
const app = useMainStore();

src/components/List.vue renamed to components/List.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
<script setup lang="ts">
2-
import { Subscription } from "../libs/types";
3-
import { useMainStore } from "./../store";
2+
import type { Subscription } from "../libs/types";
43
import { save } from "./../libs/storage";
54
6-
import Container from "./Container.vue";
7-
import Backup from "./Backup.vue";
8-
95
const app = useMainStore();
106
const i18n = app.i18n.main;
117
const fbText = "Sure you want to delete all subscriptions data?";
File renamed without changes.
File renamed without changes.

index.html

Lines changed: 0 additions & 20 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

nuxt.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// https://nuxt.com/docs/api/configuration/nuxt-config
2+
export default defineNuxtConfig({
3+
compatibilityDate: '2024-04-03',
4+
devtools: { enabled: true },
5+
modules: ['@pinia/nuxt', '@nuxtjs/tailwindcss'],
6+
})

0 commit comments

Comments
 (0)