@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
102 lines (101 loc) • 2.85 kB
TypeScript
import { addItem } from "./add-item";
import { removeItem } from "./remove-item";
export interface FileWriterData {
filePath: string;
}
export declare class FileWriter {
private data;
private filePath;
private needImportHandler;
/**
* the getter data.
* @returns the data.
*/
getData(): string;
/**
* the constructor.
* @param path the path.
*/
constructor(path: string);
/**
* the read file function.
* @param filePath the file path.
* @returns the file content.
*/
readFile(filePath: any): any;
/**
* the tab to two spaces function.
* @returns this context.
*/
tabToTwoSpaces(): this;
/**
* replaces the version in version.json
* @param input the input.
* @returns
*/
replaceVersion(input: object): this;
/**
* the add content function.
* the default indent count should be matching with addBefore or addAfter.
* @param input the input.
* @param wholeLine the whole line flag.
* @param space the space number.
* @param connector the connector.
* @returns this context.
*/
addContent(input: object | addItem[], wholeLine?: boolean, space?: number, connector?: string): this;
/**
* the fix imports function.
* @returns this context.
*/
fixImportHandler(imports: string): this;
/**
* the replace dependency version function.
* @param input the input.
* @returns the this context.
*/
replaceDependencyVersion(input: object, ignore?: boolean): this;
/**
* the remove content function.
* @param input the input array.
* @returns the this context.
*/
removeContent(input: string[] | removeItem[]): this;
/**
* the write file function.
* @returns the write file result.
*/
writeFile(): boolean;
/**
* the replace content function.
* @param input the input object
* @returns the this context
*/
replaceContent(input: object): this;
/**
* the replace tsconfig content function.
* @param input the input object
* @returns the this context
*/
replaceTsConfigContent(input: object): this;
/**
* the escape for RegExp function.
* @param string the string to escape
* @returns the escaped string
*/
private escapeRegExp;
/**
* the check if dependency exists function.
* @param newKeyword the new keyword to check
* @returns the boolean value
*/
private checkIfKeywordExists;
/**
* removes the next n items after the index of the string containing the keyword
* @param array the file content array
* @param keyword the keyword, removeItem.key
*/
private removeByKeyword;
private getIndentByKeyword;
private importFixer;
}