@knapsack/app
Version:
Build Design Systems on top of knapsack, by Basalt
60 lines • 2.19 kB
TypeScript
/**
* @param fileName - path to where JSON file should be written
* @param object - data to turn to JSON
*/
export declare function writeJson(fileName: string, object: object): Promise<void>;
/**
* @param fileName - path to where JSON file should be read
*/
export declare function readJson(fileName: string): Promise<{
[k: string]: any;
}>;
export declare function readJsonSync(fileName: string): object;
export declare function writeYaml(fileName: string, object: object): Promise<void>;
export declare function readYaml(fileName: string): Promise<{
[k: string]: any;
}>;
export declare function readYamlSync(fileName: string): object;
export declare function isRemoteUrl(url: string): boolean;
/**
* Get a NPM package's package.json as object
*/
export declare function getPkg(pkg: string): object;
export declare function fileExists(filePath: string): boolean;
export declare function dirExists(dirPath: string): boolean;
export declare function fileExistsOrExit(filePath: string, msg?: string): void;
export declare function dirExistsOrExit(dirPath: string, msg?: string): void;
export declare function getGitBranch(): string;
export declare function resolvePath({ path, resolveFromDirs, }: {
path: string;
resolveFromDirs?: string[];
}): {
exists: boolean;
absolutePath?: string;
relativePathFromCwd?: string;
originalPath: string;
type: 'absolute' | 'relative' | 'package' | 'unknown';
};
/**
* Parse QueryString, decode non-strings
* Changes strings like `'true'` to `true` among others like numbers
* @see qsStringify
*/
export declare function qsParse(querystring: string): object;
/**
* Turn object of data into query string
* @see qsParse
*/
export declare function qsStringify(data: object): string;
export declare function base64ToString(b64: string): string;
export declare function stringToBase64(string: string): string;
/**
* Format code with Prettier
* If it can't format, it just returns original code
* @link https://prettier.io/docs/en/options.html#parser
*/
export declare function formatCode({ code, language, }: {
code: string;
language: string;
}): string;
//# sourceMappingURL=server-utils.d.ts.map