Skip to content

Commit

Permalink
feat: next version (#394)
Browse files Browse the repository at this point in the history
* docs: upgrade documentation

* docs: add @nuxt/types-edge note

* fix(build): fix tsx support
  • Loading branch information
kevinmarrec committed Jul 6, 2020
1 parent a6ee94d commit e056f43
Show file tree
Hide file tree
Showing 79 changed files with 1,314 additions and 3,491 deletions.
83 changes: 0 additions & 83 deletions 2.9_MIGRATION_GUIDE.md

This file was deleted.

5 changes: 2 additions & 3 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ function getMainSidebar (prefix, guide, cookbook) {
prefix + '/cookbook/modules',
prefix + '/cookbook/server-middlewares'
]
},
prefix + '/migration'
}
]
}

Expand Down Expand Up @@ -209,7 +208,7 @@ function generateExampleMarkdown (apiName, level, options = {}) {
content += `# ${apiName[0].toUpperCase()}${apiName.slice(1)} API example (${level})\n\n`

if (!exampleExists) {
content += '### Coming Soon ...\n\n'
content += `### Contribute and propose your ${level} example on [Github](https://github.com/nuxt/typescript) !\n\n`
content += `<!-- <Example name="${apiName}-api/${level}" /> -->\n`
} else {
content += `<Example name="${apiName}-api/${level}" />\n`
Expand Down
4 changes: 2 additions & 2 deletions docs/cookbook/configuration.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Configuration (Runtime)

```ts
import { Configuration } from '@nuxt/types'
import { NuxtConfig } from '@nuxt/types'

const config: Configuration = {
const config: NuxtConfig = {
// Define your configuration with auto-completion & type checking
}

Expand Down
4 changes: 2 additions & 2 deletions docs/es/cookbook/configuration.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Configuración (Tiempo de Ejecución)

```ts
import { Configuration } from '@nuxt/types'
import { NuxtConfig } from '@nuxt/types'

const config: Configuration = {
const config: NuxtConfig = {
// Defina tu configuracion con auto completado y verificación de tipos
}

Expand Down
2 changes: 1 addition & 1 deletion docs/es/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ El soporte de Nuxt TypeScript viene con 3 paquetes :

Contiene las definiciones de tipos de Nuxt Typescript

Es usado por ambos paquetes **@nuxt/typescript-build** y **@nuxt/typescript-runtime**.
Se mantienen a lo largo del código central de Nuxt en [`nuxt/nuxt.js` repositorio](https://github.com/nuxt/nuxt.js/tree/dev/packages/types).
:::

::: tip @nuxt/typescript-build
Expand Down
8 changes: 3 additions & 5 deletions docs/es/guide/lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,12 @@ Si usted desea tener una runtime lint (teniendo ESLint corriendo despues de que
export default {
typescript: {
typeCheck: {
eslint: true
eslint: {
files: './src/**/*.{ts,js,vue}'
}
}
}
}
```

::: tip
Usted tambien puede dar opciones especificas de ESLint con `typeCheck.eslintOptions`
:::

Esto va a verificar los tipos y va a lintear su código cada vez que guarde archivos.
7 changes: 4 additions & 3 deletions docs/es/guide/runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ Todo lo que necesitas es actualizar tu archivo **package.json**:
"start": "nuxt-ts start"
},
"dependencies": {
"@nuxt/typescript-runtime",
"nuxt"
"@nuxt/typescript-runtime": "latest",
"nuxt": "latest",
},
"devDependencies": {
"@nuxt/typescript-build"
"@nuxt/types": "latest",
"@nuxt/typescript-build": "latest"
}
```

Expand Down
8 changes: 2 additions & 6 deletions docs/es/guide/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Aqui están las guias para instalar y configurarlo.
## Instalación

```sh
yarn add --dev @nuxt/typescript-build
yarn add --dev @nuxt/typescript-build @nuxt/types
# O
npm install --save-dev @nuxt/typescript-build
npm install --save-dev @nuxt/typescript-build @nuxt/types
```

## Configuración
Expand All @@ -27,10 +27,6 @@ y crear un archivo **`tsconfig.json`** :

<<< @/shared/tsconfig.json

::: tip
`@nuxt/typescript-build` incluye `@nuxt/types`, asi que no necesitas instalarlo de forma independiente.
:::

::: tip

Revisar la [documentación oficial de TypeScript](https://www.typescriptlang.org/docs/handbook/compiler-options.html) para aprender acerca de las diferentes opciones del compilador.
Expand Down
75 changes: 0 additions & 75 deletions docs/es/migration.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Nuxt TypeScript Support comes with 3 packages :

Contains Nuxt TypeScript type definitions.

It is shipped by both **@nuxt/typescript-build** and **@nuxt/typescript-runtime** packages.
They are maintained along Nuxt core code on [`nuxt/nuxt.js` repository](https://github.com/nuxt/nuxt.js/tree/dev/packages/types).
:::

::: tip @nuxt/typescript-build
Expand Down
8 changes: 3 additions & 5 deletions docs/guide/lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,12 @@ If you want to have runtime lint (having ESLint running after a file has been sa
export default {
typescript: {
typeCheck: {
eslint: true
eslint: {
files: './src/**/*.{ts,js,vue}'
}
}
}
}
```

::: tip
You can also give specific ESLint options with `typeCheck.eslintOptions`
:::

It will both type-check and lint your code whenever you're saving files.
1 change: 1 addition & 0 deletions docs/guide/runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ All you need to do is update your **package.json** file:
"nuxt": "latest"
},
"devDependencies": {
"@nuxt/types": "latest",
"@nuxt/typescript-build": "latest"
}
```
Expand Down
33 changes: 24 additions & 9 deletions docs/guide/setup.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
# Setup

Nuxt TypeScript Support mainly comes through a Nuxt module, **@nuxt/typescript-build**.
Nuxt TypeScript Support mainly comes through a Nuxt module, **@nuxt/typescript-build**, and its types **@nuxt/types**.

Here are the guidelines to install & configure it.
Here are the guidelines to install & configure them.

## Installation

```sh
yarn add --dev @nuxt/typescript-build
yarn add --dev @nuxt/typescript-build @nuxt/types
# OR
npm install --save-dev @nuxt/typescript-build
npm install --save-dev @nuxt/typescript-build @nuxt/types
```

::: tip Types version
You may want to install specific types version to match your Nuxt version if its not latest :

```sh
yarn add --dev @nuxt/types@2.13.2
# OR
npm install --save-dev @nuxt/types@2.13.2
```

If you're using `nuxt-edge` :
```sh
yarn add --dev @nuxt/types@npm:@nuxt/types-edge
# OR
npm install --save-dev @nuxt/types@npm:@nuxt/types-edge
```

Types versioning match Nuxt versioning since [2.13.0](https://github.com/nuxt/nuxt.js/releases/tag/v2.13.0).
:::

## Configuration

All you need to do is add **`@nuxt/typescript-build`** to your **`buildModules`** in **`nuxt.config.js`**
Expand All @@ -28,7 +47,7 @@ and create a **`tsconfig.json`** file :
<<< @/shared/tsconfig.json

::: tip
Notice that **es2018** target is needed to be able to use [**Optional Chaining**](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#optional-chaining) and [**Nullish Coalescing**](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#nullish-coalescing), as **esnext** target doesn't seem to support these features for now.
Notice that **ES2018** target is needed to be able to use [**Optional Chaining**](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#optional-chaining) and [**Nullish Coalescing**](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#nullish-coalescing), as **ESNext** target doesn't seem to support these features for now.
:::

You will also need to provide types for Vue files by adding the following type declaration:
Expand All @@ -45,10 +64,6 @@ declare module "*.vue" {
You can place this file in the root directory of your project or a directory named `types`. You can place it in a custom directory, but you'll need to configure [`typeRoots`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#types-typeroots-and-types) in the `tsconfig.json` file.
:::

::: tip
`@nuxt/typescript-build` ships `@nuxt/types`, so there's no need to install it independently.
:::

::: tip

Check official [TypeScript documentation](https://www.typescriptlang.org/docs/handbook/compiler-options.html) to learn about the different compiler options.
Expand Down
4 changes: 2 additions & 2 deletions docs/ja/cookbook/configuration.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# 設定(ランタイム)

```ts
import { Configuration } from '@nuxt/types'
import { NuxtConfig } from '@nuxt/types'

const config: Configuration = {
const config: NuxtConfig = {
// 自動補完と型判定による設定の定義
}

Expand Down
3 changes: 2 additions & 1 deletion docs/ja/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Nuxt の TypeScript サポートは 3 つのパッケージからなっていま

Nuxt TypeScript 型定義が含まれています。

**@nuxt/typescript-build** パッケージ と **@nuxt/typescript-runtime** パッケージに同梱されています。

それらはNuxtコアコードに沿って維持されます[リポジトリ `nuxt/nuxt.js`](https://github.com/nuxt/nuxt.js/tree/dev/packages/types)
:::

::: tip @nuxt/typescript-build
Expand Down

0 comments on commit e056f43

Please sign in to comment.