npm npx cmd

npm

  • Install a package

    โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹  npm i <package>
    โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹  npm install <package>
    โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹  npm add <package>
    
  • Install a package in devDependencies

    โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹  npm i --save-dev <package>
    
  • Initial project setup

    โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹  npm init -y
    

npx

  • Cloning repositories using degit

    โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ npx degit github:user/repo#branch-name <folder-name>
    
  • Downloading specific folder from a specified branch

    โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹  npx degit github:user/repo/directory/sub-directory#branch-name <folder-name>
    
    • ex:

      The above approach

      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹  npx degit https://github.com/jherr/wp5-starter-react.git\#main client
      

      HTTPS approach

      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹  npx degit github:jherr/wp5-starter-react#main client