Skip to content
Permalink
Browse files

fix(typescript): fix the build from breaking when typescript server h…

…as no tsconfig.json
  • Loading branch information
jyounce committed Sep 14, 2016
1 parent 3347405 commit e278de03353b0b782a66f4777573f14915e3d1a7
Showing with 19 additions and 12 deletions.
  1. +11 −2 src/helpers/TsProject.coffee
  2. +8 −10 src/tasks/compile/typescript-server.coffee
@@ -28,16 +28,25 @@ class TsProject
# ===========================================
class Typescript
constructor: (@id, @ts, @tsconfig, @opts={}) ->
@hasTsConfig = help.hasTsConfig @tsconfig
@opts.typescript = typescript
return @setProject().getProject()
return @setProject().setProjectConfig().getProject()

setProject: ->
if help.hasTsConfig @tsconfig
if @hasTsConfig
@project = @ts.createProject @tsconfig, @opts
else
@project = @ts.createProject @opts
@

setProjectConfig: ->
return @ if @hasTsConfig
# gulp-typescript needs these set if no tsconfig.json
@project.config = {}
@project.configFileName = @tsconfig
@project.options.rootDir = './'
@

getProject: ->
@project

@@ -1,12 +1,11 @@
module.exports = (config, gulp, taskOpts={}) ->
q = require 'q'
path = require 'path'
ts = require 'gulp-typescript'
log = require "#{config.req.helpers}/log"
promiseHelp = require "#{config.req.helpers}/promise"
TsProject = require "#{config.req.helpers}/TsProject"
updateFileBase = require "#{config.req.plugins}/gulp-update-file-base"
forWatchFile = !!taskOpts.watchFile
q = require 'q'
path = require 'path'
ts = require 'gulp-typescript'
log = require "#{config.req.helpers}/log"
promiseHelp = require "#{config.req.helpers}/promise"
TsProject = require "#{config.req.helpers}/TsProject"
forWatchFile = !!taskOpts.watchFile

# helpers
# =======
@@ -28,9 +27,8 @@ module.exports = (config, gulp, taskOpts={}) ->
runTask = (paths) ->
defer = q.defer()
src = help.getSrc paths
fileBase = paths.src
tsProject = TsProject.get 'server', ts, paths.tsconfig
tsResult = tsProject.src(src).pipe ts tsProject
tsResult = tsProject.src().pipe ts tsProject
reference = if paths.watchFile then [src[0]] else undefined
tsResult.js
.pipe ts.filter tsProject, { referencedFrom: reference }

0 comments on commit e278de0

Please sign in to comment.
You can’t perform that action at this time.