Closed beuted closed 7 years ago
Thank you for reporting this. I think that you're right - the typeRoots passed on the command-line to tsc should be relative to the Gruntfile, so grunt-ts ought to resolve the difference between the typeRoots values as specified in the tsconfig.json and the Gruntfile first. I think it is not currently doing that.
I would love it if you wanted to submit a PR. That would be really helpful. Please take a look at the instructions on Contributing.md for some help on getting started/debugging.
I think what you'd need to do is edit the sameNameInTSConfigAndGruntTS
array inside applyCompilerOptions
to remove typeRoots
. Please leave a comment that it is handled below (like outFile has).
Then you'd need to map the elements of co.typeRoots to apply the relative mapping, and then set the result.typeRoots
to the mapped array value.
You'll want to use path.relative()
which is part of Node.js and also relativePathFromGruntfileToTSConfig()
which is already implemented in the tsconfig.ts
. Feel free to refactor a bit if you want.
Let me know if you have any questions. If you don't want to or aren't able to complete this fix, no worries. I can take care of it. Thanks for the report!!
Hey, I've looked a bit at the issue but I can't manage to run tests on what I did, so I tried on MASTER and I've got the same issues:
Running "nodeunit:slow" (nodeunit) task
Testing test.jsFF.....F.......F.FF.F
>> tests - simple
>> Message: Actual did not match expected. Run this to compare:
>> kdiff3 "test/simple/js/zoo.js" "test/expected/simple/js/zoo.js"
>> Error: 'var__extends=(this&&this.__extends)||function(d,b){for(varpinb)if(b.hasOwnProperty(p))d[p]=b[p];function__(){this.constructor=d;}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new__());};varAnimal=(function(){functionAnimal(name){this.name=name;}Animal.prototype.move=function(meters){alert(this.name+"moved"+meters+"m.");};returnAnimal;}());varSnake=(function(_super){__extends(Snake,_super);functionSnake(name){return_super.call(this,name)||this;}Snake.prototype.move=function(){alert("Slithering...");_super.prototype.move.call(this,5);};returnSnake;}(Animal));varHorse=(function(_super){__extends(Horse,_super);functionHorse(name){return_super.call(this,name)||this;}Horse.prototype.move=function(){alert("Galloping...");_super.prototype.move.call(this,45);};returnHorse;}(Animal));varsam=newSnake("SammythePython");vartom=newHorse("TommythePalomino");sam.move();tom.move(34);//#sourceMappingURL=zoo.js.map' == 'var__extends=(this&&this.__extends)||(function(){varextendStatics=Object.setPrototypeOf||({__proto__:[]}instanceofArray&&function(d,b){d.__proto__=b;})||function(d,b){for(varpinb)if(b.hasOwnProperty(p))d[p]=b[p];};returnfunction(d,b){extendStatics(d,b);function__(){this.constructor=d;}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new__());};})();varAnimal=(function(){functionAnimal(name){this.name=name;}Animal.prototype.move=function(meters){alert(this.name+"moved"+meters+"m.");};returnAnimal;}());varSnake=(function(_super){__extends(Snake,_super);functionSnake(name){return_super.call(this,name)||this;}Snake.prototype.move=function(){alert("Slithering...");_super.prototype.move.call(this,5);};returnSnake;}(Animal));varHorse=(function(_super){__extends(Horse,_super);functionHorse(name){return_super.call(this,name)||this;}Horse.prototype.move=function(){alert("Galloping...");_super.prototype.move.call(this,45);};returnHorse;}(Animal));varsam=newSnake("SammythePython");vartom=newHorse("TommythePalomino");sam.move();tom.move(34);//#sourceMappingURL=zoo.js.map'
>> kdiff3 "test/simple/js/zoo.js" "test/expected/simple/js/zoo.js"
>> at testFile (C:\src\dkj\grunt-ts\test\test.js:16:10)
>> at Object.exports.tests.simple (C:\src\dkj\grunt-ts\test\test.js:50:9)
>> at Object.exports.tests.setUp (C:\src\dkj\grunt-ts\test\test.js:44:9)
>> at FSReqWrap.oncomplete (fs.js:123:15)
Maybe this is an issue with a dependency ? I'm on windows 7, npm 4.4.0, node 6.3.1 npm ls gives me this:
$ npm ls
grunt-ts@6.0.0-beta.11 c:\src\dkj\grunt-ts
+-- chokidar@1.6.1
| +-- anymatch@1.3.0
| | +-- arrify@1.0.1
| | `-- micromatch@2.3.11
| | +-- arr-diff@2.0.0
| | | `-- arr-flatten@1.0.1
| | +-- array-unique@0.2.1
| | +-- braces@1.8.5
| | | +-- expand-range@1.8.2
| | | | `-- fill-range@2.2.3
| | | | +-- is-number@2.1.0
| | | | +-- isobject@2.1.0
| | | | +-- randomatic@1.1.6
| | | | `-- repeat-string@1.6.1
| | | +-- preserve@0.2.0
| | | `-- repeat-element@1.1.2
| | +-- expand-brackets@0.1.5
| | | `-- is-posix-bracket@0.1.1
| | +-- extglob@0.3.2
| | +-- filename-regex@2.0.0
| | +-- kind-of@3.1.0
| | | `-- is-buffer@1.1.4
| | +-- normalize-path@2.0.1
| | +-- object.omit@2.0.1
| | | +-- for-own@0.1.5
| | | | `-- for-in@1.0.2
| | | `-- is-extendable@0.1.1
| | +-- parse-glob@3.0.4
| | | +-- glob-base@0.3.0
| | | `-- is-dotfile@1.0.2
| | `-- regex-cache@0.4.3
| | +-- is-equal-shallow@0.1.3
| | `-- is-primitive@2.0.0
| +-- async-each@1.0.1
| +-- UNMET OPTIONAL DEPENDENCY fsevents@^1.0.0
| +-- glob-parent@2.0.0
| +-- inherits@2.0.3
| +-- is-binary-path@1.0.1
| | `-- binary-extensions@1.8.0
| +-- is-glob@2.0.1
| | `-- is-extglob@1.0.0
| +-- path-is-absolute@1.0.1
| `-- readdirp@2.1.0
| +-- graceful-fs@4.1.11
| +-- readable-stream@2.2.3
| | +-- buffer-shims@1.0.0
| | +-- core-util-is@1.0.2
| | +-- isarray@1.0.0
| | +-- process-nextick-args@1.0.7
| | +-- string_decoder@0.10.31
| | `-- util-deprecate@1.0.2
| `-- set-immediate-shim@1.0.1
+-- csproj2ts@0.0.8
| +-- es6-promise@4.0.5
| `-- xml2js@0.4.17
| +-- sax@1.2.2
| `-- xmlbuilder@4.2.1
+-- es6-promise@0.1.2
+-- grunt@1.0.1
| +-- coffee-script@1.10.0
| +-- dateformat@1.0.12
| | +-- get-stdin@4.0.1
| | `-- meow@3.7.0
| | +-- camelcase-keys@2.1.0
| | | `-- camelcase@2.1.1
| | +-- decamelize@1.2.0
| | +-- loud-rejection@1.6.0
| | | `-- currently-unhandled@0.4.1
| | | `-- array-find-index@1.0.2
| | +-- map-obj@1.0.1
| | +-- minimist@1.2.0
| | +-- normalize-package-data@2.3.5
| | | +-- hosted-git-info@2.2.0
| | | +-- is-builtin-module@1.0.0
| | | | `-- builtin-modules@1.1.1
| | | `-- validate-npm-package-license@3.0.1
| | | +-- spdx-correct@1.0.2
| | | | `-- spdx-license-ids@1.2.2
| | | `-- spdx-expression-parse@1.0.4
| | +-- object-assign@4.1.1
| | +-- read-pkg-up@1.0.1
| | | +-- find-up@1.1.2
| | | | +-- path-exists@2.1.0
| | | | `-- pinkie-promise@2.0.1
| | | | `-- pinkie@2.0.4
| | | `-- read-pkg@1.1.0
| | | +-- load-json-file@1.1.0
| | | | +-- parse-json@2.2.0
| | | | | `-- error-ex@1.3.0
| | | | | `-- is-arrayish@0.2.1
| | | | `-- pify@2.3.0
| | | `-- path-type@1.1.0
| | +-- redent@1.0.0
| | | +-- indent-string@2.1.0
| | | | `-- repeating@2.0.1
| | | | `-- is-finite@1.0.2
| | | `-- strip-indent@1.0.1
| | `-- trim-newlines@1.0.0
| +-- eventemitter2@0.4.14
| +-- exit@0.1.2
| +-- findup-sync@0.3.0
| | `-- glob@5.0.15
| +-- glob@7.0.6
| | +-- fs.realpath@1.0.0
| | +-- inflight@1.0.6
| | | `-- wrappy@1.0.2
| | `-- once@1.4.0
| +-- grunt-cli@1.2.0
| +-- grunt-known-options@1.1.0
| +-- grunt-legacy-log@1.0.0
| | +-- grunt-legacy-log-utils@1.0.0
| | | `-- lodash@4.3.0
| | +-- lodash@3.10.1
| | `-- underscore.string@3.2.3
| +-- grunt-legacy-util@1.0.0
| | +-- getobject@0.1.0
| | +-- lodash@4.3.0
| | `-- which@1.2.12
| | `-- isexe@1.1.2
| +-- iconv-lite@0.4.15
| +-- js-yaml@3.5.5
| | +-- argparse@1.0.9
| | | `-- sprintf-js@1.0.3
| | `-- esprima@2.7.3
| +-- minimatch@3.0.3
| | `-- brace-expansion@1.1.6
| | +-- balanced-match@0.4.2
| | `-- concat-map@0.0.1
| +-- nopt@3.0.6
| | `-- abbrev@1.1.0
| `-- rimraf@2.2.8
+-- grunt-continue@0.1.0
+-- grunt-contrib-clean@1.0.0
| +-- async@1.5.2
| `-- rimraf@2.6.1
+-- grunt-contrib-jshint@1.1.0
| +-- chalk@1.1.3
| | +-- ansi-styles@2.2.1
| | +-- escape-string-regexp@1.0.5
| | +-- has-ansi@2.0.0
| | | `-- ansi-regex@2.1.1
| | +-- strip-ansi@3.0.1
| | `-- supports-color@2.0.0
| +-- hooker@0.2.3
| `-- jshint@2.9.4
| +-- cli@1.0.1
| | `-- glob@7.1.1
| +-- console-browserify@1.1.0
| | `-- date-now@0.1.4
| +-- htmlparser2@3.8.3
| | +-- domelementtype@1.3.0
| | +-- domhandler@2.3.0
| | +-- domutils@1.5.1
| | | `-- dom-serializer@0.1.0
| | | +-- domelementtype@1.1.3
| | | `-- entities@1.1.1
| | +-- entities@1.0.0
| | `-- readable-stream@1.1.14
| | `-- isarray@0.0.1
| +-- lodash@3.7.0
| +-- shelljs@0.3.0
| `-- strip-json-comments@1.0.4
+-- grunt-contrib-nodeunit@1.0.0
| `-- nodeunit@0.9.5
| `-- tap@7.1.2
| +-- bluebird@3.4.7
| +-- clean-yaml-object@0.1.0
| +-- color-support@1.1.2
| +-- coveralls@2.11.16
| | +-- js-yaml@3.6.1
| | +-- lcov-parse@0.0.10
| | +-- log-driver@1.2.5
| | `-- request@2.79.0
| | +-- aws-sign2@0.6.0
| | +-- aws4@1.6.0
| | +-- caseless@0.11.0
| | +-- combined-stream@1.0.5
| | | `-- delayed-stream@1.0.0
| | +-- extend@3.0.0
| | +-- forever-agent@0.6.1
| | +-- form-data@2.1.2
| | | `-- asynckit@0.4.0
| | +-- har-validator@2.0.6
| | | +-- commander@2.9.0
| | | | `-- graceful-readlink@1.0.1
| | | `-- is-my-json-valid@2.16.0
| | | +-- generate-function@2.0.0
| | | +-- generate-object-property@1.2.0
| | | | `-- is-property@1.0.2
| | | +-- jsonpointer@4.0.1
| | | `-- xtend@4.0.1
| | +-- hawk@3.1.3
| | | +-- boom@2.10.1
| | | +-- cryptiles@2.0.5
| | | +-- hoek@2.16.3
| | | `-- sntp@1.0.9
| | +-- http-signature@1.1.1
| | | +-- assert-plus@0.2.0
| | | +-- jsprim@1.3.1
| | | | +-- extsprintf@1.0.2
| | | | +-- json-schema@0.2.3
| | | | `-- verror@1.3.6
| | | `-- sshpk@1.11.0
| | | +-- asn1@0.2.3
| | | +-- assert-plus@1.0.0
| | | +-- bcrypt-pbkdf@1.0.1
| | | +-- dashdash@1.14.1
| | | | `-- assert-plus@1.0.0
| | | +-- ecc-jsbn@0.1.1
| | | +-- getpass@0.1.6
| | | | `-- assert-plus@1.0.0
| | | +-- jodid25519@1.0.2
| | | +-- jsbn@0.1.1
| | | `-- tweetnacl@0.14.5
| | +-- is-typedarray@1.0.0
| | +-- isstream@0.1.2
| | +-- json-stringify-safe@5.0.1
| | +-- oauth-sign@0.8.2
| | +-- qs@6.3.1
| | +-- stringstream@0.0.5
| | +-- tough-cookie@2.3.2
| | +-- tunnel-agent@0.4.3
| | `-- uuid@3.0.1
| +-- deeper@2.1.0
| +-- foreground-child@1.5.6
| | `-- cross-spawn@4.0.2
| | `-- lru-cache@4.0.2
| | +-- pseudomap@1.0.2
| | `-- yallist@2.0.0
| +-- nyc@7.1.0
| | +-- arrify@1.0.1
| | +-- caching-transform@1.0.1
| | | `-- write-file-atomic@1.1.4
| | | +-- graceful-fs@4.1.4
| | | +-- imurmurhash@0.1.4
| | | `-- slide@1.1.6
| | +-- convert-source-map@1.3.0
| | +-- default-require-extensions@1.0.0
| | | `-- strip-bom@2.0.0
| | | `-- is-utf8@0.2.1
| | +-- find-cache-dir@0.1.1
| | | +-- commondir@1.0.1
| | | `-- pkg-dir@1.0.0
| | +-- find-up@1.1.2
| | | +-- path-exists@2.1.0
| | | `-- pinkie-promise@2.0.1
| | | `-- pinkie@2.0.4
| | +-- foreground-child@1.5.3
| | | `-- cross-spawn@4.0.0
| | | `-- lru-cache@4.0.1
| | | +-- pseudomap@1.0.2
| | | `-- yallist@2.0.0
| | +-- glob@7.0.5
| | | +-- fs.realpath@1.0.0
| | | +-- inflight@1.0.5
| | | | `-- wrappy@1.0.2
| | | +-- inherits@2.0.1
| | | +-- minimatch@3.0.2
| | | | `-- brace-expansion@1.1.6
| | | | +-- balanced-match@0.4.2
| | | | `-- concat-map@0.0.1
| | | +-- once@1.3.3
| | | `-- path-is-absolute@1.0.0
| | +-- istanbul-lib-coverage@1.0.0-alpha.4
| | +-- istanbul-lib-hook@1.0.0-alpha.4
| | | `-- append-transform@0.3.0
| | +-- istanbul-lib-instrument@1.1.0-alpha.4
| | | +-- babel-generator@6.11.4
| | | | +-- babel-messages@6.8.0
| | | | +-- babel-runtime@6.9.2
| | | | | +-- core-js@2.4.1
| | | | | `-- regenerator-runtime@0.9.5
| | | | +-- detect-indent@3.0.1
| | | | | +-- get-stdin@4.0.1
| | | | | +-- minimist@1.2.0
| | | | | `-- repeating@1.1.3
| | | | | `-- is-finite@1.0.1
| | | | `-- lodash@4.13.1
| | | +-- babel-template@6.9.0
| | | +-- babel-traverse@6.11.4
| | | | +-- babel-code-frame@6.11.0
| | | | | +-- chalk@1.1.3
| | | | | | +-- ansi-styles@2.2.1
| | | | | | +-- escape-string-regexp@1.0.5
| | | | | | +-- has-ansi@2.0.0
| | | | | | `-- supports-color@2.0.0
| | | | | `-- js-tokens@2.0.0
| | | | +-- debug@2.2.0
| | | | | `-- ms@0.7.1
| | | | +-- globals@8.18.0
| | | | `-- invariant@2.2.1
| | | | `-- loose-envify@1.2.0
| | | | `-- js-tokens@1.0.3
| | | +-- babel-types@6.11.1
| | | | +-- esutils@2.0.2
| | | | `-- to-fast-properties@1.0.2
| | | `-- babylon@6.8.4
| | +-- istanbul-lib-report@1.0.0-alpha.3
| | | +-- async@1.5.2
| | | +-- path-parse@1.0.5
| | | `-- supports-color@3.1.2
| | | `-- has-flag@1.0.0
| | +-- istanbul-lib-source-maps@1.0.0-alpha.10
| | | `-- source-map@0.5.6
| | +-- istanbul-reports@1.0.0-alpha.8
| | | `-- handlebars@4.0.5
| | | +-- optimist@0.6.1
| | | | `-- wordwrap@0.0.3
| | | +-- source-map@0.4.4
| | | | `-- amdefine@1.0.0
| | | `-- uglify-js@2.7.0
| | | +-- async@0.2.10
| | | +-- uglify-to-browserify@1.0.2
| | | `-- yargs@3.10.0
| | | +-- camelcase@1.2.1
| | | +-- cliui@2.1.0
| | | | +-- center-align@0.1.3
| | | | | +-- align-text@0.1.4
| | | | | | `-- longest@1.0.1
| | | | | `-- lazy-cache@1.0.4
| | | | +-- right-align@0.1.3
| | | | `-- wordwrap@0.0.2
| | | `-- window-size@0.1.0
| | +-- md5-hex@1.3.0
| | | `-- md5-o-matic@0.1.1
| | +-- micromatch@2.3.11
| | | +-- arr-diff@2.0.0
| | | | `-- arr-flatten@1.0.1
| | | +-- array-unique@0.2.1
| | | +-- braces@1.8.5
| | | | +-- expand-range@1.8.2
| | | | | `-- fill-range@2.2.3
| | | | | +-- is-number@2.1.0
| | | | | +-- isobject@2.1.0
| | | | | | `-- isarray@1.0.0
| | | | | +-- randomatic@1.1.5
| | | | | `-- repeat-string@1.5.4
| | | | +-- preserve@0.2.0
| | | | `-- repeat-element@1.1.2
| | | +-- expand-brackets@0.1.5
| | | | `-- is-posix-bracket@0.1.1
| | | +-- extglob@0.3.2
| | | +-- filename-regex@2.0.0
| | | +-- is-extglob@1.0.0
| | | +-- is-glob@2.0.1
| | | +-- kind-of@3.0.3
| | | | `-- is-buffer@1.1.3
| | | +-- normalize-path@2.0.1
| | | +-- object.omit@2.0.0
| | | | +-- for-own@0.1.4
| | | | | `-- for-in@0.1.5
| | | | `-- is-extendable@0.1.1
| | | +-- parse-glob@3.0.4
| | | | +-- glob-base@0.3.0
| | | | | `-- glob-parent@2.0.0
| | | | `-- is-dotfile@1.0.2
| | | `-- regex-cache@0.4.3
| | | +-- is-equal-shallow@0.1.3
| | | `-- is-primitive@2.0.0
| | +-- mkdirp@0.5.1
| | | `-- minimist@0.0.8
| | +-- pkg-up@1.0.0
| | +-- resolve-from@2.0.0
| | +-- rimraf@2.5.4
| | +-- signal-exit@3.0.0
| | +-- spawn-wrap@1.2.4
| | | +-- os-homedir@1.0.1
| | | +-- signal-exit@2.1.2
| | | `-- which@1.2.10
| | | `-- isexe@1.1.2
| | +-- test-exclude@1.1.0
| | | +-- lodash.assign@4.0.9
| | | | +-- lodash.keys@4.0.7
| | | | `-- lodash.rest@4.0.3
| | | +-- read-pkg-up@1.0.1
| | | | `-- read-pkg@1.1.0
| | | | +-- load-json-file@1.1.0
| | | | | +-- parse-json@2.2.0
| | | | | | `-- error-ex@1.3.0
| | | | | | `-- is-arrayish@0.2.1
| | | | | `-- pify@2.3.0
| | | | +-- normalize-package-data@2.3.5
| | | | | +-- hosted-git-info@2.1.5
| | | | | +-- is-builtin-module@1.0.0
| | | | | | `-- builtin-modules@1.1.1
| | | | | +-- semver@5.3.0
| | | | | `-- validate-npm-package-license@3.0.1
| | | | | +-- spdx-correct@1.0.2
| | | | | | `-- spdx-license-ids@1.2.1
| | | | | `-- spdx-expression-parse@1.0.2
| | | | | `-- spdx-exceptions@1.0.5
| | | | `-- path-type@1.1.0
| | | `-- require-main-filename@1.0.1
| | +-- yargs@4.8.1
| | | +-- cliui@3.2.0
| | | | `-- wrap-ansi@2.0.0
| | | +-- decamelize@1.2.0
| | | +-- get-caller-file@1.0.1
| | | +-- os-locale@1.4.0
| | | | `-- lcid@1.0.0
| | | | `-- invert-kv@1.0.0
| | | +-- require-directory@2.1.1
| | | +-- set-blocking@2.0.0
| | | +-- string-width@1.0.1
| | | | +-- code-point-at@1.0.0
| | | | | `-- number-is-nan@1.0.0
| | | | +-- is-fullwidth-code-point@1.0.0
| | | | `-- strip-ansi@3.0.1
| | | | `-- ansi-regex@2.0.0
| | | +-- which-module@1.0.0
| | | +-- window-size@0.2.0
| | | `-- y18n@3.2.1
| | `-- yargs-parser@2.4.1
| | `-- camelcase@3.0.0
| +-- only-shallow@1.2.0
| +-- opener@1.4.3
| +-- os-homedir@1.0.1
| +-- signal-exit@3.0.2
| +-- stack-utils@0.4.0
| +-- tap-mocha-reporter@2.0.1
| | +-- debug@2.6.1
| | | `-- ms@0.7.2
| | +-- diff@1.4.0
| | `-- unicode-length@1.0.3
| | `-- punycode@1.4.1
| +-- tap-parser@2.2.3
| | `-- events-to-array@1.0.2
| `-- tmatch@2.0.1
+-- grunt-contrib-watch@1.0.0
| +-- gaze@1.1.2
| | `-- globule@1.1.0
| | +-- glob@7.1.1
| | `-- lodash@4.16.6
| +-- lodash@3.10.1
| `-- tiny-lr@0.2.1
| +-- body-parser@1.14.2
| | +-- bytes@2.2.0
| | +-- content-type@1.0.2
| | +-- debug@2.2.0
| | | `-- ms@0.7.1
| | +-- depd@1.1.0
| | +-- http-errors@1.3.1
| | | `-- statuses@1.3.1
| | +-- iconv-lite@0.4.13
| | +-- on-finished@2.3.0
| | | `-- ee-first@1.1.1
| | +-- qs@5.2.0
| | +-- raw-body@2.1.7
| | | +-- bytes@2.4.0
| | | +-- iconv-lite@0.4.13
| | | `-- unpipe@1.0.0
| | `-- type-is@1.6.14
| | +-- media-typer@0.3.0
| | `-- mime-types@2.1.14
| | `-- mime-db@1.26.0
| +-- debug@2.2.0
| | `-- ms@0.7.1
| +-- faye-websocket@0.10.0
| | `-- websocket-driver@0.6.5
| | `-- websocket-extensions@0.1.1
| +-- livereload-js@2.2.2
| +-- parseurl@1.3.1
| `-- qs@5.1.0
+-- grunt-tslint@4.0.0
+-- jshint-path-reporter@0.1.3
| `-- source-map@0.1.43
| `-- amdefine@1.0.1
+-- lodash@4.17.4
+-- ncp@0.5.1
+-- rimraf@2.2.6
+-- semver@5.3.0
+-- strip-bom@2.0.0
| `-- is-utf8@0.2.1
+-- tslint@4.5.1
| +-- babel-code-frame@6.22.0
| | +-- esutils@2.0.2
| | `-- js-tokens@3.0.1
| +-- colors@1.1.2
| +-- diff@3.2.0
| +-- glob@7.1.1
| +-- optimist@0.6.1
| | +-- minimist@0.0.10
| | `-- wordwrap@0.0.3
| +-- resolve@1.1.7
| +-- tsutils@1.1.0
| `-- update-notifier@2.1.0
| +-- boxen@1.0.0
| | +-- ansi-align@1.1.0
| | | `-- string-width@1.0.2
| | | +-- code-point-at@1.1.0
| | | `-- is-fullwidth-code-point@1.0.0
| | | `-- number-is-nan@1.0.1
| | +-- camelcase@4.0.0
| | +-- cli-boxes@1.0.0
| | +-- string-width@2.0.0
| | | `-- is-fullwidth-code-point@2.0.0
| | +-- term-size@0.1.1
| | | `-- execa@0.4.0
| | | +-- cross-spawn-async@2.2.5
| | | +-- is-stream@1.1.0
| | | +-- npm-run-path@1.0.0
| | | +-- path-key@1.0.0
| | | `-- strip-eof@1.0.0
| | `-- widest-line@1.0.0
| | `-- string-width@1.0.2
| +-- configstore@3.0.0
| | +-- dot-prop@4.1.1
| | | `-- is-obj@1.0.1
| | +-- mkdirp@0.5.1
| | | `-- minimist@0.0.8
| | +-- unique-string@1.0.0
| | | `-- crypto-random-string@1.0.0
| | `-- write-file-atomic@1.3.1
| | +-- imurmurhash@0.1.4
| | `-- slide@1.1.6
| +-- is-npm@1.0.0
| +-- latest-version@3.0.0
| | `-- package-json@3.1.0
| | +-- got@6.7.1
| | | +-- create-error-class@3.0.2
| | | | `-- capture-stack-trace@1.0.0
| | | +-- duplexer3@0.1.4
| | | +-- get-stream@3.0.0
| | | +-- is-redirect@1.0.0
| | | +-- is-retry-allowed@1.1.0
| | | +-- lowercase-keys@1.0.0
| | | +-- safe-buffer@5.0.1
| | | +-- timed-out@4.0.1
| | | +-- unzip-response@2.0.1
| | | `-- url-parse-lax@1.0.0
| | | `-- prepend-http@1.0.4
| | +-- registry-auth-token@3.1.0
| | | `-- rc@1.1.7
| | | +-- deep-extend@0.4.1
| | | +-- ini@1.3.4
| | | `-- strip-json-comments@2.0.1
| | `-- registry-url@3.1.0
| +-- lazy-req@2.0.0
| +-- semver-diff@2.1.0
| `-- xdg-basedir@3.0.0
`-- typescript@2.2.1
My (untested for the moment) solution is here: https://github.com/beuted/grunt-ts
I'm not sure why the slow tests aren't running properly. The file comparison it's doing generally only changes if the version of TypeScript is different. You seem to have the expected version of TypeScript installed. I did just notice that there is an issue with tslint in the latest code on master when I just did a fresh reclone.
Did you just clone down the repo yesterday?
By the way - your code seems to be mostly correct. The trick is that typeRoots is an array so you have to apply the path.relative to each element rather than the array itself. also note that you still have "out" and "outFile" in there.
Please submit a PR with what you've done already and if you want to fix it, please do so. If you can't get it working, no worries, I'll just modify it.
Thanks for contributing!
Yes I just clone the repos this afternoon.
I usually just fix no versions in my projects to avoid these kind of issues but I guess you cannot do that in a public package ppl will depend on (?)
Indeed the code is incorrect I will fix and submit a PR (not before Monday tho') What's bothering me is that I will not be able to add a test for this change :( But I'll manually test it on the repo I first had the issue.
Thanks for the quick answers and for the package :)
Cheers.
You should be able to add a test.
Do me a favor - on Monday please copy your code change to a different file and delete your entire grunt-ts repo and reclone it fresh. I just made a change to the file you were working on to support tsconfig extensions which is a new TypeScript 2.2 feature, and I also fixed an issue where the integration tests weren't working right so it's possible you were affected by that. Hopefully totally deleting everything and starting over will clear up any problems because I just tried it from scratch and it seems OK. (I have Node.js 7.5 on Windows 10 but it shouldn't really matter - the integration tests run on Node 0.10, and 4.x+ on Linux and they just all passed with the latest code in Travis.)
There are three kinds of tests supported in grunt-ts. The first is the quick "nodeunit" style tests which are true unit tests. The second is the "command-line-only" tests which basically is a hook that intercepts what the command-line "would be" and then runs a function to validate it. That's the kind you want.
Open the main Gruntfile.js and look for issue_392
- the property testExecute
references a function in the test/commandLineAssertions.ts file. You can set up a new item in the Gruntfile and reference a new function and then check that the paths you expect are passed by grunt-ts to TypeScript (it won't actually run the compiler - you're just asserting that the new relative paths you expect are there).
Thanks again for investigating this. Let me know if you need anything else. :-)
I've gave it a try here: https://github.com/beuted/grunt-ts But I've got two issues:
issue_397-tsconfig.json
and I don't understand where the rule ignoring this file is.tsconfig.js
next to tsconfig.ts
, and when I run grunt test I'm pretty sure it is using the old version of tsconfig (evn tho I ran grunt build
and even grunt release
) because I added logs in the file and I can't see them when running grunt test --verbose
So I can't run the new test I wrote, (my code might be broken, I just can't tell). :(
Any idea ?
What editor are you using? Running grunt build
or grunt release
should transpile the tsconfig.ts to tsconfig.js, so that sounds odd.
I think this work looks good. Thank you!! Please submit a PR and I'll tweak anything that's necessary and hopefully I'll be able to figure out what is causing your trouble. I really appreciate it!!
Done
Fixed via #399
So is it possible to have a new release with this feature ? (if not I'll just use the github repo with the sha1)
This is released in grunt-ts v6.0.0-beta.16 on npm. Thank you!
Here is my configuration inside my Gruntfile
Here is
server/tsconfig.json
:When I run
ts:server
I've got:app.ts --sourcemap --removeComments --noImplicitAny --types "node,socket.io,seedrandom,voronoi" --typeRoots "../node_modules/@types,./typings/" --target ES5 --module commonjs
The generated route for app.ts is
./app.ts
and not../app.ts
since grunt-ts knows that theapp.ts
is at the root since the path is relative toserver/
.But for "typeRoots" in the generated command line typeRoots have the same path as in the tsconfig.json which is false, it should be:
-typeRoots "./node_modules/@types,./server/typings/"
I would like to have the same mechanism for the "typeRoots" array.
The issue is that, the tsconfig.json being used by IDE, changing the path in the tsconfig.json is breaking static type analysis in them!
I don't know if it's easy to implement I just wanted to ask if you would consider merging such a PR if have a look ?