From a99d91342070b36cb2488a8fb3993ca1c614ea9c Mon Sep 17 00:00:00 2001 From: Quinta0 <0pietroquintavalle0@gmail.com> Date: Fri, 14 Aug 2026 23:43:49 +0200 Subject: [PATCH] full rework in vite --- .eslintrc.json | 3 - .github/workflows/deploy.yml | 49 + .github/workflows/nextjs.yml | 93 - .gitignore | 10 +- README.md | 34 +- app/_app.tsx | 16 - app/layout.tsx | 59 - app/page.tsx | 53 - components.json | 4 +- index.html | 13 + next.config.mjs | 4 - package-lock.json | 7501 ++++------------- package.json | 16 +- {app => public}/favicon.ico | Bin public/next.svg | 1 - public/vercel.svg | 1 - src/App.tsx | 39 + src/components/TopicContent.tsx | 46 + {components => src/components}/footer.tsx | 0 {components => src/components}/navigation.tsx | 12 +- {components => src/components}/ui/button.tsx | 0 {components => src/components}/ui/card.tsx | 0 .../components}/ui/carousel.tsx | 0 {components => src/components}/ui/dialog.tsx | 0 {app => src/data}/java_tutorial.json | 35 + src/data/topics.ts | 22 + app/globals.css => src/index.css | 3 + {lib => src/lib}/utils.ts | 0 src/main.tsx | 13 + src/pages/Home.tsx | 31 + src/pages/Topic.tsx | 19 + tailwind.config.ts | 4 +- tsconfig.json | 14 +- vite.config.ts | 13 + 34 files changed, 2032 insertions(+), 6076 deletions(-) delete mode 100644 .eslintrc.json create mode 100644 .github/workflows/deploy.yml delete mode 100644 .github/workflows/nextjs.yml delete mode 100644 app/_app.tsx delete mode 100644 app/layout.tsx delete mode 100644 app/page.tsx create mode 100644 index.html delete mode 100644 next.config.mjs rename {app => public}/favicon.ico (100%) delete mode 100644 public/next.svg delete mode 100644 public/vercel.svg create mode 100644 src/App.tsx create mode 100644 src/components/TopicContent.tsx rename {components => src/components}/footer.tsx (100%) rename {components => src/components}/navigation.tsx (93%) rename {components => src/components}/ui/button.tsx (100%) rename {components => src/components}/ui/card.tsx (100%) rename {components => src/components}/ui/carousel.tsx (100%) rename {components => src/components}/ui/dialog.tsx (100%) rename {app => src/data}/java_tutorial.json (87%) create mode 100644 src/data/topics.ts rename app/globals.css => src/index.css (97%) rename {lib => src/lib}/utils.ts (100%) create mode 100644 src/main.tsx create mode 100644 src/pages/Home.tsx create mode 100644 src/pages/Topic.tsx create mode 100644 vite.config.ts diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index bffb357..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "next/core-web-vitals" -} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..d8e458d --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,49 @@ +# Build and deploy the Vite site to GitHub Pages +name: Deploy to Pages + +on: + push: + branches: ["main"] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: npm + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Install dependencies + run: npm ci + - name: Build + run: npm run build + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./dist + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml deleted file mode 100644 index ed74736..0000000 --- a/.github/workflows/nextjs.yml +++ /dev/null @@ -1,93 +0,0 @@ -# Sample workflow for building and deploying a Next.js site to GitHub Pages -# -# To get started with Next.js see: https://nextjs.org/docs/getting-started -# -name: Deploy Next.js site to Pages - -on: - # Runs on pushes targeting the default branch - push: - branches: ["main"] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false - -jobs: - # Build job - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Detect package manager - id: detect-package-manager - run: | - if [ -f "${{ github.workspace }}/yarn.lock" ]; then - echo "manager=yarn" >> $GITHUB_OUTPUT - echo "command=install" >> $GITHUB_OUTPUT - echo "runner=yarn" >> $GITHUB_OUTPUT - exit 0 - elif [ -f "${{ github.workspace }}/package.json" ]; then - echo "manager=npm" >> $GITHUB_OUTPUT - echo "command=ci" >> $GITHUB_OUTPUT - echo "runner=npx --no-install" >> $GITHUB_OUTPUT - exit 0 - else - echo "Unable to determine package manager" - exit 1 - fi - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: "20" - cache: ${{ steps.detect-package-manager.outputs.manager }} - - name: Setup Pages - uses: actions/configure-pages@v5 - with: - # Automatically inject basePath in your Next.js configuration file and disable - # server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized). - # - # You may remove this line if you want to manage the configuration yourself. - static_site_generator: next - - name: Restore cache - uses: actions/cache@v4 - with: - path: | - .next/cache - # Generate a new cache whenever packages or source files change. - key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} - # If source files changed but packages didn't, rebuild from a prior cache. - restore-keys: | - ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}- - - name: Install dependencies - run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} - - name: Build with Next.js - run: ${{ steps.detect-package-manager.outputs.runner }} next build - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - with: - path: ./out - - # Deployment job - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - needs: build - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore index fd3dbb5..cc16727 100644 --- a/.gitignore +++ b/.gitignore @@ -9,12 +9,8 @@ # testing /coverage -# next.js -/.next/ -/out/ - # production -/build +/dist # misc .DS_Store @@ -28,9 +24,5 @@ yarn-error.log* # local env files .env*.local -# vercel -.vercel - # typescript *.tsbuildinfo -next-env.d.ts diff --git a/README.md b/README.md index c403366..c05feba 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,24 @@ -This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). +A quick, code-first Java tutorial site, built with [Vite](https://vitejs.dev/) + React. ## Getting Started -First, run the development server: - ```bash +npm install npm run dev -# or -yarn dev -# or -pnpm dev -# or -bun dev ``` -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. +Open [http://localhost:5173](http://localhost:5173) to see it. -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. +Content lives in `src/data/java_tutorial.json` — each entry in `sections` becomes a topic page at `/topic/:id`. Edit that file to add or change tutorial content. -This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. +## Build -## Learn More +```bash +npm run build +``` -To learn more about Next.js, take a look at the following resources: +Outputs a static site to `dist/`, deployed automatically to GitHub Pages on push to `main` via `.github/workflows/deploy.yml`. -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. +## License -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! - -## Deploy on Vercel - -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. - -Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. +MIT diff --git a/app/_app.tsx b/app/_app.tsx deleted file mode 100644 index a2c2de9..0000000 --- a/app/_app.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { AppProps } from 'next/app' -import Head from 'next/head' -import '../globals.css' - -function MyApp({ Component, pageProps }: AppProps) { - return ( - <> -
- - -{section.description}
-{item.description}
-
- {item.code}
-
-
- {item.result}
-
- {item.explanation}
-{topic.description}
+{item.description}
+
+ {item.code}
+
+
+ {item.result}
+
+ {item.explanation}
++ A quick, code-first tour of the Java language. Pick a topic to get started. +
+