yarn run

Ejecuta un script defino en el package.

Puede definir scripts en el archivo package.json.

{
  "name": "my-package",
  "scripts": {
    "build": "babel src -d lib",
    "test": "jest"
  }
}
yarn run [script] [<args>]

Si ha definido un objeto scripts en el package, este comando ejecuta el [script] especificado. Por ejemplo:

yarn run test

Ejecutar este comando correrá el script llamado "test" en su package.json.

You can pass additional arguments to your script by passing them after the script name.

yarn run test -o --watch

Ejecutar este comando correrá jest -o--watch.

[script] también puede ser cualquier ejecutable localmente instalado dentro de node_modules/.bin/.

It’s also possible to leave out the run in this command, each script can be executed with its name:

yarn test -o --watch

Running this command will do the same as yarn run test -o --watch. Note that built-in cli commands will have preference over your scripts, so you shouldn’t always rely on this shortcut in other scripts

yarn run env

Running this command will list environment variables available to the scripts at runtime.

If you want to override this command, you can do so by defining your own "env" script in package.json.

yarn run

Si no se especifica un script para el comando yarn run, el comando run listará todos los scripts disponibles para ejecutar en el package.