Javascript
yarn
Global Packages
Global packages are installed to $(yarn global dir)/node_modules/
and
symlinks are placed in $(yarn global bin)
.
Install
yarn global add $package
List
yarn global list
Upgrade
yarn global upgrade $package --latest
Or to upgrade all global packages:
yarn global upgrade
Without --latest
, yarn will respect semver specs in $(yarn global
dir)/package.json
.
npm
Global Packages
Install
npm install -g $package_name
List
npm -g list --depth 0
Delete Them All
npm list -gp --depth=0 \ | awk -F/ '/node_modules/ && !/\/npm$/ {print $NF}' \ | xargs npm -g uninstall
New project
npm init
Strings
return "😂".length
#+RESULTS:
2
From: https://hsivonen.fi/string-length/
return "🤦🏼♂️".length
#+RESULTS:
7
Scripts
const fs = require('fs'); console.log("hello")
#+RESULTS:
hello undefined