@naturalcycles/nodejs-lib
Version:
Standard library for Node.js
66 lines (65 loc) • 1.89 kB
TypeScript
import type { AnyObject } from '@naturalcycles/js-lib/types';
export interface Json2EnvOptions {
jsonPath: string;
prefix?: string;
/**
* @default true
*/
saveEnvFile?: boolean;
/**
* @default true
*/
bashEnv?: boolean;
/**
* Appends GITHUB_ENV file, also GITHUB_OUTPUT for that step
*
* @default true
*/
githubEnv?: boolean;
/**
* @default true
*/
fail?: boolean;
debug?: boolean;
silent?: boolean;
}
export declare function json2env(opt: Json2EnvOptions): void;
export declare function appendToBashEnv(obj: AnyObject, prefix?: string): void;
export declare function appendToGithubEnv(obj: AnyObject, prefix?: string): void;
export declare function appendToGithubOutput(obj: AnyObject, prefix?: string): void;
/**
* https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary
*/
export declare function appendToGithubSummary(...lines: string[]): void;
/**
* Turns Object with keys/values into a *.sh script that exports all keys as values.
*
* @example
* { a: 'b', b: 'c'}
*
* will turn into:
*
* export a="b"
* export b="c"
*
* Quotes are important, otherwise it'll break on e.g space character in the value.
* Includes trailing newline for composability.
*/
export declare function objectToShellExport(obj: AnyObject, prefix?: string): string;
/**
* Turns Object with keys/values into a file of key-value pairs
*
* @example
* { a: 'b', b: 'c'}
*
* will turn into:
*
* a="b"
* b="c"
*
* Quotes are important, otherwise it'll break on e.g space character in the value.
* Includes trailing newline for composability.
*
* UPD: Quoted values behave inconsistently, so we're trying to NOT quote now, and-see-what-happens.
*/
export declare function objectToGithubActionsEnv(obj: AnyObject, prefix?: string): string;