Generate API doc

This commit is contained in:
Alex Dima 2016-10-21 11:41:04 +02:00
parent 564d195403
commit 96d79c8180
2 changed files with 50 additions and 31 deletions

View file

@ -7,6 +7,7 @@ var fs = require('fs');
var rimraf = require('rimraf'); var rimraf = require('rimraf');
var cp = require('child_process'); var cp = require('child_process');
var httpServer = require('http-server'); var httpServer = require('http-server');
var typedoc = require("gulp-typedoc");
var WEBSITE_GENERATED_PATH = path.join(__dirname, 'website/playground/new-samples'); var WEBSITE_GENERATED_PATH = path.join(__dirname, 'website/playground/new-samples');
var MONACO_EDITOR_VERSION = (function() { var MONACO_EDITOR_VERSION = (function() {
@ -238,6 +239,7 @@ gulp.task('clean-website', function(cb) { rimraf('../monaco-editor-website', { m
gulp.task('website', ['clean-website'], function() { gulp.task('website', ['clean-website'], function() {
return ( return (
es.merge(
gulp.src('website/**/*', { dot: true }) gulp.src('website/**/*', { dot: true })
.pipe(es.through(function(data) { .pipe(es.through(function(data) {
if (!data.contents || !/\.(html)$/.test(data.path)) { if (!data.contents || !/\.(html)$/.test(data.path)) {
@ -253,7 +255,22 @@ gulp.task('website', ['clean-website'], function() {
this.emit('data', data); this.emit('data', data);
})) }))
.pipe(gulp.dest('../monaco-editor-website')) .pipe(gulp.dest('../monaco-editor-website')),
// node_modules\.bin\typedoc --mode file --out out src\monaco.d.ts --includeDeclarations --theme default --entryPoint monaco --name "Monaco Editor v0.7.0 API" --readme none --hideGenerator
gulp.src('monaco.d.ts')
.pipe(typedoc({
mode: 'file',
out: '../monaco-editor-website/api',
includeDeclarations: true,
theme: 'default',
entryPoint: 'monaco',
name: 'Monaco Editor API v' + MONACO_EDITOR_VERSION,
readme: 'none',
hideGenerator: true
}))
)
.pipe(es.through(function(data) { .pipe(es.through(function(data) {
this.emit('data', data); this.emit('data', data);
}, function() { }, function() {
@ -366,22 +383,22 @@ gulp.task('generate-test-samples', function() {
} }
var index = [ var index = [
'<!DOCTYPE html>', '<!DOCTYPE html>',
'<!-- THIS IS A GENERATED FILE VIA gulp generate-test-samples -->', '<!-- THIS IS A GENERATED FILE VIA gulp generate-test-samples -->',
'<html>', '<html>',
'<head>', '<head>',
' <base href="..">', ' <base href="..">',
'</head>', '</head>',
'<body>', '<body>',
'<a class="loading-opts" href="index.html">[&lt;&lt; BACK]</a><br/>', '<a class="loading-opts" href="index.html">[&lt;&lt; BACK]</a><br/>',
'THIS IS A GENERATED FILE VIA gulp generate-test-samples<br/><br/>', 'THIS IS A GENERATED FILE VIA gulp generate-test-samples<br/><br/>',
locations.map(function(location) { locations.map(function(location) {
return '<a class="loading-opts" href="playground.generated/' + location.path + '">' + location.name + '</a>'; return '<a class="loading-opts" href="playground.generated/' + location.path + '">' + location.name + '</a>';
}).join('<br/>\n'), }).join('<br/>\n'),
'<script src="../metadata.js"></script>', '<script src="../metadata.js"></script>',
'<script src="dev-setup.js"></script>', '<script src="dev-setup.js"></script>',
'</body>', '</body>',
'</html>', '</html>',
] ]
fs.writeFileSync(path.join(__dirname, 'test/playground.generated/index.html'), index.join('\n')); fs.writeFileSync(path.join(__dirname, 'test/playground.generated/index.html'), index.join('\n'));
}); });

View file

@ -18,13 +18,15 @@
"devDependencies": { "devDependencies": {
"event-stream": "^3.3.2", "event-stream": "^3.3.2",
"gulp": "^3.9.1", "gulp": "^3.9.1",
"gulp-typedoc": "^2.0.0",
"http-server": "^0.9.0", "http-server": "^0.9.0",
"monaco-css": "1.2.1", "monaco-css": "1.2.1",
"monaco-editor-core": "0.7.3", "monaco-editor-core": "0.7.3",
"monaco-json": "1.1.1",
"monaco-html": "1.1.0", "monaco-html": "1.1.0",
"monaco-json": "1.1.1",
"monaco-languages": "0.6.0", "monaco-languages": "0.6.0",
"monaco-typescript": "2.0.1", "monaco-typescript": "2.0.1",
"rimraf": "^2.5.2" "rimraf": "^2.5.2",
"typedoc": "^0.5.0"
} }
} }