├── assets ├── fonts │ └── .gitkeep └── css │ └── styles.css ├── server ├── api │ ├── auth │ │ ├── logout.post.ts │ │ └── login.post.ts │ └── types.ts ├── models │ ├── example.model.ts │ └── user.model.ts ├── middleware │ └── session.ts └── utils │ ├── password.ts │ └── session.ts ├── .eslintignore ├── .npmrc ├── .lintstagedrc ├── store ├── user │ ├── actions.ts │ ├── getters.ts │ ├── state.ts │ └── index.ts └── counter │ ├── actions.ts │ ├── state.ts │ ├── getters.ts │ └── index.ts ├── .husky ├── pre-commit ├── commit-msg └── git │ ├── commitlint.js │ └── commitizen.js ├── tsconfig.json ├── composables ├── auth.ts ├── auth │ ├── useAuthUser.ts │ └── useAuth.ts └── fetch.ts ├── .gitignore ├── components ├── ExampleComponent.vue └── auth │ ├── types.ts │ └── LoginForm.vue ├── .env.example ├── app.vue ├── tests ├── example.test.js └── mocks │ ├── example.mock.ts │ └── user.mock.ts ├── pages ├── login.vue ├── account.vue └── index.vue ├── middleware └── auth.ts ├── vitest.config.js ├── tailwind.config.js ├── .editorconfig ├── .github └── dependabot.yml ├── .eslintrc ├── README.md ├── nuxt.config.ts └── package.json /assets/fonts/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /server/api/auth/logout.post.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .nuxt 3 | .husky 4 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | shamefully-hoist=true 2 | strict-peer-dependencies=false 3 | -------------------------------------------------------------------------------- /.lintstagedrc: -------------------------------------------------------------------------------- 1 | { 2 | "*.{js,jsx,ts,tsx,vue}": "npm run lint:js" 3 | } 4 | -------------------------------------------------------------------------------- /assets/css/styles.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /store/user/actions.ts: -------------------------------------------------------------------------------- 1 | const actions = ({ 2 | // ... 3 | }); 4 | 5 | export default actions; 6 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npx lint-staged 5 | npm test 6 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // https://v3.nuxtjs.org/concepts/typescript 3 | "extends": "./.nuxt/tsconfig.json" 4 | } 5 | -------------------------------------------------------------------------------- /composables/auth.ts: -------------------------------------------------------------------------------- 1 | export { useAuthUser } from './auth/useAuthUser'; 2 | export { useAuth } from './auth/useAuth'; 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log* 3 | .nuxt 4 | .nitro 5 | .cache 6 | .output 7 | .env 8 | dist 9 | .idea 10 | .vscode 11 | -------------------------------------------------------------------------------- /server/models/example.model.ts: -------------------------------------------------------------------------------- 1 | export interface Example { 2 | id: number, 3 | name: string, 4 | createdAt: string 5 | } 6 | -------------------------------------------------------------------------------- /server/api/types.ts: -------------------------------------------------------------------------------- 1 | export interface ApiResponse { 2 | data: object[]|object|string, 3 | status: number, 4 | message: string 5 | } 6 | -------------------------------------------------------------------------------- /store/counter/actions.ts: -------------------------------------------------------------------------------- 1 | const actions = ({ 2 | increment() { 3 | this.counter += 1; 4 | } 5 | }); 6 | 7 | export default actions; 8 | -------------------------------------------------------------------------------- /composables/auth/useAuthUser.ts: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line import/prefer-default-export 2 | export const useAuthUser = () => useState('user'); 3 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npx --no -- commitlint --edit $1 -g './.husky/git/commitlint.js' 5 | -------------------------------------------------------------------------------- /store/counter/state.ts: -------------------------------------------------------------------------------- 1 | export interface CounterState { 2 | counter: number 3 | }; 4 | 5 | export const state = (): CounterState => ({ 6 | counter: 0 7 | }); 8 | -------------------------------------------------------------------------------- /server/models/user.model.ts: -------------------------------------------------------------------------------- 1 | export interface User { 2 | id: number, 3 | name: string, 4 | email: string, 5 | created_at: string, 6 | updated_at: string 7 | } 8 | -------------------------------------------------------------------------------- /components/ExampleComponent.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | -------------------------------------------------------------------------------- /components/auth/types.ts: -------------------------------------------------------------------------------- 1 | export interface LoginForm { 2 | data: { 3 | email: string, 4 | password: string 5 | }, 6 | errors: object, 7 | pending: boolean 8 | } 9 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | NUXT_API_SECRET=api_secret_token 2 | NUXT_PUBLIC_API_BASE=https://example.com/api/ 3 | 4 | COOKIE_NAME=__session 5 | COOKIE_SECRET=secret 6 | COOKIE_EXPIRES=604800000 # 1 week 7 | -------------------------------------------------------------------------------- /store/user/getters.ts: -------------------------------------------------------------------------------- 1 | import { UserState } from './state'; 2 | 3 | const getters = { 4 | getUser({ user }: UserState) { 5 | return user; 6 | } 7 | }; 8 | 9 | export default getters; 10 | -------------------------------------------------------------------------------- /app.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | -------------------------------------------------------------------------------- /store/counter/getters.ts: -------------------------------------------------------------------------------- 1 | import { CounterState } from './state'; 2 | 3 | const getters = { 4 | getCounter({ counter }: CounterState) { 5 | return counter; 6 | } 7 | }; 8 | 9 | export default getters; 10 | -------------------------------------------------------------------------------- /store/user/state.ts: -------------------------------------------------------------------------------- 1 | import { User } from '~~/server/models/user.model'; 2 | 3 | export interface UserState { 4 | user: User 5 | }; 6 | 7 | export const state = (): UserState => ({ 8 | user: null 9 | }); 10 | -------------------------------------------------------------------------------- /tests/example.test.js: -------------------------------------------------------------------------------- 1 | import { describe, expect, test } from 'vitest'; 2 | 3 | describe('My test', async () => { 4 | test('my test', async () => { 5 | const count = 1; 6 | expect(count).toBe(1); 7 | }); 8 | }); -------------------------------------------------------------------------------- /pages/login.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 11 | -------------------------------------------------------------------------------- /pages/account.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | -------------------------------------------------------------------------------- /server/api/auth/login.post.ts: -------------------------------------------------------------------------------- 1 | // import { verify } from '~~/server/utils/password'; 2 | // import { serialize, sign } from '~~/server/utils/session'; 3 | 4 | // export default defineEventHandler(async (event) => { 5 | // console.log('api login', event); 6 | // }); 7 | -------------------------------------------------------------------------------- /middleware/auth.ts: -------------------------------------------------------------------------------- 1 | import useUserStore from '~~/store/user'; 2 | 3 | export default defineNuxtRouteMiddleware(() => { 4 | const { user } = useUserStore(); 5 | 6 | if (user === null) { 7 | return navigateTo('/login'); 8 | } 9 | 10 | return true; 11 | }); 12 | -------------------------------------------------------------------------------- /store/user/index.ts: -------------------------------------------------------------------------------- 1 | import { state } from './state'; 2 | import getters from './getters'; 3 | import actions from './actions'; 4 | 5 | const useUserStore = defineStore('user', { 6 | state, 7 | getters, 8 | actions, 9 | }); 10 | 11 | export default useUserStore; 12 | -------------------------------------------------------------------------------- /vitest.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vitest/config'; 2 | import Vue from '@vitejs/plugin-vue'; 3 | 4 | export default defineConfig({ 5 | plugins: [ 6 | Vue() 7 | ], 8 | test: { 9 | globals: true, 10 | environment: 'jsdom' 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /store/counter/index.ts: -------------------------------------------------------------------------------- 1 | import { state } from './state'; 2 | import getters from './getters'; 3 | import actions from './actions'; 4 | 5 | const useCounterStore = defineStore('counter', { 6 | state, 7 | getters, 8 | actions, 9 | }); 10 | 11 | export default useCounterStore; 12 | -------------------------------------------------------------------------------- /server/middleware/session.ts: -------------------------------------------------------------------------------- 1 | import { getSession } from '~~/server/utils/session'; 2 | 3 | export default defineEventHandler(async (event) => { 4 | const user = await getSession(event); 5 | 6 | // eslint-disable-next-line no-param-reassign 7 | if (user) event.context.user = user; 8 | }); 9 | -------------------------------------------------------------------------------- /pages/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 12 | -------------------------------------------------------------------------------- /server/utils/password.ts: -------------------------------------------------------------------------------- 1 | import bcrypt from 'bcryptjs'; 2 | 3 | export async function hash(plainPassword: string) { 4 | return bcrypt.hash(plainPassword, 10); 5 | } 6 | 7 | export function verify(plainPassword: string, hashPass: string) { 8 | return bcrypt.compare(plainPassword, hashPass); 9 | } 10 | -------------------------------------------------------------------------------- /composables/fetch.ts: -------------------------------------------------------------------------------- 1 | export const useApi = async (url: string) => { 2 | const runtimeConfig = useRuntimeConfig(); 3 | 4 | const result = await $fetch(url, { 5 | baseURL: runtimeConfig.public.apiBase, 6 | headers: { 7 | Authorization: 'Bearer 366|Q0jiwkTkF4nRpu4Qy3ez1hunWTKRLU7FyKfrOkb4' 8 | } 9 | }); 10 | return result; 11 | }; 12 | 13 | export const useFetchDouble = () => 'kek'; 14 | -------------------------------------------------------------------------------- /tests/mocks/example.mock.ts: -------------------------------------------------------------------------------- 1 | import { Example } from '~~/server/models/example.model'; 2 | 3 | const exampleMocks: Example[] = [ 4 | { 5 | id: 1, 6 | name: 'First name', 7 | createdAt: '' 8 | }, 9 | { 10 | id: 2, 11 | name: 'Next name', 12 | createdAt: '' 13 | }, 14 | { 15 | id: 3, 16 | name: 'Latest name', 17 | createdAt: '' 18 | }, 19 | ]; 20 | 21 | export default exampleMocks; 22 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | content: [ 4 | './index.html', 5 | './components/**/*/*.{vue,js,ts,jsx,tsx}', 6 | './pages/**/*/*.{vue,js,ts,jsx,tsx}', 7 | './layouts/**/*/*.{vue,js,ts,jsx,tsx}' 8 | ], 9 | theme: { 10 | extend: { 11 | colors: {}, 12 | screens: {}, 13 | fontFamily: {} 14 | }, 15 | }, 16 | plugins: [], 17 | }; 18 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig - это замечательно: http://EditorConfig.org 2 | 3 | # Файл EditorConfig верхнего уровня 4 | root = true 5 | 6 | [*.md] 7 | trim_trailing_whitespace = false 8 | 9 | [*.js] 10 | trim_trailing_whitespace = true 11 | 12 | # Переводы строк в стиле Unix с пустой строкой в конце файла 13 | [*] 14 | indent_style = space 15 | indent_size = 2 16 | end_of_line = lf 17 | charset = utf-8 18 | insert_final_newline = true 19 | max_line_length = 120 -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "npm" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | -------------------------------------------------------------------------------- /tests/mocks/user.mock.ts: -------------------------------------------------------------------------------- 1 | import { User } from '~~/server/models/user.model'; 2 | 3 | const userMocks: User[] = [ 4 | { 5 | id: 0, 6 | name: 'Ivan B.', 7 | email: 'ivan@gmail.com', 8 | created_at: '', 9 | updated_at: '' 10 | }, 11 | { 12 | id: 1, 13 | name: 'Vasiliy O.', 14 | email: 'vas1992@gmail.com', 15 | created_at: '', 16 | updated_at: '' 17 | }, 18 | { 19 | id: 2, 20 | name: 'Misha K.', 21 | email: 'misha92992@ya.ru', 22 | created_at: '', 23 | updated_at: '' 24 | }, 25 | ]; 26 | 27 | export default userMocks; 28 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "plugin:import/recommended", 4 | "plugin:@typescript-eslint/recommended", 5 | "plugin:import/typescript", 6 | "airbnb-base", 7 | "airbnb-typescript/base", 8 | "prettier", 9 | "plugin:vue/vue3-recommended", // https://eslint.vuejs.org/rules/ 10 | "plugin:nuxt/recommended" 11 | ], 12 | "settings": { 13 | "import/resolver": { 14 | "typescript": { 15 | "alwaysTryTypes": true 16 | } 17 | } 18 | }, 19 | "parserOptions": { 20 | "extraFileExtensions": [".vue"], 21 | "parser": "@typescript-eslint/parser", 22 | "project": "./tsconfig.json" 23 | }, 24 | "rules": { 25 | "import/extensions": ["error", "ignorePackages", { 26 | "": "never", // index files 27 | "js": "never", 28 | "jsx": "never", 29 | "ts": "never", 30 | "tsx": "never" 31 | }], 32 | "quotes": ["error", "single"], 33 | "semi": ["error", "always"], 34 | "linebreak-style": ["error", "unix"], 35 | "vue/multi-word-component-names": "off" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nuxt 3 Starter LR 2 | [Nuxt 3 документация](https://v3.nuxtjs.org) 3 | 4 | ## Стартер использует 5 | - :white_check_mark: Nuxt 3 6 | - :white_check_mark: Pinia 7 | - :white_check_mark: EditorConfig 8 | - :white_check_mark: TypeScript 9 | - :white_check_mark: ESlint & prettier 10 | - :white_check_mark: Vitest 11 | - :white_check_mark: Husky + LintStage + commitlint + commitizen 12 | - :white_check_mark: Tailwind CSS 13 | 14 | ## Запуск 15 | Установка зависимостей: 16 | 17 | ```bash 18 | # npm 19 | npm install 20 | ``` 21 | 22 | ## Сервер разработки 23 | Запуск локального сервера http://localhost:3000 24 | 25 | ```bash 26 | npm run dev 27 | ``` 28 | 29 | ## Продакшн 30 | Сборка продакшн-версии: 31 | 32 | ```bash 33 | npm run build 34 | ``` 35 | 36 | Предосмотр локальной сборки: 37 | 38 | ```bash 39 | npm run preview 40 | ``` 41 | 42 | [Документация по деплою](https://v3.nuxtjs.org/guide/deploy/presets) 43 | 44 | ## GIT 45 | Commitizen и Conventional Commits 46 | 47 | Если вы ещё не работали с commitizen, установите его глобально: 48 | ```bash 49 | npm install --global commitizen 50 | ``` 51 | 52 | ```bash 53 | git add . 54 | git cz 55 | ``` 56 | -------------------------------------------------------------------------------- /server/utils/session.ts: -------------------------------------------------------------------------------- 1 | import type { CompatibilityEvent } from 'h3'; 2 | import cookieSignature from 'cookie-signature'; 3 | 4 | export function serialize(obj) { 5 | const value = Buffer.from(JSON.stringify(obj), 'utf-8').toString('base64'); 6 | const length = Buffer.byteLength(value); 7 | 8 | if (length > 4096) 9 | throw new Error('Session value is too long'); 10 | 11 | return value; 12 | } 13 | 14 | export function deserialize(value: string) { 15 | return JSON.parse(Buffer.from(value, 'base64').toString('utf-8')); 16 | } 17 | 18 | export function sign(value: string, secret: string) { 19 | return cookieSignature.sign(value, secret); 20 | } 21 | 22 | export function unsign(value: string, secret: string) { 23 | return cookieSignature.unsign(value, secret); 24 | } 25 | 26 | export async function getSession(event: CompatibilityEvent) { 27 | const config = useRuntimeConfig(); 28 | 29 | const cookie = useCookies(event)[config.cookieName]; 30 | if (!cookie) return null; 31 | 32 | const unsignedSession = unsign(cookie, config.cookieSecret); 33 | if (!unsignedSession) return null; 34 | 35 | return deserialize(unsignedSession); 36 | } 37 | -------------------------------------------------------------------------------- /nuxt.config.ts: -------------------------------------------------------------------------------- 1 | // https://v3.nuxtjs.org/api/configuration/nuxt.config 2 | export default defineNuxtConfig({ 3 | // Заменяется значениями из .env 4 | runtimeConfig: { 5 | apiSecret: '1234567890', 6 | public: { 7 | apiBase: '', 8 | } 9 | }, 10 | 11 | // Tailwind & Nuxt 2/3: https://tailwindcss.com/docs/guides/nuxtjs 12 | tailwindcss: { 13 | configPath: '~/tailwind.config.cjs', 14 | exposeConfig: false, 15 | injectPosition: 0, 16 | viewer: true 17 | }, 18 | 19 | css: [ 20 | '~/assets/css/styles.css' 21 | ], 22 | 23 | app: { 24 | head: { 25 | title: 'Nuxt 3 starter (LR)', 26 | meta: [ 27 | { charset: 'utf-8' }, 28 | { 29 | name: 'viewport', 30 | content: 'width=device-width, initial-scale=1' 31 | }, 32 | ], 33 | }, 34 | }, 35 | 36 | modules: [ 37 | // Pinia: https://pinia.vuejs.org/ssr/nuxt.html 38 | [ 39 | '@pinia/nuxt', 40 | { 41 | autoImports: [ 42 | 'defineStore', 43 | ['defineStore', 'definePiniaStore'], 44 | ], 45 | }, 46 | ], 47 | 48 | // Tailwind & Nuxt 2/3: https://tailwindcss.com/docs/guides/nuxtjs 49 | '@nuxtjs/tailwindcss', 50 | ], 51 | }); 52 | -------------------------------------------------------------------------------- /components/auth/LoginForm.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 56 | -------------------------------------------------------------------------------- /.husky/git/commitlint.js: -------------------------------------------------------------------------------- 1 | // Файл создан на основе @commitlint/config-conventional 2 | 3 | const cz = require('./commitizen.js') 4 | 5 | module.exports = { 6 | rules: { 7 | // Тело коммита должно начинаться с пустой строки 8 | "body-leading-blank": [2, "always"], 9 | 10 | // Нижний колонтитул коммита должен начинаться с пустой строки 11 | "footer-leading-blank": [2, "always"], 12 | 13 | // Максимальная длина заголовка 72 символа 14 | "header-max-length": [ 15 | 2, 16 | "always", 17 | cz.subjectLimit 18 | ], 19 | 20 | // Область всегда только в нижнем регистре 21 | "scope-case": [2, "always", "lower-case"], 22 | 23 | // Перечислим все возможные области коммитов 24 | 'scope-enum': [ 25 | 1, 26 | 'always', 27 | cz.scopes.map(type => type.name) 28 | ], 29 | 30 | // Описание не может быть пустым 31 | "subject-empty": [2, "never"], 32 | 33 | // Описание не должно заканчиваться '.' 34 | "subject-full-stop": [2, "never", "."], 35 | 36 | // Тип всегда только в нижнем регистре 37 | "type-case": [2, "always", "lower-case"], 38 | 39 | // Тип не может быть пустым 40 | "type-empty": [2, "never"], 41 | 42 | // Перечислим все возможные варианты коммитов 43 | "type-enum": [ 44 | 2, 45 | "always", 46 | cz.types.map(type => type.value) 47 | ] 48 | } 49 | }; 50 | -------------------------------------------------------------------------------- /composables/auth/useAuth.ts: -------------------------------------------------------------------------------- 1 | import { User } from '~~/server/models/user.model'; 2 | import { ApiResponse } from '~~/server/api/types'; 3 | import { useAuthUser } from './useAuthUser'; 4 | 5 | // eslint-disable-next-line import/prefer-default-export 6 | export const useAuth = () => { 7 | const runtimeConfig = useRuntimeConfig(); 8 | const authUser = useAuthUser(); 9 | 10 | const setUser = (user: User) => { 11 | authUser.value = user; 12 | }; 13 | 14 | /** 15 | * Авторизация в API 16 | * @param email 17 | * @param password 18 | * @returns Авторизованный юзер 19 | */ 20 | const login = async ( 21 | email: string, 22 | password: string 23 | ) => { 24 | const data = await $fetch('auth/login', { 25 | baseURL: runtimeConfig.public.apiBase, 26 | method: 'POST', 27 | body: { 28 | email, 29 | password 30 | }, 31 | }); 32 | 33 | setUser(data.data as User); 34 | 35 | return authUser; 36 | }; 37 | 38 | 39 | /** 40 | * Выход юзера 41 | */ 42 | const logout = async () => { 43 | const data = await $fetch('/api/auth/logout', { 44 | method: 'POST', 45 | }); 46 | 47 | setUser(data.data as User); 48 | }; 49 | 50 | /** 51 | * Получение текущего юзера 52 | * @returns авторизованный юзер 53 | */ 54 | const me = async () => { 55 | if (!authUser.value) { 56 | const data = await $fetch('/api/auth/me', { 57 | headers: useRequestHeaders(['cookie']) as HeadersInit, 58 | }); 59 | 60 | setUser(data.data as User); 61 | } 62 | 63 | return authUser; 64 | }; 65 | 66 | return { 67 | login, 68 | logout, 69 | me, 70 | }; 71 | }; 72 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "build": "nuxt build", 5 | "dev": "nuxt dev", 6 | "generate": "nuxt generate", 7 | "preview": "nuxt preview", 8 | "postinstall": "nuxt prepare && husky install", 9 | "lint:js": "eslint . --ext .js,.jsx,.ts,.tsx,.vue --fix", 10 | "test": "vitest run", 11 | "coverage": "vitest run --coverage", 12 | "prepare": "husky install" 13 | }, 14 | "config": { 15 | "commitizen": { 16 | "path": "node_modules/cz-customizable" 17 | }, 18 | "cz-customizable": { 19 | "config": ".husky/git/commitizen.js" 20 | } 21 | }, 22 | "devDependencies": { 23 | "@commitlint/cli": "^17.1.2", 24 | "@nuxt/test-utils-edge": "^3.0.0-rc.12-27730995.2894a75", 25 | "@nuxtjs/tailwindcss": "^5.3.5", 26 | "@pinia/nuxt": "^0.4.3", 27 | "@types/bcryptjs": "^2.4.2", 28 | "@types/cookie-signature": "^1.0.4", 29 | "@typescript-eslint/eslint-plugin": "^5.40.0", 30 | "@typescript-eslint/parser": "^5.38.0", 31 | "autoprefixer": "^10.4.12", 32 | "cz-customizable": "^7.0.0", 33 | "eslint": "^8.25.0", 34 | "eslint-config-airbnb-base": "^15.0.0", 35 | "eslint-config-airbnb-typescript": "^17.0.0", 36 | "eslint-config-prettier": "^8.5.0", 37 | "eslint-import-resolver-typescript": "^3.5.1", 38 | "eslint-plugin-import": "^2.26.0", 39 | "eslint-plugin-nuxt": "^4.0.0", 40 | "eslint-plugin-prettier": "^4.2.1", 41 | "eslint-plugin-vue": "^9.6.0", 42 | "husky": "^8.0.0", 43 | "jsdom": "^20.0.1", 44 | "lint-staged": "^13.0.3", 45 | "nuxt": "3.0.0-rc.11", 46 | "postcss": "^8.4.17", 47 | "prettier": "^2.7.1", 48 | "prettier-eslint": "^15.0.1" 49 | }, 50 | "dependencies": { 51 | "@vitejs/plugin-vue": "^3.1.2", 52 | "bcryptjs": "^2.4.3", 53 | "cookie-signature": "^1.2.0", 54 | "pinia": "^2.0.22", 55 | "tailwindcss": "^3.1.8", 56 | "vitest": "^0.24.0" 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /.husky/git/commitizen.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | module.exports = { 4 | // Добавим описание на русском языке ко всем типам 5 | types: [ 6 | { 7 | value: "build", 8 | name: "build: Сборка проекта или изменения внешних зависимостей" 9 | }, 10 | { value: "ci", name: "ci: Настройка CI и работа со скриптами" }, 11 | { value: "docs", name: "docs: Обновление документации" }, 12 | { value: "feat", name: "feat: Добавление нового функционала" }, 13 | { value: "fix", name: "fix: Исправление ошибок" }, 14 | { 15 | value: "perf", 16 | name: "perf: Изменения направленные на улучшение производительности" 17 | }, 18 | { 19 | value: "refactor", 20 | name: 21 | "refactor: Правки кода без исправления ошибок или добавления новых функций" 22 | }, 23 | { value: "revert", name: "revert: Откат на предыдущие коммиты" }, 24 | { 25 | value: "style", 26 | name: 27 | "style: Правки по кодстайлу (табы, отступы, точки, запятые и т.д.)" 28 | }, 29 | { value: "test", name: "test: Добавление тестов" } 30 | ], 31 | 32 | // Область. Она характеризует фрагмент кода, которую затронули изменения 33 | scopes: [ 34 | { name: "commitizen" }, 35 | { name: "git" }, 36 | { name: "scripts" }, 37 | { name: "components" }, 38 | { name: "tutorial" }, 39 | { name: "catalog" }, 40 | { name: "product" } 41 | ], 42 | 43 | // Возможность задать спец ОБЛАСТЬ для определенного типа коммита (пример для 'fix') 44 | /* 45 | scopeOverrides: { 46 | fix: [ 47 | {name: 'merge'}, 48 | {name: 'style'}, 49 | {name: 'e2eTest'}, 50 | {name: 'unitTest'} 51 | ] 52 | }, 53 | */ 54 | 55 | // Поменяем дефолтные вопросы 56 | messages: { 57 | type: "Какие изменения вы вносите?", 58 | scope: "Выберите ОБЛАСТЬ, которую вы изменили (опционально):", 59 | // Спросим если allowCustomScopes в true 60 | customScope: "Укажите свою ОБЛАСТЬ:", 61 | subject: "Напишите КОРОТКОЕ описание в ПОВЕЛИТЕЛЬНОМ наклонении:\n", 62 | body: 63 | 'Напишите ПОДРОБНОЕ описание (опционально). Используйте "|" для новой строки:\n', 64 | breaking: "Список BREAKING CHANGES (опционально):\n", 65 | footer: 66 | "Место для мета данных (тикетов, ссылок и остального). Например: MRKT-700, MRKT-800:\n", 67 | confirmCommit: "Вас устраивает получившийся коммит?" 68 | }, 69 | 70 | // Разрешим собственную ОБЛАСТЬ 71 | allowCustomScopes: true, 72 | 73 | // Запрет на Breaking Changes 74 | allowBreakingChanges: false, 75 | 76 | // Префикс для нижнего колонтитула 77 | footerPrefix: "МЕТА ДАННЫЕ:", 78 | 79 | // limit subject length 80 | subjectLimit: 72 81 | }; 82 | --------------------------------------------------------------------------------