From 765863e87aea725301d5f528b6de15bfa6022d46 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 14 Nov 2018 09:38:42 -0500 Subject: [PATCH] Add a simple doc generation tool. And website upload tool. --- tools/docs.py | 26 ++++++++++++++++++++++++++ tools/upload_website.py | 18 ++++++++++++++++++ website/app.js | 7 +++++++ website/index.html | 7 +++++-- website/rustdoc | 1 + website/typedoc | 1 + 6 files changed, 58 insertions(+), 2 deletions(-) create mode 100755 tools/docs.py create mode 100755 tools/upload_website.py create mode 120000 website/rustdoc create mode 120000 website/typedoc diff --git a/tools/docs.py b/tools/docs.py new file mode 100755 index 0000000000..00efd22c5b --- /dev/null +++ b/tools/docs.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# Copyright 2018 the Deno authors. All rights reserved. MIT license. +import os +import tempfile +from util import run, root_path + +target_path = os.path.join(root_path, "target/") + +os.chdir(root_path) + +# Builds into target/doc +run(["cargo", "doc", "--no-deps", "-vv"]) + +# 'deno --types' is stored in target/debug/gen/lib/lib.deno_runtime.d.ts +# We want to run typedoc on that declaration file only. +os.chdir(os.path.join(target_path, "debug/gen/lib/")) + +# You must have typedoc installed seprately. +# TODO Replace typedoc with something else ASAP. It's very awful. +run([ + "typedoc", "lib.deno_runtime.d.ts", "--out", + os.path.join(target_path, "typedoc"), "--entryPoint", "\"deno\"", + "--ignoreCompilerErrors", "--includeDeclarations", "--excludeExternals", + "--excludePrivate", "--excludeProtected", "--mode", "file", "--name", + "deno", "--theme", "minimal", "--readme", "none" +]) diff --git a/tools/upload_website.py b/tools/upload_website.py new file mode 100755 index 0000000000..5153d35aa3 --- /dev/null +++ b/tools/upload_website.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +# Copyright 2018 the Deno authors. All rights reserved. MIT license. +import os +import tempfile +from util import run, root_path + +# Probably run tools/docs.py first. +# AWS CLI must be installed separately. + +os.chdir(os.path.join(root_path, "website")) + +# Invalidate the cache. +run([ + "aws", "cloudfront", "create-invalidation", "--distribution-id", + "E3NZSZMS5TZ0OU", "--paths", "/*" +]) + +run(["aws", "s3", "sync", ".", "s3://deno.land/"]) diff --git a/website/app.js b/website/app.js index 6bf5194b15..d3b90b2974 100644 --- a/website/app.js +++ b/website/app.js @@ -182,6 +182,13 @@ function formatSecsAsMins(t) { * @param dataUrl The url of benchramk data json. */ export function drawCharts(dataUrl) { + // TODO Using window["location"]["hostname"] instead of + // window.location.hostname because when deno runs app_test.js it gets a type + // error here, not knowing about window.location. Ideally Deno would skip + // type check entirely on JS files. + if (window["location"]["hostname"] != "deno.github.io") { + dataUrl = "https://denoland.github.io/deno/" + dataUrl; + } drawChartsFromBenchmarkData(dataUrl); drawChartsFromTravisData(); } diff --git a/website/index.html b/website/index.html index b5357b6911..f56a312ee1 100644 --- a/website/index.html +++ b/website/index.html @@ -13,7 +13,9 @@

github.com/denoland/deno -

Docs +

Intro +

TypeScript API +

Rust API

Execution time

This shows how much time total it takes to run a few simple deno programs: @@ -58,7 +60,8 @@ diff --git a/website/rustdoc b/website/rustdoc new file mode 120000 index 0000000000..91ebb25e23 --- /dev/null +++ b/website/rustdoc @@ -0,0 +1 @@ +../target/doc/ \ No newline at end of file diff --git a/website/typedoc b/website/typedoc new file mode 120000 index 0000000000..eba22d9cad --- /dev/null +++ b/website/typedoc @@ -0,0 +1 @@ +../target/typedoc/ \ No newline at end of file