Skip to content

Instantly share code, notes, and snippets.

@kruzyk
Created May 4, 2021 20:04
Show Gist options
  • Save kruzyk/a326f9a2a96623a6f34e7c3d0a0a46a5 to your computer and use it in GitHub Desktop.
Save kruzyk/a326f9a2a96623a6f34e7c3d0a0a46a5 to your computer and use it in GitHub Desktop.

Revisions

  1. @DanyloMoraes DanyloMoraes revised this gist Jun 6, 2020. 1 changed file with 73 additions and 1 deletion.
    74 changes: 73 additions & 1 deletion yarn.md
    Original file line number Diff line number Diff line change
    @@ -68,4 +68,76 @@ alias yo="yarn outdated"
    $ yarn version
    $ yarn version --major
    $ yarn version --minor
    $ yarn version --patch
    $ yarn version --patch

    ======================= NEW REVISION

    # YARN

    [yarnpkg.com](https://yarnpkg.com/)

    ## yarn init
    Create a new package

    ```bash
    $ yarn init
    $ yarn init -y
    ```

    ## yarn add
    Add dependencies to the project

    ```bash
    $ yarn add <packageName>
    $ yarn add -D <packageName>
    $ yarn add -O <packageName>
    $ yarn add -P <packageName>

    $ yarn add <packageName>@<version>
    ```

    ## yarn cache clean
    Remove the shared cache files

    ```bash
    $ yarn cache clean
    $ yarn cache clean --mirror
    $ yarn cache clean --all
    ```

    ## yarn dlx
    Run a package in a temporary environment

    ```bash
    $ yarn dlx <packageTemporary>
    ```

    ## yarn install
    Install the project dependencies

    ```bash
    $ yarn install
    ```

    ## yarn link
    Connect the local project to another one

    ```bash
    $ yarn link <destination>
    $ yarn link ~/jquery-folder
    ```

    ## yarn run
    Run a script defined in the package.json

    ```bash
    $ yarn run <scriptName>
    ```

    ## yarn up
    Upgrade dependencies across the project

    ```bash
    $ yarn up
    $ yarn up <packageName>
    ```
  2. @DanyloMoraes DanyloMoraes revised this gist May 14, 2020. No changes.
  3. @DanyloMoraes DanyloMoraes revised this gist May 14, 2020. 1 changed file with 0 additions and 4 deletions.
    4 changes: 0 additions & 4 deletions yarn.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,3 @@
    # YARN

    [yarnpkg.com](https://yarnpkg.com/en/)

    ### Basic Commands

    ```sh
  4. @DanyloMoraes DanyloMoraes revised this gist Jun 25, 2019. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions yarn.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    # YARN

    [yarnpkg.com](https://yarnpkg.com/en/)

    ### Basic Commands

    ```sh
  5. @DanyloMoraes DanyloMoraes created this gist Jun 15, 2019.
    73 changes: 73 additions & 0 deletions yarn.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,73 @@
    # YARN

    ### Basic Commands

    ```sh
    alias y="yarn"
    alias yi="yarn init -y"
    ```

    ### Install And Remove Packages

    ```sh
    alias ya="yarn add"
    alias yr="yarn remove"
    ```

    ### Install Packages In Your *devDependencies*

    ```sh
    alias yad="yarn add -D"
    ```

    ### Install And Remove Packages Globally

    ```sh
    alias yga="yarn global add"
    alias ygr="yarn global remove"
    ```

    ### Upgrades Packages To Their Latest Version

    ```sh
    alias yu="yarn upgrade"
    alias ygu="yarn global upgrade"
    ```

    ### Clear The Global Cache

    ```sh
    alias ycc="yarn cache clean"
    ```

    ### Runs A Defined Package Script

    ```sh
    alias yrun="yarn run"
    ```

    ### List Installed Packages

    ```sh
    alias yl="yarn list --depth=0"
    alias ygl="yarn global list --depth=0"
    ```

    ### Checks For Outdated Packages

    ```sh
    alias yo="yarn outdated"
    ```

    ### Updates The Package Version

    *To change the prefix of the git tag you can use `version-tag-prefix`*.

    $ yarn config set version-tag-prefix "v"

    *Using the `yarn version` command you can update the version of your package via the command line*.

    $ yarn version
    $ yarn version --major
    $ yarn version --minor
    $ yarn version --patch