node-scripts-docs
Version:
Generate documentation for your `package.json` scripts.
118 lines • 4.13 kB
TypeScript
export declare const SCRIPTS_METADATA_DEFAULT_FILENAME = "package.json-scripts.json";
/**
* A single entry in the script store.
*/
export declare class ScriptStoreEntry {
/**
* The path where the manifest is located.
*/
manifestPath: string;
/**
* The name of the project this script exists in.
*/
projectName: string;
/**
* The name of the script itself.
*/
scriptName: string;
/**
* The code of the script.
*/
scriptCode: string;
/**
* Is this a global script?
* Scripts are usually global when their name includes a colon.
*/
isGlobal: boolean;
/**
* Is this a script from the root manifest of the monorepo?
*/
isRootManifest: boolean;
/**
* The user-authored description of the script.
*/
description?: string | undefined;
/**
* Constructs a new script store entry.
* @param manifestPath - The path where the manifest is located.
* @param projectName - The name of the project this script exists in.
* @param scriptName - The name of the script itself.
* @param scriptCode - The code of the script.
* @param isGlobal - Is this a global script?
* @param isRootManifest - Is this a script from the root manifest of the monorepo?
*/
constructor(manifestPath: string, projectName: string, scriptName: string, scriptCode: string, isGlobal: boolean, isRootManifest?: boolean);
}
/**
* The script store.
*/
export declare class ScriptStore {
#private;
/**
* Our default comment.
*/
readonly comment = "This file is generated by node-scripts-docs.";
/**
* The actual scripts in the store.
*/
scripts: ScriptStoreEntry[];
/**
* The current schema version of the script store.
*/
readonly version: number;
/**
* Retrieve all scripts that are global.
* @returns All scripts that are global.
*/
get globalScripts(): ScriptStoreEntry[];
/**
* Constructs a new script store.
* @param rootDirectory - The root directory of the project.
* @param filename - The name of the file where we persist script metadata.
*/
constructor(rootDirectory: string, filename?: string);
/**
* Add a new script to the store.
* @param manifestPath - The path where the manifest is located.
* @param projectName - The name of the project this script exists in.
* @param scriptName - The name of the script itself.
* @param scriptCode - The code of the script.
* @param isGlobal - Is this a global script?
* @param isRootManifest - Is this a script from the root manifest of the monorepo?
*/
add(manifestPath: string, projectName: string, scriptName: string, scriptCode: string, isGlobal: boolean, isRootManifest?: boolean): void;
/**
* Save the store metadata to disc.
* @param filename - The file to save the metadata to.
* @returns A promise that is fulfilled once the metadata has been written to disc.
*/
save(filename?: string): Promise<void>;
/**
* Load script metadata from the given file.
* @param filename - The file to load the metadata from.
*/
load(filename?: string): Promise<void>;
/**
* Generates a locator name for a script.
* @param projectName - The name if the project.
* @param scriptName - The name of the script.
* @returns A locator name.
*/
static makeScriptLocator(projectName: string, scriptName: string): string;
/**
* Parse a script locator into the project and script name parts.
* @param locator - The script locator.
* @returns The project and script name the locator refers to.
*/
static parseScriptLocator(locator: string): {
projectName: string;
scriptName: string;
};
/**
* Check if a store exists at the given location.
* @param storePath - A path where a store might exist.
* @returns `true` if the store exists; `false` otherwise.
*/
static exists(storePath: string): Promise<boolean>;
}
//# sourceMappingURL=ScriptStore.d.ts.map