oneRepo API
Variables
Section titled VariablesdefaultConfig
Section titled defaultConfigDefined in: modules/onerepo/src/setup/setup.ts
Commands
Section titled CommandsArgv<CommandArgv>
Section titled Argv<CommandArgv>Helper for combining local parsed arguments along with the default arguments provided by the oneRepo command module.
Type Parameters
Section titled Type ParametersType Parameter | Default type | Description |
---|---|---|
CommandArgv | object | Arguments that will be parsed for this command, always a union with `DefaultArgv` and `PositionalArgv`. |
Defined in: modules/yargs/src/yargs.ts
Builder()<CommandArgv>
Section titled Builder()<CommandArgv>Option argument parser for the given command. See Yargs .command(module)
for more, but note that only the object variant is not accepted – only function variants will be accepted in oneRepo commands.
For common arguments that work in conjunction with `HandlerExtra` methods like getAffected()
, you can use helpers from the `builders` namespace, like `builders.withAffected()`.
Type Parameters
Section titled Type ParametersType Parameter | Default type | Description |
---|---|---|
CommandArgv | object | Arguments that will be parsed for this command |
Parameters:
Parameter | Type | Description |
---|---|---|
yargs | Yargs | The Yargs instance. See Yargs .command(module) |
Returns: Yargv
<CommandArgv
>
See also:
- Yargs
.command(module)
for general usage. - Common extensions via the `builders` namespace.
Defined in: modules/yargs/src/yargs.ts
DefaultArgv
Section titled DefaultArgvDefault arguments provided globally for all commands. These arguments are included by when using `Builder` and `Handler`.
Type declaration
Section titled Type declarationdry-run
Section titled dry-runWhether the command should run non-destructive dry-mode. This prevents all subprocesses, files, and git operations from running unless explicitly specified as safe to run.
Also internally sets process.env.ONEREPO_DRY_RUN = 'true'
.
Default: false
quiet
Section titled quietSilence all logger output. Prevents all stdout and stderr output from the logger entirely.
Default: false
skip-engine-check
Section titled skip-engine-checkSkip the engines check. When false
, oneRepo will the current process’s node version with the range for engines.node
as defined in package.json
. If not defined in the root package.json
, this will be skipped.
Default: false
verbosity
Section titled verbosityVerbosity level for the Logger. See Logger.verbosity for more information.
Default: 3
Defined in: modules/yargs/src/yargs.ts
Handler()<CommandArgv>
Section titled Handler()<CommandArgv>Command handler that includes oneRepo tools like graph
, logger
, and more. This function is type-safe if Argv
is correctly passed through to the type definition.
Type Parameters
Section titled Type ParametersType Parameter | Default type | Description |
---|---|---|
CommandArgv | object | Arguments that will be parsed for this command. DefaultArguments will be automatically merged into this object for use within the handler. |
Parameters:
Parameter | Type |
---|---|
argv | Argv <CommandArgv > |
extra | HandlerExtra |
Returns: Promise
<void
>
See also:
- Yargs
.command(module)
for general usage. - `HandlerExtra` for extended extra arguments provided above and beyond the scope of Yargs.
Defined in: modules/yargs/src/yargs.ts
HandlerExtra
Section titled HandlerExtraCommands in oneRepo extend beyond what Yargs is able to provide by adding a second argument to the handler.
All extras are available as the second argument on your `Handler`
Overriding the affected threshold in getFilepaths
Type declaration
Section titled Type declarationconfig
Section titled configThis repository’s oneRepo config, resolved with all defaults.
getAffected()
Section titled getAffected()Get the affected Workspaces based on the current state of the repository.
This is a wrapped implementation of `builders.getAffected` that does not require passing the graph
argument.
Parameters:
Parameter | Type |
---|---|
opts ? | GetterOptions |
Returns: Promise
<Workspace
[]>
getFilepaths()
Section titled getFilepaths()Get the affected filepaths based on the current inputs and state of the repository. Respects manual inputs provided by `builders.withFiles` if provided.
This is a wrapped implementation of `builders.getFilepaths` that does not require the graph
and argv
arguments.
Note: that when used with --affected
, there is a default limit of 100 files before this will switch to returning affected Workspace paths. Use affectedThreshold: 0
to disable the limit.
Parameters:
Parameter | Type |
---|---|
opts ? | FileGetterOptions |
Returns: Promise
<string
[]>
getWorkspaces()
Section titled getWorkspaces()Get the affected Workspaces based on the current inputs and the state of the repository.
This function differs from getAffected
in that it respects all input arguments provided by
`builders.withWorkspaces`, `builders.withFiles` and `builders.withAffected`.
This is a wrapped implementation of `builders.getWorkspaces` that does not require the graph
and argv
arguments.
Parameters:
Parameter | Type |
---|---|
opts ? | GetterOptions |
Returns: Promise
<Workspace
[]>
graph
Section titled graphThe full monorepo `Graph`.
logger
Section titled loggerStandard `Logger`. This should always be used in place of console.log
methods unless you have
a specific need to write to standard out differently.
Defined in: modules/yargs/src/yargs.ts
PositionalArgv
Section titled PositionalArgvAlways present in Builder and Handler arguments as parsed by Yargs.
Type declaration
Section titled Type declarationPositionals / non-option arguments. These will only be filled if you include .positional()
or .strictCommands(false)
in your Builder
.
—
Any content that comes after ” — ” gets populated here. These are useful for spreading through to spawned run
functions that may take extra options that you don’t want to enumerate and validate.
The script name or node command. Similar to process.argv[1]
Defined in: modules/yargs/src/yargs.ts
Config
Section titled ConfigConfig<CustomLifecycles>
Section titled Config<CustomLifecycles>Picks the correct config type between RootConfig
and WorkspaceConfig
based on whether the root
property is set. Use this to help ensure your configs do not have any incorrect keys or values.
Satisfy a RootConfig
:
Satisfy a WorkspaceConfig
with custom lifecycles on tasks:
Type Parameters
Section titled Type ParametersType Parameter | Default type |
---|---|
CustomLifecycles extends string | void | void |
Defined in: modules/onerepo/src/types/index.ts
Lifecycle
Section titled LifecycleoneRepo comes with a pre-configured list of common lifecycles for grouping tasks.
Defined in: modules/onerepo/src/types/tasks.ts
RootConfig<CustomLifecycles>
Section titled RootConfig<CustomLifecycles>Setup configuration for the root of the repository.
Type Parameters
Section titled Type ParametersType Parameter | Default type |
---|---|
CustomLifecycles extends string | void | void |
Type declaration
Section titled Type declarationchanges?
Section titled changes?Type declaration
Section titled Type declarationchanges.filenames?
Section titled changes.filenames?Default: 'hash'
To generate human-readable unique filenames for change files, ensure human-id is installed.
changes.formatting?
Section titled changes.formatting?Type declaration
Section titled Type declarationDefault: {}
Override some formatting strings in generated changelog files.
changes.formatting.commit?
Section titled changes.formatting.commit?Default: '(${ref.short})'
Format how the commit ref will appear at the end of the first line of each change entry.
Available replacement strings:
Replacement | Description |
---|---|
${ref.short} | 8-character version of the commit ref |
${ref} | Full commit ref |
changes.formatting.footer?
Section titled changes.formatting.footer?Default: '_View git logs for full change list._'
Format the footer at the end of each version in the generated changelog files.
Available replacement strings:
Replacement | Description |
---|---|
${fromRef.short} | 8-character version of the first commit ref in the version |
${fromRef} | Full commit ref of the first commit in the version |
${through.short} | 8-character version of the last commit ref in the version |
${through} | Full commit ref of the last commit in the version |
${version} | New version string |
changes.prompts?
Section titled changes.prompts?Default: 'guided'
Change the prompt question & answer style when adding change entries.
'guided'
: Gives more detailed explanations when release types.'semver'
: A simple choice list of semver release types.
codeowners?
Section titled codeowners?Default: {}
Map of paths to array of owners.
When used with the codeowners
commands, this configuration enables syncing configurations from Workspaces to the appropriate root level CODEOWNERS file given your vcsProvider
as well as verifying that the root file is up to date.
commands?
Section titled commands?Configuration for custom commands.
Type declaration
Section titled Type declarationcommands.directory?
Section titled commands.directory?Default: 'commands'
A string to use as filepaths to subcommands. We’ll look for commands in all Workspaces using this string. If any are found, they’ll be available from the CLI.
Given the preceding configuration, commands will be searched for within the commands/
directory at the root of the repository as well as a directory of the same name at the root of each Workspace:
<root>/commands/*
<root>/<workspaces>/commands/*
commands.ignore?
Section titled commands.ignore?Default: /(/__\w+__/|\.test\.|\.spec\.|\.config\.)/
Prevent reading matched files in the commands.directory
as commands.
When writing custom commands and Workspace-level subcommands, we may need to ignore certain files like tests, fixtures, and other helpers. Use a regular expression here to configure which files will be ignored when oneRepo parses and executes commands.
dependencies?
Section titled dependencies?Type declaration
Section titled Type declarationdependencies.dedupe?
Section titled dependencies.dedupe?Default: true
When modifying dependencies using the one dependencies
command, a dedupe
will automatically be run to reduce duplicate package versions that overlap the requested ranges. Set this to false
to disable this behavior.
dependencies.mode?
Section titled dependencies.mode?Default: 'loose'
The dependency mode will be used for node module dependency management and verification.
off
: No validation will occur. Everything goes.loose
: Reused third-party dependencies will be required to have semantic version overlap across unique branches of the Graph.strict
: Versions of all dependencies across each discrete Workspace dependency tree must be strictly equal.
head?
Section titled head?Default: 'main'
The default branch of your repo? Probably main
, but it might be something else, so it’s helpful to put that here so that we can determine changed files accurately.
ignore?
Section titled ignore?Default: []
Array of fileglobs to ignore when calculating the changed Workspaces.
Periodically we may find that there are certain files or types of files that we know for a fact do not affect the validity of the repository or any code. When this happens and the files are modified, unnecessary tasks and processes will be spun up that don’t have any bearing on the outcome of the change.
To avoid extra processing, we can add file globs to ignore when calculated the afected Workspace graph.
meta?
Section titled meta?Default: {}
A place to put any custom information or configuration. A helpful space for you to extend Workspace configurations for your own custom commands.
plugins?
Section titled plugins?Default: []
Add shared commands and extra handlers. See the official plugin list for more information.
Must be set to true
in order to denote that this is the root of the repository.
taskConfig?
Section titled taskConfig?Optional extra configuration for tasks
.
Type declaration
Section titled Type declarationtaskConfig.lifecycles?
Section titled taskConfig.lifecycles?Default: []
Additional task
lifecycles to make available.
See `Lifecycle` for a list of pre-configured lifecycles.
taskConfig.stashUnstaged?
Section titled taskConfig.stashUnstaged?Default: ['pre-commit']
Stash unstaged changes before running these tasks and re-apply them after the task has completed.
tasks?
Section titled tasks?Default: {}
Globally defined tasks per lifecycle. Tasks defined here will be assumed to run for all changes, regardless of affected Workspaces. Refer to the tasks
command specifications for details and examples.
templateDir?
Section titled templateDir?Default: './config/templates'
Folder path for generate
command’s templates.
validation?
Section titled validation?Type declaration
Section titled Type declarationvalidation.schema?
Section titled validation.schema?Default: undefined
File path for custom Graph and configuration file validation schema.
Version control system settings.
Type declaration
Section titled Type declarationvcs.autoSyncHooks?
Section titled vcs.autoSyncHooks?Default: false
Automatically set and sync oneRepo-managed git hooks. Change the directory for your git hooks with the vcs.hooksPath
setting. Refer to the Git hooks documentation to learn more.
vcs.hooksPath?
Section titled vcs.hooksPath?Default: '.hooks'
Modify the default git hooks path for the repository. This will automatically be synchronized via one hooks sync
unless explicitly disabled by setting vcs.autoSyncHooks
to false
.
vcs.provider?
Section titled vcs.provider?Default: 'github'
The provider will be factored in to various commands, like CODEOWNERS
generation.
visualizationUrl?
Section titled visualizationUrl?Default: 'https://onerepo.tools/visualize/'
Override the URL used to visualize the Graph. The Graph data will be attached the the g
query parameter as a JSON string of the DAG, compressed using zLib deflate.
Defined in: modules/onerepo/src/types/config-root.ts
A Task can either be a string or `TaskDef` object with extra options, or an array of strings. If provided as an array of strings, each command will be run sequentially, waiting for the previous to succeed. If one command fails, the rest in the sequence will not be run.
To run sequences of commands with match
and meta
information, you can pass an array of strings to the cmd
property of a `TaskDef`.
Defined in: modules/onerepo/src/types/tasks.ts
TaskConfig<CustomLifecycles>
Section titled TaskConfig<CustomLifecycles>Type Parameters
Section titled Type ParametersType Parameter | Default type |
---|---|
CustomLifecycles extends string | void | void |
Defined in: modules/onerepo/src/types/tasks.ts
TaskDef
Section titled TaskDefTasks can optionally include meta information or only be run if the configured match
glob string matches the modified files. If no files match, the individual task will not be run.
Type declaration
Section titled Type declarationString command(s) to run. If provided as an array of strings, each command will be run sequentially, waiting for the previous to succeed. If one command fails, the rest in the sequence will not be run.
The commands can use replaced tokens:
$0
: the oneRepo CLI for your repository${workspaces}
: replaced with a space-separated list of Workspace names necessary for the given lifecycle
match?
Section titled match?Glob file match. This will force the cmd
to run if any of the paths in the modified files list match the glob. Conversely, if no files are matched, the cmd
will not run.
meta?
Section titled meta?Extra information that will be provided only when listing tasks with the --list
option from the tasks
command. This object is helpful when creating a matrix of runners with GitHub actions or similar CI pipelines.
Defined in: modules/onerepo/src/types/tasks.ts
Tasks
Section titled TasksIndividual `Task`s in any `Lifecycle` may be grouped to run either serial (one after the other) or in parallel (multiple at the same time).
Type declaration
Section titled Type declarationparallel?
Section titled parallel?serial?
Section titled serial?Defined in: modules/onerepo/src/types/tasks.ts
WorkspaceConfig<CustomLifecycles>
Section titled WorkspaceConfig<CustomLifecycles>Type Parameters
Section titled Type ParametersType Parameter | Default type |
---|---|
CustomLifecycles extends string | void | void |
Type declaration
Section titled Type declarationcodeowners?
Section titled codeowners?Default: {}
.
Map of paths to array of owners.
When used with the codeowners
commands, this configuration enables syncing configurations from Workspaces to the appropriate root level CODEOWNERS file given your RootConfig.vcs.provider
as well as verifying that the root file is up to date.
commands?
Section titled commands?Configuration for custom commands. To configure the commands directory, see RootConfig
commands.directory
.
Type declaration
Section titled Type declarationcommands.passthrough
Section titled commands.passthroughDefault: {}
Enable commands from installed dependencies. Similar to running npx <command>
, but pulled into the oneRepo CLI and able to be limited by Workspace. Passthrough commands must have helpful descriptions.
meta?
Section titled meta?Default: {}
A place to put any custom information or configuration. A helpful space for you to extend Workspace configurations for your own custom commands.
tasks?
Section titled tasks?Default: {}
Tasks for this Workspace. These will be merged with global tasks and any other affected Workspace tasks. Refer to the tasks
command specifications for details and examples.
Defined in: modules/onerepo/src/types/config-workspace.ts
Graph
Section titled GraphgetGraph()
Section titled getGraph()Get the `Graph` given a particular root working directory. If the working directory is not a monorepo’s root, an empty Graph
will be given in its place.
Parameters:
Parameter | Type |
---|---|
workingDir ? | string |
Returns: Graph
Defined in: modules/graph/src/index.ts
Graph
Section titled GraphThe oneRepo Graph is a representation of the entire repository’s `Workspaces` and how they depend upon each other. Most commonly, you will want to use the Graph to get lists of Workspaces that either depend on some input or are dependencies thereof:
The Graph
also includes various helpers for determining workspaces based on filepaths, name, and other factors.
Accessors
Section titled AccessorspackageManager
Section titled packageManagerGet Signature
Section titled Get SignatureGet the PackageManager that this Graph depends on. This object allows you to run many common package management commands safely, agnostic of any particular flavor of package management. Works with npm, Yarn, and pnpm.
Returns: PackageManager
Defined in: modules/graph/src/Graph.ts
Get Signature
Section titled Get SignatureThis returns the `Workspace` that is at the root of the repository.
Regardless of how the workspaces
are configured with the package manager, the root package.json
is always registered as a Workspace.
Returns: Workspace
Defined in: modules/graph/src/Graph.ts
workspaces
Section titled workspacesGet Signature
Section titled Get SignatureGet a list of all `Workspaces` that are part of the repository {@Link Graph | Graph
}.
Returns: Workspace
[]
Defined in: modules/graph/src/Graph.ts
Methods
Section titled Methodsaffected()
Section titled affected()Get a list of `Workspaces` that will be affected by the given source(s). This is equivalent to graph.dependents(sources, true)
. See also `dependents`.
Type Parameters
Section titled Type ParametersType Parameter |
---|
T extends string | Workspace |
Parameters:
Parameter | Type | Description |
---|---|---|
source | T | T [] | - |
type ? | DepType | Filter the dependents to a dependency type. |
Returns: Workspace
[]
Defined in: modules/graph/src/Graph.ts
dependencies()
Section titled dependencies()Get all dependency `Workspaces` of one or more input Workspaces or qualified names of Workspaces. This not only returns the direct dependencies, but all dependencies throughout the entire `Graph`. This returns the opposite result of `dependents`.
Type Parameters
Section titled Type ParametersType Parameter |
---|
T extends string | Workspace |
Parameters:
Parameter | Type | Description |
---|---|---|
sources ? | T | T [] | A list of `Workspaces` by `name`s or any available `aliases`. |
includeSelf ? | boolean | Whether to include the Workspaces for the input sources in the return array. |
type ? | DepType | Filter the dependencies to a dependency type. |
Returns: Workspace
[]
Defined in: modules/graph/src/Graph.ts
dependents()
Section titled dependents()Get all dependent `Workspaces` of one or more input Workspaces or qualified names of Workspaces. This not only returns the direct dependents, but all dependents throughout the entire `Graph`. This returns the opposite result of `dependencies`.
Type Parameters
Section titled Type ParametersType Parameter |
---|
T extends string | Workspace |
Parameters:
Parameter | Type | Description |
---|---|---|
sources ? | T | T [] | One or more Workspaces by name or Workspace instance |
includeSelf ? | boolean | Whether to include the Workspaces for the input sources in the return array. |
type ? | DepType | Filter the dependents to a dependency type. |
Returns: Workspace
[]
Defined in: modules/graph/src/Graph.ts
getAllByLocation()
Section titled getAllByLocation()Get all Workspaces given an array of filepaths.
Parameters:
Parameter | Type | Description |
---|---|---|
locations | string [] | A list of filepath strings. May be file URLs or string paths. |
Returns: Workspace
[]
Defined in: modules/graph/src/Graph.ts
getAllByName()
Section titled getAllByName()Get a list of `Workspaces` by string names.
Parameters:
Parameter | Type | Description |
---|---|---|
names | string [] | A list of Workspace `name`s or any available `aliases`. |
Returns: Workspace
[]
Defined in: modules/graph/src/Graph.ts
getByLocation()
Section titled getByLocation()Get the equivalent `Workspace` for a filepath. This can be any location within a Workspace
, not just its root.
Parameters:
Parameter | Type | Description |
---|---|---|
location | string | A string or URL-based filepath. |
Returns: Workspace
Throws
Section titled ThrowsError
if no Workspace can be found.
Defined in: modules/graph/src/Graph.ts
getByName()
Section titled getByName()Get a `Workspace` by string name.
Parameters:
Parameter | Type | Description |
---|---|---|
name | string | A Workspace’s `name` or any available `aliases`. |
Returns: Workspace
Throws
Section titled ThrowsError
if no Workspace exists with the given input name
.
Defined in: modules/graph/src/Graph.ts
Workspace
Section titled WorkspaceAccessors
Section titled Accessorsaliases
Section titled aliasesGet Signature
Section titled Get SignatureAllow custom array of aliases. If the fully qualified package name is scoped, this will include the un-scoped name
Returns: string
[]
Defined in: modules/graph/src/Workspace.ts
codeowners
Section titled codeownersGet Signature
Section titled Get SignatureReturns: Required
<Record
<string
, string
[]>>
Defined in: modules/graph/src/Workspace.ts
config
Section titled configGet Signature
Section titled Get SignatureGet the Workspace’s configuration
Returns: Required
<RootConfig
| WorkspaceConfig
>
Defined in: modules/graph/src/Workspace.ts
dependencies
Section titled dependenciesGet Signature
Section titled Get SignatureGet the package.json
defined production dependencies for the Workspace.
Returns: Record
<string
, string
>
Map of modules to their version.
Defined in: modules/graph/src/Workspace.ts
description
Section titled descriptionGet Signature
Section titled Get SignatureCanonical to the package.json
"description"
field.
Returns: undefined
| string
Defined in: modules/graph/src/Workspace.ts
devDependencies
Section titled devDependenciesGet Signature
Section titled Get SignatureGet the package.json
defined development dependencies for the Workspace.
Returns: Record
<string
, string
>
Map of modules to their version.
Defined in: modules/graph/src/Workspace.ts
isRoot
Section titled isRootGet Signature
Section titled Get SignatureWhether or not this Workspace is the root of the repository / Graph.
Returns: boolean
Defined in: modules/graph/src/Workspace.ts
location
Section titled locationGet Signature
Section titled Get SignatureAbsolute path on the current filesystem to the Workspace.
Returns: string
Defined in: modules/graph/src/Workspace.ts
Get Signature
Section titled Get SignatureReturns: string
Defined in: modules/graph/src/Workspace.ts
Get Signature
Section titled Get SignatureThe full name
of the Workspace, as defined in its package.json
Returns: string
Defined in: modules/graph/src/Workspace.ts
packageJson
Section titled packageJsonGet Signature
Section titled Get SignatureA full deep copy of the package.json
file for the Workspace. Modifications to this object will not be preserved on the Workspace.
Returns: PackageJson
Defined in: modules/graph/src/Workspace.ts
peerDependencies
Section titled peerDependenciesGet Signature
Section titled Get SignatureGet the package.json
defined peer dependencies for the Workspace.
Returns: Record
<string
, string
>
Map of modules to their version.
Defined in: modules/graph/src/Workspace.ts
private
Section titled privateGet Signature
Section titled Get SignatureIf a Workspace package.json
is set to private: true
, it will not be available to publish through NPM or other package management registries.
Returns: boolean
Defined in: modules/graph/src/Workspace.ts
publishablePackageJson
Section titled publishablePackageJsonGet Signature
Section titled Get SignatureGet a version of the Workspace’s package.json
that is meant for publishing.
This strips off devDependencies
and applies appropriate `publishConfig` values to the root of the package.json
. This feature enables your monorepo to use source-dependencies and avoid manually building shared Workspaces for every change in order to see them take affect in dependent Workspaces.
To take advantage of this, configure your package.json
root level to point to source files and the publishConfig
entries to point to the build location of those entrypoints.
Returns: null
| PublicPackageJson
Defined in: modules/graph/src/Workspace.ts
scope
Section titled scopeGet Signature
Section titled Get SignatureGet module name scope if there is one, eg @onerepo
Returns: string
Defined in: modules/graph/src/Workspace.ts
tasks
Section titled tasksGet Signature
Section titled Get SignatureGet the task configuration as defined in the onerepo.config.js
file at the root of the Workspace.
Returns: Partial
<Record
<Lifecycle
, Tasks
>>
If a config does not exist, an empty object will be given.
Defined in: modules/graph/src/Workspace.ts
version
Section titled versionGet Signature
Section titled Get SignatureReturns: undefined
| string
Defined in: modules/graph/src/Workspace.ts
Methods
Section titled MethodsgetCodeowners()
Section titled getCodeowners()Parameters:
Parameter | Type |
---|---|
filepath | string |
Returns: string
[]
Defined in: modules/graph/src/Workspace.ts
getTasks()
Section titled getTasks()Get a list of Workspace tasks for the given lifecycle
Parameters:
Parameter | Type |
---|---|
lifecycle | string |
Returns: Required
<Tasks
>
Defined in: modules/graph/src/Workspace.ts
relative()
Section titled relative()Get the relative path of an absolute path to the Workspace’s location root
Parameters:
Parameter | Type | Description |
---|---|---|
to | string | Absolute filepath |
Returns: string
Relative path to the workspace’s root location.
Defined in: modules/graph/src/Workspace.ts
resolve()
Section titled resolve()Resolve a full filepath within the Workspace given the path segments. Similar to Node.js’s path.resolve().
Parameters:
Parameter | Type | Description |
---|---|---|
…pathSegments | string [] | A sequence of paths or path segments |
Returns: string
Absolute path based on the input path segments
Defined in: modules/graph/src/Workspace.ts
DependencyType
Section titled DependencyTypeType declaration
Section titled Type declarationDevelopment-only dependency (defined in devDependencies
keys of package.json
)
Peer dependency (defined in peerDependencies
key of package.json
)
Production dependency (defined in dependencies
of package.json
)
Defined in: modules/graph/src/Graph.ts
DepType
Section titled DepTypeDependency type value.
See also: `DependencyType`
Defined in: modules/graph/src/Graph.ts
GraphSchemaValidators
Section titled GraphSchemaValidatorsDefinition for graph verify
JSON schema validators.
See “Validating configurations” for more examples and use cases.
Defined in: modules/onerepo/src/core/graph/schema.ts
Logger
Section titled LoggerbufferSubLogger()
Section titled bufferSubLogger()Alpha
Create a new Logger instance that has its output buffered up to a LogStep.
Parameters:
Parameter | Type |
---|---|
step | LogStep |
Returns: ```ts
{
end: () => Promise
Returns: Promise
<void
>
logger
Section titled loggerDefined in: modules/logger/src/index.ts
getLogger()
Section titled getLogger()This gets the logger singleton for use across all of oneRepo and its commands.
Available directly as `HandlerExtra` on `Handler` functions:
Parameters:
Parameter | Type |
---|---|
opts ? | Partial <LoggerOptions > |
Returns: Logger
Defined in: modules/logger/src/index.ts
stepWrapper()
Section titled stepWrapper()For cases where multiple processes need to be completed, but should be joined under a single `LogStep` to avoid too much noisy output, this safely wraps an asynchronous function and handles step creation and completion, unless a step
override is given.
Type Parameters
Section titled Type ParametersType Parameter |
---|
T |
Parameters:
Parameter | Type |
---|---|
options | { name : string ; step : LogStep ; } |
options.name | string |
options.step ? | LogStep |
fn | (step ) => Promise <T > |
Returns: Promise
<T
>
Defined in: modules/logger/src/index.ts
Logger
Section titled LoggerThe oneRepo logger helps build commands and capture output from spawned subprocess in a way that’s both delightful to the end user and includes easy to scan and follow output.
All output will be redirected from stdout
to stderr
to ensure order of output and prevent confusion of what output can be piped and written to files.
If the current terminal is a TTY, output will be buffered and asynchronous steps will animated with a progress logger.
See `HandlerExtra` for access the the global Logger instance.
Accessors
Section titled AccessorshasError
Section titled hasErrorGet Signature
Section titled Get SignatureWhether or not an error has been sent to the logger or any of its steps. This is not necessarily indicative of uncaught thrown errors, but solely on whether .error()
has been called in the Logger
or any Step
instance.
Returns: boolean
Defined in: modules/logger/src/Logger.ts
hasInfo
Section titled hasInfoGet Signature
Section titled Get SignatureWhether or not an info message has been sent to the logger or any of its steps.
Returns: boolean
Defined in: modules/logger/src/Logger.ts
hasLog
Section titled hasLogGet Signature
Section titled Get SignatureWhether or not a log message has been sent to the logger or any of its steps.
Returns: boolean
Defined in: modules/logger/src/Logger.ts
hasWarning
Section titled hasWarningGet Signature
Section titled Get SignatureWhether or not a warning has been sent to the logger or any of its steps.
Returns: boolean
Defined in: modules/logger/src/Logger.ts
verbosity
Section titled verbosityGet Signature
Section titled Get SignatureGet the logger’s verbosity level
Returns: Verbosity
Set Signature
Section titled Set SignatureRecursively applies the new verbosity to the logger and all of its active steps.
Parameters:
Parameter | Type |
---|---|
value | Verbosity |
Returns: void
Defined in: modules/logger/src/Logger.ts
writable
Section titled writableGet Signature
Section titled Get SignatureReturns: boolean
Defined in: modules/logger/src/Logger.ts
Methods
Section titled MethodscreateStep()
Section titled createStep()Create a sub-step, `LogStep`, for the logger. This and any other step will be tracked and required to finish before exit.
Parameters:
Parameter | Type | Description |
---|---|---|
name | string | The name to be written and wrapped around any output logged to this new step. |
__namedParameters ? | { writePrefixes : boolean ; } | - |
__namedParameters.writePrefixes ? | boolean | - |
Returns: LogStep
Defined in: modules/logger/src/Logger.ts
pause()
Section titled pause()When the terminal is a TTY, steps are automatically animated with a progress indicator. There are times when it’s necessary to stop this animation, like when needing to capture user input from stdin
. Call the pause()
method before requesting input and `logger.unpause()` when complete.
This process is also automated by the `run()` function when stdio
is set to pipe
.
Parameters:
Parameter | Type |
---|---|
write ? | boolean |
Returns: void
Defined in: modules/logger/src/Logger.ts
unpause()
Section titled unpause()Unpause the logger and resume writing buffered logs to stderr
. See `logger.pause()` for more information.
Returns: void
Defined in: modules/logger/src/Logger.ts
Logging
Section titled Loggingdebug()
Section titled debug()Extra debug logging when verbosity greater than or equal to 4.
If a function with zero arguments is passed, the function will be executed before writing. This is helpful for avoiding extra work in the event that the verbosity is not actually high enough to render the logged debug information:
Parameters:
Parameter | Type | Description |
---|---|---|
contents | unknown | Any value that can be converted to a string for writing to stderr . |
Returns: void
See also:
`debug()` This is a pass-through for the main step’s `debug()` method.
Defined in: modules/logger/src/Logger.ts
error()
Section titled error()Log an error. This will cause the root logger to include an error and fail a command.
If a function with zero arguments is passed, the function will be executed before writing. This is helpful for avoiding extra work in the event that the verbosity is not actually high enough to render the logged error:
Parameters:
Parameter | Type | Description |
---|---|---|
contents | unknown | Any value that can be converted to a string for writing to stderr . |
Returns: void
See also:
`error()` This is a pass-through for the main step’s `error()` method.
Defined in: modules/logger/src/Logger.ts
info()
Section titled info()Should be used to convey information or instructions through the log, will log when verbositu >= 1
If a function with zero arguments is passed, the function will be executed before writing. This is helpful for avoiding extra work in the event that the verbosity is not actually high enough to render the logged information:
Parameters:
Parameter | Type | Description |
---|---|---|
contents | unknown | Any value that can be converted to a string for writing to stderr . |
Returns: void
See also:
`info()` This is a pass-through for the main step’s `info()` method.
Defined in: modules/logger/src/Logger.ts
log()
Section titled log()General logging information. Useful for light informative debugging. Recommended to use sparingly.
If a function with zero arguments is passed, the function will be executed before writing. This is helpful for avoiding extra work in the event that the verbosity is not actually high enough to render the logged information:
Parameters:
Parameter | Type | Description |
---|---|---|
contents | unknown | Any value that can be converted to a string for writing to stderr . |
Returns: void
See also:
`log()` This is a pass-through for the main step’s `log()` method.
Defined in: modules/logger/src/Logger.ts
timing()
Section titled timing()Log timing information between two Node.js performance mark names.
Parameters:
Parameter | Type | Description |
---|---|---|
start | string | A PerformanceMark entry name |
end | string | A PerformanceMark entry name |
Returns: void
See also:
`timing()` This is a pass-through for the main step’s `timing()` method.
Defined in: modules/logger/src/Logger.ts
warn()
Section titled warn()Log a warning. Does not have any effect on the command run, but will be called out.
If a function with zero arguments is passed, the function will be executed before writing. This is helpful for avoiding extra work in the event that the verbosity is not actually high enough to render the logged warning:
Parameters:
Parameter | Type | Description |
---|---|---|
contents | unknown | Any value that can be converted to a string for writing to stderr . |
Returns: void
See also:
`warn()` This is a pass-through for the main step’s `warn()` method.
Defined in: modules/logger/src/Logger.ts
LogStep
Section titled LogStepLog steps should only be created via the `logger.createStep()` method.
Properties
Section titled PropertiesProperty | Type | Description | Defined in |
---|---|---|---|
hasError | boolean | Whether or not an error has been sent to the step. This is not necessarily indicative of uncaught thrown errors, but solely on whether .error() has been called in this step. | modules/logger/src/LogStep.ts |
hasInfo | boolean | Whether or not an info message has been sent to this step. | modules/logger/src/LogStep.ts |
hasLog | boolean | Whether or not a log message has been sent to this step. | modules/logger/src/LogStep.ts |
hasWarning | boolean | Whether or not a warning has been sent to this step. | modules/logger/src/LogStep.ts |
Methods
Section titled Methodsend()
Section titled end()Finish this step and flush all buffered logs. Once a step is ended, it will no longer accept any logging output and will be effectively removed from the base logger. Consider this method similar to a destructor or teardown.
Returns: Promise
<void
>
Defined in: modules/logger/src/LogStep.ts
Logging
Section titled Loggingdebug()
Section titled debug()Extra debug logging when verbosity greater than or equal to 4.
If a function with zero arguments is passed, the function will be executed before writing. This is helpful for avoiding extra work in the event that the verbosity is not actually high enough to render the logged debug information:
Parameters:
Parameter | Type | Description |
---|---|---|
contents | unknown | Any value that can be converted to a string for writing to stderr . |
Returns: void
Defined in: modules/logger/src/LogStep.ts
error()
Section titled error()Log an error. This will cause the root logger to include an error and fail a command.
If a function with zero arguments is passed, the function will be executed before writing. This is helpful for avoiding extra work in the event that the verbosity is not actually high enough to render the logged error:
Parameters:
Parameter | Type | Description |
---|---|---|
contents | unknown | Any value that can be converted to a string for writing to stderr . |
Returns: void
Defined in: modules/logger/src/LogStep.ts
info()
Section titled info()Log an informative message. Should be used when trying to convey information with a user that is important enough to always be returned.
If a function with zero arguments is passed, the function will be executed before writing. This is helpful for avoiding extra work in the event that the verbosity is not actually high enough to render the logged information:
Parameters:
Parameter | Type | Description |
---|---|---|
contents | unknown | Any value that can be converted to a string for writing to stderr . |
Returns: void
Defined in: modules/logger/src/LogStep.ts
log()
Section titled log()General logging information. Useful for light informative debugging. Recommended to use sparingly.
If a function with zero arguments is passed, the function will be executed before writing. This is helpful for avoiding extra work in the event that the verbosity is not actually high enough to render the logged information:
Parameters:
Parameter | Type | Description |
---|---|---|
contents | unknown | Any value that can be converted to a string for writing to stderr . |
Returns: void
Defined in: modules/logger/src/LogStep.ts
timing()
Section titled timing()Log timing information between two Node.js performance mark names.
Parameters:
Parameter | Type | Description |
---|---|---|
start | string | A PerformanceMark entry name |
end | string | A PerformanceMark entry name |
Returns: void
Defined in: modules/logger/src/LogStep.ts
warn()
Section titled warn()Log a warning. Does not have any effect on the command run, but will be called out.
If a function with zero arguments is passed, the function will be executed before writing. This is helpful for avoiding extra work in the event that the verbosity is not actually high enough to render the logged warning:
Parameters:
Parameter | Type | Description |
---|---|---|
contents | unknown | Any value that can be converted to a string for writing to stderr . |
Returns: void
Defined in: modules/logger/src/LogStep.ts
LoggerOptions
Section titled LoggerOptionsType declaration
Section titled Type declarationstream?
Section titled stream?Advanced – override the writable stream in order to pipe logs elsewhere. Mostly used for dependency injection for @onerepo/test-cli
.
verbosity
Section titled verbosityControl how much and what kind of output the Logger will provide.
Defined in: modules/logger/src/Logger.ts
Verbosity
Section titled VerbosityControl the verbosity of the log output
Value | What | Description |
---|---|---|
<= 0 | Silent | No output will be read or written. |
>= 1 | Error, Info | |
>= 2 | Warnings | |
>= 3 | Log | |
>= 4 | Debug | logger.debug() will be included |
>= 5 | Timing | Extra performance timing metrics will be written |
Defined in: modules/logger/src/Logger.ts
Package management
Section titled Package managementgetLockfile()
Section titled getLockfile()Get the absolute path for the package manager’s lock file for this repository.
Parameters:
Parameter | Type |
---|---|
cwd | string |
Returns: string
| null
Defined in: modules/package-manager/src/get-package-manager.ts
getPackageManager()
Section titled getPackageManager()Get the `PackageManager` for the given package manager type (NPM, PNPm, or Yarn)
Parameters:
Parameter | Type |
---|---|
type | "yarn" | "pnpm" | "npm" |
Returns: PackageManager
Defined in: modules/package-manager/src/index.ts
getPackageManagerName()
Section titled getPackageManagerName()Get the package manager for the current working directory with some confidence
Parameters:
Parameter | Type | Description |
---|---|---|
cwd | string | Current working directory. Should be the root of the module/repository. |
fromPkgJson ? | string | Value as defined in a package.json file, typically the packageManager value |
Returns: "npm"
| "pnpm"
| "yarn"
Defined in: modules/package-manager/src/get-package-manager.ts
PackageManager
Section titled PackageManagerImplementation details for all package managers. This interface defines a subset of common methods typically needed when interacting with a monorepo and its dependency `Graph` & `Workspace`s.
Methods
Section titled Methodsadd()
Section titled add()Add one or more packages from external registries
Parameters:
Parameter | Type | Description |
---|---|---|
packages | string | string [] | One or more packages, by name and/or 'name@version' . |
opts ? | { dev : boolean ; } | Various options to pass while installing the packages |
opts.dev ? | boolean | Set to true to install as a devDependency . Default false |
Returns: Promise
<void
>
Defined in: modules/package-manager/src/methods.ts
batch()
Section titled batch()Batch commands from npm packages as a batch of subprocesses using the package manager. Alternative to batching with npm exec
and compatible APIs.
Parameters:
Parameter | Type |
---|---|
processes | RunSpec [] |
Returns: Promise
<(Error
| [string
, string
])[]>
See also:
`batch` for general subprocess batching.
Defined in: modules/package-manager/src/methods.ts
dedupe()
Section titled dedupe()Reduce duplication in the package tree by checking overlapping ranges.
Returns: Promise
<void
>
Defined in: modules/package-manager/src/methods.ts
info()
Section titled info()Get standard information about a package
Parameters:
Parameter | Type |
---|---|
name | string |
opts ? | Partial <RunSpec > |
Returns: Promise
<null
| NpmInfo
>
Defined in: modules/package-manager/src/methods.ts
install()
Section titled install()Install current dependencies as listed in the package manager’s lock file
Parameters:
Parameter | Type |
---|---|
cwd ? | string |
Returns: Promise
<string
>
Defined in: modules/package-manager/src/methods.ts
loggedIn()
Section titled loggedIn()Check if the current user is logged in to the external registry
Parameters:
Parameter | Type | Description |
---|---|---|
opts ? | { registry : string ; scope : string ; } | - |
opts.registry ? | string | The base URL of your NPM registry. PNPM and NPM ignore scope and look up per-registry. |
opts.scope ? | string | When using Yarn, lookups are done by registry configured by scope. This value must be included if you have separate registries for separate scopes. |
Returns: Promise
<boolean
>
Defined in: modules/package-manager/src/methods.ts
publish()
Section titled publish()Publish Workspaces to the external registry
Type Parameters
Section titled Type ParametersType Parameter |
---|
T extends MinimalWorkspace |
Parameters:
Parameter | Type | Description |
---|---|---|
opts | { access : "restricted" | "public" ; cwd : string ; otp : string ; tag : string ; workspaces : T []; } | - |
opts.access ? | "restricted" | "public" | Set the registry access level for the package Default inferred from Workspaces publishConfig.access or 'public' |
opts.cwd ? | string | Command working directory. Defaults to the repository root. |
opts.otp ? | string | This is a one-time password from a two-factor authenticator. |
opts.tag ? | string | If you ask npm to install a package and don’t tell it a specific version, then it will install the specified tag. Default 'latest' |
opts.workspaces | T [] | Workspaces to publish. If not provided or empty array, only the given Workspace at cwd will be published. This type is generally compatible with `Workspace`. |
Returns: Promise
<void
>
Defined in: modules/package-manager/src/methods.ts
publishable()
Section titled publishable()Filter Workspaces to the set of those that are actually publishable. This will check both whether the package is not marked as “private” and if the current version is not in the external registry.
Type Parameters
Section titled Type ParametersType Parameter |
---|
T extends MinimalWorkspace |
Parameters:
Parameter | Type | Description |
---|---|---|
workspaces | T [] | List of compatible `Workspace` objects. |
Returns: Promise
<T
[]>
Defined in: modules/package-manager/src/methods.ts
remove()
Section titled remove()Remove one or more packages.
Parameters:
Parameter | Type | Description |
---|---|---|
packages | string | string [] | One or more packages, by name |
Returns: Promise
<void
>
Defined in: modules/package-manager/src/methods.ts
run()
Section titled run()Run a command from an npm package as a subprocess using the package manager. Alternative to npm exec
and compatible APIs.
Parameters:
Parameter | Type |
---|---|
opts | RunSpec |
Returns: Promise
<[string
, string
]>
See also:
`batch` for general subprocess running.
Defined in: modules/package-manager/src/methods.ts
MinimalWorkspace
Section titled MinimalWorkspaceType declaration
Section titled Type declarationlocation?
Section titled location?private?
Section titled private?version?
Section titled version?Defined in: modules/package-manager/src/methods.ts
NpmInfo
Section titled NpmInfoType declaration
Section titled Type declarationdependencies
Section titled dependenciesdist-tags
Section titled dist-tagsType declaration
Section titled Type declarationIndex Signature
Section titled Index Signature[key
: string
]: string
dist-tags.latest
Section titled dist-tags.latesthomepage
Section titled homepagelicense
Section titled licenseversion
Section titled versionversions
Section titled versionsDefined in: modules/package-manager/src/methods.ts
Plugins
Section titled PluginsPlugin
Section titled PluginDefined in: modules/onerepo/src/types/plugin.ts
PluginObject
Section titled PluginObjectType declaration
Section titled Type declarationshutdown()?
Section titled shutdown()?Runs just before the application process is exited. Allows returning data that will be merged with all other shutdown handlers.
Parameters:
Parameter | Type |
---|---|
argv | Argv <DefaultArgv > |
Returns: Promise
<Record
<string
, unknown
> | void
> | Record
<string
, unknown
> | void
startup()?
Section titled startup()?Runs before any and all commands after argument parsing. This is similar to global Yargs middleware, but guaranteed to have the fully resolved and parsed arguments.
Use this function for setting up global even listeners like PerformanceObserver
, process
events, etc.
Parameters:
Parameter | Type |
---|---|
argv | Argv <DefaultArgv > |
Returns: Promise
<void
> | void
yargs()?
Section titled yargs()?A function that is called with the CLI’s yargs
object and a visitor.
It is important to ensure every command passed through the visitor
to enable all of the features of oneRepo. Without this step, you will not have access to the Workspace Graph, affected list, and much more.
Parameters:
Parameter | Type |
---|---|
yargs | Yargs |
visitor | NonNullable <RequireDirectoryOptions ["visit" ]> |
Returns: Yargs
Defined in: modules/onerepo/src/types/plugin.ts
Subprocess
Section titled Subprocessbatch()
Section titled batch()Batch multiple subprocesses, similar to Promise.all
, but only run as many processes at a time fulfilling N-1 cores. If there are more processes than cores, as each process finishes, a new process will be picked to run, ensuring maximum CPU usage at all times.
If any process throws a SubprocessError
, this function will reject with a BatchError
, but only after all processes have completed running.
Most oneRepo commands will consist of at least one `run()` or `batch()` processes.
Parameters:
Parameter | Type |
---|---|
processes | (RunSpec | PromiseFn )[] |
options ? | BatchOptions |
Returns: Promise
<([string
, string
] | Error
)[]>
Throws
Section titled Throws`BatchError` An object that includes a list of all of the `SubprocessError`s thrown.
See also: `PackageManager.batch` to safely batch executables exposed from third party modules.
Defined in: modules/subprocess/src/index.ts
run()
Section titled run()Spawn a process and capture its stdout
and stderr
through a Logger Step. Most oneRepo commands will consist of at least one `run()` or `batch()` processes.
The run()
command is an async wrapper around Node.js’s child_process.spawn
and has a very similar API, with some additions. This command will buffer and catch all stdout
and stderr
responses.
Skipping failures:
If a subprocess fails when called through run()
, a `SubprocessError` will be thrown. Some third-party tooling will exit with error codes as an informational tool. While this is discouraged, there’s nothing we can do about how they’ve been chosen to work. To prevent throwing errors, but still act on the stderr
response, include the skipFailures
option:
Dry-run:
By default, run()
will respect oneRepo’s --dry-run
option (see `DefaultArgv`, process.env.ONEREPO_DRY_RUN
). When set, the process will not be spawned, but merely log information about what would run instead. To continue running a command, despite the --dry-run
option being set, use runDry: true
:
Parameters:
Parameter | Type |
---|---|
options | RunSpec |
Returns: Promise
<[string
, string
]>
A promise with an array of [stdout, stderr]
, as captured from the command run.
Throws
Section titled Throws`SubprocessError` if not skipFailures
and the spawned process does not exit cleanly (with code 0
)
See also: `PackageManager.run` to safely run executables exposed from third party modules.
Defined in: modules/subprocess/src/index.ts
runTasks()
Section titled runTasks()Alpha
Run Lifecycle tasks in commands other than the one tasks
command. Use this function when you have a command triggering a Lifecycle in non-standard ways.
Parameters:
Parameter | Type | Description |
---|---|---|
lifecycle | Lifecycle | The individual Lifecycle to trigger. |
args | string [] | Array of string arguments as if passed in from the command-line. |
graph | Graph | The current repository Graph. |
logger ? | Logger | Optional Logger instance. Defaults to the current Logger (usually there is only one). |
Returns: Promise
<void
>
Defined in: modules/onerepo/src/core/tasks/run-tasks.ts
start()
Section titled start()Start a subprocess. For use when control over watching the stdout and stderr or long-running processes that are not expected to complete without SIGINT/SIGKILL.
Parameters:
Parameter | Type |
---|---|
options | Omit <RunSpec , "name" | "runDry" > |
Returns: ChildProcess
Defined in: modules/subprocess/src/index.ts
sudo()
Section titled sudo()This function is similar to run
, but can request and run with elevated sudo
permissions. This function should not be used unless you absolutely know that you will need to spawn an executable with elevated permissions.
This function will first check if sudo
permissions are valid. If not, the logger will warn the user that sudo permissions are being requested and properly pause the animated logger while the user enters their password directly through stdin
. If permissions are valid, no warning will be given.
Parameters:
Parameter | Type |
---|---|
options | Omit <RunSpec , "opts" > & { reason : string ; } |
Returns: Promise
<[string
, string
]>
Defined in: modules/subprocess/src/index.ts
BatchError
Section titled BatchErrorExtends
Section titled ExtendsError
Constructors
Section titled Constructorsnew BatchError()
Section titled new BatchError()Parameters:
Parameter | Type |
---|---|
errors | (string | SubprocessError )[] |
options ? | ErrorOptions |
Returns: BatchError
Overrides
Section titled OverridesError.constructor
Defined in: modules/subprocess/src/index.ts
Properties
Section titled PropertiesProperty | Modifier | Type | Description | Inherited from | Defined in |
---|---|---|---|---|---|
cause? | public | unknown | - | Error.cause | node_modules/typescript/lib/lib.es2022.error.d.ts:26 |
errors | public | (string | SubprocessError )[] | - | - | modules/subprocess/src/index.ts |
message | public | string | - | Error.message | node_modules/typescript/lib/lib.es5.d.ts:1077 |
name | public | string | - | Error.name | node_modules/typescript/lib/lib.es5.d.ts:1076 |
prepareStackTrace? | static | (err : Error , stackTraces : CallSite []) => any | Optional override for formatting stack traces See https://v8.dev/docs/stack-trace-api#customizing-stack-traces | Error.prepareStackTrace | node_modules/@types/node/globals.d.ts:98 |
stack? | public | string | - | Error.stack | node_modules/typescript/lib/lib.es5.d.ts:1078 |
stackTraceLimit | static | number | - | Error.stackTraceLimit | node_modules/@types/node/globals.d.ts:100 |
Methods
Section titled MethodscaptureStackTrace()
Section titled captureStackTrace()Create .stack property on a target object
Parameters:
Parameter | Type |
---|---|
targetObject | object |
constructorOpt ? | Function |
Returns: void
Inherited from
Section titled Inherited fromError.captureStackTrace
Defined in: node_modules/@types/node/globals.d.ts:91
SubprocessError
Section titled SubprocessErrorExtends
Section titled ExtendsError
Constructors
Section titled Constructorsnew SubprocessError()
Section titled new SubprocessError()Parameters:
Parameter | Type |
---|---|
message | string |
options ? | ErrorOptions |
Returns: SubprocessError
Overrides
Section titled OverridesError.constructor
Defined in: modules/subprocess/src/index.ts
Properties
Section titled PropertiesProperty | Modifier | Type | Description | Inherited from | Defined in |
---|---|---|---|---|---|
cause? | public | unknown | - | Error.cause | node_modules/typescript/lib/lib.es2022.error.d.ts:26 |
message | public | string | - | Error.message | node_modules/typescript/lib/lib.es5.d.ts:1077 |
name | public | string | - | Error.name | node_modules/typescript/lib/lib.es5.d.ts:1076 |
prepareStackTrace? | static | (err : Error , stackTraces : CallSite []) => any | Optional override for formatting stack traces See https://v8.dev/docs/stack-trace-api#customizing-stack-traces | Error.prepareStackTrace | node_modules/@types/node/globals.d.ts:98 |
stack? | public | string | - | Error.stack | node_modules/typescript/lib/lib.es5.d.ts:1078 |
stackTraceLimit | static | number | - | Error.stackTraceLimit | node_modules/@types/node/globals.d.ts:100 |
Methods
Section titled MethodscaptureStackTrace()
Section titled captureStackTrace()Create .stack property on a target object
Parameters:
Parameter | Type |
---|---|
targetObject | object |
constructorOpt ? | Function |
Returns: void
Inherited from
Section titled Inherited fromError.captureStackTrace
Defined in: node_modules/@types/node/globals.d.ts:91
BatchOptions
Section titled BatchOptionsOptions for running `batch()` subprocesses.
Type declaration
Section titled Type declarationmaxParallel?
Section titled maxParallel?The absolute maximum number of subprocesses to batch. This amount will always be limited by the number of CPUs/cores available on the current machine.
Default: deterministic
Number of CPUs - 1
Defined in: modules/subprocess/src/index.ts
PromiseFn()
Section titled PromiseFn()Returns: Promise
<[string
, string
]>
Defined in: modules/subprocess/src/index.ts
RunSpec
Section titled RunSpecThe core configuration for `run`, `start`, `sudo`, and `batch` subprocessing.
Type declaration
Section titled Type declarationargs?
Section titled args?Arguments to pass to the executable. All arguments must be separate string entries.
Beware that some commands have different ways of parsing arguments.
Typically, it is safest to have separate entries in the args
array for the flag and its value:
However, if an argument parser is implemented in a non-standard way, the flag and its value may need to be a single entry:
The command to run. This should be an available executable or path to an executable.
A friendly name for the Step in log output.
opts?
Section titled opts?See the Node.js child_process.spawn()
documentation for available options.
runDry?
Section titled runDry?Skip the --dry-run
check and run this command anyway.
skipFailures?
Section titled skipFailures?Prevents throwing a `SubprocessError` in the event of the process failing and exiting with an unclean state.
step?
Section titled step?Pass a custom `LogStep` to bundle this process input & output into another step instead of creating a new one.
Defined in: modules/subprocess/src/index.ts
package.json
Section titled package.jsongetPublishablePackageJson()
Section titled getPublishablePackageJson()Return a deep copy of a package.json
suitabkle for publishing. Moves all non-standard publishConfig
keys to the root of the package.json
and deletes devDependencies
.
Parameters:
Parameter | Type |
---|---|
input | PublicPackageJson |
Returns: PublicPackageJson
Defined in: modules/package-manager/src/package-json.ts
BasePackageJson
Section titled BasePackageJsonType declaration
Section titled Type declarationalias?
Section titled alias?Enable’s the `Graph` to look up `Workspace`s by shorter names or common `aliases` used by teams. This enables much short command-line execution. See `Graph.getByName` and `Graph.getAllByName`.
author?
Section titled author?bugs?
Section titled bugs?Type declaration
Section titled Type declarationbugs.email?
Section titled bugs.email?bugs.url?
Section titled bugs.url?bundleDependencies?
Section titled bundleDependencies?contributors?
Section titled contributors?dependencies?
Section titled dependencies?description?
Section titled description?devDependencies?
Section titled devDependencies?engines?
Section titled engines?exports?
Section titled exports?files?
Section titled files?homepage?
Section titled homepage?keywords?
Section titled keywords?license?
Section titled license?main?
Section titled main?The full name for the `Workspace`. This will be used within the package manager and publishable registry.
optionalDependencies?
Section titled optionalDependencies?overrides?
Section titled overrides?packageManager?
Section titled packageManager?peerDependencies?
Section titled peerDependencies?peerDependenciesMeta?
Section titled peerDependenciesMeta?scripts?
Section titled scripts?version?
Section titled version?Defined in: modules/package-manager/src/package-json.ts
PackageJson
Section titled PackageJsonDefined in: modules/package-manager/src/package-json.ts
Person
Section titled PersonType declaration
Section titled Type declarationemail?
Section titled email?name?
Section titled name?Defined in: modules/package-manager/src/package-json.ts
PrivatePackageJson
Section titled PrivatePackageJsonType declaration
Section titled Type declarationlicense?
Section titled license?private
Section titled privateworkspaces?
Section titled workspaces?Defined in: modules/package-manager/src/package-json.ts
PublicPackageJson
Section titled PublicPackageJsonType declaration
Section titled Type declarationprivate?
Section titled private?publishConfig?
Section titled publishConfig?workspaces?
Section titled workspaces?Defined in: modules/package-manager/src/package-json.ts
PublishConfig
Section titled PublishConfigThe publishConfig
should follow NPM’s guidelines, apart from the possible defined extra keys here. Anything defined here will be merged back to the root of the package.json
at publish time.
Use these keys to help differentiate between your repository’s source-dependency entrypoints vs published module entrypoints.
Type declaration
Section titled Type declarationIndex Signature
Section titled Index Signature[key
: string
]: unknown
exports?
Section titled exports?main?
Section titled main?module?
Section titled module?typings?
Section titled typings?Defined in: modules/package-manager/src/package-json.ts
Namespaces
Section titled NamespacesNamespace | Description |
---|---|
builders | Common and reusable command-line option builders. |
file | File manipulation functions. |
git | Special handlers for managing complex queries and manipulation of the git repository’s state. |