Skip to content

Commit

Permalink
fix(typescript): fix the build from breaking when typescript server h…
Browse files Browse the repository at this point in the history
…as no tsconfig.json
  • Loading branch information
jyounce committed Sep 14, 2016
1 parent 3347405 commit e278de0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
13 changes: 11 additions & 2 deletions src/helpers/TsProject.coffee
Expand Up @@ -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

Expand Down
18 changes: 8 additions & 10 deletions src/tasks/compile/typescript-server.coffee
@@ -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
# =======
Expand All @@ -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 }
Expand Down

0 comments on commit e278de0

Please sign in to comment.