@lit-labs/gen-utils
Version:
Utilities for lit code generators
29 lines (28 loc) • 1.01 kB
TypeScript
/**
* @license
* Copyright 2022 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* Object with keys either specifying a filename (with value of string contents)
* or a folder name (with value of another FileTree object). As a convenience,
* filenames may contain slashes, in which case folders are automatically
* created.
*/
export interface FileTree {
[path: string]: string | FileTree;
}
/**
* Test whether a path is contained within a root path
*/
export declare const pathIsinRootPath: (subPath: string, rootPath: string) => boolean;
/**
* Writes a tree of files to an output folder.
*
* @param outDir Root folder to write files into
* @param tree Object with keys either specifying a filename (with value
* of string contents) or a folder name (with value of another FileTree object).
* As a convenience, filenames may contain slashes, in which case folders
* are automatically created.
*/
export declare const writeFileTree: (outDir: string, tree: FileTree) => Promise<void>;