設定ファイルの探索。プロジェクトの設定ファイルがどこに存在するかを、作業ディレクトリから worktree のルートまで上方向にたどり、さらにグローバル設定ディレクトリを加えて解決する。個々の設定ファイルは寛容に読み込む。

Members

(static, constant) directories

参照すべき設定ディレクトリの重複を除いたリストを解決する Effect。すなわち、グローバル設定ディレクトリ、directory と worktree ルートの間で見つかった .closedcode ディレクトリ(プロジェクト設定が無効化されている場合を除く)に加えてホームディレクトリ内のもの、そして設定されている場合は明示的なオーバーライドディレクトリ。

(static, constant) files

あるディレクトリから worktree のルートまで上方向にたどって <name>.jsonc<name>.json 設定ファイルを探す Effect。結果は最も外側を先頭(ネストよりルートが先)に返す。

Methods

(static) fileInDirectory(dir, name) → {Array.<string>}

あるディレクトリ内の設定ファイルについて、候補となる .json.jsonc のパスを組み立てる。

Parameters:
NameTypeDescription
dirstring

探索するディレクトリ。

namestring

設定ファイルのベース名(拡張子なし)。

Returns:

[<dir>/<name>.json, <dir>/<name>.jsonc] の候補パス。

Type: 
Array.<string>

(static) readFile(filepath) → {Promise.<(string|undefined)>}

設定ファイルを読み込む。ファイルが存在しない場合は undefined を返し、その他の失敗時には JsonError をスローする。

Parameters:
NameTypeDescription
filepathstring

設定ファイルへの絶対パス。

Throws:

When the file exists but cannot be read.

Type
JsonError
Returns:

ファイルの内容。ファイルが存在しない場合は undefined。

Type: 
Promise.<(string|undefined)>