barrelsby-alias
Version:
Barrelsby fork providing an alias builder.
32 lines (27 loc) • 952 B
text/typescript
/** A location in the file tree. */
export interface Location {
/** The full path of the location including the name. */
path: string;
/** The local name of the location. */
name: string;
}
/** A directory in the file tree. */
export interface Directory extends Location {
/** The directories within the directory. */
directories: Directory[];
/** The files within the directory. */
files: Location[];
/** The barrel within the directory if one exists. */
barrel?: Location;
}
/** Convert path separator from windows to unix */
export function convertPathSeparator(path: string): string {
return path.replace(/\\+/g, "/");
}
export function toCamelCase(name: string): string {
return name.replace(/-([a-z])/g, (g) => g[1].toUpperCase());
}
export const isTypeScriptFile = /\.tsx?$/m;
export const nonAlphaNumeric = /\W+/g;
export const thisDirectory = /^\.[\\\/]/g;
export const indentation = " ";