Ejemplo n.º 1
0
gulp.task(instrumenterJsPath, false, [servicesFile], () => {
    const settings: tsc.Settings = getCompilerSettings({
        outFile: instrumenterJsPath
    }, /*useBuiltCompiler*/ true);
    return gulp.src(instrumenterPath)
        .pipe(newer(instrumenterJsPath))
        .pipe(sourcemaps.init())
        .pipe(tsc(settings))
        .pipe(sourcemaps.write("."))
        .pipe(gulp.dest("."));
});
Ejemplo n.º 2
0
  gulp.task('tsc:jasmineHelper', () => {

    var tsResult = gulp.src(env.path.jasmine.helpers)
      .pipe(sourcemaps.init())
      .pipe(ts(tsConf));

    return merge([
      tsResult.dts.pipe(gulp.dest(`${env.dir.jasmine}`)),
      tsResult.js.pipe(sourcemaps.write()).pipe(gulp.dest(env.dir.tmpJasmine)),
    ]);
  });
Ejemplo n.º 3
0
gulp.task("scripts:tsjs", ["scripts:coffee", "scripts:js", "scripts:ts"], () => {
  function error(err: {message: string}) {
    const raw = stripAnsi(err.message)
    const result = raw.match(/(.*)(\(\d+,\d+\): error TS(\d+):.*)/)

    if (result != null) {
      const [, file, rest, code] = result
      const real = path.join('src', 'coffee', ...file.split(path.sep).slice(3))
      if (fs.existsSync(real)) {
        gutil.log(`${chalk.red(real)}${rest}`)
        return
      }

      // XXX: can't enable "6133", because CS generates faulty code for closures
      if (["2307", "2688", "6053"].indexOf(code) != -1) {
        gutil.log(err.message)
        return
      }
    }

    if (!argv.ts)
      return

    if (typeof argv.ts === "string") {
      const keywords = argv.ts.split(",")
      for (let keyword of keywords) {
        let must = true
        if (keyword[0] == "^") {
          keyword = keyword.slice(1)
          must = false
        }
        const found = err.message.indexOf(keyword) != -1
        if (!((found && must) || (!found && !must)))
          return
      }
    }

    gutil.log(err.message)
  }

  const tree_ts = paths.build_dir.tree_ts
  const project = gulp
    .src(`${tree_ts}/**/*.ts`)
    .pipe(sourcemaps.init())
    .pipe(ts(tsconfig.compilerOptions, ts.reporter.nullReporter()).on('error', error))

  return merge([
    project.js
      .pipe(sourcemaps.write("."))
      .pipe(gulp.dest(paths.build_dir.tree_js)),
    project.dts
      .pipe(gulp.dest(paths.build_dir.types)),
  ])
})
function compileTypeScriptFor(moduleType: string) {
  const options = project.plugin.outputs[moduleType].settings;
  const compile = createCompiler(options);

  return gulp
    .src(path.join(root, project.plugin.src, '**/*.ts'))
    .pipe(sourcemaps.init())
    .pipe(compile())
    .pipe(sourcemaps.write({ sourceRoot: project.plugin.src }))
    .pipe(gulp.dest(path.join(project.plugin.output, moduleType)));
}
Ejemplo n.º 5
0
gulp.task(run, false, [servicesFile], () => {
    const settings: tsc.Settings = getCompilerSettings({
        outFile: run
    }, /*useBuiltCompiler*/ true);
    return gulp.src(harnessSources)
        .pipe(newer(run))
        .pipe(sourcemaps.init())
        .pipe(tsc(settings))
        .pipe(sourcemaps.write(".", { includeContent: false, sourceRoot: "../../" }))
        .pipe(gulp.dest("."));
});
Ejemplo n.º 6
0
export = gulp.task('development:styles', () => {
  return gulp
    .src(paths.sources.styles)
    .pipe(sourcemaps.init())
      .pipe(sass())
      .pipe(autoprefixer(config.autoprefixer))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest(paths.output.styles))
    .on('error', errors)
    .pipe(browsersync.stream());
});
Ejemplo n.º 7
0
gulp.task(webhostJsPath, false, [servicesFile], () => {
    const settings: tsc.Settings = getCompilerSettings({
        outFile: webhostJsPath
    }, /*useBuiltCompiler*/ true);
    return gulp.src(webhostPath)
        .pipe(newer(webhostJsPath))
        .pipe(sourcemaps.init())
        .pipe(tsc(settings))
        .pipe(sourcemaps.write("."))
        .pipe(gulp.dest(path.dirname(webhostJsPath)));
});
Ejemplo n.º 8
0
gulp.task(word2mdJs, false, [], () => {
    const settings: tsc.Settings = getCompilerSettings({
        outFile: word2mdJs
    }, /*useBuiltCompiler*/ false);
    return gulp.src(word2mdTs)
        .pipe(newer(word2mdJs))
        .pipe(sourcemaps.init())
        .pipe(tsc(settings))
        .pipe(sourcemaps.write("."))
        .pipe(gulp.dest("."));
});
Ejemplo n.º 9
0
 gulp.task('tsc:e2e', () => {
   return gulp.src(env.path.spec.protractor)
     .pipe(sourcemaps.init())
     .pipe(ts({
       target: 'es5',
       module: "commonjs",
       noImplicitAny: true,
       moduleResolution: 'node',
     }))
     .pipe(sourcemaps.write())
     .pipe(gulp.dest(env.dir.tmpE2e));
 });
Ejemplo n.º 10
0
gulp.task('build:js', 'compile *.ts files into *.js files', ['build:tslint'], () => {
  var tsProject = tsProjectFn();

  var tsResult = gulp.src(PATH.src.ts)
    .pipe(printFiles())
    .pipe(sourcemaps.init())
    .pipe(tsc(tsProject));

  return tsResult.js
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest(PATH.dest.base));
});