Repository: element-plus/element-plus-nuxt-starter Branch: main Commit: 6ecb01e7a0ba Files: 41 Total size: 20.4 KB Directory structure: gitextract_9c3dgak6/ ├── .github/ │ └── workflows/ │ ├── ci.yml │ └── gh-pages.yml ├── .gitignore ├── .npmrc ├── .vscode/ │ └── settings.json ├── Dockerfile ├── LICENSE ├── README.md ├── app/ │ ├── app.vue │ ├── assets/ │ │ └── scss/ │ │ ├── element/ │ │ │ ├── dark.scss │ │ │ └── index.scss │ │ └── index.scss │ ├── components/ │ │ ├── DarkToggle.vue │ │ ├── GitHubLink.vue │ │ ├── NuxtLogo.vue │ │ ├── RightTopMenu.vue │ │ ├── TheCounter.vue │ │ ├── TheExamples.vue │ │ ├── TheLogos.vue │ │ └── example/ │ │ ├── Buttons.vue │ │ ├── DatePickers.vue │ │ ├── Icons.vue │ │ ├── Switches.vue │ │ └── Tags.vue │ ├── composables/ │ │ └── count.ts │ ├── constants/ │ │ └── index.ts │ ├── layouts/ │ │ ├── README.md │ │ ├── default.vue │ │ └── home.vue │ ├── pages/ │ │ ├── [...all].vue │ │ ├── hi/ │ │ │ └── [id].vue │ │ └── index.vue │ └── stores/ │ └── user.ts ├── eslint.config.mjs ├── nuxt.config.ts ├── package.json ├── public/ │ └── CNAME ├── server/ │ ├── api/ │ │ └── pageview.ts │ └── tsconfig.json ├── tsconfig.json └── uno.config.ts ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/workflows/ci.yml ================================================ name: CI on: push: branches: - main pull_request: branches: - main jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 with: node-version: lts/* cache: pnpm - name: Install run: pnpm install - name: Lint run: pnpm run lint typecheck: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 with: node-version: lts/* cache: pnpm - name: Install run: pnpm install - name: Typecheck run: pnpm run typecheck ================================================ FILE: .github/workflows/gh-pages.yml ================================================ name: GitHub Pages on: push: branches: - main workflow_dispatch: permissions: contents: read pages: write id-token: write concurrency: group: 'pages' cancel-in-progress: true jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install Dependencies uses: pnpm/action-setup@v4 with: run_install: true - name: Setup Node uses: actions/setup-node@v4 with: node-version: lts/* - name: Build run: npm run generate - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: path: ./dist deploy: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest needs: build steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 ================================================ FILE: .gitignore ================================================ node_modules *.log dist .output .nuxt .vercel ================================================ FILE: .npmrc ================================================ shamefully-hoist=true strict-peer-dependencies=false shell-emulator=true # fix code ERESOLVE \n ERESOLVE could not resolve legacy-peer-deps=true ================================================ FILE: .vscode/settings.json ================================================ { "eslint.useFlatConfig": true, // Auto fix "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit", "source.organizeImports": "never" }, "typescript.tsdk": "node_modules/typescript/lib" } ================================================ FILE: Dockerfile ================================================ FROM node:20-alpine as build-stage WORKDIR /app RUN corepack enable COPY .npmrc package.json pnpm-lock.yaml ./ RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \ pnpm install --frozen-lockfile COPY . . RUN pnpm build # SSR FROM node:20-alpine as production-stage WORKDIR /app COPY --from=build-stage /app/.output ./.output EXPOSE 3000 CMD ["node", ".output/server/index.mjs"] ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2021 Element Plus Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # Element Plus with Nuxt 3 Minimal Starter - SSR Preview: - SSG Preview: We recommend to look at the [Nuxt 3 Docs](https://nuxt.com/) and [Element Plus Docs](https://element-plus.org/). > If you are looking for a Vite + Vue + Element Plus starter, check out [element-plus-vite-starter](https://github.com/element-plus/element-plus-vite-starter/). ## Setup Make sure to install the dependencies ```bash pnpm install ``` ## Development Start the development server on `http://localhost:3000` ```bash pnpm dev ``` More info about [nuxt deployment](https://nuxt.com/docs/getting-started/deployment#presets). Run `npm run generate` to generate static html in `.output/public`. ## Production Build the application for production: ```bash pnpm build ``` Checkout the [deployment documentation](https://nuxt.com/docs/getting-started/deployment). ## Deploy You need set `NITRO_PRESET=vercel-edge`, see [Nuxt on Vercel](https://vercel.com/docs/frameworks/nuxt#edge-functions). ## Ref - [vitesse-nuxt3](https://github.com/antfu/vitesse-nuxt3) ================================================ FILE: app/app.vue ================================================ ================================================ FILE: app/assets/scss/element/dark.scss ================================================ @forward 'element-plus/theme-chalk/src/dark/var.scss' with ( $bg-color: ( 'page': #0a0a0a, 'overlay': #1d1e1f, ) ); ================================================ FILE: app/assets/scss/element/index.scss ================================================ $-colors: ( 'primary': ( 'base': rgba(107,33,168, 1), ), 'success': ( 'base': green, ), 'warning': ( 'base': #f9a23c, ), 'danger': ( 'base': #ff3300, ), 'error': ( 'base': #f56c6c, ), 'info': ( 'base': #909399, ), ); @forward 'element-plus/theme-chalk/src/common/var.scss' with ( $colors: $-colors ); @use './dark.scss'; ================================================ FILE: app/assets/scss/index.scss ================================================ html, body, #app { margin: 0; padding: 0; } html.dark { background: #222; color: white; } a { font-weight: 400; color: var(--el-color-primary); } ================================================ FILE: app/components/DarkToggle.vue ================================================ ================================================ FILE: app/components/GitHubLink.vue ================================================ ================================================ FILE: app/components/NuxtLogo.vue ================================================ ================================================ FILE: app/components/RightTopMenu.vue ================================================ ================================================ FILE: app/components/TheCounter.vue ================================================ ================================================ FILE: app/components/TheExamples.vue ================================================ ================================================ FILE: app/components/TheLogos.vue ================================================ ================================================ FILE: app/components/example/Buttons.vue ================================================ ================================================ FILE: app/components/example/DatePickers.vue ================================================ ================================================ FILE: app/components/example/Icons.vue ================================================ ================================================ FILE: app/components/example/Switches.vue ================================================ ================================================ FILE: app/components/example/Tags.vue ================================================ ================================================ FILE: app/composables/count.ts ================================================ export function useCount() { const count = useState('count', () => Math.round(Math.random() * 20)) function inc() { count.value += 1 } function dec() { count.value -= 1 } return { count, inc, dec, } } ================================================ FILE: app/constants/index.ts ================================================ export const appName = 'Element Plus Nuxt Starter' export const appDescription = 'Nuxt Starter for Element Plus' ================================================ FILE: app/layouts/README.md ================================================ ## Layouts Vue components in this dir are used as layouts. By default, `default.vue` will be used unless an alternative is specified in the route meta. ```vue ``` Learn more on https://nuxt.com/docs/guide/directory-structure/layouts ================================================ FILE: app/layouts/default.vue ================================================ ================================================ FILE: app/layouts/home.vue ================================================ ================================================ FILE: app/pages/[...all].vue ================================================ ================================================ FILE: app/pages/hi/[id].vue ================================================ ================================================ FILE: app/pages/index.vue ================================================ ================================================ FILE: app/stores/user.ts ================================================ import { acceptHMRUpdate, defineStore } from "pinia"; export const useUserStore = defineStore("user", () => { /** * Current named of the user. */ const savedName = ref(""); const previousNames = ref(new Set()); const usedNames = computed(() => Array.from(previousNames.value)); const otherNames = computed(() => usedNames.value.filter((name) => name !== savedName.value) ); /** * Changes the current name of the user and saves the one that was used * before. * * @param name - new name to set */ function setNewName(name: string) { if (savedName.value) previousNames.value.add(savedName.value); savedName.value = name; } return { setNewName, otherNames, savedName, }; }); if (import.meta.hot) import.meta.hot.accept(acceptHMRUpdate(useUserStore, import.meta.hot)); ================================================ FILE: eslint.config.mjs ================================================ import withNuxt from './.nuxt/eslint.config.mjs' // https://eslint.nuxt.com/packages/module export default withNuxt( { rules: { 'vue/multi-word-component-names': 'off', } } // your custom flat configs go here, for example: // { // files: ['**/*.ts', '**/*.tsx'], // rules: { // 'no-console': 'off' // allow console.log in TypeScript files // } // }, // { // ... // } ) ================================================ FILE: nuxt.config.ts ================================================ // https://v3.nuxtjs.org/docs/directory-structure/nuxt.config export default defineNuxtConfig({ modules: [ '@nuxt/eslint', '@vueuse/nuxt', '@unocss/nuxt', '@pinia/nuxt', '@element-plus/nuxt', '@nuxtjs/color-mode' ], devtools: { enabled: true, }, app: { // head head: { title: 'Element Plus + Nuxt 3', meta: [ { name: 'viewport', content: 'width=device-width, initial-scale=1' }, { name: 'description', content: 'ElementPlus + Nuxt3', }, ], link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }], } }, // css css: [ '@unocss/reset/tailwind.css', '~/assets/scss/index.scss' ], // vueuse vueuse: { ssrHandlers: true, }, // colorMode colorMode: { classSuffix: '', }, future: { compatibilityVersion: 4, }, experimental: { // when using generate, payload js assets included in sw precache manifest // but missing on offline, disabling extraction it until fixed payloadExtraction: false, renderJsonPayloads: true, typedPages: true, }, compatibilityDate: '2024-08-14', nitro: { esbuild: { options: { target: 'esnext', }, }, prerender: { crawlLinks: false, routes: ['/'], ignore: ['/hi'], }, }, vite: { css: { preprocessorOptions: { scss: { additionalData: `@use "@/assets/scss/element/index.scss" as element;`, }, }, }, }, elementPlus: { icon: 'ElIcon', importStyle: 'scss', themes: ['dark'], }, }) ================================================ FILE: package.json ================================================ { "name": "element-plus-nuxt-starter", "type": "module", "private": true, "packageManager": "pnpm@10.14.0", "version": "0.1.0", "description": "Element Plus with Nuxt 3 Minimal Starter", "repository": { "type": "git", "url": "https://github.com/element-plus/element-plus-nuxt-starter" }, "author": "Element Plus Team", "license": "MIT", "scripts": { "preinstall": "npx only-allow pnpm", "dev": "nuxi dev", "build": "nuxi build", "lint": "eslint .", "lint:fix": "eslint . --fix", "preview": "nuxi preview", "start": "node .output/server/index.mjs", "generate": "nuxi generate", "prepare": "nuxi prepare", "typecheck": "vue-tsc --noEmit" }, "dependencies": { "@element-plus/icons-vue": "^2.3.1", "element-plus": "^2.10.5" }, "devDependencies": { "@element-plus/nuxt": "^1.1.4", "@iconify-json/ri": "^1.2.5", "@nuxt/eslint": "^1.7.1", "@nuxtjs/color-mode": "^3.5.2", "@pinia/nuxt": "^0.11.2", "@unocss/nuxt": "^66.4.0", "@vueuse/nuxt": "^13.6.0", "consola": "^3.4.2", "eslint": "^9.32.0", "nuxt": "^4.0.2", "sass": "^1.89.2", "typescript": "^5.9.2", "vue-tsc": "^3.0.5" }, "peerDependencies": { "pinia": "^2.1.6" }, "pnpm": { "peerDependencyRules": { "ignoreMissing": [ "webpack", "vite", "vue" ] } } } ================================================ FILE: public/CNAME ================================================ nuxt-starter.element-plus.org ================================================ FILE: server/api/pageview.ts ================================================ const startAt = Date.now() let count = 0 export default defineEventHandler(() => ({ pageview: count++, startAt, })) ================================================ FILE: server/tsconfig.json ================================================ { "extends": "../.nuxt/tsconfig.server.json" } ================================================ FILE: tsconfig.json ================================================ { // https://v3.nuxtjs.org/concepts/typescript "extends": "./.nuxt/tsconfig.json" } ================================================ FILE: uno.config.ts ================================================ import { defineConfig, presetAttributify, presetIcons, presetTypography, presetUno, presetWebFonts, transformerDirectives, transformerVariantGroup, } from 'unocss' export default defineConfig({ shortcuts: [ ['btn', 'px-4 py-1 rounded inline-block bg-teal-600 text-white cursor-pointer hover:bg-teal-700 disabled:cursor-default disabled:bg-gray-600 disabled:opacity-50'], ['icon-btn', 'inline-block cursor-pointer select-none opacity-75 transition duration-200 ease-in-out hover:opacity-100 hover:text-teal-600'], ], presets: [ presetUno(), presetAttributify(), presetIcons({ scale: 1.2, }), presetTypography(), presetWebFonts({ fonts: { sans: 'DM Sans', serif: 'DM Serif Display', mono: 'DM Mono', }, }), ], transformers: [ transformerDirectives(), transformerVariantGroup(), ], })