This commit is contained in:
Jonathan Protzenko 2015-02-05 14:41:57 -08:00
Родитель f4c3aaa720 57e02f3773
Коммит fb428eb79a
20 изменённых файлов: 51 добавлений и 367 удалений

Просмотреть файл

@ -152,8 +152,8 @@ mkSimpleTask('build/jsonapi.d.ts', [], "noderunner/jsonapi.ts");
mkSimpleTask('build/client.js', [
'rt/typings.d.ts',
'build/jsonapi.d.ts',
'nodeclient/client.ts'
], "nodeclient/client.ts");
'tools/client.ts'
], "tools/client.ts");
// XXX coarse-grained dependencies here over the whole 'noderunner' directory
mkSimpleTask('build/runner.js', [
'build/browser.d.ts',

Просмотреть файл

@ -94,7 +94,7 @@ fork them and send pull requests from TouchDevelop itself to update them.
## More handy commands
Our catch-all tool is `build/client.js`, which is compiled from
`nodeclient/client.ts`. Some of the common invocations of `client.js` are
`tools/client.ts`. Some of the common invocations of `client.js` are
exposed as Jake targets.
# assumes TD_UPLOAD_KEY and TD_UPLOAD_USER are set, uploads a new test build
@ -115,7 +115,8 @@ The `client.js` is built by default.
* `browser`: feature-detection
* `editor`: the TouchDevelop user interface that drives the website: hub, script
list, editor itself
* `generated`: files needed for the build that are re-generated manually
* `generated`: files needed for the build that are re-generated manually once in
a while
* `intellitrain`:
* `json`:
* `lib`: the libraries exposed to TouchDevelop scripts, written in TypeScript
@ -124,15 +125,29 @@ The `client.js` is built by default.
* `libwab`:
* `libwinRT`:
* `mc`: Minecraft bindings
* `nodeclient`: our multi-purpose local tool
* `noderunner`: local node server for running TouchDevelop locally
* `noderunner`: runs in the cloud, and parses TouchDevelop scripts / compiles
them; as an accident, it is also used to run a local node server when
developing
* `node-webkit`:
* `officemix`:
* `rt`: various run-time support libraries for the TouchDevelop application:
in-browser storage, cloud connection, promises, DOM utilities...
* `runner`:
* `runner`: the run-time system for *generated* TouchDevelop apps; that is, once
a TouchDevelop script is packaged as an app (webapp, cordova app, etc.),
`runner.html` is the entry point
* `shell`:
* `storage`: code for syncing your locally-stored scripts and the cloud storage,
in the TouchDevelop application
* `tools`: internal tools that are part of the build (pre-processings)
* `tools`: internal tools that are part of the build (pre-processing)
* `www`: the base files that make up the TouchDevelop website (html and css)
### 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.
When running locally (via `jake run`), the local node server knows where to find
the right files to give the illusion that all files are at the root `/` of the
web server.

Просмотреть файл

Просмотреть файл

@ -1498,10 +1498,14 @@ function getMime(filename:string)
function serveFile(filename:string, resp:http.ServerResponse)
{
// When running locally, we resolve "foo.js" to "build/foo.js", since all
// our js files are in that folder.
if (filename.substr(filename.length - 3, 3) == ".js")
// When running locally, we must give the illusion of a flat directory
// structure, since that's what we have *once we're packaged*. However,
// because no packaging happened yet, we must figure out where to find the
// files. It's easy: js files are in [build/] and the rest is in [www/].
if (filename != "worker.js" && filename.substr(filename.length - 3, 3) == ".js")
filename = "build/"+filename;
else
filename = "www/"+filename;
// Furthermore, once compiled, we sit as "build/noderunner.js", so
// __dirname+"../" is the root directory.
var fn = path.resolve(path.join(__dirname, ".."), filename)
@ -1582,10 +1586,11 @@ function reportBug(ctx: string, err: any) {
function startServer(port:number)
{
var allowed = ['css', 'tutorial', 'json', 'icons', "webapp", "testing", "vueplot",
var allowed = ['tutorial', 'json', 'icons', 'webapp.html',
'index.html',
'browser.js', 'main.js', 'favicon.ico', "worker.js", "runtime.js", "cordova.js",
'browsers.html', 'results.html', 'error.html', 'landing.html', 'hoc.html'
'browsers.html', 'error.html', 'landing.html', 'hoc.html',
'default.css', 'editor.css',
];
http.createServer((req, resp) => {

Просмотреть файл

@ -1,80 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<meta name="Description" content=""/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no"/>
<meta property="og:title" content=""/>
<meta property="og:site_name" content="TouchDevelop"/>
<meta property="og:type" content="game" />
<meta property="og:description" content="" />
<meta property="og:image" content="" />
<meta property="og:url" content="" />
<meta name="mobile-web-app-capable" content="yes">
</head>
<body id="root">
<style type="text/css">
@import url("./css/default.css");
</style>
<div id="loading" style="width: 200px; margin: 150px auto 0 auto; text-align: center; color: #81e774; font-family: sans-serif; ">
<div id="loadingDot" style="font-size: 18px;margin-top:-10px">we need JavaScript enabled</div>
<div id='progressContainer' style='margin-top:20px;height:3px;width:200px; background:#eee;'>
<div id='progressBar' style='height:3px; width:0px; background:#81e774'></div>
</div>
<div style="margin-top: 1em; font-size:12px;" id="statusMsg"></div>
</div>
<script type="text/javascript">
var browsersUrl = "browsers.html";
var errorUrl = "error.html";
var mainJsName = "./runtime.js";
var userId = "";
var userName = "";
var webAppName = "";
var webAppGuid = "";
var webAppPublicationId = "";
var rootUrl = "https://www.touchdevelop.com";
if (/debugLocal/.test(document.URL)) rootUrl = "http://localhost:7777";
var webRunner = true;
(function() {
var e = document.getElementById("loadingDot");
if (e) {
e.innerHTML = 'just a moment';
}
}());
(function() {
var ratio = 0.97
var curr = 195 / (1 / (1 - ratio))
var sum = 0
function updatePbar() {
var pbar = document.getElementById("progressBar");
if (!pbar) return;
sum += curr
curr *= ratio
pbar.style.width = sum + "px"
setTimeout(updatePbar, 200)
}
updatePbar();
}());
function statusMsg(m) {
if (/debugMsg/.test(document.URL)) {
var e = document.getElementById("statusMsg");
if (e) e.innerHTML = m;
}
}
</script>
<!--CORDOVA <script src="cordova.js" type="text/javascript"></script> -->
<script src="js/browser.js" type="text/javascript"></script>
<script type="text/javascript">
TDev.Browser.check(true);
</script>
<script src="js/precompiled.js" type="text/javascript"></script>
<script src="js/runtime.js" type="text/javascript"></script>
<script src="js/apikeys.js" type="text/javascript"></script>
</body>
</html>

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -44,7 +44,7 @@ var addPrefixToContent = (pref:string, cont:string) =>
});
echo("*** START CSS");
forEachFile("../css", function (s) {
forEachFile("../www", function (s) {
var bn = s.replace(/\.css$/, "");
if (bn == s) return;

Просмотреть файл

@ -1463,7 +1463,7 @@ var scriptsCache:any;
function getScript(id:string)
{
if (!scriptsCache) {
var f = fs.readFileSync('scripts.cache', 'utf-8');
var f = fs.readFileSync('generated/scripts.cache', 'utf-8');
var fj = JSON.parse('{' + f + ' "theEnd": {} }');
delete fj.theEnd;
scriptsCache = fj;
@ -1508,7 +1508,7 @@ function downloadScript(arg:string, f:(s:string) => void)
function save(text) {
if (!scriptsCache[arg]) {
scriptsCache[arg] = text;
fs.appendFileSync('scripts.cache', '"' + arg + '": ' + JSON.stringify(text) + ",\n", "utf-8");
fs.appendFileSync('generated/scripts.cache', '"' + arg + '": ' + JSON.stringify(text) + ",\n", "utf-8");
}
f(text);
}
@ -3421,13 +3421,13 @@ function tdupload(args:string[])
"build/runtime.js",
"build/browser.js",
"build/noderunner.js",
"css/default.css",
"css/editor.css",
"index.html",
"browsers.html",
"app.manifest",
"webapp.html",
"error.html",
"www/default.css",
"www/editor.css",
"www/index.html",
"www/browsers.html",
"www/app.manifest",
"webapp/webapp.html",
"www/error.html",
"build/touchdevelop.tgz",
]
@ -3445,7 +3445,7 @@ function tdupload(args:string[])
url += "&contentType=" + encodeURIComponent(mime)
tdevGet(url, (resp) => {
console.log(path + ": " + resp)
console.log(fileName + ": " + resp)
}, 1, data)
})
})
@ -3686,7 +3686,7 @@ export function main()
var d = cmds[cmd]
d.f(args);
} else {
console.log("USAGE: node nodeclient.js [URL] COMMAND [ARGUMENTS...]");
console.log("USAGE: node build/client.js [URL] COMMAND [ARGUMENTS...]");
console.log("URL defaults to %s", localUrl);
console.log("Commands:");
Object.keys(cmds).forEach((cmd) => {

Просмотреть файл

@ -370,13 +370,14 @@ export function genStubs()
processFile(path.join(libPath, fn));
})
var srcPaths = ["lib", "rt", "storage", "ast", "editor", "libwab", "libwinRT", "libnode", "nodeclient"]
var srcPaths = ["lib", "rt", "storage", "ast", "editor", "libwab", "libwinRT", "libnode"]
srcPaths.forEach(pth => {
fs.readdirSync("../" + pth).forEach((fn) => {
fileCnt++;
processLf(path.join("../" + pth, fn));
})
})
});
processLf("../tools/client.ts");
Object.keys(translationHelpStrings).forEach(k => translationStrings[k] = 1)
var tr = Object.keys(translationStrings)
@ -392,7 +393,7 @@ export function genStubs()
helpDefinitions += "TDev.api.addHelpTopics(" + loadText("../generated/help.cache") + ")\n\n";
helpDefinitions += "TDev.AST.Json.docs = " + JSON.stringify(loadText("../ast/jsonInterfaces.ts").replace(/\r/g, "")) + ";\n";
helpDefinitions += "TDev.webappHtml = " + JSON.stringify(loadText("../webapp.html").replace(/\r/g, "")) + ";\n";
helpDefinitions += "TDev.webappHtml = " + JSON.stringify(loadText("../webapp/webapp.html").replace(/\r/g, "")) + ";\n";
saveText("api.js", prelude + kindInit + interlude + parametricInit + parametricFinal + propInit + helpDefinitions + postlude);
fs.writeFileSync("topiclist.json", JSON.stringify(topicList, null, 2))

Просмотреть файл

151
win8.html
Просмотреть файл

@ -1,151 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>TouchDevelop</title>
<!-- WinJS references -->
<script src="//Microsoft.WinJS.2.0/js/base.js"></script>
<script src="//Microsoft.WinJS.2.0/js/ui.js"></script>
<!-- Microsoft.TouchDevelop.Win8App references -->
<link rel="stylesheet" href="/css/default.css" />
<link rel="stylesheet" href="/css/editor.css" />
</head>
<body id="realRoot">
<div id="root">
<div id="loading" style="width: 200px; margin: 150px auto 0 auto; text-align: center; color: #81e774; font-family: sans-serif; ">
<svg style="width:200px;height:200px;" viewBox='0 0 480 480' preserveAspectRatio='xMinYMin' xmlns='http://www.w3.org/2000/svg' >
<path fill='#81E774' d='M 331,233C 284,233 245,195 245,147C 245,100 284,62 331,62C 378,62 417,100 417,147C 417,195 378,233 331,233 Z M 331,223C 373,223 406,189 406,147C 406,105 373,72 331,72C 289,72 255,105 255,147C 255,189 289,223 331,223 Z M 294,188L 297,173L 309,186L 294,188 Z M 316,183L 299,166L 343,122L 360,139L 316,183 Z M 364,136L 347,118L 350,115L 351,114C 356,109 363,110 368,114C 372,119 373,126 368,131L 367,132L 364,136 Z M 147,418C 100,418 62,379 62,332C 62,285 100,246 147,246C 194,246 233,285 233,332C 233,379 194,418 147,418 Z M 147,408C 189,408 223,374 223,332C 223,290 189,256 147,256C 105,256 72,290 72,332C 72,374 105,408 147,408 Z M 181,332L 130,370L 130,293L 181,332 Z M 331,417C 284,417 245,379 245,331C 245,284 284,246 331,246C 378,246 417,284 417,331C 417,379 378,417 331,417 Z M 331,407C 373,407 406,373 406,331C 406,290 373,256 331,256C 289,256 255,290 255,331C 255,373 289,407 331,407 Z M 320,356C 319,356 317,356 316,354C 315,353 314,352 314,350C 314,349 315,347 316,346C 317,345 319,344 320,344C 322,344 324,345 325,346C 326,347 327,349 327,350C 327,352 326,353 325,354C 324,356 322,356 320,356 Z M 320,321C 319,321 317,320 316,319C 315,318 314,316 314,315C 314,313 315,312 316,310C 317,309 319,309 320,309C 322,309 324,309 325,310C 326,312 327,313 327,315C 327,316 326,318 325,319C 324,320 322,321 320,321 Z M 341,370L 332,370C 342,359 346,346 346,331C 346,316 342,303 332,291L 341,291C 351,302 355,315 355,331C 355,346 351,359 341,370 Z M 147,233C 100,233 62,195 62,147C 62,100 100,62 147,62C 194,62 233,100 233,147C 233,195 194,233 147,233 Z M 147,223C 189,223 223,189 223,147C 223,105 189,72 147,72C 105,72 72,105 72,147C 72,189 105,223 147,223 Z M 150,160C 133,160 120,147 120,131C 120,115 133,102 150,102C 166,102 179,115 179,131C 179,147 166,160 150,160 Z M 150,152C 150,152 151,152 152,152L 158,132L 141,132L 147,152C 148,152 149,152 150,152 Z M 171,131C 171,119 162,109 150,109C 138,109 128,119 128,131C 128,140 133,148 141,151L 135,130L 135,129L 135,129C 135,129 135,128 136,128C 136,128 136,127 136,127C 137,127 137,127 137,127L 138,127L 161,127L 162,127L 162,127L 163,127L 163,128L 164,128C 164,128 164,129 164,129C 164,129 164,130 164,130L 158,151C 166,148 171,140 171,131 Z M 135,168L 135,163L 164,163L 164,166L 135,168 Z M 135,170L 164,168L 164,172L 135,174L 135,170 Z M 135,176L 164,174L 164,178L 136,180L 135,176 Z M 136,182L 141,181L 159,180L 163,180L 163,180L 163,182C 162,182 162,183 161,184C 161,185 160,186 159,187C 158,188 157,189 155,189C 153,190 152,191 150,191C 149,191 148,191 146,190C 145,190 144,190 143,189C 142,189 141,188 140,187C 139,186 138,186 138,185C 137,184 137,183 136,182L 136,182L 136,182 Z '></path>
</svg>
<div id="loadingDot" style="font-size: 18px;margin-top:-10px">we need JavaScript enabled</div>
<div id='progressContainer' style='margin-top:20px;height:3px;width:200px; background:#eee;'>
<div id='progressBar' style='height:3px; width:0px; background:#81e774'></div>
</div>
<div style="margin-top: 1em; font-size:12px;" id="statusMsg"></div>
</div>
<div id='scriptHolder'></div>
<script type="text/javascript">
// these are used in the included JS files
var browsersUrl = "browsers.html";
var errorUrl = "error.html";
var mainJsName = "./main.js";
var betaFriendlyId = "";
var rootUrl = "https://www.touchdevelop.com";
var TDev;
(function () {
var e = document.getElementById("loadingDot");
if (e) {
e.innerHTML = 'just a moment';
}
}());
(function () {
var ratio = 0.97
var curr = 195 / (1 / (1 - ratio))
var sum = 0
function updatePbar() {
var pbar = document.getElementById("progressBar");
if (!pbar) return;
sum += curr
curr *= ratio
pbar.style.width = sum + "px"
setTimeout(updatePbar, 200)
}
updatePbar();
}());
function statusMsg(m) {
console.log(m);
}
var TDev;
statusMsg("js initialized");
</script>
<style type="text/css">
@import url("./css/default.css");
@import url("./css/editor.css");
</style>
<script type="text/javascript"> statusMsg("css imported"); </script>
<script src="./browser.js" type="text/javascript"></script>
<script type="text/javascript">
statusMsg("browser detector loaded");
TDev.Browser.check(true);
statusMsg("browser detector finished");
</script>
<script id='mainScript' src="./main.js" type="text/javascript"></script>
<script type="text/javascript">
var app = WinJS.Application;
var appModel = Windows.ApplicationModel;
/*
TDev.Cloud.getAccessToken = function(){
var vault = new Windows.Security.Credentials.PasswordVault();
try {
var credential = vault.retrieve(Cloud.getServiceUrl(), "win8app");
if (!!credential)
return credential.password;
} catch (err) { }
return undefined;
};
TDev.Cloud.setAccessToken = function(token) {
var vault = new Windows.Security.Credentials.PasswordVault();
if (!!token) {
var credential = new Windows.Security.Credentials.PasswordCredential(Cloud.getServiceUrl(), "win8app", token);
vault.add(credential);
}
else {
try {
var credential = vault.retrieve(Cloud.getServiceUrl(), "win8app");
if (!!credential)
vault.remove(credential);
} catch (err) { }
}
};
*/
TDev.Intro.Name = "Early App Preview for Windows 8";
TDev.Intro.Where = "in the app";
TDev.Intro.Limitation = "Your device does not report to have";
app.onactivated = function (eventObject) {
if (eventObject.detail.kind === appModel.Activation.ActivationKind.launch) {
if (eventObject.detail.previousExecutionState !== appModel.Activation.ApplicationExecutionState.terminated) {
TDev.initAsync().done();
TDev.RT.WinRT.ShareManagerWinRT.init();
// TODO: This application has been newly launched. Initialize
// your application here.
} else {
// TODO: This application has been reactivated from suspension.
// Restore application state here.
}
WinJS.UI.processAll();
} else if (eventObject.detail.kind === appModel.Activation.ActivationKind.shareTarget) {
var so = eventObject.detail.shareOperation;
if (so.data.contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.text)) {
so.data.getTextAsync().then(function (text) {
if (text !== null) {
sharedText = text;
snapView = true;
onWallClose = function () { so.reportCompleted(); }
initAsync().done();
}
}).done();
}
}
};
// print charm handled in printmanager
app.oncheckpoint = function (ev) {
// TODO: This application is about to be suspended. Save any state
// that needs to persist across suspensions here. You might use the
// WinJS.Application.sessionState object, which is automatically
// saved and restored across suspension. If you need to complete an
// asynchronous operation before your application is suspended, call
// eventObject.setPromise().
if (!!TDev.TheEditor) eventObject.setPromise(TDev.TheEditor.saveStateAsync());
};
app.start();
</script>
</div>
</body>
</html>

Просмотреть файл

@ -3,8 +3,8 @@ CACHE MANIFEST
CACHE:
./main.js
./browser.js
./css/default.css
./css/editor.css
./default.css
./editor.css
# this is worker.js file; it will likely not change and it needs to sit under td.com domain, not on cdn
https://www.touchdevelop.com/app/?releaseid=2519967637668242448-920d9e58.a88e.4fa8.bcd1.9be5ba29da9f-workerjs

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 15 KiB

После

Ширина:  |  Высота:  |  Размер: 15 KiB

Просмотреть файл

Просмотреть файл

Просмотреть файл