本文整理汇总了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;未经允许,请勿转载。 |
请发表评论