Skip to content

Instantly share code, notes, and snippets.

@Nayananga
Forked from bradtraversy/yarncrashcourse
Created May 22, 2019 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nayananga/84099084a12b49c0676e8c454660aedf to your computer and use it in GitHub Desktop.
Save Nayananga/84099084a12b49c0676e8c454660aedf to your computer and use it in GitHub Desktop.
# GET VERSION
yarn -v (or --version)
# GET HELP
yarn help
# CREATE PACKAGE.JSON
yarn init
yarn init -y // Use defaults
# SET DEFAULTS
yarn config set init-license ISC
# GET DEFAULTS
yarn config get init-license
# REMOVE DEFAULTS
yarn delete init-license
# INSTALLING LOCAL PACKAGES
yarn add lodash
yarn add moment
# INSTALL FROM PACKAGE.JSON
(add "gulp":"*")
yarn install
# REMOVING MODULES
yarn remove lodash
# INSTALL CERTAIN VERSIONS
yarn add lodash@4.17.3
# FIND OUTDATED VERSIONS
yarn outdated lodash
yarn outdated
# UPGRADE
yarn upgrade lodash
yarn upgrade
# INSTALL GLOBAL MODULE (global must be put right after yarn)
yarn global add nodemon
# FIND ROOT FOLDER
yarn global bin
# REMOVE GLOBAL PACKAGES
yarn global remove nodemon
# LISTING PACKAGES
yarn list
yarn list --depth=0
yarn list --depth=1
yarn list --pattern gulp
# INSTALLING AS DEV DEPENDENCY
yarn add gulp -D or --dev
# REMOVE DEV DEPENDENCY
yarn remove gulp
#VERIFY THAT VERSIONS MATCH LOCK FILE
yarn check
# CREATE YARN.LOCK FILE
yarn import
# ADD SCRIPT
"scripts": {
"dev": "nodemon index.js"
},
# RUN SCRIPT
yarn run dev
# GET LICENSES
yarn license
# CREATE GZIP ARCHIVE OF DEPENDENCIES
yarn pack
yarn pack mydep
# LIST GLOBAL CACHE PACKAGES
yarn cache list
yarn cache list --pattern lodash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment