ardunno-sketch
Version:
Utility for Arduino sketches
33 lines • 1.61 kB
TypeScript
/**
* Tests if the `path` is a main sketch file based on the [specs](https://arduino.github.io/arduino-cli/0.27/sketch-specification/#sketch-folders-and-files).
*
* It does **not** check whether the resource is accessible.
*/
export declare function isMainSketchFile(path: string): boolean;
/**
* Returns a promise which resolves with an array of all valid main sketch filenames recursively discovered from the `cwd` directory.
* By default, filters the sketches from the `hardware` and `libraries` folders.
* The array might contain nested main sketch files. For example: `['/path/to/Sketch/Sketch.ino', '/path/to/Sketch/Nested/Nested.ino']`.
* @param cwd the root path to start the sketch discovery from.
*/
export declare function findMainSketchFiles(cwd: string): Promise<string[]>;
export declare function findMainSketchFilesSync(cwd: string): string[];
/**
* Filters `['/path/to/Sketch/Sketch.ino', '/path/to/Sketch/Nested/Nested.ino']` to `['/path/to/Sketch/Sketch.ino']`.
*/
export declare function filterNestedMainSketchFiles(mainSketchFiles: string[]): string[];
export declare type Sketch = string;
export interface Folder {
readonly [name: string]: Folder | Sketch;
}
export interface SketchbookTree {
readonly cwd: string;
readonly root: Folder | Sketch;
}
/**
* Builds a sketchbook tree by discovering main sketch files from the root `cwd`.
* The root arg can be a sketch folder.
*/
export declare function sketchbookTree(cwd: string): Promise<SketchbookTree>;
export declare function sketchbookTreeSync(cwd: string): SketchbookTree;
//# sourceMappingURL=index.d.ts.map