aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/tensorboard/gulpfile.js
blob: 4b9215281897fa95fa1c339651d3be8a2e4aed29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

var gulp = require('gulp');
var server = require('gulp-server-livereload');
var minimist = require('minimist');

var options = minimist(process.argv.slice(2), {
  default: {
    p: 8000,  // port for gulp server
    h: '0.0.0.0', // host to serve on
  }
});

function getTask(task) {
    return require('./gulp_tasks/' + task);
}


gulp.task('compile', getTask('compile'));
gulp.task('tslint', getTask('tslint')(true));
// tslint.permissive warns without failing.
gulp.task('tslint.permissive', getTask('tslint')(false));
gulp.task('first-compile', getTask('compile'));
gulp.task('test.onlytest', getTask('test')); // if you don't want to lint, etc
gulp.task('test', ['tslint', 'compile'], getTask('test'));

gulp.task('watch', [], function() {
  // Avoid watching generated .d.ts in the build (aka output) directory.
  return gulp.watch(
      ['components/tf-*/**/*.ts', 'components/vz-*/**/*.ts'],
      {ignoreInitial: true}, ['compile', 'tslint.permissive']);
});


// Do first-compile before turning on server, to avoid spamming
// livereload info
// TODO(danmane): Disconnect this once we can get livereload to
// no longer spam.
gulp.task('server', ['first-compile'], function() {
  gulp.src('.').pipe(server({
    host: options.h,
    port: options.p,
    livereload: {
      enable: true,
      // Don't livereload on .ts changes, since they aren't loaded by browser.
      filter: function(filePath, cb) { cb(!(/\.ts$/.test(filePath))); },
      port: 27729 + options.p
    },
    directoryListing: true,
  }));
});

// TODO(danmane): When testing is nicer, integrate into vulcanize task
// gulp vulcanize: Regenerate the tf-tensorboard.html.OPENSOURCE file for pre-release
gulp.task('vulcanize', ['first-compile', 'tslint.permissive'], getTask('vulcanize')(false));
// gulp regenerate: Regenerate the tf-tensorboard.html for interactive bazel development
gulp.task('regenerate', ['first-compile', 'tslint.permissive'], getTask('vulcanize')(true));

// TODO(danmane): consider making bower install part of default task
gulp.task('default', ['watch', 'server']);

// Clean all compiled JS files.
var cleanCompiledTypeScript = require('gulp-clean-compiled-typescript');
gulp.task('clean', function () {
  return gulp.src(['./components/**/*.ts', '!./components/**/deps.d.ts'])
      .pipe(cleanCompiledTypeScript());
});