@criticalmanufacturing/node-package-bundler
Version:
Connect IoT Package Bundler
82 lines (81 loc) • 3.15 kB
TypeScript
export declare class Operations {
private _logger;
/**
* Copy one file from one place to another
* @param file Name of the file
* @param source Directory path where the file is located
* @param destination Directory path where the file is to be copied
*/
copyFile(file: string, source: string, destination: string, isOptional?: boolean): void;
/**
* Move a file from one location into another
* @param file File to move
* @param source Directory path where the file is located
* @param destination Directory path where the file is to be moved
*/
moveFile(file: string, source: string, destination: string): void;
/**
* Rename an existing file
* @param source Full path of the original file
* @param destination Full path of the destination file
*/
renameFile(source: string, destination: string): void;
/**
* Delete a file
* @param filePath Path of the file
*/
deleteFile(filePath: string): void;
createFile(destination: string, contents: Buffer): void;
/**
* Replaces a text from a file with another text
* @param file Full path of the file
* @param search Token to search
* @param replace Token to replace
*/
replaceTextInFile(file: string, search: string, replace: string, isRegularExpression: boolean): void;
/**
* Remove from package.json all dependencies and dev dependencies
* @param file Full path of the package.json file
*/
removeDependenciesFromPackageJson(file: string): void;
/**
* Change the version stated in a package.json file
* @param file Full path of the package.json file
* @param version Version to change to
*/
changePackageJsonVersion(file: string, version: string): void;
setPackageJsonAsPacked(file: string): void;
/**
* Create a new Directory
* @param directoryPath Full path of the directory to create
*/
createDirectory(directoryPath: string): void;
/**
* Delete an entire directory, even if it is not empty
* @param directoryPath Full path of the directory to delete
*/
deleteDirectory(directoryPath: string): void;
/**
* Copy entire directory from one place to another
* @param source Full path of the original directory
* @param destination Full path of the destination directory
*/
copyDirectory(source: string, destination: string): void;
/**
* Run an external application
* @param command Command to execute
* @param args Arguments to pass to the command
* @param cwd Directory where the command will run
*/
run(command: string, args: string[], cwd?: string): boolean;
/**
* Utility function to convert ReadableStream<Uint8Array> to Buffer
* @param readableStream ReadableStream to convert
*/
readStreamToBuffer(readableStream: ReadableStream<Uint8Array>): Promise<Buffer>;
/**
* Utility function to convert ReadableStream<Uint8Array> to Buffer
* @param urlToValidate String representing the url to validate
*/
isValidUrl(urlToValidate: string): boolean;
}