oneRepo API
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. |
Variables
Section titled VariablesdefaultConfig
Section titled defaultConfigSource: 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:
Type parameter | Value | Description |
---|---|---|
CommandArgv | object | Arguments that will be parsed for this command, always a union with DefaultArgv and PositionalArgv . |
Source: 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()
.
See also:
- Yargs
.command(module)
for general usage. - Common extensions via the
builders
namespace.
Type parameters:
Type parameter | Value | 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
>
Source: 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
Source: 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.
See also:
- Yargs
.command(module)
for general usage. HandlerExtra
for extended extra arguments provided above and beyond the scope of Yargs.
Type parameters:
Type parameter | Value | 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
>
Source: 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 getAffectedGet 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 getFilepathsGet 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 getWorkspacesGet 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.
Source: modules/yargs/src/yargs.ts
PositionalArgv
Section titled PositionalArgvAlways present in Builder and Handler arguments as parsed by Yargs.
Type declaration
Section titled Type declarationThe script name or node command. Similar to process.argv[1]
—
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.
Positionals / non-option arguments. These will only be filled if you include .positional()
or .strictCommands(false)
in your Builder
.
Source: 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:
Type parameter | Value |
---|---|
CustomLifecycles extends string | void | void |
Source: modules/onerepo/src/types/index.ts
Lifecycle
Section titled LifecycleoneRepo comes with a pre-configured list of common lifecycles for grouping tasks.
Source: modules/onerepo/src/types/tasks.ts
RootConfig<CustomLifecycles>
Section titled RootConfig<CustomLifecycles>Setup configuration for the root of the repository.
Type parameters:
Type parameter | Value |
---|---|
CustomLifecycles extends string | void | void |
Type declaration
Section titled Type declarationchanges?
Section titled changes?changes.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?Default: {}
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.
commands.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?dependencies.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
.
taskConfig.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?validation.schema?
Section titled validation.schema?Default: undefined
File path for custom Graph and configuration file validation schema.
Version control system settings.
vcs.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.
Source: 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
.
Source: modules/onerepo/src/types/tasks.ts
TaskConfig<CustomLifecycles>
Section titled TaskConfig<CustomLifecycles>Type parameters:
Type parameter | Value |
---|---|
CustomLifecycles extends string | void | void |
Source: 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.
Source: 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?Source: modules/onerepo/src/types/tasks.ts
WorkspaceConfig<CustomLifecycles>
Section titled WorkspaceConfig<CustomLifecycles>Type parameters:
Type parameter | Value |
---|---|
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
.
commands.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.
Source: 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
Source: 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 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
Source: modules/graph/src/Graph.ts
This 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
Source: modules/graph/src/Graph.ts
workspaces
Section titled workspacesGet a list of all Workspaces
that are part of the repository {@Link Graph | Graph
}.
Returns: Workspace
[]
Source: 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:
Type parameter |
---|
T extends string | Workspace |
Parameters:
Parameter | Type | Description |
---|---|---|
source | T | T [] | - |
type ? | DepType | Filter the dependents to a dependency type. |
Returns: Workspace
[]
Source: 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:
Type 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
[]
Source: 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:
Type 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
[]
Source: 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
[]
Source: 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
[]
Source: 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.
Source: 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
.
Source: modules/graph/src/Graph.ts
Workspace
Section titled WorkspaceAccessors
Section titled Accessorsaliases
Section titled aliasesAllow custom array of aliases. If the fully qualified package name is scoped, this will include the un-scoped name
Returns: string
[]
Source: modules/graph/src/Workspace.ts
codeowners
Section titled codeownersReturns: Required
<Record
<string
, string
[]>>
Source: modules/graph/src/Workspace.ts
config
Section titled configGet the Workspace’s configuration
Returns: Required
<RootConfig
| WorkspaceConfig
>
Source: modules/graph/src/Workspace.ts
dependencies
Section titled dependenciesGet the package.json
defined production dependencies for the Workspace.
Returns: Record
<string
, string
>
Map of modules to their version.
Source: modules/graph/src/Workspace.ts
description
Section titled descriptionCanonical to the package.json
"description"
field.
Returns: undefined
| string
Source: modules/graph/src/Workspace.ts
devDependencies
Section titled devDependenciesGet the package.json
defined development dependencies for the Workspace.
Returns: Record
<string
, string
>
Map of modules to their version.
Source: modules/graph/src/Workspace.ts
isRoot
Section titled isRootWhether or not this Workspace is the root of the repository / Graph.
Returns: boolean
Source: modules/graph/src/Workspace.ts
location
Section titled locationAbsolute path on the current filesystem to the Workspace.
Returns: string
Source: modules/graph/src/Workspace.ts
Returns: string
Source: modules/graph/src/Workspace.ts
The full name
of the Workspace, as defined in its package.json
Returns: string
Source: modules/graph/src/Workspace.ts
packageJson
Section titled packageJsonA full deep copy of the package.json
file for the Workspace. Modifications to this object will not be preserved on the Workspace.
Returns: PackageJson
Source: modules/graph/src/Workspace.ts
peerDependencies
Section titled peerDependenciesGet the package.json
defined peer dependencies for the Workspace.
Returns: Record
<string
, string
>
Map of modules to their version.
Source: modules/graph/src/Workspace.ts
private
Section titled privateIf 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
Source: modules/graph/src/Workspace.ts
publishablePackageJson
Section titled publishablePackageJsonGet 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
Source: modules/graph/src/Workspace.ts
scope
Section titled scopeGet module name scope if there is one, eg @onerepo
Returns: string
Source: modules/graph/src/Workspace.ts
tasks
Section titled tasksGet 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.
Source: modules/graph/src/Workspace.ts
version
Section titled versionReturns: undefined
| string
Source: modules/graph/src/Workspace.ts
Methods
Section titled MethodsgetCodeowners()
Section titled getCodeowners()Parameters:
Parameter | Type |
---|---|
filepath | string |
Returns: string
[]
Source: 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
>
Source: 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.
Source: 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
Source: 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
)
Source: modules/graph/src/Graph.ts
DepType
Section titled DepTypeDependency type value.
See also:
DependencyType
Source: modules/graph/src/Graph.ts
GraphSchemaValidators
Section titled GraphSchemaValidatorsDefinition for graph verify
JSON schema validators.
See “Validating configurations” for more examples and use cases.
Source: 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 loggerSource: 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
Source: 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:
Type parameter |
---|
T |
Parameters:
Parameter | Type |
---|---|
options | Object |
options.name | string |
options.step ? | LogStep |
fn | (step ) => Promise <T > |
Returns: Promise
<T
>
Source: modules/logger/src/index.ts
LogStep
Section titled LogStepLog steps should only be created via the logger.createStep()
method.
Properties
Section titled PropertiesProperty | Type | Description |
---|---|---|
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. |
hasInfo | boolean | Whether or not an info message has been sent to this step. |
hasLog | boolean | Whether or not a log message has been sent to this step. |
hasWarning | boolean | Whether or not a warning has been sent to this step. |
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
>
Source: 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
Source: 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
Source: 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
Source: 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
Source: 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
Source: 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
Source: modules/logger/src/LogStep.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 hasErrorWhether 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
Source: modules/logger/src/Logger.ts
hasInfo
Section titled hasInfoWhether or not an info message has been sent to the logger or any of its steps.
Returns: boolean
Source: modules/logger/src/Logger.ts
hasLog
Section titled hasLogWhether or not a log message has been sent to the logger or any of its steps.
Returns: boolean
Source: modules/logger/src/Logger.ts
hasWarning
Section titled hasWarningWhether or not a warning has been sent to the logger or any of its steps.
Returns: boolean
Source: modules/logger/src/Logger.ts
verbosity
Section titled verbosityGet the logger’s verbosity level
Recursively applies the new verbosity to the logger and all of its active steps.
Parameters:
Parameter | Type |
---|---|
value | Verbosity |
Returns: Verbosity
Source: modules/logger/src/Logger.ts
writable
Section titled writableReturns: boolean
Source: 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 ? | Object | - |
__namedParameters.writePrefixes ? | boolean | - |
Returns: LogStep
Source: 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
Source: 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
Source: 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.
Source: 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.
Source: 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.
Source: 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.
Source: 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.
Source: 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.
Source: modules/logger/src/Logger.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.
Source: 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 |
Source: 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
Source: 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
Source: 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"
Source: 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 ? | Object | Various options to pass while installing the packages |
opts.dev ? | boolean | Set to true to install as a devDependency .Default false |
Returns: Promise
<void
>
Source: 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.
Source: modules/package-manager/src/methods.ts
dedupe()
Section titled dedupe()Reduce duplication in the package tree by checking overlapping ranges.
Returns: Promise
<void
>
Source: 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
>
Source: 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
>
Source: 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 ? | Object | - |
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
>
Source: modules/package-manager/src/methods.ts
publish()
Section titled publish()Publish Workspaces to the external registry
Type parameters:
Type parameter |
---|
T extends MinimalWorkspace |
Parameters:
Parameter | Type | Description |
---|---|---|
opts | Object | - |
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
>
Source: 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:
Type parameter |
---|
T extends MinimalWorkspace |
Parameters:
Parameter | Type | Description |
---|---|---|
workspaces | T [] | List of compatible Workspace objects. |
Returns: Promise
<T
[]>
Source: 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
>
Source: 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.
Source: 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?Source: modules/package-manager/src/methods.ts
NpmInfo
Section titled NpmInfoType declaration
Section titled Type declarationdependencies
Section titled dependenciesdist-tags
Section titled dist-tagsIndex 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 versionsSource: modules/package-manager/src/methods.ts
Plugins
Section titled PluginsPlugin
Section titled PluginSource: 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
Source: 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 ThrowsBatchError
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.
Source: 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 ThrowsSubprocessError
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.
Source: 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
>
Source: 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
Source: 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
]>
Source: modules/subprocess/src/index.ts
BatchError
Section titled BatchErrorExtends
Section titled ExtendsError
Constructors
Section titled Constructorsnew BatchError(errors, options)
Section titled new BatchError(errors, options)Parameters:
Parameter | Type |
---|---|
errors | (string | SubprocessError )[] |
options ? | ErrorOptions |
Returns: BatchError
Overrides
Section titled OverridesError.constructor
Source: modules/subprocess/src/index.ts
Properties
Section titled PropertiesProperty | Modifier | Type | Description | Inherited from |
---|---|---|---|---|
cause? | public | unknown | - | Error.cause |
errors | public | (string | SubprocessError )[] | - | - |
message | public | string | - | Error.message |
name | public | string | - | Error.name |
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 |
stack? | public | string | - | Error.stack |
stackTraceLimit | static | number | - | Error.stackTraceLimit |
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
Source: node_modules/@types/node/globals.d.ts:21
SubprocessError
Section titled SubprocessErrorExtends
Section titled ExtendsError
Constructors
Section titled Constructorsnew SubprocessError(message, options)
Section titled new SubprocessError(message, options)Parameters:
Parameter | Type |
---|---|
message | string |
options ? | ErrorOptions |
Returns: SubprocessError
Overrides
Section titled OverridesError.constructor
Source: modules/subprocess/src/index.ts
Properties
Section titled PropertiesProperty | Modifier | Type | Description | Inherited from |
---|---|---|---|---|
cause? | public | unknown | - | Error.cause |
message | public | string | - | Error.message |
name | public | string | - | Error.name |
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 |
stack? | public | string | - | Error.stack |
stackTraceLimit | static | number | - | Error.stackTraceLimit |
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
Source: node_modules/@types/node/globals.d.ts:21
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
Source: modules/subprocess/src/index.ts
PromiseFn
Section titled PromiseFnReturns: Promise
<[string
, string
]>
Source: 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.
Source: 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
Source: 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?bugs.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?Source: modules/package-manager/src/package-json.ts
PackageJson
Section titled PackageJsonSource: modules/package-manager/src/package-json.ts
Person
Section titled PersonType declaration
Section titled Type declarationemail?
Section titled email?name?
Section titled name?Source: 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?Source: 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?Source: 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.
Index signature
Section titled Index signature[key
: typeof publishConfigKeep
[number
]]: unknown