mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
ci: add lychee link checker (#23254)
This commit is contained in:
parent
51d90014cf
commit
e15fe73100
51
.github/workflows/check-links.yml
vendored
Normal file
51
.github/workflows/check-links.yml
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
name: Check links with Lychee
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "docs/**"
|
||||
- "*.md"
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
paths:
|
||||
- "docs/**"
|
||||
- "*.md"
|
||||
branches:
|
||||
- main
|
||||
|
||||
# Remove default permissions of GITHUB_TOKEN for security
|
||||
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
linkChecker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Cache lychee results (e.g. to avoid hitting rate limits)
|
||||
- name: Restore lychee cache
|
||||
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
|
||||
with:
|
||||
path: .lycheecache
|
||||
key: cache-lychee-${{ github.sha }}
|
||||
restore-keys: cache-lychee-
|
||||
|
||||
# check links with Lychee
|
||||
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
|
||||
|
||||
- name: Lychee link checker
|
||||
uses: lycheeverse/lychee-action@ec7614d7605b47efb08dc370f6d0a71884cba944 # for v1.8.0
|
||||
with:
|
||||
# arguments with file types to check
|
||||
args: >-
|
||||
--cache
|
||||
--verbose
|
||||
--no-progress
|
||||
--max-cache-age=1d
|
||||
'./**/*.md'
|
||||
'./**/*.html'
|
||||
# fail the action on broken links
|
||||
fail: true
|
||||
env:
|
||||
# to be used in case rate limits are surpassed
|
||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -17,6 +17,9 @@ packages/*/LICENSE
|
||||
.tmp
|
||||
.cache
|
||||
|
||||
# Lychee cache
|
||||
.lycheecache
|
||||
|
||||
# Generated dirs
|
||||
dist
|
||||
.nuxt
|
||||
|
@ -123,7 +123,7 @@ Some examples of projects doing this already:
|
||||
|
||||
- [histoire](https://github.com/histoire-dev/histoire/blob/main/packages/histoire-plugin-nuxt/src/index.ts)
|
||||
- [nuxt-vitest](https://github.com/danielroe/nuxt-vitest/blob/main/packages/nuxt-vitest/src/config.ts)
|
||||
- [@storybook-vue/nuxt](https://github.com/storybook-vue/nuxt/blob/main/src/preset.ts)
|
||||
- [@storybook-vue/nuxt](https://github.com/storybook-vue/storybook-nuxt/blob/main/packages/storybook-nuxt/src/preset.ts)
|
||||
|
||||
Here is a brief example of how you might access the Vite config from a project; you could implement a similar approach to get the webpack configuration.
|
||||
|
||||
|
@ -106,7 +106,7 @@ It will be much easier to migrate your application if you use Nuxt's TypeScript
|
||||
You can read more about Nuxt's TypeScript support [in the docs](/docs/guide/concepts/typescript).
|
||||
|
||||
::alert{icon=📦}
|
||||
Nuxt can type-check your app using [`vue-tsc`](https://github.com/johnsoncodehk/volar/tree/master/vue-language-tools/vue-tsc) with `nuxi typecheck` command.
|
||||
Nuxt can type-check your app using [`vue-tsc`](https://github.com/vuejs/language-tools/tree/master/packages/vue-tsc) with `nuxi typecheck` command.
|
||||
::
|
||||
|
||||
### Migration
|
||||
|
13
lychee.toml
Normal file
13
lychee.toml
Normal file
@ -0,0 +1,13 @@
|
||||
# Cache the results of Lychee if ran locally in order to minimise the chance of rate limiting
|
||||
cache = true
|
||||
# Ignore all private link (such as localhost) to avoid errors
|
||||
exclude_all_private = true
|
||||
# HTTP status code: 429 (Too Many Requests) will also be treated as a valid link if Lychee gets rate limited
|
||||
accept = [200, 429]
|
||||
# Explicitly exclude some URLs
|
||||
exclude = [
|
||||
"https://twitter.nuxt.dev/",
|
||||
"https://github.com/nuxt/nuxt.com",
|
||||
"https://github.com/nuxt/translations/discussions/4",
|
||||
'(https?:\/\/github\.com\/)(.*\/)(generate)'
|
||||
]
|
Loading…
Reference in New Issue
Block a user