mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-21 21:25:11 +00:00
ci: lint workflows (#19556)
This commit is contained in:
parent
c8a5a4a487
commit
eb1bb59542
1
.github/workflows/docs-e2e.yml
vendored
1
.github/workflows/docs-e2e.yml
vendored
@ -22,7 +22,6 @@ jobs:
|
|||||||
- run: corepack enable
|
- run: corepack enable
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node }}
|
|
||||||
cache: "pnpm"
|
cache: "pnpm"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
25
.github/workflows/introspect.yml
vendored
Normal file
25
.github/workflows/introspect.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
name: Docs
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- ".github/workflows/**"
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- ".github/workflows/**"
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint-workflows:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
# From https://github.com/rhysd/actionlint/blob/main/docs/usage.md#use-actionlint-on-github-actions
|
||||||
|
- name: Check workflow files
|
||||||
|
run: |
|
||||||
|
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
|
||||||
|
./actionlint -color -shellcheck=""
|
@ -93,7 +93,7 @@ Whether to run a separate build step.
|
|||||||
|
|
||||||
#### `browser`
|
#### `browser`
|
||||||
|
|
||||||
Under the hood, Nuxt test utils uses [`playwright`](https://playwright.dev/) to carry out browser testing. If this option is set, a browser will be launched and can be controlled in the subsequent test suite. (More info can be found [here](/docs/guide/going-further/testing).)
|
Under the hood, Nuxt test utils uses [`playwright`](https://playwright.dev/) to carry out browser testing. If this option is set, a browser will be launched and can be controlled in the subsequent test suite. (More info can be found [here](/docs/getting-started/testing).)
|
||||||
|
|
||||||
* Type: `boolean`
|
* Type: `boolean`
|
||||||
* Default: `false`
|
* Default: `false`
|
||||||
|
@ -46,7 +46,7 @@ Any nested directories need to be added first as they are scanned in order.
|
|||||||
|
|
||||||
## Component extensions
|
## Component extensions
|
||||||
|
|
||||||
By default, any file with an extension specified in the [extensions key of `nuxt.config.ts`](/api/configuration/nuxt-config#extensions) is treated as a component.
|
By default, any file with an extension specified in the [extensions key of `nuxt.config.ts`](/docs/api/configuration/nuxt-config#extensions) is treated as a component.
|
||||||
If you need to restrict the file extensions that should be registered as components, you can use the extended form of the components directory declaration and its `extensions` key:
|
If you need to restrict the file extensions that should be registered as components, you can use the extended form of the components directory declaration and its `extensions` key:
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
|
@ -34,7 +34,7 @@ import { useNuxt } from '@nuxt/kit'
|
|||||||
Nuxt Kit utilities are only available for modules and not meant to be imported in runtime (components, Vue composables, pages, plugins, or server routes).
|
Nuxt Kit utilities are only available for modules and not meant to be imported in runtime (components, Vue composables, pages, plugins, or server routes).
|
||||||
::
|
::
|
||||||
|
|
||||||
Nuxt Kit is an [esm-only package](/docs/guide/going-further/esm) meaning that you **cannot** `require('@nuxt/kit')`. As a workaround, use dynamic import in the CommonJS context:
|
Nuxt Kit is an [esm-only package](/docs/guide/concepts/esm) meaning that you **cannot** `require('@nuxt/kit')`. As a workaround, use dynamic import in the CommonJS context:
|
||||||
|
|
||||||
```js [test.cjs]
|
```js [test.cjs]
|
||||||
// This does NOT work!
|
// This does NOT work!
|
||||||
|
@ -32,7 +32,7 @@ const submit = async () => {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
::ReadMore{link="/docs/api/composables/navigate-to"}
|
::ReadMore{link="/docs/api/utils/navigate-to"}
|
||||||
::
|
::
|
||||||
|
|
||||||
::alert{icon=👉}
|
::alert{icon=👉}
|
||||||
|
@ -7,10 +7,10 @@ toc: false
|
|||||||
This example shows how to test your Nuxt application.
|
This example shows how to test your Nuxt application.
|
||||||
|
|
||||||
::alert{type=info icon=👉}
|
::alert{type=info icon=👉}
|
||||||
Learn more about [testing](/docs/guide/going-further/testing).
|
Learn more about [testing](/docs/getting-started/testing).
|
||||||
::
|
::
|
||||||
|
|
||||||
::ReadMore{link="/docs/guide/going-further/testing"}
|
::ReadMore{link="/docs/getting-started/testing"}
|
||||||
::
|
::
|
||||||
|
|
||||||
::sandbox{repo="nuxt/nuxt" branch="main" dir="examples/advanced/testing" file="app.vue"}
|
::sandbox{repo="nuxt/nuxt" branch="main" dir="examples/advanced/testing" file="app.vue"}
|
||||||
|
@ -10,7 +10,7 @@ const logger = consola.withTag('crawler')
|
|||||||
const baseURL = withoutTrailingSlash(process.env.BASE_URL || 'https://nuxt.com')
|
const baseURL = withoutTrailingSlash(process.env.BASE_URL || 'https://nuxt.com')
|
||||||
const startingURL = baseURL + '/'
|
const startingURL = baseURL + '/'
|
||||||
|
|
||||||
const excludedExtensions = ['svg', 'png', 'jpg', 'sketch', 'ico', 'gif']
|
const excludedExtensions = ['svg', 'png', 'jpg', 'sketch', 'ico', 'gif', 'zip']
|
||||||
const urlsToOmit = ['http://localhost:3000']
|
const urlsToOmit = ['http://localhost:3000']
|
||||||
|
|
||||||
// TODO: remove when migrating to Nuxt 3/Docus
|
// TODO: remove when migrating to Nuxt 3/Docus
|
||||||
@ -27,6 +27,8 @@ const errorsToIgnore = [
|
|||||||
const urls = new Set([startingURL])
|
const urls = new Set([startingURL])
|
||||||
const erroredUrls = new Set()
|
const erroredUrls = new Set()
|
||||||
|
|
||||||
|
const referrers = new Map()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} path Path to check
|
* @param {string} path Path to check
|
||||||
* @param {string | undefined} referrer The referring page
|
* @param {string | undefined} referrer The referring page
|
||||||
@ -34,7 +36,7 @@ const erroredUrls = new Set()
|
|||||||
function queue (path, referrer) {
|
function queue (path, referrer) {
|
||||||
if (!path) {
|
if (!path) {
|
||||||
const message = chalk.red(`${chalk.bold('✗')} ${referrer} linked to empty href`)
|
const message = chalk.red(`${chalk.bold('✗')} ${referrer} linked to empty href`)
|
||||||
if (isCI) { actions.error(message) }
|
if (isCI && path?.match(/\/docs\//)) { actions.error(message) }
|
||||||
logger.log(message)
|
logger.log(message)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -54,6 +56,7 @@ function queue (path, referrer) {
|
|||||||
// Don't crawl external URLs
|
// Don't crawl external URLs
|
||||||
if (origin !== baseURL) { return }
|
if (origin !== baseURL) { return }
|
||||||
|
|
||||||
|
referrers.set(url, referrer)
|
||||||
urls.add(url)
|
urls.add(url)
|
||||||
|
|
||||||
crawler.queue(url)
|
crawler.queue(url)
|
||||||
@ -68,12 +71,13 @@ const crawler = new Crawler({
|
|||||||
const { statusCode } = res.request.response
|
const { statusCode } = res.request.response
|
||||||
|
|
||||||
if (error || ![200, 301, 302].includes(statusCode) || !$) {
|
if (error || ![200, 301, 302].includes(statusCode) || !$) {
|
||||||
if (errorsToIgnore.includes(parseURL(uri).pathname)) {
|
// TODO: normalize relative links in module readmes - https://github.com/nuxt/nuxt.com/issues/1271
|
||||||
const message = chalk.gray(`${chalk.bold('✗')} ${uri} (${statusCode}) (ignored)`)
|
if (errorsToIgnore.includes(parseURL(uri).pathname) || referrers.get(uri)?.match(/\/modules\//) || !uri?.match(/\/docs\//)) {
|
||||||
|
const message = chalk.gray(`${chalk.bold('✗')} ${uri} (${statusCode}) [<- ${referrers.get(uri)}] (ignored)`)
|
||||||
logger.log(message)
|
logger.log(message)
|
||||||
return done()
|
return done()
|
||||||
}
|
}
|
||||||
const message = chalk.red(`${chalk.bold('✗')} ${uri} (${statusCode})`)
|
const message = chalk.red(`${chalk.bold('✗')} ${uri} (${statusCode}) [<- ${referrers.get(uri)}]`)
|
||||||
if (isCI) { actions.error(message) }
|
if (isCI) { actions.error(message) }
|
||||||
logger.log(message)
|
logger.log(message)
|
||||||
erroredUrls.add(uri)
|
erroredUrls.add(uri)
|
||||||
|
Loading…
Reference in New Issue
Block a user