The Problem
I've been writing NodeJS on a 2016 Macbook Pro since well... 2016. And the experience has been gr8. Except for one small problem...
I am an avid PC gamer. And I'm not holding my breath for a "Gaming Macbook Air" to come out any time soon... Beyond that, I also love building PCs. I know each and every component in my gaming rig because I hand-picked everything. There is a certain craftsmanship aspect to it that has always intrigued me.
When I come home at the end of the day and need some time to decompress 2 things come to mind. Do I want to pwn N00bs, or work on side projects? Depending on my answer I'll be on entirely different hardware, which SUCKS. So for years, I've been trying to make my experience at home with gaming & writing Node just a bit smoother.
The fact remains that beyond gaming there may be many reasons why you are interested in moving to Windows. This is my journey 🚀.
The Alpha Solution: "Cordy McCord Face"
The alpha solution is one I'm pretty sure many reading this article already do or know... I call this solution "Cordy McCord Face". What you do is buy a nice laptop stand, a display switcher, and a USB hub that connects to a central keyboard and mouse. That way you can dock your MacBook, press 3 buttons total (switch display, switch USB, power on device) and BOOM. Now you're cooking with avocado oil, and can 👏 "seamlessly" 👏 switch 👏 between 👏 your 👏 gaming 👏 rig 👏 and 👏 mac.
Dongle Problems
If you like to re-arrange your office, ever move, have the ports on your laptop change, or have lots of dongles... it can just be a huge pain. Cable management also sucks if you need to have your office look "clean".
The Beta Solution: Dual Boot
Dual boot Ubuntu (or some other distro). The thing that makes NodeJS development so great on Mac is that Linux & Mac are so closely related. After all, MacOS is Unix based. I love using tools like zsh
, and most of the dependencies I need for app development are available via homebrew
or a simple apt-get
. So I felt like I would feel right at home on Ubuntu.
Dual Boot Problems
Let's face it. No matter how good the Linux desktop environment is getting, it will never be as polished as Mac & Windows. Maybe that will change someday. I hope so. I personally ran into an obscure issue with Grub, where it would reset my Ubuntu OS instance to a fresh install whenever I switched between operating systems. Ugh... I'm sure there was a solution. But I don't want to spend time debugging those things. Those are issues I know I will never have on Windows or Mac. And if I'm going to write code on my PC the development experience needs to be just as good as Mac otherwise I know I won't do it.
The Solution: Going All In On Windows
For me to go all in on Windows I needed a few things to happen.
- I needed to be able to use
bash
, or even more preferable:zsh
withoh-my-zsh
- I needed all of my editor settings to seamlessly transfer over.
- I needed Node through Node Version Manager
- I needed Yarn for package management.
- I needed Docker.
The Shell
The best part about going all in on Windows is that I bypassed Windows altogether. My development environment is isolated from my gaming environment.
- Download the Ubuntu app from the Windows Store. Once this install is complete, you will have the Windows Subsystem for Linux running on your PC. (WSL also supports a handful of other distros, I just prefer Ubuntu)
-
Install the new Windows Terminal app from the Windows Store.
The new terminal app is sleek. It's minimal, it stays out of the way, it actually supports re-sizing (cough cough command prompt), and here's the best part... If you have WSL installed it has automatic support for WSL. Just open a new WSL tab and boom. You're running Linux.
Drops Mic.
Please note that the Terminal app is still in Preview. I haven't had any issues with it as of 08-28-2019.
- From there the rest was history. I could fly free. I followed the Ubuntu specific guides for installing docker, git, yarn, node version manager, and all my other dependencies.
sudo apt-get
worked great with no hiccups. I tried to find things to poke at, but in my personal experience, things worked exactly the way they did when I was using the terminal in Ubuntu natively.
The Editor
I use VS Code. But I had so many small details configured just the way I wanted on Mac that I didn't want to have to set up again.
I discovered a handy extension in the marketplace called Settings Sync that has worked wonders.
Because all settings in VS Code eventually become some sort of json
object. What Setting Sync does is save your VS Code Settings to a Github Gist. You can then push settings up to a gist and pull settings down to a new editor instance on a different machine. It's a thing of beauty.
Potential "Gotchas" 😳
- If you're coming from Mac/Ubuntu then all of your line endings are
LF
. VS Code usesCLRF
on Windows by default. You will want to make sure you go to user settings and setfiles.eol: 'lf'
- The
code
command works great inside of WSL. If you are using Webstorm, or a different IDE, it can be a bit tricky to set up commands in your path to be able to open up the IDE from the command line. - You may want to set up symlinks from
/mnt/c/**
-> your User directory in Windows so that you can find your files inside the File Explorer.
TLDR;
- Use WSL
- Use the new Windows Terminal App
- Use VSCode.
- Switch between gaming & coding like an absolute bad ass.
- Profit.
I had such a great experience switching to this setup that I was even able to generate a super small side project completely in windows with my Mac tightly closed in my backpack. I took plenty of gaming breaks because for the first time... I could.