oneRepo API: builders
Common and reusable command-line option builders.
Type Aliases
Section titled Type AliasesFileGetterOptions
Section titled FileGetterOptionsType declaration
Section titled Type declarationaffectedThreshold?
Section titled affectedThreshold?Threshold of number of files until we fall-back and swap to Workspace locations. This exists as a safeguard from attempting to pass too many files through to subprocesses and hitting the limit on input argv, resulting in unexpected and unexplainable errors.
Default Value
Section titled Default ValueSource: modules/builders/src/getters.ts
Staged
Section titled StagedType declaration
Section titled Type declarationfrom?
Section titled from?staged
Section titled stagedLimit to only changes that are currently staged. This cannot be used with from
and through
.
through?
Section titled through?Source: modules/builders/src/getters.ts
Through
Section titled ThroughType declaration
Section titled Type declarationfrom?
Section titled from?Git ref to calculate changes exclusively since.
staged?
Section titled staged?through?
Section titled through?Git ref to calculate changes inclusively through.
Source: modules/builders/src/getters.ts
Builders
Section titled BuilderswithAffected()
Section titled withAffected()Adds the following input arguments to command Handler
. Typically used in conjunction with getters like builders.getAffected
, builders.getFilepaths
, and builders.getGetWorkspaces
.
--affected
--from-ref
--through-ref
If all of --all
, --files
, and --workspaces
were not passed, --affected
will default to true
.
See WithAffected
for type safety.
Type parameters:
Type parameter |
---|
T |
Parameters:
Parameter | Type |
---|---|
yargs | Yargs <T > |
Returns: Yargs
<T
& WithAffected
>
Source: modules/builders/src/with-affected.ts
withAllInputs()
Section titled withAllInputs()Helper to chain all of builders.withAffected
, builders.withFiles
, and builders.withWorkspaces
on a Builder
.
Parameters:
Parameter | Type |
---|---|
yargs | Yargs <DefaultArgv > |
Returns: Yargs
<WithAllInputs
>
Source: modules/builders/src/with-all-inputs.ts
withFiles()
Section titled withFiles()Adds the following input arguments to command Handler
. Typically used in conjunction with getters like builders.getFilepaths
.
--files
See WithFiles
for type safety.
Type parameters:
Type parameter |
---|
T |
Parameters:
Parameter | Type |
---|---|
yargs | Yargs <T > |
Returns: Yargs
<T
& WithFiles
>
Source: modules/builders/src/with-files.ts
withWorkspaces()
Section titled withWorkspaces()Adds the following input arguments to command Handler
. Typically used in conjunction with getters like builders.getAffected
builders.getWorkspaces
.
--all
--workspaces
See builders.WithWorkspaces
for type safety.
Type parameters:
Type parameter |
---|
T |
Parameters:
Parameter | Type |
---|---|
yargs | Yargs <T > |
Returns: Yargs
<T
& WithWorkspaces
>
Source: modules/builders/src/with-workspaces.ts
WithAffected
Section titled WithAffectedTo be paired with the builders.withAffected
. Adds types for arguments parsed.
Type declaration
Section titled Type declarationaffected?
Section titled affected?When used with builder helpers, will include all of the affected Workspaces based on changes within the repository.
from-ref?
Section titled from-ref?Git ref to calculate changes exclusively since.
staged?
Section titled staged?Calculate changes based inclusively on the files added to the git stage.
through-ref?
Section titled through-ref?Git ref to calculate changes inclusively through.
Source: modules/builders/src/with-affected.ts
WithAllInputs
Section titled WithAllInputsHelper to include all of builders.withAffected
, builders.withFiles
, and builders.withWorkspaces
on builder Argv
.
Source: modules/builders/src/with-all-inputs.ts
WithFiles
Section titled WithFilesTo be paired with the builders.withFiles
. Adds types for arguments parsed.
Type declaration
Section titled Type declarationfiles?
Section titled files?List of filepaths.
Source: modules/builders/src/with-files.ts
WithWorkspaces
Section titled WithWorkspacesTo be paired with the builders.withWorkspaces
. Adds types for arguments parsed.
Type declaration
Section titled Type declarationInclude all Workspaces.
workspaces?
Section titled workspaces?One or more Workspaces by name
or alias
string.
Source: modules/builders/src/with-workspaces.ts
Getters
Section titled GettersgetAffected()
Section titled getAffected()Get a list of the affected Workspaces.
Typically, this should be used from the helpers provided by the command Handler
, in which case the first argument has been scoped for you already.
If the root Workspace is included in the list, all Workspaces will be presumed affected and returned.
Parameters:
Parameter | Type |
---|---|
graph | Graph |
__namedParameters ? | GetterOptions |
Returns: Promise
<Workspace
[]>
Source: modules/builders/src/getters.ts
getFilepaths()
Section titled getFilepaths()Get a list of filepaths based on the input arguments made available with the builders builders.withAffected
, builders.withAllInputs
, builders.withFiles
, and builders.withWorkspaces
.
When providing --workspaces <names>
, the paths will be paths to the requested Workspaces, not individual files.
Typically, this should be used from the helpers provided by the command handler’s HandlerExtra
, in which case the first argument has been scoped for you already.
When using this function to get affected filenames, a soft threshold is provided at 100 files. This is a safeguard against overloading subprocess run
arguments. When the threshold is hit, this function will swap to return the set of parent Workspace locations for the affected file lists.
Parameters:
Parameter | Type |
---|---|
graph | Graph |
argv | WithAllInputs |
__namedParameters ? | FileGetterOptions |
Returns: Promise
<string
[]>
See also:
!HandlerExtra
Source: modules/builders/src/getters.ts
getWorkspaces()
Section titled getWorkspaces()Get a list of Workspaces based on the input arguments made available with the builders builders.withAffected
, builders.withAllInputs
, builders.withFiles
, and builders.withWorkspaces
.
Typically, this should be used from the helpers provided by the command Handler
, in which case the first argument has been scoped for you already.
If the root Workspace is included in the list, all Workspaces will be presumed affected and returned.
Parameters:
Parameter | Type |
---|---|
graph | Graph |
argv | WithAllInputs |
__namedParameters ? | GetterOptions |
Returns: Promise
<Workspace
[]>
Source: modules/builders/src/getters.ts
Source: modules/builders/src/getters.ts
GetterOptions
Section titled GetterOptionsType declaration
Section titled Type declarationignore?
Section titled ignore?List of files to not take into account when getting the list of files, workspaces, and affected.
step?
Section titled step?Optional logger step to avoid creating a new
Source: modules/builders/src/getters.ts