Skip to content

Commit

Permalink
feat: refactoring the project in Nuxt
Browse files Browse the repository at this point in the history
  • Loading branch information
moebiusmania committed Nov 5, 2024
1 parent 038b312 commit 71d1277
Show file tree
Hide file tree
Showing 43 changed files with 9,731 additions and 2,801 deletions.
35 changes: 23 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,40 @@
name: Deploy React App to GH pages
name: Build & deploy

on:
push:
branches: [main]

permissions:
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.12]
node-version: [22.10]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- name: 💻 Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm test
- run: npm run build

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
- name: 📦 Install dependencies
run: npm ci

- name: 🏗️ Build static website
run: npm run build:gh

- name: 🚀 Upload artifact
uses: actions/upload-pages-artifact@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
path: .output/public

- name: 🏁 Deploy to GitHub Pages
id: gh-pages
uses: actions/deploy-pages@v4
39 changes: 19 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
# Nuxt dev/build outputs
.output
.data
.nuxt
.nitro
.cache
dist

# Node dependencies
node_modules

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

coverage
node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
# Misc
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.fleet
.idea

# Local env files
.env
.env.*
!.env.example
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,9 @@ open a browser at `http://localhost:3000` and you will see the application.

### What has been used

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

Expand Down
48 changes: 48 additions & 0 deletions app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<script setup lang="ts">
import { hasData, load } from "./libs/storage";
const app = useMainStore();
onMounted(() => {
if (hasData()) {
app.setState(load());
document.querySelector("html")?.setAttribute("data-theme", app.theme);
}
});
useHead({
title: "Subscriptions Tracker ⚠️",
meta: [
{ name: "description", content: "Webapp to keep track on subscriptions fees and have some math done for you." },
{ name: "theme-color", content: "#ffffff" },
{ name: "viewport", content: "width=device-width, initial-scale=1.0" },
{ name: "title", content: "Subscriptions Tracker ⚠️" },
],
link: [
{
rel: "icon",
type: "image/svg+xml",
href: "/favicon.svg",
},
{
rel: "icon",
type: "image/png",
sizes: "32x32",
href: "/static/favicons/favicon-32x32.png",
},
],
htmlAttrs: {
lang: "it-IT",
"data-theme": "light",
// class: document && document.documentElement.classList.contains("dark") ? "dark" : "light",
}
})
</script>

<template>
<div class="flex flex-col h-screen">
<Header />
<NuxtPage />
<Footer />
</div>
</template>
1 change: 0 additions & 1 deletion src/components/Backup.vue → components/Backup.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { useMainStore } from "./../store";
import { save } from "./../libs/storage";
const app = useMainStore();
Expand Down
File renamed without changes.
6 changes: 1 addition & 5 deletions src/components/Dashboard.vue → components/Dashboard.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<script setup lang="ts">
import Container from "./Container.vue";
import Stat from "./Stat.vue";
import { Subscription } from "../libs/types";
import type { Subscription } from "../libs/types";
import { getInactives, getMonthlyCost, getYearlyCost, getTranslation } from "./../libs";
import { useMainStore } from "../store";
defineProps<{
data: Subscription[];
Expand Down
2 changes: 0 additions & 2 deletions src/components/Empty.vue → components/Empty.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import Container from "./Container.vue";
import { useMainStore } from "./../store";
import { save } from "./../libs/storage";
const app = useMainStore();
Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions src/components/Form.vue → components/Form.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<script setup lang="ts">
import { ref, Ref } from "vue";
import { ref, type Ref } from "vue";
// import { format } from "date-fns";
import { formatDate } from "../libs";
import { Subscription } from "../libs/types";
import type { Subscription } from "../libs/types";
const emit = defineEmits<{
(e: "add-item", item: Subscription): void;
Expand Down
1 change: 0 additions & 1 deletion src/components/Header.vue → components/Header.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { useMainStore } from "./../store";
import { save } from "./../libs/storage";
const app = useMainStore();
Expand Down
6 changes: 1 addition & 5 deletions src/components/List.vue → components/List.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<script setup lang="ts">
import { Subscription } from "../libs/types";
import { useMainStore } from "./../store";
import type { Subscription } from "../libs/types";
import { save } from "./../libs/storage";
import Container from "./Container.vue";
import Backup from "./Backup.vue";
const app = useMainStore();
const i18n = app.i18n.main;
const fbText = "Sure you want to delete all subscriptions data?";
Expand Down
File renamed without changes.
File renamed without changes.
20 changes: 0 additions & 20 deletions index.html

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.
6 changes: 6 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: '2024-04-03',
devtools: { enabled: true },
modules: ['@pinia/nuxt', '@nuxtjs/tailwindcss'],
})
Loading

0 comments on commit 71d1277

Please sign in to comment.