• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript gulp-typescript.reporter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中gulp-typescript.reporter的典型用法代码示例。如果您正苦于以下问题:TypeScript reporter类的具体用法?TypeScript reporter怎么用?TypeScript reporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了reporter类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: error

gulp.task("scripts:ts", () => {
  let n_errors = 0

  function error(err: {message: string}) {
    gutil.log(err.message)
    n_errors++
  }

  const project = ts.createProject(join(paths.src_dir.coffee, "tsconfig.json"))
  const compiler = project
    .src()
    .pipe(sourcemaps.init())
    .pipe(project(ts.reporter.nullReporter()).on("error", error))

  const result = merge([
    compiler.js
      .pipe(sourcemaps.write("."))
      .pipe(gulp.dest(paths.build_dir.tree)),
    compiler.dts
      .pipe(gulp.dest(paths.build_dir.types)),
  ])

  result.on("finish", function() {
    if (argv.emitError && n_errors > 0) {
      gutil.log(`There were ${chalk.red("" + n_errors)} TypeScript errors.`)
      process.exit(1)
    }
  })

  return result
})
开发者ID:Zyell,项目名称:bokeh,代码行数:31,代码来源:scripts.ts


示例2: require

gulp.task("compiler:ts", () => {
  const error = (err: {message: string}) => gutil.log(err.message)
  const tsconfig = require(join(paths.src_dir.compiler, "tsconfig.json"))
  return gulp.src(join(paths.src_dir.compiler, "compile.ts"))
    .pipe(ts(tsconfig.compilerOptions, ts.reporter.nullReporter()).on('error', error))
    .pipe(gulp.dest(paths.build_dir.compiler))
})
开发者ID:alamont,项目名称:bokeh,代码行数:7,代码来源:compiler.ts


示例3: error

gulp.task("test:compile", () => {
  let n_errors = 0

  function error(err: {message: string}) {
    gutil.log(err.message)
    n_errors++
  }

  const project = ts.createProject("./test/tsconfig.json")
  const compiler = project
    .src()
    .pipe(project(ts.reporter.nullReporter()).on("error", error))

  const result = compiler
    .js
    .pipe(gulp.dest(join("./build", "test")))

  result.on("finish", function() {
    if (argv.emitError && n_errors > 0) {
      gutil.log(`There were ${chalk.red("" + n_errors)} TypeScript errors.`)
      process.exit(1)
    }
  })

  return result
})
开发者ID:Zyell,项目名称:bokeh,代码行数:26,代码来源:test.ts


示例4: error

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)),
  ])
})
开发者ID:jsalcal,项目名称:bokeh,代码行数:54,代码来源:scripts.ts


示例5: compile

export function compile({
  declarations = false,
  tsProjectOptions = {},
  tsProject,
  compilePaths = getCompilePaths(),
  outputDir = '.',
  definitionsDir = 'definitions',
  reporter = tsReporter.fullReporter(true)
}: {
  declarations?: boolean;
  tsProjectOptions?: any;
  tsProject?: any,
  compilePaths?: Array<string>;
  outputDir?: string;
  definitionsDir?: string;
  reporter?: any;
}) {
  log('------------------------------------------');
  log('===> Starting typescript compilation...');
  log('------------------------------------------');
  const startTime = new Date();
  const tsProjectToUse = tsProject || createTsProjectFromOptions({
      tsProjectOptions,
      declarations
    });

  const tsResult = src(compilePaths, {base: "."})
    .pipe(sourcemaps.init())
    .pipe(tsProjectToUse(reporter) as any);

  const jsFiles = tsResult.js
    .pipe(sourcemaps.write())
    .pipe(dest(outputDir))
    .on('error', (err) => {
      log('------------------------------------------');
      log('<=== Failed to compile sources. ' + err.stack);
      log('------------------------------------------');
    })
    .on('end', () => {
      const compilationTime = Math.round((new Date().getTime() - startTime.getTime()) / 1000 * 100) / 100;

      log('------------------------------------------');
      log(`<=== Typescript source compiling finished in ${compilationTime} sec.`);
      log('------------------------------------------');
    });

  const dtsFiles = tsResult.dts.pipe(
    dest(join(outputDir, definitionsDir))
  );

  return merge([jsFiles, dtsFiles]) as any;
}
开发者ID:netanelgilad,项目名称:bigg-typescript,代码行数:52,代码来源:compile.ts


示例6: error

gulp.task("scripts:ts", () => {
  const errors: string[] = []

  function error(err: {message: string}) {
    const text = stripAnsi(err.message)
    errors.push(text)

    const result = text.match(/(.*)(\(\d+,\d+\): error TS(\d+):.*)/)
    if (result != null) {
      const [, file, , code] = result
      if (is_partial(file)) {
        if (is_excluded(parseInt(code))) {
          if (!(argv.include && text.includes(argv.include)))
            return
        }
      }
    }

    if (argv.filter && !text.includes(argv.filter))
      return

    gutil.log(err.message)
  }

  const tsconfig = require(join(paths.src_dir.coffee, "tsconfig.json"))
  let compilerOptions = tsconfig.compilerOptions

  if (argv.es6) {
    compilerOptions.target = "ES6"
    compilerOptions.lib[0] = "es6"
  }

  const project = gulp
    .src(join(paths.src_dir.coffee, "**", "*.ts"))
    .pipe(sourcemaps.init())
    .pipe(ts(tsconfig.compilerOptions, ts.reporter.nullReporter()).on('error', error))

  const result = merge([
    project.js
      .pipe(sourcemaps.write("."))
      .pipe(gulp.dest(paths.build_dir.tree)),
    project.dts
      .pipe(gulp.dest(paths.build_dir.types)),
  ])
  result.on("finish", () => {
    fs.writeFileSync(join(paths.build_dir.js, "ts.log"), errors.join("\n"))
  })
  return result
})
开发者ID:FourtekIT-incubator,项目名称:bokeh,代码行数:49,代码来源:scripts.ts


示例7: require

import * as fs from "fs"
import {join} from "path"
import * as gulp from "gulp"
import * as gutil from "gulp-util"
import * as ts from 'gulp-typescript'
import * as run from 'run-sequence'
import {argv} from "yargs"

const BASE_DIR = "./examples"

const reporter = ts.reporter.nullReporter()

const compile = (name: string) => {
  const project = ts.createProject(join(BASE_DIR, name, "tsconfig.json"), {
    typescript: require('typescript')
  })
  return project.src()
   .pipe(project(reporter).on('error', (err: {message: string}) => gutil.log(err.message)))
   .pipe(gulp.dest(join(BASE_DIR, name)))
}

const examples: string[] = []

for(const name of fs.readdirSync("./examples")) {
  const stats = fs.statSync(join(BASE_DIR, name))
  if (stats.isDirectory() && fs.existsSync(join(BASE_DIR, name, "tsconfig.json"))) {
    examples.push(name)
    gulp.task(`examples:${name}`, () => compile(name))
  }
}
开发者ID:FourtekIT-incubator,项目名称:bokeh,代码行数:30,代码来源:examples.ts



注:本文中的gulp-typescript.reporter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript gulp-typings.default函数代码示例发布时间:2022-05-25
下一篇:
TypeScript gulp-typescript.default函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap