Skip to content

Instantly share code, notes, and snippets.

@nodkz
Created November 20, 2017 10:15
Show Gist options
  • Save nodkz/1cfb6970a5cdec6fcc690e14a0ab84ba to your computer and use it in GitHub Desktop.
Save nodkz/1cfb6970a5cdec6fcc690e14a0ab84ba to your computer and use it in GitHub Desktop.
Ram disk via scripts
{
"scripts": {
"ram": "yarn ram-check-disk && yarn ram-create-disk && yarn ram-link-node-modules && yarn ram-link-build && yarn install && yarn start",
"ram-check-disk": "[ -d /Volumes/npm_ram_disk ] && echo 'Disk already mounted!' && yarn build && exit 1 || exit 0",
"ram-create-disk": "diskutil erasevolume hfsx npm_ram_disk `hdiutil attach -nomount ram://1600000`",
"ram-link-node-modules": "mkdir /Volumes/npm_ram_disk/node_modules && rm -r -f ./node_modules && ln -s /Volumes/npm_ram_disk/node_modules ./node_modules",
"ram-link-build": "mkdir /Volumes/npm_ram_disk/build && rm -r -f ./build && ln -s /Volumes/npm_ram_disk/build ./build",
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment