@tech_query/node-toolkit
Version:
Toolkit for Node.JS packages
22 lines (21 loc) • 866 B
TypeScript
export declare function packageNameOf(path: string): string;
/**
* @param map - Key for RegExp source, value for replacement
*
* @return Key for replacement, value for RegExp
*/
export declare function patternOf(map: Record<string, string>): Record<string, RegExp>;
export declare function currentModulePath(): string;
export declare function packageOf(path?: string): {
path: string;
meta: Record<string, any>;
};
/**
* Get configuration of a Package from
* `package.json`, `.${name}.json` or `.${name}.yml` in `process.cwd()`
*
* (`process.env.NODE_ENV` will affect the result)
*/
export declare function configOf(name: string): Record<string, any>;
export declare const stringifyEnv: (data: Record<string, unknown>) => string;
export declare function saveEnv(newData: Record<string, unknown>, filePath: string): Promise<Record<string, unknown>>;