How to use gulp-typescript - 10 common examples

To help you get started, we’ve selected a few gulp-typescript examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SharePoint / PnP-JS-Core / buildtasks / package.js View on Github external
function packageDefinitions() {

    console.log(global.TSDist.RootFolder + "/" + global.TSDist.DefinitionFileName);

    var src = global.TSWorkspace.Files.slice(0);

    // create a project specific to our typings build and specify the outFile. This will result
    // in a single pnp.d.ts file being creating and piped to the typings folder
    var typingsProject = tsc.createProject('tsconfig.json', { "declaration": true, "outFile": "pnp.js", "removeComments": false, "module": "system" });

    return gulp.src(src)
        .pipe(typingsProject())
        .dts.pipe(gulp.dest(global.TSDist.RootFolder));
}
github dsherret / server-bridge / gulpfile.js View on Github external
gulp.task("typescript", ["clean-scripts"], function() {
    var tsProject = ts.createProject("tsconfig.json", {
        typescript: require("typescript")
    });

    return gulp.src(["./src/**/*.ts", "!src/tests/**/resources/*.ts"])
        .pipe(sourcemaps.init())
        .pipe(ts(tsProject))
        .pipe(replace(/(}\)\()(.*\|\|.*;)/g, '$1/* istanbul ignore next */$2'))
        .pipe(replace(/(var __extends = \(this && this.__extends\))/g, '$1/* istanbul ignore next */'))
        .pipe(replace(/(if \(!exports.hasOwnProperty\(p\)\))/g, '/* istanbul ignore else */ $1'))
        // ignore empty constructors (for mixins and static classes)
        .pipe(replace(/(function [A-Za-z]+\(\) {[\s\n\t]+})/g, '/* istanbul ignore next */ $1'))
        .pipe(sourcemaps.write("./"))
        .pipe(gulp.dest("./dist"));
});
github dsherret / ts-nameof / gulpfile.js View on Github external
gulp.task("typescript", ["clean-scripts"], function() {
    var tsProject = ts.createProject("tsconfig.json", {
        typescript: require("typescript")
    });

    return gulp.src(["./src/typings/**/*.d.ts", "./src/**/*.ts", "./ts-nameof.d.ts", "!./src/tests/definitionFileTests.ts"])
        .pipe(sourcemaps.init())
        .pipe(ts(tsProject))
        .pipe(replace(/(}\)\()(.*\|\|.*;)/g, '$1/* istanbul ignore next */$2'))
        .pipe(replace(/(var __extends = \(this && this.__extends\))/g, '$1/* istanbul ignore next */'))
        .pipe(replace(/(if \(!exports.hasOwnProperty\(p\)\))/g, '/* istanbul ignore else */ $1'))
        // ignore empty constructors (for mixins and static classes)
        .pipe(replace(/(function [A-Za-z]+\(\) {[\s\n\t]+})/g, '/* istanbul ignore next */ $1'))
        .pipe(sourcemaps.write("./"))
        .pipe(gulp.dest("./dist"));
});
github DevartSoftware / tmetric-plugins / gulpfile.js View on Github external
gulp.task('compile:ts', () => {
    var ts = require('gulp-typescript'); // TypeScript compiler for gulp.js
    var project = ts.createProject('./src/tsconfig.json');
    var files = project.config.files.map(path => src + path);
    return gulp.src(files, { base: src }).pipe(project()).pipe(gulp.dest(src));
});
github brn / fuel / gulpfile.js View on Github external
function typescript(srcs = [], useSourcemaps = false) {
  const tsc = require('gulp-typescript');
  const sourceMaps = require('gulp-sourcemaps');
  const project = tsc.createProject('tsconfig.json', {
    typescript: require('typescript'),
    declaration: true
  });
  const src = gulp.src(srcs.concat(['src/**/*', '_references.ts']));
  return (() => {
    if (useSourcemaps) {
      return src.pipe(sourceMaps.init());
    }
    return src;
  })()
    .pipe(project());
}
github GoogleCloudPlatform / nodejs-docker / runtime-image / gulpfile.js View on Github external
gulp.task('compile', () => {
  const tsResult = gulp.src(sources)
                       .pipe(sourcemaps.init())
                       .pipe(ts.createProject('tsconfig.json')())
                       .on('error', onError);
  return merge([
    tsResult.dts.pipe(gulp.dest(`${outDir}/definitions`)),
    tsResult.js
        .pipe(sourcemaps.write(
            '.', {includeContent : false, sourceRoot : '../../src'}))
        .pipe(gulp.dest(`${outDir}/src`)),
    tsResult.js.pipe(gulp.dest(`${outDir}/src`))
  ]);
});
github GoogleCloudPlatform / nodejs-docker / builder / steps / gen-dockerfile / contents / gulpfile.js View on Github external
gulp.task('compile', ['copy-data', 'copy-package-json'], function() {
  var tsResult = gulp.src(sources)
                     .pipe(sourcemaps.init())
                     .pipe(ts.createProject('tsconfig.json')())
                     .on('error', onError);
  return merge([
    tsResult.dts.pipe(gulp.dest(outDir + '/definitions')),
    tsResult.js
        .pipe(sourcemaps.write(
            '.', {includeContent: false, sourceRoot: '../../src'}))
        .pipe(gulp.dest(outDir + '/src')),
    tsResult.js.pipe(gulp.dest(outDir + '/src'))
  ]);
});
github DAVFoundation / dav-js / gulpfile.js View on Github external
gulp.task('tsc', function(done) {
  var tsProject = ts.createProject('tsconfig.json');
  const tsResults = tsProject
    .src()
    .pipe(sourcemaps.init())
    .pipe(tsProject())
    .on('error', function(err) {
      done(err);
    });

  return merge([
    tsResults.dts.pipe(gulp.dest('./build/')),
    tsResults.js.pipe(sourcemaps.write('')).pipe(gulp.dest('./build')),
  ]);
});
github bleenco / ng2-datepicker / gulpfile.js View on Github external
gulp.task('compile:ts', () => {
  var tsProject = gulpTs.createProject(TSCONFIG);

  var tsResult = tsProject.src()
    .pipe(sourceMap.init())
    .pipe(tsProject());

  return merge([
      tsResult.dts,
      tsResult.pipe(sourceMap.write('.'))
    ])
    .pipe(gulp.dest(DEST));
});
github dotnet / aspnetcore / samples / angular / MusicStore / gulpfile.js View on Github external
gulp.task('build', ['build.lib'], function () {
    var tsProject = typescript.createProject('./tsconfig.json', { typescript: require('typescript') });
    var tsSrcInlined = gulp.src([webroot + '**/*.ts', 'typings/**/*.d.ts'], { base: webroot })
        .pipe(inlineNg2Template({ base: webroot }));
    return tsSrcInlined
        .pipe(sourcemaps.init())
        .pipe(typescript(tsProject))
        .pipe(sourcemaps.write())
        .pipe(gulp.dest(webroot));
});

gulp-typescript

A typescript compiler for gulp with incremental compilation support.

MIT
Latest version published 5 years ago

Package Health Score

50 / 100
Full package analysis

Popular gulp-typescript functions