* Update README

* Further refine readme

* Further update

* Correct the build badge

* Remove link to cloning a repository

* Add back npm run build

* localbuild flag

* Fix the header
This commit is contained in:
Franklin Tse 2018-08-31 04:39:43 +08:00 committed by Guillaume Jenkins
parent 4e4ad21cb5
commit 2482abf9f8

View File

@ -1,11 +1,12 @@
# micro:bit target for PXT # micro:bit target for PXT
This target allows you to program a [BBC micro:bit](https://microbit.org/) using [![Build Status](https://travis-ci.org/Microsoft/pxt-microbit.svg?branch=v1)](https://travis-ci.org/Microsoft/pxt-microbit)
PXT ([Microsoft Programming Experience Toolkit](https://github.com/Microsoft/pxt)).
* [Try it live](https://makecode.microbit.org) *This README is for pxt-microbit v1.x, which is [currently in beta](https://makecode.com/blog/microbit/v1-beta).*
[![Build Status](https://travis-ci.org/Microsoft/pxt-microbit.svg?branch=master)](https://travis-ci.org/Microsoft/pxt-microbit) pxt-microbit is a [Microsoft Programming Experience Toolkit (PXT)](https://github.com/Microsoft/pxt) target that allows you to program a [BBC micro:bit](https://microbit.org/). pxt-microbit v1.x requires pxt v3.x, which is currently in the [master branch of pxt](https://github.com/Microsoft/pxt/tree/master).
* [Try it live](https://makecode.microbit.org/beta)
## Issue tracking ## Issue tracking
@ -15,50 +16,35 @@ 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 dependancy, [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. 1. Install [Node.js](https://nodejs.org/) 8.9.4 or higher.
* Note for any editing of the `.cpp` files, Yotta must be installed. To do so, follow the instructions on [their site](http://docs.yottabuild.org/). 2. Install [Yotta](http://docs.yottabuild.org/) if you are going to edit any `.cpp` files.
* Install node.js 8.9.4 or higher. 3. Clone the pxt repository.
* 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
```
* [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 git clone https://github.com/microsoft/pxt
cd pxt cd pxt
git checkout v0
``` ```
4. Install the dependencies of pxt and build it
* Install the pxt dependencies.
``` ```
npm install npm install
typings install npm run build
jake cd ..
cd ../
``` ```
5. Clone the `v1` branch of this repository.
* [Clone this repo](https://help.github.com/articles/cloning-a-repository/) to your computer.
``` ```
git clone https://github.com/microsoft/pxt-microbit git clone https://github.com/microsoft/pxt-microbit --branch v1
cd pxt-microbit cd pxt-microbit
``` ```
* install the PXT command line (add ``sudo`` for Mac/Linux shells). 6. Install the PXT command line (add `sudo` for Mac/Linux shells).
``` ```
npm install -g pxt npm install -g pxt
``` ```
* install the dependencies 7. Install the pxt-microbit dependencies.
``` ```
npm install npm install
``` ```
8. Link pxt-microbit back to base pxt repo (add `sudo` for Mac/Linux shells).
* Link pxt-microbit back to base pxt repo.
``` ```
npm link ../pxt npm link ../pxt
``` ```
@ -73,21 +59,21 @@ Note the above command assumes the folder structure of
### Running ### Running
Run this command from inside pxt-microbit 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
``` ```
pxt serve --cloud pxt serve
``` ```
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.
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): If you need to modify the `.cpp` files (and have installed yotta), enable yotta compilation using the `--localbuild` flag:
``` ```
pxt serve pxt serve --localbuild
``` ```
### Updates ### Updates
To update your PXT version and make sure you're running the latest tools, run (add ``sudo`` for Mac/Linux shells): To update your PXT version and make sure you're running the latest tools, run:
``` ```
pxt update pxt update
``` ```