chore: enable typecheck ci for packages (#4664)

This commit is contained in:
Anthony Fu 2022-04-29 17:38:22 +08:00 committed by GitHub
parent ab3971d302
commit 256df28124
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 50 additions and 38 deletions

View File

@ -61,6 +61,30 @@ jobs:
- name: Lint
run: yarn lint
typecheck:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node: [16]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
- name: Install dependencies
run: yarn --immutable
- name: Stub
run: yarn stub
- name: Typecheck
run: yarn typecheck
test-fixtures:
runs-on: ${{ matrix.os }}

View File

@ -19,6 +19,7 @@
"lint": "eslint --ext .vue,.ts,.js,.mjs .",
"lint:docs": "markdownlint ./docs/content && case-police 'docs/content**/*.md'",
"lint:docs:fix": "markdownlint ./docs/content --fix && case-police 'docs/content**/*.md' --fix",
"typecheck": "tsc --noEmit",
"nuxi": "NUXT_TELEMETRY_DISABLED=1 node ./packages/nuxi/bin/nuxi.mjs",
"nuxt": "NUXT_TELEMETRY_DISABLED=1 node ./packages/nuxi/bin/nuxi.mjs",
"play": "echo use yarn dev && exit 1",

View File

@ -66,6 +66,6 @@ export default defineNuxtCommand({
await listen(app)
return 'wait'
return 'wait' as const
}
})

View File

@ -107,6 +107,6 @@ export default defineNuxtCommand({
await load(false)
return 'wait'
return 'wait' as const
}
})

View File

@ -18,7 +18,7 @@ export default defineNuxtCommand({
})
if (args.watch) {
return 'wait'
return 'wait' as const
}
}
})

View File

@ -1,4 +1,4 @@
import { onBeforeMount, onServerPrefetch, onUnmounted, ref, getCurrentInstance, watch } from 'vue'
import { onBeforeMount, onServerPrefetch, onUnmounted, ref, getCurrentInstance, watch, unref } from 'vue'
import type { Ref, WatchSource } from 'vue'
import { wrapInRef } from './utils'
import { NuxtApp, useNuxtApp } from '#app'
@ -116,7 +116,7 @@ export function useAsyncData<
})
.catch((error: any) => {
asyncData.error.value = error
asyncData.data.value = options.default()
asyncData.data.value = unref(options.default())
})
.finally(() => {
asyncData.pending.value = false

View File

@ -1,6 +1,7 @@
// We set __webpack_public_path via this import with webpack builder
import { createSSRApp, createApp, nextTick } from 'vue'
import { $fetch } from 'ohmyfetch'
// @ts-ignore
import { baseURL } from '#build/paths.mjs'
import { createNuxtApp, applyPlugins, normalizePlugins, CreateOptions } from '#app'
import '#build/css'
@ -12,6 +13,7 @@ import RootComponent from '#build/root-component.mjs'
import AppComponent from '#build/app-component.mjs'
if (!globalThis.$fetch) {
// @ts-ignore
globalThis.$fetch = $fetch.create({
baseURL: baseURL()
})

View File

@ -1,4 +1,5 @@
import { joinURL } from 'ufo'
// @ts-ignore
import { useRuntimeConfig } from '#internal/nitro'
export function baseURL (): string {

View File

@ -1,7 +1,9 @@
import { createRenderer } from 'vue-bundle-renderer'
import { eventHandler, useQuery } from 'h3'
import devalue from '@nuxt/devalue'
// @ts-ignore
import { useRuntimeConfig } from '#internal/nitro'
// @ts-ignore
import { buildAssetsURL } from '#paths'
// @ts-ignore
import htmlTemplate from '#build/views/document.template.mjs'
@ -10,7 +12,9 @@ const STATIC_ASSETS_BASE = process.env.NUXT_STATIC_BASE + '/' + process.env.NUXT
const NUXT_NO_SSR = process.env.NUXT_NO_SSR
const PAYLOAD_JS = '/payload.js'
// @ts-ignore
const getClientManifest = cachedImport(() => import('#build/dist/server/client.manifest.mjs'))
// @ts-ignore
const getSSRApp = !process.env.NUXT_NO_SSR && cachedImport(() => import('#build/dist/server/server.mjs'))
const getSSRRenderer = cachedResult(async () => {
@ -21,6 +25,7 @@ const getSSRRenderer = cachedResult(async () => {
const createSSRApp = await getSSRApp()
if (!createSSRApp) { throw new Error('Server bundle is not available') }
// Create renderer
// @ts-ignore
const { renderToString } = await import('#vue-renderer') // Alias to vue2.ts or vue3.ts
return createRenderer((createSSRApp), { clientManifest, renderToString, publicPath: buildAssetsURL() }).renderToString
})

View File

@ -4,6 +4,7 @@ import type { MetaObject } from '..'
import { defineNuxtPlugin } from '#app'
export default defineNuxtPlugin((nuxtApp) => {
// @ts-expect-error missing resolver
const manager = createMetaManager(process.server)
nuxtApp.vueApp.use(manager)
@ -20,6 +21,7 @@ export default defineNuxtPlugin((nuxtApp) => {
if (process.server) {
nuxtApp.ssrContext.renderMeta = async () => {
// @ts-ignore
const { renderMetaToString } = await import('vue-meta/ssr')
nuxtApp.ssrContext.teleports = nuxtApp.ssrContext.teleports || {}

View File

@ -1 +0,0 @@
export { reservedVueTags } from './reserved-tags'

View File

@ -19,12 +19,19 @@
],
"#app/*": [
"./packages/nuxt/src/app/*"
]
],
"#head": [
"./packages/nuxt/src/head/runtime/index"
],
}
},
"exclude": [
"**/*/dist/*",
"**/.nuxt/**",
"**/nuxt.d.ts"
"**/nuxt.d.ts",
"**/examples/**",
"**/docs/**",
"**/playground/**",
"**/test/fixtures/**"
]
}

View File

@ -13913,36 +13913,7 @@ __metadata:
languageName: node
linkType: hard
"vite@npm:^2.9.5":
version: 2.9.5
resolution: "vite@npm:2.9.5"
dependencies:
esbuild: ^0.14.27
fsevents: ~2.3.2
postcss: ^8.4.12
resolve: ^1.22.0
rollup: ^2.59.0
peerDependencies:
less: "*"
sass: "*"
stylus: "*"
dependenciesMeta:
fsevents:
optional: true
peerDependenciesMeta:
less:
optional: true
sass:
optional: true
stylus:
optional: true
bin:
vite: bin/vite.js
checksum: 354189cbce6904a3b58ca70b7ad9e1bb751ded9c13e483165562e634804cfb29bbf1507a4e6334cb9987e3f1f41e9f50764878a3c837523762e9da65229c9543
languageName: node
linkType: hard
"vite@npm:^2.9.6":
"vite@npm:^2.9.5, vite@npm:^2.9.6":
version: 2.9.6
resolution: "vite@npm:2.9.6"
dependencies: