當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript gulp-typescript.createProject函數代碼示例

本文整理匯總了TypeScript中gulp-typescript.createProject函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript createProject函數的具體用法?TypeScript createProject怎麽用?TypeScript createProject使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了createProject函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: 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

示例2: function

gulp.task('compile-project', function () {
    var opts = {
        basedir: config.paths.app,
        debug: true
    };
    var streamFinished = function () {
        gutil.log('End stream');
    };
    var entry = config.paths.app + '/main.ts';
    var fileName = path.basename(entry, path.extname(entry)) + ".js";

    var project = ts.createProject('tsconfig_m.json', {
        outFile: fileName
    });

    var tsResult = project.src()
        .pipe(project())
        .pipe(wrap({ src: 'template.txt' }))
        .pipe(gulp.dest(config.paths.pub))
        .pipe(rename({ suffix: '.debug' }))
        .pipe(gulp.dest(config.paths.pub))
        .pipe(uglify())
        .pipe(rename(fileName))
        .pipe(gulp.dest(config.paths.pub))
        .on('end', streamFinished);
});
開發者ID:alekspolitov,項目名稱:TypeScriptTest,代碼行數:26,代碼來源:gulpfile.ts

示例3: require

gulp.task('karma:build', () => {
  const typescript = require('gulp-typescript');
  const sourcemaps = require('gulp-sourcemaps');
  const tplinline = require('gulp-inline-ng2-template');
  const errors = require('../utils/errors');
  const paths = require('../config/paths');

  const config = {
    typescript: require('../config/typescript'),
    tplinline: require('../config/tplinline')
  };

  const tsProject = typescript.createProject(paths.typescript.appConfig, config.typescript);

  return gulp
    .src([
      paths.typings,
      paths.sources.scripts,
      '!' + paths.sources.bootstrap,
      '!' + paths.scripts.tests.e2e
    ])
    .pipe(sourcemaps.init())
      .pipe(tplinline(config.tplinline))
      .pipe(typescript(tsProject))
      .js
    .pipe(sourcemaps.write())
    .on('error', errors)
    .pipe(gulp.dest(paths.output.app));
});
開發者ID:mogusbi,項目名稱:ts-starter,代碼行數:29,代碼來源:karma.ts

示例4: compile

function compile(isRelease: boolean) {
    var tsProject = ts.createProject({
        removeComments: true,  // Do not emit comments to output.
        //noImplicitAny: false,  // Warn on expressions and declarations with an implied 'any' type.
        //noLib: false,  // Don't include the default lib (with definitions for - Array, Date etc)
        //noEmitOnError: false,  // Do not emit outputs if any type checking errors were reported.
        //target: "ES3",  // Specify ECMAScript target version: 'ES3' (default), 'ES5' or 'ES6'.
        //module: "",  // Specify module code generation: 'commonjs' or 'amd'
        //sourceRoot: "",  // Specifies the location where debugger should locate TypeScript files instead of source locations.
        declarationFiles: false,  // Generates corresponding .d.ts files.
        noExternalResolve: false,  // Do not resolve files that are not in the input. Explanation below.
        sortOutput: true,  // Sort output files. Usefull if you want to concatenate files (see below).
    });


    var tsResult = gulp.src(srcGlob)
        .pipe(ts(tsProject, { referencedFrom: ['Application.ts'] }));

    return tsResult.js
        .pipe(concat('app.js'))
        //.pipe(ngAnnotate())
        //.pipe(gulpIf(isRelease, uglify()))
        //.pipe(uglify())
        .pipe(gulp.dest('Chokaigi2015/html/js'));
}
開發者ID:yuhki50,項目名稱:pepper-chokaigi2015,代碼行數:25,代碼來源:typescript.ts

示例5: 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

示例6: build

function build(path: string[]): Promise<any> {
  // TODO: remove this if it every works in watch mode without needing to re-create.
  let project = gulpTs.createProject('tsconfig.json', {
    typescript: require('typescript'),
    rootDir: 'modules'
  });
  let output = gulp.src(path)
    .pipe(gulpTs(project));
  // Using a promise instead of merging streams since end
  // event on streams seems not to be propagated when merged.
  return new Promise((resolve) => {
    var doneCount = 0;
    output.js
      .pipe(rename(buildUtils.stripSrcFromPath))
      .pipe(gulp.dest('dist'))
      .on('end', maybeDone),
    output.dts
      .pipe(rename(buildUtils.stripSrcFromPath))
      .pipe(gulp.dest('dist'))
      .on('end', maybeDone)

    function maybeDone() {
      doneCount++;
      if (doneCount == 2) resolve();
    }
  })

}
開發者ID:Zeniagromoff,項目名稱:universal,代碼行數:28,代碼來源:gulpfile.ts

示例7:

g.task('ts', () => {
    const tsProject = ts.createProject('tsconfig.json')
    g.src('src/**/*.ts')
        .pipe(sourcemaps.init())
        .pipe(tsProject())
        .pipe(sourcemaps.write('.'))
        .pipe(g.dest('build'))
})
開發者ID:MiYogurt,項目名稱:nl-gulp-imovie,代碼行數:8,代碼來源:gulpfile.ts

示例8: require

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)))
}
開發者ID:FourtekIT-incubator,項目名稱:bokeh,代碼行數:8,代碼來源:examples.ts

示例9: compileBundles

    // -------------------------------------------------------------------------
    // Packaging and Publishing tasks
    // -------------------------------------------------------------------------

    /**
     * Compiles and compiles bundles.
     */
    @MergedTask()
    compileBundles() {
        const amdTsProject = ts.createProject("tsconfig.json", {
            module: "amd",
            outFile: packageName + ".amd.js",
            typescript: require("typescript")
        });
        const systemTsProject = ts.createProject("tsconfig.json", {
            module: "system",
            outFile: packageName + ".system.js",
            typescript: require("typescript")
        });
        const amdPureTsProject = ts.createProject("tsconfig.json", {
            module: "amd",
            outFile: packageName + ".pure.amd.js",
            noEmitHelpers: true,
            noImplicitUseStrict: true,
            typescript: require("typescript")
        });
        const systemPureTsProject = ts.createProject("tsconfig.json", {
            module: "system",
            outFile: packageName + ".pure.system.js",
            noEmitHelpers: true,
            noImplicitUseStrict: true,
            typescript: require("typescript")
        });

        return [
            gulp.src("build/bundle/**/*.ts")
                .pipe(amdTsProject()).js
                .pipe(gulp.dest("build/package")),

            gulp.src("build/bundle/**/*.ts")
                .pipe(systemTsProject()).js
                .pipe(gulp.dest("build/package")),

            gulp.src("build/bundle/**/*.ts")
                .pipe(amdPureTsProject()).js
                .pipe(gulp.dest("build/package")),

            gulp.src("build/bundle/**/*.ts")
                .pipe(systemPureTsProject()).js
                .pipe(gulp.dest("build/package"))
        ];
    }
開發者ID:IrieLabs,項目名稱:ngx-popover,代碼行數:52,代碼來源:gulpfile.ts

示例10: function

gulp.task('build:server', function () {
    var tsProject = tsc.createProject('server/tsconfig.json');
    var tsResult = gulp.src('server/src/**/*.ts')
        .pipe(sourcemaps.init())
        .pipe(tsc(tsProject))
    return tsResult.js
        .pipe(sourcemaps.write())
        .pipe(gulp.dest('dist/server'))
});
開發者ID:ppbustamante,項目名稱:Angular2-Express-MongoDB-Typescript-Gulp,代碼行數:9,代碼來源:gulpfile.ts


注:本文中的gulp-typescript.createProject函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。