Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Merge upstream (upgraded to nuxt@3.0.0)
- Temporary fixing `vue-tsc` to `1.0.13` to workaround: https://github.com/nuxt/framework/issues/9777#issuecomment-1357547284
- Temporary using forked `unplugin-auto-imports` and `unplugin-vue-components` for `nuxt@3.0.0` compatibility
- Remove GraphQL
  • Loading branch information
NexZhu committed Dec 20, 2022
2 parents 2395059 + 71e6127 commit c8794b5
Show file tree
Hide file tree
Showing 37 changed files with 2,213 additions and 4,084 deletions.
18 changes: 1 addition & 17 deletions README.md
Expand Up @@ -25,23 +25,7 @@ References:

## Features

- [💚 Nuxt 3](https://v3.nuxtjs.org) - SSR, ESR, File-based routing, components auto importing, modules, etc.

- 💻 [TypeGraphql](https://typegraphql.com/docs/introduction.html) + [Apollo Server](https://www.apollographql.com/docs/apollo-server/)

- 🌞 [@urql/vue](https://formidable.com/open-source/urql/docs/basics/vue/) - composable query, SSR or client mode
For example:
```ts
import { usePersonQuery } from '~/graphql/generated/hello.query'

const { data, fetching, error } = usePersonQuery({
variables: ref({
personInput: {
name: 'Phil Xu',
},
}),
})
```
- [💚 Nuxt 3](https://nuxt.com/) - SSR, ESR, File-based routing, components auto importing, modules, etc.

- 🌏 [i18n](https://github.com/intlify/nuxt3) customized intlify i18n - set preferred language according to browser, and save user's preferred language to cookie.

Expand Down
2 changes: 1 addition & 1 deletion components/Footer.vue
Expand Up @@ -7,7 +7,7 @@ const { setLocale, locale } = useLocale()
<NuxtLink i-carbon-campsite to="/" />
<a
i-carbon-logo-github
href="https://github.com/antfu/vitesse-nuxt3"
href="https://github.com/daotl/nuxt-starter"
target="_blank"
/>
<DarkToggle />
Expand Down
32 changes: 0 additions & 32 deletions components/Home.vue

This file was deleted.

4 changes: 2 additions & 2 deletions components/InputEntry.vue
Expand Up @@ -8,7 +8,7 @@ const go = (): void => {
if (name.value) {
void router.push({
name: routes.hiId,
params: { id: encodeURIComponent(name.value as string) },
params: { id: name.value as string },
})
}
}
Expand All @@ -19,7 +19,7 @@ const go = (): void => {
<input
id="input"
v-model="name"
:placeholder="$t('input-name')"
:placeholder="$t('inputName')"
type="text"
autocomplete="off"
p="x-4 y-2"
Expand Down
58 changes: 58 additions & 0 deletions components/PageView.vue
@@ -0,0 +1,58 @@
<script setup lang="ts">
const { t } = useI18n()
const { data } = await useFetch('/api/pageview' as const)
const time = useTimeAgo(
computed(() => data.value?.startAt ?? new Date()),
{
fullDateFormatter: (date: Date) => date.toLocaleDateString(),
messages: {
justNow: t('justNow'),
past: (n: number | string) =>
String(n).match(/\d/) ? t('timeAgo', [n]) : String(n),
future: (n: number | string) =>
String(n).match(/\d/) ? t('inTime', [n]) : String(n),
second: (n: number | string) => `${n} ${t(`second${n > 1 ? 's' : ''}`)}`,
minute: (n: number | string) => `${n} ${t(`minute${n > 1 ? 's' : ''}`)}`,
hour: (n: number | string) => `${n} ${t(`hour${n > 1 ? 's' : ''}`)}`,
day: (n: number | string, past: boolean) =>
n === 1
? past
? t('yesterday')
: t('tomorrow')
: `${n} ${t(`day${n > 1 ? 's' : ''}`)}`,
week: (n: number | string, past: boolean) =>
n === 1
? past
? t('last week')
: t('next week')
: `${n} ${t(`week${n > 1 ? 's' : ''}`)}`,
month: (n: number | string, past: boolean) =>
n === 1
? past
? t('last month')
: t('next month')
: `${n} ${t(`month${n > 1 ? 's' : ''}`)}`,
year: (n: number | string, past: boolean) =>
n === 1
? past
? t('last year')
: t('next year')
: `${n} ${t(`year${n > 1 ? 's' : ''}`)}`,
},
},
)
</script>

<template>
<div text-gray:80>
<span v-if="data" font-500 text-gray>
{{
$t('visited', {
count: data.pageview,
time,
})
}}
</span>
</div>
</template>
2 changes: 2 additions & 0 deletions generated/auto-imports.d.ts
Expand Up @@ -13,6 +13,7 @@ declare global {
const setActivePinia: typeof import('pinia')['setActivePinia']
const setMapStoreSuffix: typeof import('pinia')['setMapStoreSuffix']
const storeToRefs: typeof import('pinia')['storeToRefs']
const useI18n: typeof import('vue-i18n')['useI18n']
}
// for vue template auto import
import { UnwrapRef } from 'vue'
Expand All @@ -30,5 +31,6 @@ declare module 'vue' {
readonly setActivePinia: UnwrapRef<typeof import('pinia')['setActivePinia']>
readonly setMapStoreSuffix: UnwrapRef<typeof import('pinia')['setMapStoreSuffix']>
readonly storeToRefs: UnwrapRef<typeof import('pinia')['storeToRefs']>
readonly useI18n: UnwrapRef<typeof import('vue-i18n')['useI18n']>
}
}
5 changes: 2 additions & 3 deletions generated/typed-router/__routes.ts
Expand Up @@ -5,10 +5,9 @@
* */

export const routerPagesNames = {
'404': '404' as const,
all: 'all' as const,
hiId: 'hi-id' as const,
index: 'index' as const,
restfulPageView: 'restful-page-view' as const,
}

export type TypedRouteList = '404' | 'hi-id' | 'index' | 'restful-page-view'
export type TypedRouteList = 'all' | 'hi-id' | 'index'
7 changes: 1 addition & 6 deletions generated/typed-router/__useTypedRouter.ts
Expand Up @@ -23,12 +23,7 @@ export const useTypedRouter = (): {
} => {
const { $router } = useNuxtApp()

const routesList = {
'404': '404',
hiId: 'hi-id',
index: 'index',
restfulPageView: 'restful-page-view',
}
const routesList = { all: 'all', hiId: 'hi-id', index: 'index' }

return {
router: $router,
Expand Down
12 changes: 3 additions & 9 deletions generated/typed-router/typed-router.d.ts
Expand Up @@ -13,22 +13,16 @@ import type {
} from 'vue-router'
import type { TypedRouteList } from './__routes'

export type RouteListDecl = {
'404': '404'
hiId: 'hi-id'
index: 'index'
restfulPageView: 'restful-page-view'
}
export type RouteListDecl = { all: 'all'; hiId: 'hi-id'; index: 'index' }

export type TypedRouteParams = {
'404': {
catchAll: string | number
all: {
all: string | number
}
'hi-id': {
id: string | number
}
index: never
'restful-page-view': never
}

type TypedRouteParamsStructure = {
Expand Down
31 changes: 0 additions & 31 deletions graphql/codegen.yml

This file was deleted.

1 change: 0 additions & 1 deletion graphql/generated/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion graphql/generated/ops/index.js

This file was deleted.

4 changes: 0 additions & 4 deletions graphql/generated/ops/queries/index.js

This file was deleted.

6 changes: 0 additions & 6 deletions graphql/generated/ops/queries/person.gql

This file was deleted.

19 changes: 0 additions & 19 deletions graphql/generated/ops/queries/person.ts

This file was deleted.

17 changes: 0 additions & 17 deletions graphql/generated/schema.gql

This file was deleted.

33 changes: 0 additions & 33 deletions graphql/generated/types.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion layouts/README.md
Expand Up @@ -12,4 +12,4 @@ definePageMeta({
</script>
```

Learn more on https://v3.nuxtjs.org/guide/directory-structure/layouts
Learn more on https://nuxt.com/docs/guide/directory-structure/layouts
22 changes: 18 additions & 4 deletions locales/en.ts
Expand Up @@ -3,11 +3,25 @@ export default {
clientMode: 'Client Mode',
ssrLoading: 'Loading when jump from other landing page',
ssrMode: 'Prefetch on SSR Mode',
'input-name': "What's your name?",
inputName: "What's your name?",
go: 'Go',
visited: '{count} page views since {time}',
back: 'Back',
alias: 'Also as known as',
China: 'China',
'Phil Xu': 'Phil Xu',
justNow: 'just now',
timeAgo: '{0} ago',
inTime: 'in {0}',
second: 'second',
seconds: 'seconds',
minute: 'minute',
minutes: 'minutes',
hour: 'hour',
hours: 'hours',
day: 'day',
days: 'days',
week: 'week',
weeks: 'weeks',
month: 'month',
months: 'months',
year: 'year',
years: 'years',
}

0 comments on commit c8794b5

Please sign in to comment.