Improve monorepo

This commit is contained in:
Dominik Milacher 2025-06-13 16:27:59 +02:00
parent 8ad50b5184
commit ba45adc378
15 changed files with 87 additions and 26 deletions

View File

@ -1,6 +1,5 @@
<template>
<div>
<NuxtRouteAnnouncer />
<NuxtWelcome />
</div>
</template>
<NuxtLayout>
<NuxtPage/>
</NuxtLayout>
</template>

View File

@ -0,0 +1,5 @@
<template>
<UApp :toaster="{ position: 'top-center' }">
<WDummy/>
</UApp>
</template>

View File

@ -2,5 +2,5 @@
export default defineNuxtConfig({
compatibilityDate: '2025-05-15',
devtools: { enabled: true },
modules: ['@nuxt/fonts', '@nuxt/icon', '@nuxt/image', '@nuxt/ui']
modules: ['@nuxt/fonts', '@nuxt/icon', '@nuxt/image', '@nuxt/ui', '@websites/ui']
})

View File

@ -10,7 +10,8 @@
"postinstall": "nuxt prepare"
},
"dependencies": {
"@websites/ui": "0.0.0",
"@websites/ui": "workspace:*",
"@websites/tsconfig": "workspace:*",
"@nuxt/fonts": "0.11.4",
"@nuxt/icon": "1.13.0",
"@nuxt/image": "1.10.0",

View File

@ -1,4 +1,4 @@
{
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json"
"extends": "@websites/tsconfig/base.json"
}

View File

@ -0,0 +1,17 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"composite": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"strict": true,
"strictNullChecks": true
},
"exclude": ["node_modules"]
}

View File

@ -0,0 +1,4 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": ["./base.json"]
}

View File

@ -0,0 +1,12 @@
{
"name": "@websites/tsconfig",
"version": "0.0.0",
"private": true,
"license": "MIT",
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@vue/tsconfig": "^0.5.1"
}
}

View File

@ -0,0 +1,4 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": ["./base.json", "@vue/tsconfig/tsconfig.dom.json"]
}

View File

@ -5,17 +5,19 @@
"repository": "your-org/my-module",
"license": "MIT",
"type": "module",
"main": "./src/module.ts",
"exports": {
".": {
"types": "./dist/types.d.mts",
"import": "./dist/module.mjs"
"import": "./src/module.ts",
"require": "./src/module.ts",
"default": "./src/module.ts",
"types": "./src/module.ts"
}
},
"main": "./dist/module.mjs",
"typesVersions": {
"*": {
".": [
"./dist/types.d.mts"
"./src/modules.ts"
]
}
},
@ -41,6 +43,7 @@
"nuxt": "^3.17.5"
},
"devDependencies": {
"@websites/tsconfig": "workspace:*",
"@nuxt/devtools": "^2.5.0",
"@nuxt/eslint-config": "^1.4.1",
"@nuxt/fonts": "0.11.4",

View File

@ -1,19 +1,21 @@
import { defineNuxtModule, addPlugin, createResolver } from '@nuxt/kit'
import { defineNuxtModule, createResolver, addComponentsDir } from '@nuxt/kit'
// Module options TypeScript interface definition
export interface ModuleOptions {}
export default defineNuxtModule<ModuleOptions>({
meta: {
name: 'my-module',
configKey: 'myModule',
name: 'websites',
configKey: 'websites',
},
// Default configuration options of the Nuxt module
defaults: {},
setup(_options, _nuxt) {
const resolver = createResolver(import.meta.url)
// Do not add the extension since the `.ts` will be transpiled to `.mjs` after `npm run prepack`
addPlugin(resolver.resolve('./runtime/plugin'))
addComponentsDir({
path: resolver.resolve('./runtime/components'),
pathPrefix: false,
prefix: '',
global: true,
})
},
})

View File

@ -0,0 +1,3 @@
<template>
Dummy
</template>

View File

@ -1,5 +0,0 @@
import { defineNuxtPlugin } from '#app'
export default defineNuxtPlugin((_nuxtApp) => {
console.log('Plugin injected by my-module!')
})

View File

@ -1,5 +1,5 @@
{
"extends": "./.nuxt/tsconfig.json",
"extends": "@websites/tsconfig/base.json",
"exclude": [
"dist",
"node_modules",

18
pnpm-lock.yaml generated
View File

@ -29,8 +29,11 @@ importers:
'@nuxt/ui':
specifier: 3.1.3
version: 3.1.3(embla-carousel@8.6.0)(typescript@5.8.3)(vite@6.3.5)(vue-router@4.5.1)(vue@3.5.16)
'@websites/tsconfig':
specifier: workspace:*
version: link:../../packages/tsconfig
'@websites/ui':
specifier: 0.0.0
specifier: workspace:*
version: link:../../packages/ui
nuxt:
specifier: ^3.17.5
@ -45,6 +48,12 @@ importers:
specifier: ^4.5.1
version: 4.5.1(vue@3.5.16)
packages/tsconfig:
devDependencies:
'@vue/tsconfig':
specifier: ^0.5.1
version: 0.5.1
packages/ui:
dependencies:
'@nuxt/kit':
@ -81,6 +90,9 @@ importers:
'@types/node':
specifier: latest
version: 24.0.1
'@websites/tsconfig':
specifier: workspace:*
version: link:../tsconfig
changelogen:
specifier: ^0.6.1
version: 0.6.1
@ -3079,6 +3091,10 @@ packages:
/@vue/shared@3.5.16:
resolution: {integrity: sha512-c/0fWy3Jw6Z8L9FmTyYfkpM5zklnqqa9+a6dz3DvONRKW2NEbh46BP0FHuLFSWi2TnQEtp91Z6zOWNrU6QiyPg==}
/@vue/tsconfig@0.5.1:
resolution: {integrity: sha512-VcZK7MvpjuTPx2w6blwnwZAu5/LgBUtejFOi3pPGQFXQN5Ela03FUtd2Qtg4yWGGissVL0dr6Ro1LfOFh+PCuQ==}
dev: true
/@vueuse/core@10.11.1(vue@3.5.16):
resolution: {integrity: sha512-guoy26JQktXPcz+0n3GukWIy/JDNKti9v6VEMu6kV2sYBsWuGiTU8OWdg+ADfUbHg3/3DlqySDe7JmdHrktiww==}
dependencies: