mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +00:00
chore: enable typecheck ci for packages (#4664)
This commit is contained in:
parent
ab3971d302
commit
256df28124
24
.github/workflows/ci.yml
vendored
24
.github/workflows/ci.yml
vendored
@ -61,6 +61,30 @@ jobs:
|
|||||||
- name: Lint
|
- name: Lint
|
||||||
run: yarn 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:
|
test-fixtures:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
"lint": "eslint --ext .vue,.ts,.js,.mjs .",
|
"lint": "eslint --ext .vue,.ts,.js,.mjs .",
|
||||||
"lint:docs": "markdownlint ./docs/content && case-police 'docs/content**/*.md'",
|
"lint:docs": "markdownlint ./docs/content && case-police 'docs/content**/*.md'",
|
||||||
"lint:docs:fix": "markdownlint ./docs/content --fix && case-police 'docs/content**/*.md' --fix",
|
"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",
|
"nuxi": "NUXT_TELEMETRY_DISABLED=1 node ./packages/nuxi/bin/nuxi.mjs",
|
||||||
"nuxt": "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",
|
"play": "echo use yarn dev && exit 1",
|
||||||
|
@ -66,6 +66,6 @@ export default defineNuxtCommand({
|
|||||||
|
|
||||||
await listen(app)
|
await listen(app)
|
||||||
|
|
||||||
return 'wait'
|
return 'wait' as const
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -107,6 +107,6 @@ export default defineNuxtCommand({
|
|||||||
|
|
||||||
await load(false)
|
await load(false)
|
||||||
|
|
||||||
return 'wait'
|
return 'wait' as const
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -18,7 +18,7 @@ export default defineNuxtCommand({
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (args.watch) {
|
if (args.watch) {
|
||||||
return 'wait'
|
return 'wait' as const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -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 type { Ref, WatchSource } from 'vue'
|
||||||
import { wrapInRef } from './utils'
|
import { wrapInRef } from './utils'
|
||||||
import { NuxtApp, useNuxtApp } from '#app'
|
import { NuxtApp, useNuxtApp } from '#app'
|
||||||
@ -116,7 +116,7 @@ export function useAsyncData<
|
|||||||
})
|
})
|
||||||
.catch((error: any) => {
|
.catch((error: any) => {
|
||||||
asyncData.error.value = error
|
asyncData.error.value = error
|
||||||
asyncData.data.value = options.default()
|
asyncData.data.value = unref(options.default())
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
asyncData.pending.value = false
|
asyncData.pending.value = false
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// We set __webpack_public_path via this import with webpack builder
|
// We set __webpack_public_path via this import with webpack builder
|
||||||
import { createSSRApp, createApp, nextTick } from 'vue'
|
import { createSSRApp, createApp, nextTick } from 'vue'
|
||||||
import { $fetch } from 'ohmyfetch'
|
import { $fetch } from 'ohmyfetch'
|
||||||
|
// @ts-ignore
|
||||||
import { baseURL } from '#build/paths.mjs'
|
import { baseURL } from '#build/paths.mjs'
|
||||||
import { createNuxtApp, applyPlugins, normalizePlugins, CreateOptions } from '#app'
|
import { createNuxtApp, applyPlugins, normalizePlugins, CreateOptions } from '#app'
|
||||||
import '#build/css'
|
import '#build/css'
|
||||||
@ -12,6 +13,7 @@ import RootComponent from '#build/root-component.mjs'
|
|||||||
import AppComponent from '#build/app-component.mjs'
|
import AppComponent from '#build/app-component.mjs'
|
||||||
|
|
||||||
if (!globalThis.$fetch) {
|
if (!globalThis.$fetch) {
|
||||||
|
// @ts-ignore
|
||||||
globalThis.$fetch = $fetch.create({
|
globalThis.$fetch = $fetch.create({
|
||||||
baseURL: baseURL()
|
baseURL: baseURL()
|
||||||
})
|
})
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { joinURL } from 'ufo'
|
import { joinURL } from 'ufo'
|
||||||
|
// @ts-ignore
|
||||||
import { useRuntimeConfig } from '#internal/nitro'
|
import { useRuntimeConfig } from '#internal/nitro'
|
||||||
|
|
||||||
export function baseURL (): string {
|
export function baseURL (): string {
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import { createRenderer } from 'vue-bundle-renderer'
|
import { createRenderer } from 'vue-bundle-renderer'
|
||||||
import { eventHandler, useQuery } from 'h3'
|
import { eventHandler, useQuery } from 'h3'
|
||||||
import devalue from '@nuxt/devalue'
|
import devalue from '@nuxt/devalue'
|
||||||
|
// @ts-ignore
|
||||||
import { useRuntimeConfig } from '#internal/nitro'
|
import { useRuntimeConfig } from '#internal/nitro'
|
||||||
|
// @ts-ignore
|
||||||
import { buildAssetsURL } from '#paths'
|
import { buildAssetsURL } from '#paths'
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import htmlTemplate from '#build/views/document.template.mjs'
|
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 NUXT_NO_SSR = process.env.NUXT_NO_SSR
|
||||||
const PAYLOAD_JS = '/payload.js'
|
const PAYLOAD_JS = '/payload.js'
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
const getClientManifest = cachedImport(() => import('#build/dist/server/client.manifest.mjs'))
|
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 getSSRApp = !process.env.NUXT_NO_SSR && cachedImport(() => import('#build/dist/server/server.mjs'))
|
||||||
|
|
||||||
const getSSRRenderer = cachedResult(async () => {
|
const getSSRRenderer = cachedResult(async () => {
|
||||||
@ -21,6 +25,7 @@ const getSSRRenderer = cachedResult(async () => {
|
|||||||
const createSSRApp = await getSSRApp()
|
const createSSRApp = await getSSRApp()
|
||||||
if (!createSSRApp) { throw new Error('Server bundle is not available') }
|
if (!createSSRApp) { throw new Error('Server bundle is not available') }
|
||||||
// Create renderer
|
// Create renderer
|
||||||
|
// @ts-ignore
|
||||||
const { renderToString } = await import('#vue-renderer') // Alias to vue2.ts or vue3.ts
|
const { renderToString } = await import('#vue-renderer') // Alias to vue2.ts or vue3.ts
|
||||||
return createRenderer((createSSRApp), { clientManifest, renderToString, publicPath: buildAssetsURL() }).renderToString
|
return createRenderer((createSSRApp), { clientManifest, renderToString, publicPath: buildAssetsURL() }).renderToString
|
||||||
})
|
})
|
||||||
|
@ -4,6 +4,7 @@ import type { MetaObject } from '..'
|
|||||||
import { defineNuxtPlugin } from '#app'
|
import { defineNuxtPlugin } from '#app'
|
||||||
|
|
||||||
export default defineNuxtPlugin((nuxtApp) => {
|
export default defineNuxtPlugin((nuxtApp) => {
|
||||||
|
// @ts-expect-error missing resolver
|
||||||
const manager = createMetaManager(process.server)
|
const manager = createMetaManager(process.server)
|
||||||
|
|
||||||
nuxtApp.vueApp.use(manager)
|
nuxtApp.vueApp.use(manager)
|
||||||
@ -20,6 +21,7 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|||||||
|
|
||||||
if (process.server) {
|
if (process.server) {
|
||||||
nuxtApp.ssrContext.renderMeta = async () => {
|
nuxtApp.ssrContext.renderMeta = async () => {
|
||||||
|
// @ts-ignore
|
||||||
const { renderMetaToString } = await import('vue-meta/ssr')
|
const { renderMetaToString } = await import('vue-meta/ssr')
|
||||||
nuxtApp.ssrContext.teleports = nuxtApp.ssrContext.teleports || {}
|
nuxtApp.ssrContext.teleports = nuxtApp.ssrContext.teleports || {}
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
export { reservedVueTags } from './reserved-tags'
|
|
@ -19,12 +19,19 @@
|
|||||||
],
|
],
|
||||||
"#app/*": [
|
"#app/*": [
|
||||||
"./packages/nuxt/src/app/*"
|
"./packages/nuxt/src/app/*"
|
||||||
]
|
],
|
||||||
|
"#head": [
|
||||||
|
"./packages/nuxt/src/head/runtime/index"
|
||||||
|
],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"**/*/dist/*",
|
"**/*/dist/*",
|
||||||
"**/.nuxt/**",
|
"**/.nuxt/**",
|
||||||
"**/nuxt.d.ts"
|
"**/nuxt.d.ts",
|
||||||
|
"**/examples/**",
|
||||||
|
"**/docs/**",
|
||||||
|
"**/playground/**",
|
||||||
|
"**/test/fixtures/**"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
31
yarn.lock
31
yarn.lock
@ -13913,36 +13913,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"vite@npm:^2.9.5":
|
"vite@npm:^2.9.5, vite@npm:^2.9.6":
|
||||||
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":
|
|
||||||
version: 2.9.6
|
version: 2.9.6
|
||||||
resolution: "vite@npm:2.9.6"
|
resolution: "vite@npm:2.9.6"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
Loading…
Reference in New Issue
Block a user