Skip to content

Commit

Permalink
refactor: co-locate runtime files with modules (#1532)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Jan 26, 2025
1 parent 987909f commit 9aa30e8
Show file tree
Hide file tree
Showing 16 changed files with 6 additions and 6 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions modules/router.ts → modules/router/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ export default defineNuxtModule({
addTemplate({
filename: 'routes.mjs',
async getContents () {
const files = await readRecursive(resolver.resolve('../app/pages'))
const files = await readRecursive(resolver.resolve('../../app/pages'))
const componentNames = Object.fromEntries(
files.map(f => [f, genSafeVariableName(f)]),
)
const routes = files.map(f => {
const path = withLeadingSlash(
relative(resolver.resolve('../app/pages'), f).replace(
relative(resolver.resolve('../../app/pages'), f).replace(
/(\/?index)?\.vue$/,
'',
),
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions modules/runtime/server/tsconfig.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import type { HmrOptions } from 'vite'

export default defineNuxtConfig({
modules: [
'~~/modules/social',
'~~/modules/invites',
'~~/modules/router',
'@nuxtjs/sanity',
'nuxt-og-image',
'@nuxt/eslint',
Expand Down
2 changes: 1 addition & 1 deletion test/unit/bundle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('project sizes', () => {
const modules = await analyzeSizes('node_modules/**/*', serverDir)
expect
.soft(roundToKilobytes(modules.totalBytes))
.toMatchInlineSnapshot(`"11162k"`)
.toMatchInlineSnapshot(`"11157k"`)

const packages = modules.files
.filter(m => m.endsWith('package.json'))
Expand Down

0 comments on commit 9aa30e8

Please sign in to comment.