Skip to content

Commit 1e3cd08

Browse files
author
Orta
authored
Merge pull request #267 from Quramy/i18n-jp-tsconfig-in-out-directory-options
Translate tsconfig basic options about output directory into Japanese
2 parents 0b4af57 + 3b47765 commit 1e3cd08

File tree

5 files changed

+134
-1
lines changed

5 files changed

+134
-1
lines changed

packages/tsconfig-reference/copy/en/options/rootDir.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ By setting `rootDir: "."` in `tsconfig.json`, TypeScript would write this tree:
3939
```
4040
MyProj
4141
├── dist
42-
| ├── core
42+
├── core
4343
│ │ ├── a.js
4444
│ │ ├── b.js
4545
│ │ ├── sub
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
display: "Composite"
3+
oneline: "Used to create multiple build projects"
4+
---
5+
6+
`composite`オプションは、ビルドツール(`--build`モードでのTypeScript自体を含む)
7+
がプロジェクトがビルドされているかどうかを迅速に判断できるようにするために特定の制約を適用します。
8+
9+
この設定が有効なとき:
10+
11+
- 明示的に設定されていない`rootDir`のデフォルト値は`tsconfig.json`ファイルを含むディレクトリとなります。
12+
13+
- すべての実装ファイルは、`include`パターンにマッチするか`files`リストに含まれなくてはなりません。この制約に違反した場合、`tsc`はどのファイルが指定されていないかを通知します。
14+
15+
- `declaration`のデフォルト値が`true`になります。
16+
17+
TypeScriptのプロジェクト機能についてのドキュメントは[ハンドブック](https://www.typescriptlang.org/docs/handbook/project-references.html)から参照できます。
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
display: "Out Dir"
3+
oneline: "Set an output folder for all emitted files"
4+
---
5+
6+
設定すると、`.js`ファイル(`.d.ts``.js.map`ファイルも同様)がこのディレクトリ内に出力されます。
7+
元のソースファイルのディレクトリ構造は保存されます。結果のルート構造が意図どおりでない場合は、[rootDir](#rootDir)を参照してください。
8+
9+
設定しない場合、`.js`ファイルは`.ts`ファイルを作成したのと同じディレクトリに出力されます。
10+
11+
```sh
12+
$ tsc
13+
14+
example
15+
├── index.js
16+
└── index.ts
17+
```
18+
19+
次のような`tsconfig.json`の場合:
20+
21+
```json
22+
{
23+
"compilerOptions": {
24+
"outDir": "dist"
25+
}
26+
}
27+
```
28+
29+
この設定で`tsc`を実行すると、ファイルは指定された`dist`フォルダに生成されます。
30+
31+
```sh
32+
$ tsc
33+
34+
example
35+
├── dist
36+
│ └── index.js
37+
├── index.ts
38+
└── tsconfig.json
39+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
display: "Out File"
3+
oneline: "Output a single file of all JS files concatenated"
4+
---
5+
6+
設定すると、すべての_グローバルな_(モジュールでない)ファイルは指定した単一の出力ファイルに結合されます。
7+
8+
もし`module``system``amd`の場合、この単一出力ファイルのグローバルなコンテンツの後ろにすべてのモジュールファイルも結合されます。
9+
10+
Note: `module``None``System``AMD`のいずれかでない限り、`outFile`は使用できません。
11+
このオプションはCommonJSまたはES6 Modulesにバンドルする目的では使用_できません_
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
display: "Root Dir"
3+
oneline: "Sets the root folder within your source files"
4+
---
5+
6+
**デフォルト値**: 型定義ファイルでないすべての入力ファイルの中での最長の共通パス。`composite`が設定されている場合、この値の代わりに`tsconfig.json`を含むディレクトリがデフォルトとなります。
7+
8+
TypeScriptはファイルをコンパイルするとき、入力ディレクトリ内のディレクトリ構造が同じになるように出力ディレクト内の構造を保ちます。
9+
10+
例えば、いくつかの入力ファイルがあったとしましょう:
11+
12+
```
13+
MyProj
14+
├── tsconfig.json
15+
├── core
16+
│ ├── a.ts
17+
│ ├── b.ts
18+
│ ├── sub
19+
│ │ ├── c.ts
20+
├── types.d.ts
21+
```
22+
23+
推定される`rootDir`の値は、型定義ファイルでないすべての入力ファイルの中での最長の共通パス、この例では`core/`となります。
24+
25+
`outDir``dist`だったとすると、TypeScriptは次のツリー構造を出力します:
26+
27+
```
28+
MyProj
29+
├── dist
30+
│ ├── a.ts
31+
│ ├── b.ts
32+
│ ├── sub
33+
│ │ ├── c.ts
34+
```
35+
36+
ただし、出力ディレクトリ内に`core`を含めることを意図している場合があります。
37+
`rootDir: "."``tsconfig.json`に設定すると、TypeScriptは次のツリー構造を出力します:
38+
39+
```
40+
MyProj
41+
├── dist
42+
│ ├── core
43+
│ │ ├── a.js
44+
│ │ ├── b.js
45+
│ │ ├── sub
46+
│ │ │ ├── c.js
47+
```
48+
49+
重要なこととして、`rootDir`**どのファイルがコンパイルに含められるかに影響しません**
50+
`tsconfig.json``include``exclude``files`設定との相互作用はありません。
51+
52+
TypeScriptは`outDir`以外のディレクトリに出力ファイルを書き込むことはなく、ファイルの入力をスキップすることもありません。
53+
このため、`rootDir`は出力する必要があるすべてのファイルがrootDirパスの下にあることを強制します。
54+
55+
例えば、次のツリー構造があったとしましょう:
56+
57+
```
58+
MyProj
59+
├── tsconfig.json
60+
├── core
61+
│ ├── a.ts
62+
│ ├── b.ts
63+
├── helpers.ts
64+
```
65+
66+
`rootDir``core`に、`include``*`に設定すると、`outDir`の_外部_(i.e. `../helpers.ts`)に出力する必要のあるファイル(`helpers.ts`)が生まれるため、エラーとなります。

0 commit comments

Comments
 (0)