builder-util
- Version 25.1.7
- Published
- 130 kB
- 16 dependencies
- MIT license
Install
npm i builder-util
yarn add builder-util
pnpm add builder-util
Overview
Various utilities. Used by [electron-builder](https://github.com/electron-userland/electron-builder).
Index
Variables
Functions
- addValue()
- archFromString()
- copyDir()
- copyFile()
- copyOrLinkFile()
- deepAssign()
- defaultArchFromString()
- dirSize()
- DO_NOT_USE_HARD_LINKS()
- doSpawn()
- exec()
- executeAppBuilder()
- executeFinally()
- exists()
- getArchCliNames()
- getArchSuffix()
- getArtifactArchName()
- getPath7x()
- getPath7za()
- getPlatformIconFileName()
- isEmptyOrSpaces()
- isEnvTrue()
- isPullRequest()
- isTokenCharValid()
- orIfFileNotExist()
- orNullIfFileNotExist()
- printErrorAndExit()
- removePassword()
- replaceDefault()
- retry()
- serializeToYaml()
- setPrinter()
- spawn()
- spawnAndWrite()
- statOrNull()
- toLinuxArchString()
- unlinkIfExists()
- use()
- USE_HARD_LINKS()
- walk()
Classes
Interfaces
Enums
Type Aliases
Variables
variable CONCURRENCY
const CONCURRENCY: { concurrency: number };
variable debug
const debug: _debug.Debugger;
variable debug7z
const debug7z: _debug.Debugger;
variable httpExecutor
const httpExecutor: NodeHttpExecutor;
variable log
const log: Logger;
variable MAX_FILE_REQUESTS
const MAX_FILE_REQUESTS: number;
variable PADDING
const PADDING: number;
Functions
function addValue
addValue: <K, T>(map: Map<K, Array<T>>, key: K, value: T) => void;
function archFromString
archFromString: (name: string) => Arch;
function copyDir
copyDir: ( src: string, destination: string, options?: CopyDirOptions) => Promise<any>;
Empty directories is never created. Hard links is used if supported and allowed.
function copyFile
copyFile: (src: string, dest: string, isEnsureDir?: boolean) => Promise<any>;
function copyOrLinkFile
copyOrLinkFile: ( src: string, dest: string, stats?: Stats | null, isUseHardLink?: boolean, exDevErrorHandler?: (() => boolean) | null) => Promise<any>;
Hard links is used if supported and allowed. File permission is fixed — allow execute for all if owner can, allow read for all if owner can.
ensureDir is not called, dest parent dir must exists
function deepAssign
deepAssign: <T>(target: T, ...objects: Array<any>) => T;
function defaultArchFromString
defaultArchFromString: (name?: string) => Arch;
function dirSize
dirSize: (dirPath: string) => Promise<number>;
function DO_NOT_USE_HARD_LINKS
DO_NOT_USE_HARD_LINKS: (file: string) => boolean;
function doSpawn
doSpawn: ( command: string, args: Array<string>, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions) => ChildProcess;
function exec
exec: ( file: string, args?: Array<string> | null, options?: ExecFileOptions, isLogOutIfDebug?: boolean) => Promise<string>;
function executeAppBuilder
executeAppBuilder: ( args: Array<string>, childProcessConsumer?: (childProcess: ChildProcess) => void, extraOptions?: SpawnOptions, maxRetries?: number) => Promise<string>;
function executeFinally
executeFinally: <T>( promise: Promise<T>, task: (isErrorOccurred: boolean) => Promise<any>) => Promise<T>;
function exists
exists: (file: string) => Promise<boolean>;
function getArchCliNames
getArchCliNames: () => Array<string>;
function getArchSuffix
getArchSuffix: (arch: Arch, defaultArch?: string) => string;
function getArtifactArchName
getArtifactArchName: (arch: Arch, ext: string) => string;
function getPath7x
getPath7x: () => Promise<string>;
function getPath7za
getPath7za: () => Promise<string>;
function getPlatformIconFileName
getPlatformIconFileName: ( value: string | null | undefined, isMac: boolean) => string | null | undefined;
function isEmptyOrSpaces
isEmptyOrSpaces: (s: string | null | undefined) => s is '';
function isEnvTrue
isEnvTrue: (value: string | null | undefined) => boolean;
function isPullRequest
isPullRequest: () => boolean | '' | undefined;
function isTokenCharValid
isTokenCharValid: (token: string) => boolean;
function orIfFileNotExist
orIfFileNotExist: <T>(promise: Promise<T>, fallbackValue: T) => Promise<T>;
function orNullIfFileNotExist
orNullIfFileNotExist: <T>(promise: Promise<T>) => Promise<T | null>;
function printErrorAndExit
printErrorAndExit: (error: Error) => void;
function removePassword
removePassword: (input: string) => string;
function replaceDefault
replaceDefault: ( inList: Array<string> | null | undefined, defaultList: Array<string>) => Array<string>;
function retry
retry: <T>( task: () => Promise<T>, retryCount: number, interval: number, backoff?: number, attempt?: number, shouldRetry?: (e: any) => boolean) => Promise<T>;
function serializeToYaml
serializeToYaml: ( object: any, skipInvalid?: boolean, noRefs?: boolean) => string;
function setPrinter
setPrinter: (value: (message: string) => void) => void;
function spawn
spawn: ( command: string, args?: Array<string> | null, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions) => Promise<any>;
function spawnAndWrite
spawnAndWrite: ( command: string, args: Array<string>, data: string, options?: SpawnOptions) => Promise<any>;
function statOrNull
statOrNull: (file: string) => Promise<Stats | null>;
function toLinuxArchString
toLinuxArchString: (arch: Arch, targetName: string) => string;
function unlinkIfExists
unlinkIfExists: (file: string) => Promise<void>;
function use
use: <T, R>(value: T | Nullish, task: (value: T) => R) => R | null;
function USE_HARD_LINKS
USE_HARD_LINKS: (file: string) => boolean;
function walk
walk: ( initialDirPath: string, filter?: Filter | null, consumer?: FileConsumer) => Promise<Array<string>>;
Returns list of file paths (system-dependent file separator)
Classes
class AsyncTaskManager
class AsyncTaskManager {}
constructor
constructor(cancellationToken: CancellationToken);
property tasks
readonly tasks: Promise<any>[];
method add
add: (task: () => Promise<any>) => void;
method addTask
addTask: (promise: Promise<any>) => void;
method awaitTasks
awaitTasks: () => Promise<Array<any>>;
method cancelTasks
cancelTasks: () => void;
class CopyFileTransformer
class CopyFileTransformer {}
constructor
constructor(afterCopyTransformer: AfterCopyFileTransformer);
property afterCopyTransformer
readonly afterCopyTransformer: AfterCopyFileTransformer;
class DebugLogger
class DebugLogger {}
constructor
constructor(isEnabled?: boolean);
property data
readonly data: any;
property isEnabled
readonly isEnabled: boolean;
method add
add: (key: string, value: any) => void;
method save
save: (file: string) => Promise<void>;
class ExecError
class ExecError extends Error {}
constructor
constructor( command: string, exitCode: number, out: string, errorOut: string, code?: string);
property alreadyLogged
alreadyLogged: boolean;
property exitCode
readonly exitCode: number;
class FileCopier
class FileCopier {}
constructor
constructor( isUseHardLinkFunction?: (file: string) => boolean, transformer?: FileTransformer);
property isUseHardLink
isUseHardLink: boolean;
method copy
copy: (src: string, dest: string, stat: Stats | undefined) => Promise<void>;
class InvalidConfigurationError
class InvalidConfigurationError extends Error {}
constructor
constructor(message: string, code?: string);
class Logger
class Logger {}
constructor
constructor(stream: WritableStream);
property isDebugEnabled
readonly isDebugEnabled: boolean;
property messageTransformer
messageTransformer: (message: string, level: LogLevel) => string;
property stream
protected readonly stream: WritableStream;
method createMessage
static createMessage: ( message: string, fields: Fields | null, level: LogLevel, color: (it: string) => string, messagePadding?: number) => string;
method debug
debug: (fields: Fields | null, message: string) => void;
method error
error: (messageOrFields: Fields | null | string, message?: string) => void;
method filePath
filePath: (file: string) => string;
method info
info: (messageOrFields: Fields | null | string, message?: string) => void;
method log
log: (message: string) => void;
method warn
warn: (messageOrFields: Fields | null | string, message?: string) => void;
class NestedError
class NestedError extends Error {}
constructor
constructor(errors: Error[], message?: string);
class NodeHttpExecutor
class NodeHttpExecutor extends HttpExecutor<ClientRequest> {}
method createRequest
createRequest: ( options: any, callback: (response: any) => void) => ClientRequest;
Interfaces
interface CopyDirOptions
interface CopyDirOptions {}
property filter
filter?: Filter | null;
property isUseHardLink
isUseHardLink?: ((file: string) => boolean) | null;
property transformer
transformer?: FileTransformer | null;
interface ExtraSpawnOptions
interface ExtraSpawnOptions {}
property isPipeInput
isPipeInput?: boolean;
interface Fields
interface Fields {}
index signature
[index: string]: any;
interface FileConsumer
interface FileConsumer {}
property isIncludeDir
isIncludeDir?: boolean;
false
method consume
consume: ( file: string, fileStat: Stats, parent: string, siblingNames: Array<string>) => any;
Enums
Type Aliases
type AfterCopyFileTransformer
type AfterCopyFileTransformer = (file: string) => Promise<boolean>;
type ArchType
type ArchType = 'x64' | 'ia32' | 'armv7l' | 'arm64' | 'universal';
type FileTransformer
type FileTransformer = ( file: string) => | Promise<null | string | Buffer | CopyFileTransformer> | null | string | Buffer | CopyFileTransformer;
type Filter
type Filter = (file: string, stat: Stats) => boolean;
type LogLevel
type LogLevel = 'info' | 'warn' | 'debug' | 'notice' | 'error';
Package Files (10)
Dependencies (16)
Dev Dependencies (5)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/builder-util
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/builder-util)
- HTML<a href="https://www.jsdocs.io/package/builder-util"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3611 ms. - Missing or incorrect documentation? Open an issue for this package.