Vagrant is a tool for managing and configuring virtual machines. You can use it to run a development installation of MakeCode which can build the static version of the MakeCode site, like the one hosted at makecode.adafruit.com.
First, you'll need to install Vagrant, VirtualBox, and Git. We have a guide to installing these tools on Windows.
Next, you'll need a copy of the git repository here:
Start Bash, and clone the repository:
git clone https://github.com/adafruit/Adafruit-PXT-Setup.git cd Adafruit-PXT-Setup
Start and provision the Vagrant box:
vagrant up
This part will take a while, particularly on a slow connection, since it has to download both the image for the virtual machine and a bunch of dependencies. When it finishes, you should see the string "setup.sh completed" as the last message it prints out.
Now you can SSH into the Vagrant box and build MakeCode itself:
vagrant ssh cd pxt-adafruit pxt staticpkg -o /var/www/html
This will take a while, and may fail with a long error message on the first attempt. If so, run pxt staticpkg -o /var/www/html
again. When it finishes, you should see something like:
... rendering docs/tutorials/sensors/graph-acceleration.png rendering docs/tutorials/sensors/graph-lightlevel.png rendering docs/tutorials/sensors/graphblock.gif rendering docs/tutorials/sensors/lightlevelblock.gif rendering docs/tutorials/sensors/sensors.md rendering docs/tutorials/siren.md rendering docs/tutorials.md rendering docs/windows-app-web-link-ref.json Docs written.
Now, as long as the Vagrant box is running, you should be able to load MakeCode for Adafruit from your local system. Open up a browser and load the following URL:
...this works because port 8080 on your system is forwarded to port 80 on the Vagrant box, which is running a webserver to serve the generated files.
Page last edited March 08, 2024
Text editor powered by tinymce.