VS Code Workflow
I have been trying to switch over to using VS Code for the majority of my workflow lately. It allows me to keep my dev environment contained into a single space and offers visualization that working straight from a terminal cannot provide, especially when working with branches in Git.
thehoneycomb
Workspace
Everything related to thehoneycomb.dev
is worked on through a workspace in VS Code called thehoneycomb
. This workspace has custom settings and is stored in C:\Projects\thehoneycomb\.vscode\
as thehoneycomb.code-workspace
.
Workspace settings
Below are the settings within the thehoneycomb.code-workspace
file.
thehoneycomb.code-workspace | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
Send Bees
Send Bees is a custom button located in the Status Bar that I created to simplify the deployment process. It exists solely within the thehoneycomb
workspace. When clicked, it runs a VS Code task called "Send Bees"
.
Button in VS Code UI
The Send Bees button currently does 4 main things via the "Send Bees"
task:
- Access the remote host via SSH.
- Switch to the
HoneyAPI
local repo,git pull
, restart theHoneyAPI
service via NSSM. - Switch to the
Honeycomb
local repo,git pull
, restart theHoneycomb
service via NSSM. - Execute the
notify_discord.py
script.
Whenever I've pushed updates to the remote repos on GitHub that I'm ready to make live, all I have to do is click the button and run the task.
I never need to open a terminal, remote in, or actually touch the laptop I'm using to host everything at all.
This process can be easily expanded as more is added to theHoneycomb.dev
over time.
notify_discord.py
script
The Python script uses a Discord webhook to send a message to a channel in my personal Discord server to let me know when the task has finished running.
Message in Discord
The full Python script (modified for privacy) is included below.
notify_discord.py | |
---|---|
1 2 3 4 5 |
|
Task code
The "Send Bees"
task is stored in C:\Projects\thehoneycomb\.vscode\tasks.json
, which contains tasks that only exist within the scope of the thehoneycomb
workspace:
tasks.json | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
Button code
The Send Bees button is setup in thehoneycomb.code-workspace
settings. You can view it under Workspace Settings, within the "status-bar-button.buttons"
section.
The button is created via a personally modified version of the status-bar-button extension. The original extension was developed for the web version of VS Code, which doesn't support tasks. The extension was modified to function as a desktop extension and allow buttons to use runTask
with the "command"
field.
The modified extension has been installed locally to my VS Code.