Skip to content

Translate tsconfig basic options about output directory into Japanese #267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/tsconfig-reference/copy/en/options/rootDir.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ By setting `rootDir: "."` in `tsconfig.json`, TypeScript would write this tree:
```
MyProj
├── dist
| ├── core
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orta
I found nits typo in original doc and fix it.
(this character should be not | but )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

├── core
│ │ ├── a.js
│ │ ├── b.js
│ │ ├── sub
Expand Down
17 changes: 17 additions & 0 deletions packages/tsconfig-reference/copy/ja/options/composite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
display: "Composite"
oneline: "Used to create multiple build projects"
---

`composite`オプションは、ビルドツール(`--build`モードでのTypeScript自体を含む)
がプロジェクトがビルドされているかどうかを迅速に判断できるようにするために特定の制約を適用します。

この設定が有効なとき:

- 明示的に設定されていない`rootDir`のデフォルト値は`tsconfig.json`ファイルを含むディレクトリとなります。

- すべての実装ファイルは、`include`パターンにマッチするか`files`リストに含まれなくてはなりません。この制約に違反した場合、`tsc`はどのファイルが指定されていないかを通知します。

- `declaration`のデフォルト値が`true`になります。

TypeScriptのプロジェクト機能についてのドキュメントは[ハンドブック](https://www.typescriptlang.org/docs/handbook/project-references.html)から参照できます。
39 changes: 39 additions & 0 deletions packages/tsconfig-reference/copy/ja/options/outDir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
display: "Out Dir"
oneline: "Set an output folder for all emitted files"
---

設定すると、`.js`ファイル(`.d.ts`や`.js.map`ファイルも同様)がこのディレクトリ内に出力されます。
元のソースファイルのディレクトリ構造は保存されます。結果のルート構造が意図どおりでない場合は、[rootDir](#rootDir)を参照してください。

設定しない場合、`.js`ファイルは`.ts`ファイルを作成したのと同じディレクトリに出力されます。

```sh
$ tsc

example
├── index.js
└── index.ts
```

次のような`tsconfig.json`の場合:

```json
{
"compilerOptions": {
"outDir": "dist"
}
}
```

この設定で`tsc`を実行すると、ファイルは指定された`dist`フォルダに生成されます。

```sh
$ tsc

example
├── dist
│ └── index.js
├── index.ts
└── tsconfig.json
```
11 changes: 11 additions & 0 deletions packages/tsconfig-reference/copy/ja/options/outFile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
display: "Out File"
oneline: "Output a single file of all JS files concatenated"
---

設定すると、すべての_グローバルな_(モジュールでない)ファイルは指定した単一の出力ファイルに結合されます。

もし`module`が`system`か`amd`の場合、この単一出力ファイルのグローバルなコンテンツの後ろにすべてのモジュールファイルも結合されます。

Note: `module`が`None`、`System`、`AMD`のいずれかでない限り、`outFile`は使用できません。
このオプションはCommonJSまたはES6 Modulesにバンドルする目的では使用_できません_。
66 changes: 66 additions & 0 deletions packages/tsconfig-reference/copy/ja/options/rootDir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
display: "Root Dir"
oneline: "Sets the root folder within your source files"
---

**デフォルト値**: 型定義ファイルでないすべての入力ファイルの中での最長の共通パス。`composite`が設定されている場合、この値の代わりに`tsconfig.json`を含むディレクトリがデフォルトとなります。

TypeScriptはファイルをコンパイルするとき、入力ディレクトリ内のディレクトリ構造が同じになるように出力ディレクト内の構造を保ちます。

例えば、いくつかの入力ファイルがあったとしましょう:

```
MyProj
├── tsconfig.json
├── core
│ ├── a.ts
│ ├── b.ts
│ ├── sub
│ │ ├── c.ts
├── types.d.ts
```

推定される`rootDir`の値は、型定義ファイルでないすべての入力ファイルの中での最長の共通パス、この例では`core/`となります。

`outDir`が`dist`だったとすると、TypeScriptは次のツリー構造を出力します:

```
MyProj
├── dist
│ ├── a.ts
│ ├── b.ts
│ ├── sub
│ │ ├── c.ts
```

ただし、出力ディレクトリ内に`core`を含めることを意図している場合があります。
`rootDir: "."`を`tsconfig.json`に設定すると、TypeScriptは次のツリー構造を出力します:

```
MyProj
├── dist
│ ├── core
│ │ ├── a.js
│ │ ├── b.js
│ │ ├── sub
│ │ │ ├── c.js
```

重要なこととして、`rootDir`は**どのファイルがコンパイルに含められるかに影響しません**。
`tsconfig.json`の`include`、`exclude`や`files`設定との相互作用はありません。

TypeScriptは`outDir`以外のディレクトリに出力ファイルを書き込むことはなく、ファイルの入力をスキップすることもありません。
このため、`rootDir`は出力する必要があるすべてのファイルがrootDirパスの下にあることを強制します。

例えば、次のツリー構造があったとしましょう:

```
MyProj
├── tsconfig.json
├── core
│ ├── a.ts
│ ├── b.ts
├── helpers.ts
```

`rootDir`を`core`に、`include`を`*`に設定すると、`outDir`の_外部_(i.e. `../helpers.ts`)に出力する必要のあるファイル(`helpers.ts`)が生まれるため、エラーとなります。