Skip to content

Commit 63cbef9

Browse files
authored
Merge pull request #185 from lazercaveman/update/v.2.0.0
# Release Notes v2.0.0 Focus: Migration to Nuxt 4, folder restructuring, dependency and tooling updates ## Breaking Changes ### Nuxt 4 Compatibility - future.compatibilityVersion: 4 - Repository restructured: all source folders moved under app/ (e.g. app/components, app/pages, app/, ...) ## New Features & Improvements ### 🤌 Cleanup Script - yarn script:cleanup now empties content in app/ directories (components, tests, store, middleware, server/api) - Also deletes .git, .github, .vscode, SECURITY.md, LICENSE - Script file and its npm entry self-delete after execution ### Added Example-Content (can conveniently be removed, using the Cleanup Script) - NuxtStarter.vue and StarterButton.vue updated for new paths and store - Corresponding test files updated with revised import paths - Main page: pages/index.vue → app/pages/demo. - Added clean demo entry in app/pages/index.vue - sampleStore moved to app/store/sample.ts and extended with apiGreeting state - Components, pages, store, middleware and tests relocated and renamed under app/ - Example assets (screenshots, demo images) moved to app/assets - Client middleware at app/middleware/demo.ts with console log - Server middleware at server/middleware/demo.ts using H3Event hook - New endpoint server/api/test.ts returning 👋 Hello from test API! ## Dependency Updates - Nuxt: ^3.16.2 → ^3.17.4 (preparing for v4 final) - ESLint: v9.25.1 → v9.28.0 (Flat Config, extended ignore patterns) - Tailwind CSS: v4.1.4 → v4.1.8 - Vitest: v3.1.2 → v3.2.0 - @nuxt/devtools: v2.4.0 → v2.4.1 - Others: Pinia, Sass, TypeScript-ESLint, and more ### Build Config - nuxt.config.ts: baseURL, head tags and module list updated - eslint.config.ts: ignore list extended (.output, .yarn, etc.) - vitest.config.ts: test include paths updated (app/components, app/tests) ## Summary This release readies the codebase for Nuxt 4, cleans up folder structures, and brings multiple dependency and tooling upgrades. Developers can immediately adopt the new layout, use the cleanup script to strip demo content, and prepare for the upcoming Nuxt 4 final release.
2 parents db207b1 + f910278 commit 63cbef9

File tree

30 files changed

+1530
-2974
lines changed

30 files changed

+1530
-2974
lines changed

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22.15.0

README.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
![Release Badge](https://img.shields.io/github/v/release/lazercaveman/nuxt-starter)
2-
[![Nuxt 3](https://img.shields.io/badge/Nuxt-3.16.2-00DC82?logo=nuxt.js)](https://nuxt.com)
2+
[![Nuxt 4](https://img.shields.io/badge/Nuxt-3.16.2-00DC82?logo=nuxt.js)](https://nuxt.com)
33
[![MIT License](https://img.shields.io/github/license/lazercaveman/nuxt-starter)](LICENSE)
44

5-
# Nuxt 3 Starter / (will switch to [Nuxt 4](https://github.com/lazercaveman/nuxt-starter/tree/update/v.2.0.0) Starter ASAP)
6-
7-
> ### **This repo will switch to Nuxt 4** as soon as it is officially released.
8-
> ### 🔥 You can already preview and already download the Nuxt 4 version [here](https://github.com/lazercaveman/nuxt-starter/tree/update/v.2.0.0).
9-
5+
# Nuxt 4 Starter (currently using future.compatibilityVersion 4 and will entirely switch to v4 ASAP)
106
![Screenshot](./assets/img/screenshot.png)
117

128
## 🥸 Why this template?
13-
Get ready to supercharge your development with this fully configured Nuxt 3 Starter Kit! Built on Vue 3 and powered by TypeScript and many other technologies (for more information see down-below or checkout package.json for even more), this setup comes preloaded with tools and libraries designed to enhance your workflow, streamline development, and maintain high-quality code. 🙌 No more wrestling with configurations—jump straight into building amazing projects!
9+
Get ready to supercharge your development with this fully configured Nuxt 4 Starter Kit! Built on Vue 3 and powered by TypeScript and many other technologies (for more information see down-below or checkout package.json for even more), this setup comes preloaded with tools and libraries designed to enhance your workflow, streamline development, and maintain high-quality code. 🙌 No more wrestling with configurations—jump straight into building amazing projects!
1410

1511
- **Clean up project in seconds:** Using the `yarn script:cleanup` command in your terminal, will clean up the project, remove demo contents - the Starter Kit is designed so that developers can start working immediately without having to spend time setting up basic structures and configurations.
1612
- **Up to date:** Using up to date dependencies and tools to ensure a smooth development experience. (at least I try ^^)
@@ -27,7 +23,7 @@ Get ready to supercharge your development with this fully configured Nuxt 3 Star
2723
5. Run `yarn dev` to start the local development environment
2824

2925
### 🧹 Comes with Auto-Clean-Script
30-
Nuxt-Starter is delivered with a range of example content – including sample components, tests, and store configurations. If you'd prefer to start with a clean setup, simply run the following CLI command in your terminal `yarn script:cleanup` - this command offers an easy, one-step process to prepare your Nuxt 3 project for a fresh start.
26+
Nuxt-Starter is delivered with a range of example content – including sample components, tests, and store configurations. If you'd prefer to start with a clean setup, simply run the following CLI command in your terminal `yarn script:cleanup` - this command offers an easy, one-step process to prepare your Nuxt 4 project for a fresh start.
3127
- It empties the contents of './components', './tests' and ./store while keeping the directories intact.
3228
- It completely deletes the './.assets/img', './coverage', './.github', './.vscode', './.git' folder, and all its contents. 🚨 Since the .git folder will be deleted your project will be disconnected from this repository.
3329
- The cleaning script is set up to delete itself after execution, ensuring that your project is as lean as possible once you’ve cleaned up the examples - therefor it will delete the script file as well as the npm script 'script:cleanup' from the package.json file.
@@ -43,7 +39,7 @@ Why? Because it’s blazing fast. Vite ensures instant builds and on-demand comp
4339
[learn more](https://vitejs.dev/).
4440

4541
### 🏗️ ESLint
46-
ESLint V9 with a "Flat Config setup" tailored for TypeScript and Vue 3 or Nuxt 3 - it is configured to use best practices integrating some plugins (eslint:recommended, typescript-eslint, and eslint-plugin-vue) - wanna change them!? just add some custom rules to meet your team's needs to ensure clean, maintainable, and standard-compliant code quality.
42+
ESLint V9 with a "Flat Config setup" tailored for TypeScript and Vue 3 or Nuxt 4 - it is configured to use best practices integrating some plugins (eslint:recommended, typescript-eslint, and eslint-plugin-vue) - wanna change them!? just add some custom rules to meet your team's needs to ensure clean, maintainable, and standard-compliant code quality.
4743
[learn more](https://eslint.org/blog/2024/04/eslint-v9.0.0-released/).
4844

4945
### 🧪 Vitest
@@ -63,7 +59,7 @@ For flexibility in styling. Use SCSS to add custom styles when needed - SCSS def
6359
[learn more](https://sass-lang.com/).
6460

6561
### 🍍 Pinia
66-
To manage app state easily. Pinia is modern, simple, and works perfectly with Vue 3 and Nuxt 3, for scalable state management.
62+
To manage app state easily. Pinia is modern, simple, and works perfectly with Vue 3 and Nuxt 4, for scalable state management.
6763
[learn more](https://pinia.vuejs.org).
6864

6965
### 🤌 TypeScript
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

components/nuxt-starter/nuxt-starter.test.ts renamed to app/components/nuxt-starter/nuxt-starter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, expect, it } from 'vitest';
22
import { mount } from '@vue/test-utils';
33
import { createTestingPinia } from '@pinia/testing';
4-
import NuxtStarter from '~/components/nuxt-starter/NuxtStarter.vue';
4+
import NuxtStarter from './NuxtStarter.vue';
55

66

77
describe('NuxtStarter unit test', () => {
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<template>
2+
<nav class="flex gap-12">
3+
<NuxtLink
4+
:to="$route.name === 'demo' ? '/' : '/demo'"
5+
class="px-6 py-3 w-fit rounded-sm bg-nuxt-green cursor-pointer transition-all hover:scale-up-transition"
6+
>
7+
🧭 Route: {{ $route.name }}
8+
</NuxtLink>
9+
<button
10+
class="px-6 py-3 w-fit rounded-sm bg-nuxt-green cursor-pointer transition-all hover:scale-up-transition"
11+
@click="changeSampleStoreData(`🥳 So let's go - create some epic stuff that will change the world!`)"
12+
>
13+
🍍 Pinia State
14+
</button>
15+
<button
16+
class="px-6 py-3 w-fit rounded-sm bg-nuxt-green cursor-pointer transition-all hover:scale-up-transition"
17+
@click="callTestApi(`🥳 So let's go - create some epic stuff that will change the world!`)"
18+
>
19+
☎️ Call Api
20+
</button>
21+
</nav>
22+
</template>
23+
24+
25+
<script setup>
26+
import { useSampleStore } from '~/app/store/sample';
27+
28+
const Store = useSampleStore();
29+
30+
function changeSampleStoreData(testString) {
31+
Store.setSampleData(testString);
32+
}
33+
34+
function callTestApi() {
35+
Store.callTestApi();
36+
}
37+
</script>

components/start-button/start-button.test.ts renamed to app/components/start-button/start-button.test.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
import { describe, expect, it } from 'vitest';
22
import { mount } from '@vue/test-utils';
33
import { createTestingPinia } from '@pinia/testing';
4-
import StarterButton from '~/components/start-button/StarterButton.vue';
5-
4+
import StarterButton from './StarterButton.vue';
65

76
describe('StartButton unit test', () => {
87
it('renders with required properties', () => {
98
const wrapper = mount(StarterButton, {
109
props: {},
1110
global: {
1211
plugins: [createTestingPinia()],
12+
mocks: {
13+
$route: {
14+
name: 'demo',
15+
},
16+
},
17+
stubs: {
18+
NuxtLink: true,
19+
},
1320
},
1421
});
1522

app/error.vue

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<template>
2+
😱 ERROR!
3+
<p>{{ error }}</p>
4+
</template>
5+
6+
<script lang="ts" setup>
7+
import type { NuxtError } from 'nuxt/app';
8+
9+
const props = defineProps({
10+
error: {
11+
type: Object as () => NuxtError,
12+
default: () => ({} as NuxtError),
13+
},
14+
});
15+
16+
onMounted (() => {
17+
console.error(props.error)
18+
})
19+
20+
</script>

0 commit comments

Comments
 (0)