This commit is contained in:
Peli de Halleux 2018-02-27 16:19:39 -08:00
commit 9c5f96bc10

View File

@ -16,33 +16,73 @@ Please add an issue if you discover an (unreported) bug.
The local server lets you to run the editor and serve the documentation from your own computer. The local server lets you to run the editor and serve the documentation from your own computer.
### Setup ### Setup
This section explains how to setup your development environment for pxt-microbit, whether that be to run a copy locally or to make source changes.
Note that pxt-microbit can not be run without its main depandancy, [pxt](https://github.com/Microsoft/pxt). Below explains how to setup both.
The following commands perform a one-time setup after synching the repo on your machine. The following commands perform a one-time setup after synching the repo on your machine.
* Note for any editing of the .cpp files, Yotta must be installed. Do do so, follow the instructions on [their site](http://docs.yottabuild.org/).
* Install node.js 8.9.4 or higher.
* Install requirements for [pxt](https://github.com/Microsoft/pxt). Note the v0 branch must be used for pxt-microbit (add ``sudo`` for Mac/Linux shells).
```
npm install -g jake
npm install -g typings
```
* install node.js 8.9.4 or higher * [Clone the pxt repository](https://help.github.com/articles/cloning-a-repository/) and set it to the v0 branch.
```
git clone https://github.com/microsoft/pxt
cd pxt
git checkout v0
```
* Install the pxt dependencies.
```
npm install
typings install
jake
cd ../
```
* [Clone this repo](https://help.github.com/articles/cloning-a-repository/) to your computer.
```
git clone https://github.com/microsoft/pxt-microbit
cd pxt-microbit
```
* install the PXT command line (add ``sudo`` for Mac/Linux shells). * install the PXT command line (add ``sudo`` for Mac/Linux shells).
``` ```
npm install -g pxt npm install -g pxt
``` ```
* install the microbit target * install the dependencies
``` ```
pxt target microbit npm install
``` ```
* Link pxt-microbit back to base pxt repo.
```
npm link ../pxt
```
Note the above command assumes the folder structure of
```
makecode
|
-----------------
| |
pxt pxt-microbit
```
### Running ### Running
Run this command to open a local web server (add ``sudo`` for Mac/Linux shells) Run this command from inside pxt-microbit to open a local web server (add ``sudo`` for Mac/Linux shells)
``` ```
pxt serve pxt serve --cloud
``` ```
If the local server opens in the wrong browser, make sure to copy the URL containing the local token. If the local server opens in the wrong browser, make sure to copy the URL containing the local token.
Otherwise, the editor will not be able to load the projects. Otherwise, the editor will not be able to load the projects.
The server assumes you have yotta installed. You can skip that requirement by adding ``--cloud``. If you need modify the `.cpp` files (and have installed yotta), enable yotta compilation by removing the ```--cloud``` flag (add ``sudo`` for Mac/Linux shells):
``` ```
pxt serve --cloud pxt serve
``` ```
### Updates ### Updates
@ -54,45 +94,6 @@ pxt update
More instructions are at https://github.com/Microsoft/pxt#running-a-target-from-localhost More instructions are at https://github.com/Microsoft/pxt#running-a-target-from-localhost
## Developer setup
If you need to make source changes to ``pxt`` and ``pxt-microbit``, follow these instructions:
* clone https://github.com/Microsoft/pxt
```
git clone https://github.com/Microsoft/pxt
```
* checkout the ``v0`` branch in pxt
```
cd pxt
git checkout v0
```
* ``npm install`` and run ``jake``
```
npm install
jake
```
* clone https://github.com/Microsoft/pxt-microbit
```
cd ..
git clone https://github.com/Microsoft/pxt-microbit
```
* ``npm install`` and link to the ``pxt`` folder
```
cd pxt-microbit
npm install
npm link ../pxt
```
Both of those repoes are now ready to go. To start your local server, run
```
pxt serve
```
or, without yotta tools,
```
pxt serve --cloud
```
## Repos ## Repos
The pxt-microbit target depends on several other repos. The main ones are: The pxt-microbit target depends on several other repos. The main ones are: