2015-02-04 19:07:58 +03:00
![](https://az31353.vo.msecnd.net/c04/uxoj.png)
# TouchDevelop
2015-02-04 22:48:06 +03:00
TouchDevelop is a touch-friendly app creation environment for iPad, iPhone,
2015-02-05 03:36:53 +03:00
Android, Windows, Mac, Linux developed with < 3 at Microsoft Research . Our
2015-02-04 22:48:06 +03:00
mobile-friendly editor makes coding fun, even on your phone or tablet!
2015-02-04 19:07:58 +03:00
2015-02-11 02:52:24 +03:00
[![Build Status ](https://travis-ci.org/Microsoft/TouchDevelop.svg )](https://travis-ci.org/Microsoft/TouchDevelop)
2015-02-05 00:46:17 +03:00
2015-02-04 22:52:51 +03:00
**This repo contains the source code of the TouchDevelop editor.** If you are
intending to write TouchDevelop scripts, you probably want to go to
`touchdevelop.com` :
2015-02-04 19:07:58 +03:00
* **stable:** https://www.touchdevelop.com/app
* **beta:** https://www.touchdevelop.com/app/beta
2015-02-04 22:52:51 +03:00
Other pages of interest:
* landing page: [https://www.touchdevelop.com ](https://www.touchdevelop.com )
* blog: [https://www.touchdevelop.com/blog ](https://www.touchdevelop.com/blog )
* Hour Of Code tutorials: [https://www.touchdevelop.com/hoc ](https://www.touchdevelop.com/hoc )
2015-02-04 19:07:58 +03:00
2015-02-04 22:48:06 +03:00
## What's in this repo?
2015-02-04 19:07:58 +03:00
The repo is mostly written in [Typescript ](http://www.typescriptlang.org/ ) with tiny pieces
of HTML gluing.
This repo contains the source code for:
* the browser client
* the compiler
* the editor
* the runtime
* the node.js client
2015-02-04 22:48:06 +03:00
However, you will not find the cloud backend code here. Indeed,
[https://www.touchdevelop.com ](https://www.touchdevelop.com ) takes care of
storing and managing the scripts.
2015-02-04 19:07:58 +03:00
2015-02-04 22:52:51 +03:00
## Contributing
2015-02-04 19:52:32 +03:00
2015-02-04 20:01:53 +03:00
There are many ways to [contribute ](https://github.com/Microsoft/TouchDevelop/blob/master/CONTRIBUTING.md ) to TouchDevelop.
2015-02-04 21:23:42 +03:00
* [submit bugs ](https://github.com/Microsoft/TouchDevelop/issues ) and help us verify fixes as they are checked in.
2015-02-04 22:52:51 +03:00
* review the [source code changes ](https://github.com/Microsoft/TouchDevelop/pulls )
2015-02-04 21:23:42 +03:00
* [contribute bug fixes or features ](https://github.com/Microsoft/TouchDevelop/blob/master/CONTRIBUTING.md ).
2015-02-04 22:52:51 +03:00
If you're not a developer but still would like to help, we've got more tasks for you!
2015-02-04 21:23:42 +03:00
2015-02-04 22:52:51 +03:00
* [help translate the user inferface ](https://touchdeveloptranslator.azurewebsites.net ): do you use TouchDevelop and speak a foreign language? You can help!
2015-02-04 19:52:32 +03:00
2015-02-04 22:48:06 +03:00
## Building
2015-02-04 19:07:58 +03:00
2015-02-04 19:52:32 +03:00
In order to build TouchDevelop, ensure that you have [Git ](http://git-scm.com/downloads ) and [Node.js ](http://nodejs.org/ ) installed.
Clone a copy of the repo:
git clone https://github.com/Microsoft/TouchDevelop.git
Change to the TouchDevelop directory:
cd TouchDevelop
2015-02-04 19:07:58 +03:00
2015-02-04 22:52:51 +03:00
Install dependencies:
2015-02-04 19:52:32 +03:00
2015-02-05 22:07:35 +03:00
npm install jake -g
2015-02-10 21:39:29 +03:00
npm install tsd@next -g
tsd reinstall
2015-02-04 19:07:58 +03:00
npm install
2015-02-04 22:52:51 +03:00
Build:
2015-02-04 19:07:58 +03:00
2015-02-10 05:56:43 +03:00
export TD_SOURCE_MAPS=1 # optional, will slow down your build
2015-02-04 19:07:58 +03:00
jake
2015-02-04 19:52:32 +03:00
2015-02-04 22:48:06 +03:00
## Running
2015-02-04 19:07:58 +03:00
2015-02-04 22:48:06 +03:00
After building, you can run TouchDevelop from a local node server by running:
2015-02-04 19:07:58 +03:00
2015-02-10 05:56:43 +03:00
jake local
The local instance can be accessed at `http://localhost:4242/editor/local/` .
2015-02-04 19:07:58 +03:00
2015-02-04 22:48:06 +03:00
## Tests
2015-02-04 19:07:58 +03:00
2015-02-04 22:48:06 +03:00
jake test
2015-02-04 22:52:51 +03:00
2015-02-05 21:50:41 +03:00
## Cleaning
2015-02-05 20:31:38 +03:00
2015-02-05 21:50:41 +03:00
jake clean
2015-02-05 20:31:38 +03:00
2015-02-04 22:52:51 +03:00
## Documentation
All the docs are available online at
[https://www.touchdevelop.com/docs ](https://www.touchdevelop.com/docs ).
The docs are authored as TouchDevelop scripts in TouchDevelop itself. You can
fork them and send pull requests from TouchDevelop itself to update them.
2015-02-06 19:37:03 +03:00
You can update the local cache of documents by running this command:
jake update-docs
2015-02-05 21:50:41 +03:00
## More handy commands
Our catch-all tool is `build/client.js` , which is compiled from
2015-02-06 01:29:38 +03:00
`tools/client.ts` . Some of the common invocations of `client.js` are
2015-02-05 21:50:41 +03:00
exposed as Jake targets.
# assumes TD_UPLOAD_KEY and TD_UPLOAD_USER are set, uploads a new test build
jake upload
Find out about other commands directly:
node build/client.js
The `client.js` is built by default.
2015-02-06 00:41:12 +03:00
2015-02-11 02:53:48 +03:00
## The various directories in the tree
2015-02-06 00:41:12 +03:00
* `ast` : contains the lexer, parser, type-checker and ast definitions for the
TouchDevelop language
* `browser` : feature-detection
* `editor` : the TouchDevelop user interface that drives the website: hub, script
list, editor itself
2015-02-06 01:29:38 +03:00
* `generated` : files needed for the build that are re-generated manually once in
a while
2015-02-06 00:41:12 +03:00
* `intellitrain` :
* `json` :
* `lib` : the libraries exposed to TouchDevelop scripts, written in TypeScript
2015-02-06 19:37:03 +03:00
* `libcordova` : Apache Cordova specific implementations
* `libnode` : Node.JS specific implementations
* `libwab` : WebAppBooster implementations, used by the Windows Phone client
* `libwinRT` : (deprecated) WinRT specific implementations
2015-02-06 00:41:12 +03:00
* `mc` : Minecraft bindings
2015-02-06 01:29:38 +03:00
* `noderunner` : runs in the cloud, and parses TouchDevelop scripts / compiles
2015-02-10 02:16:36 +03:00
them by responding to requests on `/api` .
2015-02-06 19:37:03 +03:00
* `node-webkit` : configuration files for the node-webkit app creation
* `officemix` : office mix app host
2015-02-06 00:41:12 +03:00
* `rt` : various run-time support libraries for the TouchDevelop application:
in-browser storage, cloud connection, promises, DOM utilities...
2015-02-06 01:29:38 +03:00
* `runner` : the run-time system for *generated* TouchDevelop apps; that is, once
a TouchDevelop script is packaged as an app (webapp, cordova app, etc.),
2015-02-06 02:15:13 +03:00
`runner.js` is the runtime system and the stub is in `webapp`
2015-02-10 02:16:36 +03:00
* `shell` : shell app used by Azure and node-webkit; basically a way to serve
files locally
2015-02-06 00:41:12 +03:00
* `storage` : code for syncing your locally-stored scripts and the cloud storage,
in the TouchDevelop application
2015-02-06 01:29:38 +03:00
* `tools` : internal tools that are part of the build (pre-processing)
2015-02-06 02:15:13 +03:00
* `webapp` : the stub file that is used to generate the HTML5 Web App when
exporting a script
2015-02-06 00:41:12 +03:00
* `www` : the base files that make up the TouchDevelop website (html and css)
2015-02-06 01:29:38 +03:00
### Structure of the generated website / app
When packaged, as the website or as an app, the directory structure is flat.
That is, the CSS and HTML files from `www/` as well as the generated `.js` files
from `build/` all end up in the same directory. That way, `index.html` can refer
to `main.js` without worrying.
2015-02-10 22:42:47 +03:00
When running locally (via `jake local` ), the local node server knows where to find
the right files to give the illusion that all files are in the `/editor/local/`
directory of the web server.
2015-02-06 20:47:55 +03:00
## LICENSE
The MIT License (MIT)
Copyright (c) 2015 Microsoft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.