Skip to content

Commit

Permalink
Translate tsconfig files section into Japanese
Browse files Browse the repository at this point in the history
  • Loading branch information
Quramy committed Feb 9, 2020
1 parent 3c4fe9a commit 0fce9a8
Show file tree
Hide file tree
Showing 7 changed files with 199 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "ファイルインクルージョン"
---

これらの設定はTypeScriptが適切なファイルを確実に選択できるようにします。
11 changes: 11 additions & 0 deletions packages/tsconfig-reference/copy/ja/options/exclude.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
display: "Exclude"
oneline: "Files or patterns to be skipped from the include option"
---

`include`の解決時にスキップさせるファイル名やパターンのリストを指定します。

**重要**: `exclude``include`の結果として、どのファイルが含まれるべきか_のみ_に影響を与えます。
`exclude`に指定されたファイルは、コードでの`import``types`でのインクルード、`/// <reference` ディレクティブ、`files`リストの指定によって、コードベースの一部となり得ます。

`exclude`はコードベースに含まれているファイルの読み込みを**防ぐ**ための仕組みではありません。`include`設定の結果を変更するだけです。
45 changes: 45 additions & 0 deletions packages/tsconfig-reference/copy/ja/options/extends.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
display: "Extends"
oneline: "Inherit options for a TSConfig"
---

`extends`の値は、別の継承対象の設定ファイルへのパスを含む文字列です。
Node.jsにおけるモジュール解決の流儀が用いられます。

ベースとなるファイルからの設定が最初に読み込まれ、続いて継承ファイルの設定によってオーバーライドされます。設定ファイル内のすべての相対パスは、元の設定ファイルを起点として解決されます。

継承した設定ファイルの`files``include`および`exclude`はベースとなる設定ファイルの内容を_上書き_します。
また、継承における循環参照は許容されません。

#####

`configs/base.json`:

```json
{
"compilerOptions": {
"noImplicitAny": true,
"strictNullChecks": true
}
}
```

`tsconfig.json`:

```json
{
"extends": "./configs/base",
"files": ["main.ts", "supplemental.ts"]
}
```

`tsconfig.nostrictnull.json`:

```json
{
"extends": "./tsconfig",
"compilerOptions": {
"strictNullChecks": false
}
}
```
26 changes: 26 additions & 0 deletions packages/tsconfig-reference/copy/ja/options/files.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
display: "Files"
oneline: "Include a set list of files, does not support globs"
---

プログラムに含めるファイルの許可リストを指定します。ファイルが見つからない場合、エラーが発生します。

```json
{
"compilerOptions": {},
"files": [
"core.ts",
"sys.ts",
"types.ts",
"scanner.ts",
"parser.ts",
"utilities.ts",
"binder.ts",
"checker.ts",
"tsc.ts"
]
}
```

このオプションは、プロジェクトが少数のファイルから構成されていて、グロブパターンを必要としない場合で有用です。
グロブパターンが必要な場合、[`include`](#include)を利用してください。
66 changes: 66 additions & 0 deletions packages/tsconfig-reference/copy/ja/options/include.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
display: "Include"
oneline: "Files or patterns to include in this project"
---

プログラムに含めるファイル名またはパターンのリストを指定します。
ファイル名は`tsconfig.json`ファイルを含んでいるディレクトリからの相対パスとして解決されます。

```json
{
"include": ["src/**", "tests/**"]
}
```

この設定は以下のようにマッチします。

<!-- TODO: #135
```diff
.
- ├── scripts
- │ ├── lint.ts
- │ ├── update_deps.ts
- │ └── utils.ts
+ ├── src
+ │ ├── client
+ │ │ ├── index.ts
+ │ │ └── utils.ts
+ │ ├── server
+ │ │ └── index.ts
+ ├── tests
+ │ ├── app.test.ts
+ │ ├── utils.ts
+ │ └── tests.d.ts
- ├── package.json
- ├── tsconfig.json
- └── yarn.lock
``` -->

```
.
├── scripts ⨯
│ ├── lint.ts ⨯
│ ├── update_deps.ts ⨯
│ └── utils.ts ⨯
├── src ✓
│ ├── client ✓
│ │ ├── index.ts ✓
│ │ └── utils.ts ✓
│ ├── server ✓
│ │ └── index.ts ✓
├── tests ✓
│ ├── app.test.ts ✓
│ ├── utils.ts ✓
│ └── tests.d.ts ✓
├── package.json
├── tsconfig.json
└── yarn.lock
```

`include``exclude`はグロブパターンのためのワイルドカードをサポートしています:

- `*` ゼロ個以上の文字列にマッチ(ディレクトリセパレータは除く)
- `?` 任意の1文字にマッチ(ディレクトリセパレータは除く)
- `**/` 任意階層の任意ディレクトリにマッチ

グロブパターンがファイルの拡張子を含まない場合、サポートされる拡張子のみが含まれるようになります(例:`.ts``.tsx``.d.ts`はデフォルトでインクルードされ、`.js``.jsx``allowJs`が設定された場合のみインクルードされます)。
9 changes: 9 additions & 0 deletions packages/tsconfig-reference/copy/ja/options/references.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
display: "References"
oneline: "Provide a structure for composite projects"
---

プロジェクト参照はTypeScriptのプログラムを小さい断片に分けて構造化するための手法です。
プロジェクト参照を用いると、ビルド時間やエディターとのインタラクションに必要な時間が大幅に改善され、コンポーネント間の論理分割が強制により、より洗練された方法でコードを整理できます。

プロジェクト参照がどのように動作するかについては、このハンドブックの[Project References](/docs/handbook/project-references.html)を読んでください。
37 changes: 37 additions & 0 deletions packages/tsconfig-reference/copy/ja/options/typeAcquisition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
display: "Type Acquisition"
oneline: "Sets of options for Automatic Type Acquisition in JavaScript"
---

エディターにJavaScriptプロジェクトが存在する場合、TypeScriptは`@types`で定義されるDefinitelyTypedから提供されるファイルを用いて、`node_modules`のための型ファイルを自動で提供します。
これは自動型取得と呼ばれており、また設定の`typeAcquisition`を使ってカスタマイズできます。

この機能を無効化したりカスタマイズする場合、プロジェクトのルートに`jsconfig.json`ファイルを作成してください:

```json
{
"typeAcquisition": {
"enable": false
}
}
```

プロジェクトに含めるべき特定のモジュールがある場合(それが`node_modules`には存在しない場合):

```json
{
"typeAcquisition": {
"include": ["jest"]
}
}
```

モジュールが自動で取得されるべきでない場合。例えば、そのライブラリが`node_modules`に含まれてはいるが、チームでこのライブラリを利用しないことを合意している場合:

```json
{
"typeAcquisition": {
"exclude": ["jquery"]
}
}
```

0 comments on commit 0fce9a8

Please sign in to comment.