From dcd2df2486e500a4b19de80337aa51a2ee25fd31 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Mon, 14 Sep 2015 15:44:19 -0700 Subject: [PATCH] build(gulp): add docs/angular.io/watch and docs/angular.io/copy tasks --- gulpfile.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/gulpfile.js b/gulpfile.js index 38f88574bf..57dcac7797 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -485,6 +485,32 @@ gulp.task('docs/angular.io', ['build/clean.docs_angular_io'], function() { } }); + +gulp.task('docs/angular.io/watch', function() { + watch(['modules/angular2/docs/**', 'modules/**/src/**'], ['docs/angular.io', 'docs/angular.io/copy']); +}); + + +gulp.task('docs/angular.io/copy', function(){ + var DOCS_DIRS = ['core', 'http', 'lifecycle_hooks', 'router', 'test']; + var DOCS_DIST = 'dist/angular.io/partials/api/angular2/'; + var DOCS_IO_DIST = '../angular.io/public/docs/js/latest/api/'; + + var fs = require('fs'); + var fse = require('fs-extra'); + + if (!fs.existsSync('../angular.io')) { + throw new Error('docs/angular.io-watch task requires the angular.io repo to be at ' + path.resolve('../angular.io')); + } + + DOCS_DIRS.forEach(function(dir) { + var distIODir = DOCS_IO_DIST + dir; + fse.removeSync(distIODir); + fse.copySync(DOCS_DIST + dir, DOCS_IO_DIST + dir); + }); +}); + + gulp.task('docs/typings', [], function() { try { var dgeni = new Dgeni([require('./docs/typescript-definition-package')]);