website
website copied to clipboard
Include --ignore-optional doc
Resolves #265.
Two changes:
- Fix broken link to optionalDependencies
- Include documentation for the --ignore-optional CLI command
Looks like this (locally):

Shouldn't this be on the yarn install
page?
@thejameskyle This is in reference to yarn help add
in the CLI which outputs:
▶ yarn help add
Usage: yarn add [packages ...] [flags]
Options:
-h, --help output usage information
-V, --version output the version number
--offline
--prefer-offline
--strict-semver
--json
--global-folder <path>
--modules-folder <path> rather than installing modules into the node_modules folder relative to the cwd, output them here
--cache-folder <path> specify a custom folder to store the yarn cache
--mutex <type>[:specifier] use a mutex to ensure only one yarn instance is executing
--no-emoji disable emoji in output
--har save HAR output of network traffic
--ignore-platform ignore platform checks
--ignore-engines ignore engines check
--ignore-scripts
--ignore-optional
--force ignore all caches
--flat only allow one version of a package
--prod, --production
--no-lockfile don't read or generate a lockfile
--pure-lockfile don't generate a lockfile
--dev save package to your `devDependencies`
--peer save package to your `peerDependencies`
--optional save package to your `optionalDependencies`
--exact
--tilde
Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
However I see the same list when I run yarn help install
▶ yarn help install
Usage: yarn install [flags]
Options:
-h, --help output usage information
-V, --version output the version number
--offline
--prefer-offline
--strict-semver
--json
--global-folder <path>
--modules-folder <path> rather than installing modules into the node_modules folder relative to the cwd, output them here
--cache-folder <path> specify a custom folder to store the yarn cache
--mutex <type>[:specifier] use a mutex to ensure only one yarn instance is executing
--no-emoji disable emoji in output
--har save HAR output of network traffic
--ignore-platform ignore platform checks
--ignore-engines ignore engines check
--ignore-scripts
--ignore-optional
--force ignore all caches
--flat only allow one version of a package
--prod, --production
--no-lockfile don't read or generate a lockfile
--pure-lockfile don't generate a lockfile
-g, --global DEPRECATED
-S, --save DEPRECATED - save package to your `dependencies`
-D, --save-dev DEPRECATED - save package to your `devDependencies`
-P, --save-peer DEPRECATED - save package to your `peerDependencies`
-O, --save-optional DEPRECATED - save package to your `optionalDependencies`
-E, --save-exact DEPRECATED
-T, --save-tilde DEPRECATED
Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
add
is replacing install
right? Would you recommend this go in two places or something else?
add
is not replacing install
. install
has been broken up into separate commands.
Internally add uses a lot of the same logic that install has, I wouldn't be surprised if was using the same content even if some of those flags don't make sense in add
@kittens did you intend this? yarn add [package] --ignore-optional
is confusing.
@Daniel15 I moved this to the yarn install
CLI documentation.
The PR looks good to me, but given https://github.com/yarnpkg/yarn/issues/2666 it could be good clarify whether --ignore-optional
is intended to work only for the top-level package or also for all dependencies as well.