import { Gulpclass , MergedTask , SequenceTask , Task } from "gulpclass" ; const gulp = require ( "gulp" ) ; const del = require ( "del" ) ; const ts = require ( "gulp-typescript" ) ; const sourcemaps = require ( "gulp-sourcemaps" ) ; @ Gulpclass ( ) export class Gulpfile { /**
     * Cleans build folder.
     */ @ Task ( ) clean ( cb ) { return del ( [ "build/**" ] , cb ) ; } /**
     * Copies all sources to the package directory.
     */ @ MergedTask ( ) packageCompile ( ) { const tsProject = ts . createProject ( "tsconfig.json" ) ; const tsResult = gulp . src ( [ "./src/**/*.ts" , "./typings/**/*.ts" ] ) . pipe ( sourcemaps . init ( ) ) . pipe ( tsProject ( ) ) ; return [ tsResult . dts . pipe ( gulp . dest ( "./build/package" ) ) , tsResult . js . pipe ( sourcemaps . write ( "." , { sourceRoot : "" , includeContent : true } ) ) . pipe ( gulp . dest ( "./build/package" ) ) ] ; } /**
     * Moves all compiled files to the final package directory.
     */ @ Task ( ) packageMoveCompiledFiles ( ) { return gulp . src ( "./build/package/src/**/*" ) . pipe ( gulp . dest ( "./build/package" ) ) ; } /**
     * Moves all compiled files to the final package directory.
     */ @ Task ( ) packageClearCompileDirectory ( cb ) { return del ( [ "./build/package/src/**" ] , cb ) ; } /**
     * Change the "private" state of the packaged package.json file to public.
     */ @ Task ( ) packagePreparePackageFile ( ) { return gulp . src ( "./package.json" ) . pipe ( gulp . dest ( "./build/package" ) ) ; } /**
     * Creates a package that can be published to npm.
     */ @ SequenceTask ( ) package ( ) { return [ "clean" , "packageCompile" , "packageMoveCompiledFiles" , "packageClearCompileDirectory" , "packagePreparePackageFile" ] ; } }