diff --git a/package.json b/package.json index f0fd691..33bdf74 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "version": "0.5.0", "description": "The productive way to build fullstack Nuxt 3 applications, like create-t3-app but for Nuxt.", "scripts": { - "dev": "vite-node src/", + "dev": "vite-node src/ -- --nocounting", "dev:ci": "vite-node src/ -- --ci", "lint": "eslint \"./src/**/*.{ts,tsx}\" --max-warnings=0", "typecheck": "tsc --noEmit", @@ -51,6 +51,7 @@ "@nuxt/schema": "^3.0.0", "chalk": "^5.2.0", "commander": "^9.4.1", + "consola": "^3.2.3", "defu": "^6.1.1", "execa": "^6.1.0", "giget": "^1.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4d533a4..28c5f00 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ dependencies: commander: specifier: ^9.4.1 version: 9.5.0 + consola: + specifier: ^3.2.3 + version: 3.2.3 defu: specifier: ^6.1.1 version: 6.1.2 @@ -1303,7 +1306,7 @@ packages: '@vue/shared': 3.4.21 entities: 4.5.0 estree-walker: 2.0.2 - source-map-js: 1.0.2 + source-map-js: 1.2.0 dev: true /@vue/compiler-dom@3.4.21: @@ -1324,7 +1327,7 @@ packages: estree-walker: 2.0.2 magic-string: 0.30.8 postcss: 8.4.38 - source-map-js: 1.0.2 + source-map-js: 1.2.0 dev: true /@vue/compiler-ssr@3.4.21: diff --git a/src/configs/lint/index.ts b/src/configs/eslint.ts similarity index 86% rename from src/configs/lint/index.ts rename to src/configs/eslint.ts index 7d962f8..4b1a418 100644 --- a/src/configs/lint/index.ts +++ b/src/configs/eslint.ts @@ -1,4 +1,4 @@ -import type { PackageConfig } from '../index' +import type { Config } from '../types' const eslintConfig = `import antfu from '@antfu/eslint-config' @@ -43,10 +43,7 @@ export default antfu({ }) ` -const lint: PackageConfig = { - type: 'template', - humanReadableName: 'ESLint', - description: 'Lint your code.', +const eslint: Config = { scripts: [{ name: 'lint', command: 'eslint .' @@ -68,7 +65,6 @@ const lint: PackageConfig = { path: 'eslint.config.js', content: eslintConfig }], - tasksPostInstall: [], } -export default lint +export default eslint diff --git a/src/steps/4.addCi.ts b/src/configs/github-actions.ts similarity index 62% rename from src/steps/4.addCi.ts rename to src/configs/github-actions.ts index 260b016..cf16bb3 100644 --- a/src/steps/4.addCi.ts +++ b/src/configs/github-actions.ts @@ -1,6 +1,4 @@ -import { mkdir, writeFile } from 'node:fs/promises' -import { getResolver } from '../utils/getResolver' -import type { Preferences } from '../prompts' +import type { Config } from '../types' const GITHUB_ACTIONS_TEMPLATE = ` name: CI @@ -57,14 +55,14 @@ jobs: # TODO: Add more steps here, like "nr test" as you add the tooling for it ` -export default async (preferences: Preferences, templateDir: string) => { - // Cheviot already has github actions by default - if (preferences.setStack === 'cheviot') { - return - } - - const resolver = getResolver(templateDir) - - await mkdir(resolver('.github/workflows'), { recursive: true }) - await writeFile(resolver('.github/workflows/ci.yaml'), GITHUB_ACTIONS_TEMPLATE) +const githubActions: Config = { + scripts: [], + dependencies: [], + nuxtConfig: {}, + files: [{ + path: '.github/workflows/ci.yaml', + content: GITHUB_ACTIONS_TEMPLATE + }], } + +export default githubActions diff --git a/src/configs/index.ts b/src/configs/index.ts index 28f43b4..0201748 100644 --- a/src/configs/index.ts +++ b/src/configs/index.ts @@ -1,40 +1,23 @@ -import type { NuxtConfig } from '@nuxt/schema' -import type { Dependency, Script } from '../utils/addPackageDependency' -import prisma from './prisma' -import auth from './auth' -import trpc from './trpc' +import type { Config, ModuleConfig } from '../types' import tailwind from './tailwind' import naiveui from './naiveui' -import lint from './lint' - -export declare interface File { - path: string - content: string -} +import prisma from './prisma' +import trpc from './trpc' +import sidebaseAuth from './sidebase-auth' +import eslint from './eslint' +import githubActions from './github-actions' -export declare interface PackageConfig { - type: 'module' | 'template' - humanReadableName: string - description: string - dependencies: Dependency[] - scripts: Script[] - nuxtConfig: NuxtConfig - files: File[] - tasksPostInstall: string[] - indexVue?: { - html: string - css?: string - js?: string - } +export type Modules = 'prisma' | 'sidebase-auth' | 'trpc' | 'tailwind' | 'naiveui' +export const modules: Record = { + 'tailwind': tailwind, + 'naiveui': naiveui, + 'prisma': prisma, + 'trpc': trpc, + 'sidebase-auth': sidebaseAuth } -// Package options -export type Packages = 'prisma' | 'auth' | 'trpc' | 'tailwind' | 'naiveui' | 'lint' -export const packageConfigs: Record = { - prisma, - auth, - trpc, - tailwind, - naiveui, - lint +export type Configs = 'eslint' | 'github-actions' +export const configs: Record = { + 'eslint': eslint, + 'github-actions': githubActions } diff --git a/src/configs/naiveui/index.ts b/src/configs/naiveui.ts similarity index 90% rename from src/configs/naiveui/index.ts rename to src/configs/naiveui.ts index 64b8068..a0c1c16 100644 --- a/src/configs/naiveui/index.ts +++ b/src/configs/naiveui.ts @@ -1,5 +1,5 @@ -import { generateModuleHTMLComponent, generateModuleHTMLSnippet } from '../../generators/generateModuleComponents' -import type { PackageConfig } from '../index' +import { generateModuleHTMLComponent, generateModuleHTMLSnippet } from '../generators/generateModuleComponents' +import type { ModuleConfig } from '../types' const naiveDemoComponent = `