chore: upgrade deps & fix lint
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,5 +1,5 @@
|
||||
# auto generate
|
||||
src/data/recipe.json
|
||||
data/recipe.json
|
||||
|
||||
.DS_Store
|
||||
.vite-ssg-dist
|
||||
@@ -7,6 +7,7 @@ src/data/recipe.json
|
||||
*.local
|
||||
|
||||
esbuild-kit
|
||||
tsx-*
|
||||
|
||||
# nuxt
|
||||
node_modules
|
||||
|
||||
68
.vscode/settings.json
vendored
68
.vscode/settings.json
vendored
@@ -1,11 +1,69 @@
|
||||
{
|
||||
"cSpell.words": ["Vitesse", "Vite", "unocss", "vitest", "vueuse", "pinia", "demi", "antfu", "iconify", "intlify", "vitejs", "unplugin", "pnpm"],
|
||||
"prettier.enable": false,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": true,
|
||||
},
|
||||
"files.associations": {
|
||||
"*.css": "postcss",
|
||||
"*.css": "postcss"
|
||||
},
|
||||
|
||||
// Enable the ESlint flat config support
|
||||
"eslint.experimental.useFlatConfig": true,
|
||||
// Disable the default formatter, use eslint instead
|
||||
"prettier.enable": false,
|
||||
"editor.formatOnSave": false,
|
||||
// Auto fix
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": "explicit",
|
||||
"source.organizeImports": "never"
|
||||
},
|
||||
// Silent the stylistic rules in you IDE, but still auto fix them
|
||||
"eslint.rules.customizations": [
|
||||
{
|
||||
"rule": "style/*",
|
||||
"severity": "off"
|
||||
},
|
||||
{
|
||||
"rule": "*-indent",
|
||||
"severity": "off"
|
||||
},
|
||||
{
|
||||
"rule": "*-spacing",
|
||||
"severity": "off"
|
||||
},
|
||||
{
|
||||
"rule": "*-spaces",
|
||||
"severity": "off"
|
||||
},
|
||||
{
|
||||
"rule": "*-order",
|
||||
"severity": "off"
|
||||
},
|
||||
{
|
||||
"rule": "*-dangle",
|
||||
"severity": "off"
|
||||
},
|
||||
{
|
||||
"rule": "*-newline",
|
||||
"severity": "off"
|
||||
},
|
||||
{
|
||||
"rule": "*quotes",
|
||||
"severity": "off"
|
||||
},
|
||||
{
|
||||
"rule": "*semi",
|
||||
"severity": "off"
|
||||
}
|
||||
],
|
||||
// Enable eslint for all supported languages
|
||||
"eslint.validate": [
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"vue",
|
||||
"html",
|
||||
"markdown",
|
||||
"json",
|
||||
"jsonc",
|
||||
"yaml"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import { storeToRefs } from 'pinia'
|
||||
import type { StuffItem } from '~/data/food'
|
||||
import type { StuffItem } from '~/types'
|
||||
import { meat, staple, tools, vegetable } from '~/data/food'
|
||||
|
||||
import { useEmojiAnimation } from '~/composables/animation'
|
||||
|
||||
@@ -29,7 +29,6 @@ const showTooltip = computed(() => !selectedStuff.value.length && !curTool.value
|
||||
<SearchFoodInput v-if="showSearchInput" />
|
||||
|
||||
<Transition mode="out-in">
|
||||
<div class="cook-filter-recipes">
|
||||
<span v-if="showTooltip" text="sm" p="2">
|
||||
你要先选食材或工具哦~
|
||||
</span>
|
||||
@@ -61,7 +60,6 @@ const showTooltip = computed(() => !selectedStuff.value.length && !curTool.value
|
||||
<span>反馈新的菜谱!</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import type { Recipes } from 'types'
|
||||
import type { Recipes } from '~/types'
|
||||
|
||||
defineProps<{
|
||||
recipes: Recipes
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import type { RecipeItem } from 'types'
|
||||
import type { RecipeItem } from '~/types'
|
||||
|
||||
defineProps<{
|
||||
index: number
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import type { DbRecipeItem } from 'utils/db'
|
||||
import type { DbRecipeItem } from '~/utils/db'
|
||||
import { tools } from '~/data/food'
|
||||
import type { RecipeItem } from '~/types'
|
||||
import { getEmojisFromStuff } from '~/utils'
|
||||
|
||||
@@ -4,7 +4,6 @@ import { isClient, useElementBounding } from '@vueuse/core'
|
||||
/**
|
||||
* trigger show invisible element
|
||||
* @param target
|
||||
* @returns
|
||||
*/
|
||||
export function useInvisibleElement(target: MaybeComputedElementRef<HTMLElement>) {
|
||||
const { top } = useElementBounding(target)
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import type { DbRecipeItem } from 'utils/db'
|
||||
import type { DbRecipeItem } from '~/utils/db'
|
||||
|
||||
/**
|
||||
* 随机几道菜
|
||||
* @param total
|
||||
* @returns
|
||||
*/
|
||||
export function useRandomRecipe(total: Ref<number>) {
|
||||
const randomRecipes = ref<(DbRecipeItem | undefined)[]>([])
|
||||
|
||||
@@ -2,9 +2,8 @@ import { acceptHMRUpdate, defineStore } from 'pinia'
|
||||
import { useStorage } from '@vueuse/core'
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
import { useGtm } from '@gtm-support/vue-gtm'
|
||||
import type { RecipeItem } from 'types'
|
||||
import type { StuffItem } from '../../data/food'
|
||||
import { db } from '../../utils/db'
|
||||
import type { RecipeItem, StuffItem } from '~/types'
|
||||
|
||||
const namespace = 'cook'
|
||||
|
||||
@@ -74,7 +73,6 @@ export const useRecipeStore = defineStore('recipe', () => {
|
||||
const isSearching = ref(false)
|
||||
/**
|
||||
* 搜索菜谱
|
||||
* @returns
|
||||
*/
|
||||
async function searchRecipes() {
|
||||
isSearching.value = true
|
||||
|
||||
27
data/food.ts
27
data/food.ts
@@ -1,29 +1,4 @@
|
||||
export interface StuffItem {
|
||||
/**
|
||||
* 食材名称
|
||||
*/
|
||||
name: string
|
||||
/**
|
||||
* 例如:🥔
|
||||
*/
|
||||
emoji: string
|
||||
/**
|
||||
* 图片链接
|
||||
*/
|
||||
image?: string
|
||||
/**
|
||||
* 别名,譬如:西红柿/番茄
|
||||
*/
|
||||
alias?: string
|
||||
/**
|
||||
* 图标名称
|
||||
*/
|
||||
icon?: string
|
||||
/**
|
||||
* 显示标签
|
||||
*/
|
||||
label?: string
|
||||
}
|
||||
import type { StuffItem } from '../types'
|
||||
|
||||
/**
|
||||
* 素菜
|
||||
|
||||
3
eslint.config.js
Normal file
3
eslint.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import antfu from '@antfu/eslint-config'
|
||||
|
||||
export default antfu()
|
||||
43
package.json
43
package.json
@@ -1,7 +1,8 @@
|
||||
{
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"version": "1.1.6",
|
||||
"packageManager": "pnpm@8.6.10",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@8.10.2",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
@@ -24,40 +25,40 @@
|
||||
"vue-about-me": "^1.2.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^0.40.2",
|
||||
"@antfu/eslint-config": "^1.1.0",
|
||||
"@headlessui/vue": "^1.7.16",
|
||||
"@iconify-json/carbon": "^1.1.19",
|
||||
"@iconify-json/carbon": "^1.1.21",
|
||||
"@iconify-json/fe": "^1.1.7",
|
||||
"@iconify-json/gg": "^1.1.6",
|
||||
"@iconify-json/ic": "^1.1.14",
|
||||
"@iconify-json/mdi": "^1.1.54",
|
||||
"@iconify-json/mdi": "^1.1.55",
|
||||
"@iconify-json/ri": "^1.1.12",
|
||||
"@iconify-json/twemoji": "^1.1.12",
|
||||
"@nuxt/devtools": "^0.8.0",
|
||||
"@nuxt/devtools": "^1.0.0",
|
||||
"@nuxtjs/color-mode": "^3.3.0",
|
||||
"@pinia/nuxt": "^0.4.11",
|
||||
"@pinia/nuxt": "^0.5.1",
|
||||
"@pinia/testing": "^0.1.3",
|
||||
"@unocss/eslint-config": "^0.55.2",
|
||||
"@unocss/nuxt": "^0.55.2",
|
||||
"@vite-pwa/nuxt": "^0.1.0",
|
||||
"@unocss/eslint-config": "^0.57.2",
|
||||
"@unocss/nuxt": "^0.57.2",
|
||||
"@vite-pwa/nuxt": "^0.1.1",
|
||||
"@vue/test-utils": "^2.4.1",
|
||||
"@vueuse/nuxt": "^10.3.0",
|
||||
"@vueuse/nuxt": "^10.5.0",
|
||||
"@yunlefun/vue": "^0.0.7",
|
||||
"@zadigetvoltaire/nuxt-gtm": "^0.0.13",
|
||||
"consola": "^3.2.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"dexie": "^3.2.4",
|
||||
"eslint": "^8.47.0",
|
||||
"fake-indexeddb": "^4.0.2",
|
||||
"eslint": "^8.53.0",
|
||||
"fake-indexeddb": "^5.0.1",
|
||||
"jsdom": "^22.1.0",
|
||||
"nuxt": "^3.6.5",
|
||||
"pinia": "^2.1.6",
|
||||
"sass": "^1.66.1",
|
||||
"nuxt": "^3.8.0",
|
||||
"pinia": "^2.1.7",
|
||||
"sass": "^1.69.5",
|
||||
"star-markdown-css": "^0.4.2",
|
||||
"tsx": "^3.12.7",
|
||||
"typescript": "^5.1.6",
|
||||
"unocss": "^0.55.2",
|
||||
"vitest": "^0.34.2",
|
||||
"vue-tsc": "^1.8.8"
|
||||
"tsx": "^3.14.0",
|
||||
"typescript": "^5.2.2",
|
||||
"unocss": "^0.57.2",
|
||||
"vitest": "^0.34.6",
|
||||
"vue-tsc": "^1.8.22"
|
||||
}
|
||||
}
|
||||
|
||||
5475
pnpm-lock.yaml
generated
5475
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
10
shims.d.ts
vendored
10
shims.d.ts
vendored
@@ -9,13 +9,15 @@ declare interface Window {
|
||||
|
||||
// with vite-plugin-vue-markdown, markdowns can be treat as Vue components
|
||||
declare module '*.md' {
|
||||
import { type DefineComponent } from 'vue'
|
||||
const component: DefineComponent<{}, {}, any>
|
||||
import type { DefineComponent } from 'vue'
|
||||
|
||||
const component: DefineComponent<object, object, any>
|
||||
export default component
|
||||
}
|
||||
|
||||
declare module '*.vue' {
|
||||
import { type DefineComponent } from 'vue'
|
||||
const component: DefineComponent<{}, {}, any>
|
||||
import type { DefineComponent } from 'vue'
|
||||
|
||||
const component: DefineComponent<object, object, any>
|
||||
export default component
|
||||
}
|
||||
|
||||
1
src/data/recipe.json
Normal file
1
src/data/recipe.json
Normal file
File diff suppressed because one or more lines are too long
@@ -5,7 +5,7 @@ import { describe, it } from 'vitest'
|
||||
// import { createTestingPinia } from '@pinia/testing'
|
||||
// import ChooseFood from '../src/components/ChooseFood.vue'
|
||||
|
||||
describe('ChooseFood.vue', () => {
|
||||
describe('chooseFood.vue', () => {
|
||||
it('should render', async () => {
|
||||
// const pinia = createTestingPinia({
|
||||
// createSpy: vi.fn,
|
||||
|
||||
@@ -40,3 +40,30 @@ export interface RecipeItem {
|
||||
}
|
||||
|
||||
export type Recipes = RecipeItem[]
|
||||
|
||||
export interface StuffItem {
|
||||
/**
|
||||
* 食材名称
|
||||
*/
|
||||
name: string
|
||||
/**
|
||||
* 例如:🥔
|
||||
*/
|
||||
emoji: string
|
||||
/**
|
||||
* 图片链接
|
||||
*/
|
||||
image?: string
|
||||
/**
|
||||
* 别名,譬如:西红柿/番茄
|
||||
*/
|
||||
alias?: string
|
||||
/**
|
||||
* 图标名称
|
||||
*/
|
||||
icon?: string
|
||||
/**
|
||||
* 显示标签
|
||||
*/
|
||||
label?: string
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ foodItems.forEach((item) => {
|
||||
/**
|
||||
* get emojis from stuff name array
|
||||
* @param stuff
|
||||
* @returns
|
||||
*/
|
||||
export function getEmojisFromStuff(stuff: string[]) {
|
||||
const emojis: string[] = stuff.map(name => foodEmojiMap.get(name)).filter(item => !!item)
|
||||
|
||||
@@ -3,7 +3,6 @@ import { isClient } from '@vueuse/core'
|
||||
/**
|
||||
* - https://web.dev/customize-install/#detect-install
|
||||
* - [Trigger installation from your PWA](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/How_to/Trigger_install_prompt)
|
||||
* @returns
|
||||
*/
|
||||
export function installPrompt() {
|
||||
if (!isClient)
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/**
|
||||
* 生成随机数组
|
||||
* @param recipes
|
||||
* @returns
|
||||
*/
|
||||
export function generateRandomArray(length: number, total = 1) {
|
||||
const randomArr: number[] = []
|
||||
|
||||
Reference in New Issue
Block a user