@tarojs/cli
Version:
cli tool for taro
51 lines (50 loc) • 1.73 kB
TypeScript
/// <reference types="node" />
/// <reference types="node" />
import { fs } from '@tarojs/helper';
interface IFile {
contents: Buffer | NodeJS.ReadableStream | null;
cwd: string;
base: string | null | undefined;
history: string[];
relative: string;
dirname: string;
basename: string;
stem: string;
extname: string;
symlink: string;
stat: fs.Stats | null;
}
interface IReadOptions {
raw?: boolean;
}
interface IAppendOptions {
trimEnd?: boolean;
separator?: string;
}
interface IMemFsEditor {
store: {
[key: string]: IFile;
};
read(filePath: string, options?: IReadOptions): string | Buffer;
readJSON(filePath: string, defaults?: JSON): JSON;
write(filePath: string, contents: string | Buffer): string;
writeJSON(filepath: string, contents: JSON, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
append(filePath: string, contents: string | Buffer, options?: IAppendOptions): string | Buffer;
copyTpl(from: string, to: string, context: Record<any, any>, templateOptions: Record<any, any>): any;
commit(cb: () => void): any;
}
export default class Creator {
fs: IMemFsEditor;
protected _rootPath: string;
private _destinationRoot;
constructor(sourceRoot?: string);
init(): void;
sourceRoot(rootPath?: string): string;
templatePath(...args: string[]): string;
destinationRoot(rootPath?: string): string;
destinationPath(...args: string[]): string;
template(template: string, source: string, dest: string, data?: Record<any, any>, options?: any): this | undefined;
writeGitKeepFile(dirname: string): void;
write(): void;
}
export {};