Skip to content

Commit

Permalink
Merge branch 'feat/add-and-restructure-templates' of https://github.c…
Browse files Browse the repository at this point in the history
…om/nuxt/cli into feat/add-and-restructure-templates
  • Loading branch information
DamianGlowala committed Jan 6, 2025
2 parents 459f55b + 1a70600 commit 9de7a29
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/utils/templates/api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { applySuffix } from '.'
import { resolve } from 'pathe'
import type { Template } from '.'
import { resolve } from 'pathe'
import { applySuffix } from '.'

const httpMethods = [
'connect',
Expand Down
4 changes: 2 additions & 2 deletions src/utils/templates/app.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { resolve } from 'pathe'
import type { Template } from '.'
import { resolve } from 'pathe'

const app: Template = ({ args, nuxtOptions }) => ({
path: resolve(nuxtOptions.srcDir, 'app.vue'),
contents: args['pages']
contents: args.pages
? `
<script setup lang="ts"></script>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/templates/component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Template } from '.'
import { applySuffix } from '.'
import { resolve } from 'pathe'
import { applySuffix } from '.'

const component: Template = ({ name, args, nuxtOptions }) => ({
path: resolve(nuxtOptions.srcDir, `components/${name}${applySuffix(
Expand Down
2 changes: 1 addition & 1 deletion src/utils/templates/composable.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Template } from '.'
import { resolve } from 'pathe'
import { camelCase, upperFirst } from 'scule'
import type { Template } from '.'

const composable: Template = ({ name, nuxtOptions }) => {
const nameWithoutUsePrefix = name.replace(/^use-?/, '')
Expand Down
2 changes: 1 addition & 1 deletion src/utils/templates/error.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { resolve } from 'pathe'
import type { Template } from '.'
import { resolve } from 'pathe'

const error: Template = ({ nuxtOptions }) => ({
path: resolve(nuxtOptions.srcDir, 'error.vue'),
Expand Down
2 changes: 1 addition & 1 deletion src/utils/templates/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { NuxtOptions } from '@nuxt/schema'
import { api } from './api'
import { app } from './app'
import { component } from './component'
Expand All @@ -9,7 +10,6 @@ import { middleware } from './middleware'
import { page } from './page'
import { plugin } from './plugin'
import { serverMiddleware } from './server-middleware'
import type { NuxtOptions } from '@nuxt/schema'

interface TemplateOptions {
name: string
Expand Down
6 changes: 3 additions & 3 deletions src/utils/templates/layer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { resolve } from "pathe"
import { Template } from "."
import type { Template } from '.'
import { resolve } from 'pathe'

const layer: Template = ({ name, nuxtOptions }) => {
return {
Expand All @@ -10,4 +10,4 @@ export default defineNuxtConfig({})
}
}

export { layer }
export { layer }
2 changes: 1 addition & 1 deletion src/utils/templates/layout.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { resolve } from 'pathe'
import type { Template } from '.'
import { resolve } from 'pathe'

const layout: Template = ({ name, nuxtOptions }) => ({
path: resolve(nuxtOptions.srcDir, nuxtOptions.dir.layouts, `${name}.vue`),
Expand Down
2 changes: 1 addition & 1 deletion src/utils/templates/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { resolve } from 'pathe'
import type { Template } from '.'
import { resolve } from 'pathe'
import { applySuffix } from '.'

const middleware: Template = ({ name, args, nuxtOptions }) => ({
Expand Down
2 changes: 1 addition & 1 deletion src/utils/templates/page.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { resolve } from 'pathe'
import type { Template } from '.'
import { resolve } from 'pathe'

const page: Template = ({ name, nuxtOptions }) => ({
path: resolve(nuxtOptions.srcDir, nuxtOptions.dir.pages, `${name}.vue`),
Expand Down
2 changes: 1 addition & 1 deletion src/utils/templates/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Template } from '.'
import { applySuffix } from '.'
import { resolve } from 'pathe'
import { applySuffix } from '.'

const plugin: Template = ({ name, args, nuxtOptions }) => ({
path: resolve(nuxtOptions.srcDir, nuxtOptions.dir.plugins, `${name}${applySuffix(args, ['client', 'server'], 'mode')}.ts`),
Expand Down
2 changes: 1 addition & 1 deletion src/utils/templates/server-middleware.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { resolve } from 'pathe'
import type { Template } from '.'
import { resolve } from 'pathe'

const serverMiddleware: Template = ({ name, nuxtOptions }) => ({
path: nuxtOptions.future.compatibilityVersion === 3
Expand Down

0 comments on commit 9de7a29

Please sign in to comment.