typestrong / grunt-ts Goto Github PK
View Code? Open in Web Editor NEWA grunt task to manage your complete typescript development to production workflow
Home Page: https://www.npmjs.com/package/grunt-ts
License: MIT License
A grunt task to manage your complete typescript development to production workflow
Home Page: https://www.npmjs.com/package/grunt-ts
License: MIT License
@basarat would you be okay with this? I want to make sure that the definition file is useful for us. I feel weird putting it up for open-source and not using it on this project.
Hi, is this file necessary to be created in root folder?
I'm using latest WebStorm and latest grunt-ts.
When html file is created, grunt-ts generates .ts file for it and adds reference for this file to a reference file like this:
/// <reference path="directives/testme.html.ts" />// generated
The comment "// generated" causes that WebStorm cannot evaluate this line as reference and intellisense doesn't work well.
ts-internal still depends on shelljs : https://github.com/grunt-ts/grunt-ts/blob/master/tasks/ts-internal.js#L94
Update internal to latest grunt-ts once it stabalizes.
I would like to watch and run tests as I make source or test code changes. Since I can't run arbitrary tasks with the grunt-ts watch, I have to choose between using grunt-ts to compile and generate the reference and template files or using grunt-typescript and grunt-contrib-watch to compile and run the tests (but without the other awesome development features of grunt-ts).
The best way I can think of doing this is to split the definition file generator into a separate grunt task so that I can watch for file changes with grunt-contrib-watch, generate the declaration file, generate any templates, run ts, and then run my tests. It would allow maximum flexibility with each individual's build process.
Another route, if that is not feasible would be to allow running arbitrary grunt tasks in the "watch" configuration.
we're considering moving to grunt-ts for palantir/tslint#84. But, it fails to compile the compiler sources. Here's the error:
dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:950
throw new Error("Debug Failure. False expression: " + message
^
Error: Debug Failure. False expression: Provided ast is not the expected AST, Expected: ObjectLiteralExpression Given: FunctionPropertyAssignment
at Function.Debug.assert (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:950:23)
at SourceMapper.decreaseMappingLevel (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:29244:30)
at Emitter.recordSourceMappingEnd (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:31093:35)
at Emitter.emitFunctionPropertyAssignment (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:32078:18)
at Emitter.emitWorker (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:32683:33)
at Emitter.emit (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:32551:18)
at Emitter.emitJavascript (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:31456:18)
at Emitter.emitCommaSeparatedList (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:31164:22)
at Emitter.emitObjectLiteralExpression (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:29841:18)
at Emitter.emitWorker (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:32679:33)
at Emitter.emit (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:32551:18)
at Emitter.emitJavascript (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:31456:18)
at Emitter.emitCommaSeparatedList (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:31164:22)
at Emitter.emitInvocationExpression (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:29938:22)
at Emitter.emitWorker (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:32590:33)
at Emitter.emit (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:32551:18)
at Emitter.emitReturnStatement (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:32215:22)
at Emitter.emitWorker (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:32655:33)
at Emitter.emit (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:32551:18)
at Emitter.emitJavascript (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:31456:18)
at Emitter.emitList (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:31205:26)
at Emitter.emitFunctionBodyStatements (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:29997:22)
at Emitter.emitClassMemberFunctionDeclaration (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:31719:18)
at Emitter.emitClassMembers (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:31656:30)
at Emitter.emitClass (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:31602:18)
at Emitter.emitClassDeclaration (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:32434:22)
at Emitter.emit (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:32519:33)
at Emitter.emitJavascript (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:31456:18)
at Emitter.emitList (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:31205:26)
at Emitter.emitSingleModuleDeclaration (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:30344:26)
at Emitter.emitModuleDeclarationWorker (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:30281:22)
at Emitter.emitModuleDeclaration (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:32422:22)
at Emitter.emit (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:32533:33)
at Emitter.emitJavascript (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:31456:18)
at Emitter.emitList (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:31205:26)
at Emitter.emitScriptElements (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:31376:18)
at Emitter.emitSourceUnit (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:32397:22)
at Emitter.emit (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:32513:33)
at Emitter.emitJavascript (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:31456:18)
at TypeScriptCompiler.emitDocumentWorker (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:53576:21)
at TypeScriptCompiler._emitDocument (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:53589:42)
at CompilerIterator.moveNextEmitPhase (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:54290:53)
at CompilerIterator.moveNextInternal (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:54200:33)
at CompilerIterator.moveNext (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:54171:25)
at BatchCompiler.compile (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:60389:20)
at BatchCompiler.batchCompile (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:60268:22)
at TypeScript (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:60897:11)
at Object.<anonymous> (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc.js:60898:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/aramaswamy/dev/tslint/node_modules/grunt-ts/node_modules/typescript/bin/tsc:2:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
>> Compilation failed
For starters get fast:true
working with grunt-contrib-watch
.
Basically do something like https://github.com/tschaub/grunt-newer : https://github.com/tschaub/grunt-newer/blob/master/lib/util.js
Calculate hashes of all the files expanded under src
and on next compile only run with the files that are changed. This will make it file watching method independent.
Note : this cache needs to be per target (since different target can have different --outDir
and different ---module
etc)
Add a fast compile option. What this will do is compile a single typescript file silently removing all ///<reference
statements and change import foo = require('bar')
to var foo = require('bar')
so that you can test the single js file quickly and silently (even though it might have type errors)
It will then continue to compile the project in the background which will allow us to get the type errors in the complete project.
Please forgive my ignorance, I could not think of a more appropriate way to ask this question. I cannot be sure if this is inherent to grunt-ts or ts itself, so please tell me what you think.
I noticed that the output JS file has module definitions repeated per source file. This was happening to me so I downloaded your angularJS example (from the video) and saw that it happens to your source as well. This snippet is from your out.js file:
var services = angular.module('services', []);
var directives = angular.module('directives', []);
var testme;
(function (testme) {
testme.html = '<div>Hey wassup yo!</div>';
})(testme || (testme = {}));
var Controllers;
(function (Controllers) {
var MainController = (function () {
function MainController($scope, logService) {
this.message = "asdf";
$scope.vm = this;
logService.log('Some log');
}
return MainController;
})();
Controllers.MainController = MainController;
})(Controllers || (Controllers = {}));
var Controllers;
(function (Controllers) {
var TestController = (function () {
function TestController($scope) {
this.message = "foo";
$scope.vm = this;
}
return TestController;
})();
Controllers.TestController = TestController;
})(Controllers || (Controllers = {}));
directives.directive('testme', function () {
return {
restrict: 'EAC',
template: testme.html
};
});
var LogService = (function () {
function LogService() {
}
LogService.prototype.log = function (msg) {
console.log(msg);
};
return LogService;
})();
services.service('logService', LogService);
angular.module('controllers', []).controller(Controllers);
angular.module('myApp', ['controllers', 'services', 'directives']);
//# sourceMappingURL=out.js.map
Notice the repeating "var Controllers; \n(function (Controllers) {"..
I would expect MainController and TestController to be rendered within the same Controllers definition.
a. Is this typescript or grunt-ts driven behavior?
b. Can it cause problems?
c. Are you aware of any workarounds to make it render as I expected?
Thanks,
Hi, I am a newbie of Grunt so maybe the problem I am experiencing is caused by myself.
I created a new project using Yeoman, and then I installed grunt-ts, and modified the Gruntfile.js as follow:
grunt.initConfig({
...
ts: {
options: { // use to override the default options, http://gruntjs.com/configuring-tasks#options
target: 'es3', // es3 (default) / or es5
module: 'commonjs', // amd , commonjs (default)
sourcemap: true, // true (default) | false
declaration: false, // true | false (default)
nolib: false, // true | false (default)
comments: false // true | false (default)
},
dev: { // a particular target
src: ['<%= yeoman.app %>/scripts/{,*/}*.ts'], // The source typescript files, http://gruntjs.com/configuring-tasks#files
reference: '<%= yeoman.app %>/scripts/reference.ts', // If specified, generate this file that you can use for your reference management
out: '<%= yeoman.app %>/scripts/out.js', // If specified, generate an out.js file which is the merged js file
watch: '<%= yeoman.app %>/scripts/', // If specified, configures this target to watch the specified director for ts changes and reruns itself.
options: { // override the main options, http://gruntjs.com/configuring-tasks#options
sourcemap: true,
declaration: true
},
},
build: { // another target
src: ['<%= yeoman.app %>/scripts/*.ts'],
options: { // overide the main options for this target
sourcemap: false,
}
},
},
...
...
grunt.task.run([
...
'ts',
...
]);
...
grunt.registerTask('build', [
...
'ts',
...
]);
When I run grunt server the compilation runs just fine, but this exclude the livereload from working as it would be using coffeescript.
You can have a look at the full file here: https://github.com/mimo84/tsyong/blob/master/Gruntfile.js
I moved my project from grunt-typescript
to grunt-ts
, it works great but using it leaves a tscommand.tmp.txt
in the root of my project.
Is this intentional?
Hi,
is it possible to enable incremental compilation?
On the https://github.com/jeffmay/angular-ts-seed project, I don't see an AMD loader file when I update the root "ts" options to include the amdloader config:
ts:
options:
module: 'commonjs'
sourceMap: true
sourceRoot: '/typescript/app'
amdloader: 'public/js/loader.js'
Regarding #16 @jeffmay I thought compile:false
was to get the codegen benefits without the compilation overhead. However it seems to skip updating the reference.ts
and amdLoader
: https://github.com/jeffmay/grunt-ts/blob/7e4d2fba7243c4ea382ec9b475206aea73a56137/tasks/ts.ts#L711-L752
Just interested to know if I've misunderstood the purpose of the flag.
Either way its not a big concern and we need to cleanup "compilation" vs. "codegen" tasks to be clearer for fastcompile anyways and this can be a part of that refactor :)
From jeffmay/angular-ts-seed#1 (comment)
//Only recompile the ts files that have actually changed.
var onChange = grunt.util._.debounce(function () {
grunt.config('typescript.base.src', Object.keys(changedFiles));
changedFiles = Object.create(null);
}, 200);
grunt.event.on('watch', function (action, filepath) {
changedFiles[filepath] = action;
onChange();
});
Instead of expanding all the source.
As per your SO response, I tried using grunt-ts in my project - but see this:
In folder /home/ttsiod/work/work3/codeGen/Customers-war/src/TypeScript
$ cat Gruntfile.js
module.exports = function (grunt) {
// load the task
grunt.loadNpmTasks("grunt-ts");
// Configure grunt here
grunt.initConfig({
ts: {
dev: { // a particular target
src: ["Customers/**/*.ts", "RTL/**/*.ts"],
reference: "Customers/reference.ts",
out: 'Customers/script.js',
watch: 'Customers',
options: {
target: 'es5',
sourcemap: true
}
}
}
});
grunt.registerTask("default", ["ts:dev"]);
};
In folder /home/ttsiod/work/work3/codeGen/Customers-war/src/TypeScript
$ grunt
Running "ts:dev" (ts) task
Compiling.
module.js:340
throw err;
^
Error: Cannot find module '/home/ttsiod/work/work3/codeGen/Customers-war/src/TypeScript/undefined/tsc'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
>> Compilation failed
Watching all TypeScript / Html files under : /home/ttsiod/work/work3/codeGen/Customers-war/src/TypeScript/Customers
Any ideas what could be wrong? I used the same setup as your tutorial video (Animal / Cow / etc) where it worked fine - but with my project I see this error. How to debug it?
We keep a local copy of node along with source in projects to let anyone checkout the project and launch grunt without node installation.
grunt-ts expects node to be installed. grunt-typescript works without node installed in the system.
@basarat I'm going to add travis-ci and TSLint (grunt-tslint) to the project.
This would makes sure the code compiles and the code-style is consistent for every contributor even if they have their editor misconfigured.
(would make PR's like the open shebang issue go a lot smoother)
Is there a way to specify source root for generated source maps like here?
I'm working on AngularJS app generated with Yeoman. The project has directory layout similar to this:
.
|-- app
| |-- index.html
| |-- scripts
| | |-- controllers
| | | |-- HomeController.ts
| | | `-- SearchController.ts
| | |-- directives/
| | |-- filters/
| | |-- models/
| | |-- services/
| | |-- app.ts
| | `-- reference.ts
`-- Gruntfile.js
grunt-ts
is configured this way:
ts: {
options: {
sourcemap: true
},
dist: {
src: ['app/scripts/{,*/}*.ts'],
reference: 'app/scripts/reference.ts',
outDir: '.tmp/scripts'
}
}
Every time grunt ts
command is executed, the plugin picks up all the *.ts
files in the app/scripts
directory and generates corresponding *.js
files in the .tmp/scripts
directory preserving relative paths (i.e. .tmp/scripts
directory has exactly the same layout of subdirectories as app/scripts
).
Source map files are generated side by side with JS files in .tmp/scripts
. But if we open for example .tmp/scripts/controllers/HomeController.js.map
file we see following:
{
"version": 3,
"file": "HomeController.js",
"sourceRoot": "",
"sources": [
"../../../app/scripts/controllers/HomeController.ts"
]
}
As you you can see generated path to the original TS file includes app
directory, but the app
is itself a root directory for the grunt web server, so original TS files can't be found by a web browser:
It would be really helpful to be able to set sourceRoot
dynamically for every generated file, so all generated source maps would look like this:
{
"sourceRoot": "scripts/controllers",
"sources": [
"HomeController.ts"
]
}
Or alternatively introduce internal grunt-ts
base path option, so all the generated source map paths would be relative to this base path:
ts: {
options: {
sourcemap: true,
basePath: 'app'
}
}
ย
{
"sourceRoot": "",
"sources": [
"scripts/controllers/HomeController.ts"
]
}
See if possible to add a wrapper file to export a string module for import
:
/// <reference path="./MyNpmModule.d.ts" />
declare module 'myNpmModule' {
export = MyNpmModule;
}
e.g. require([""],function (){
Hi basarat,
It would be super cool to have a kind of "banner" option which would combine with the "out" option of the grunt-ts task.
This way we wouldn't need to use another grunt task to insert a header after the concatenation.
I suppose we could use the comment-are-kept feature in the _reference.ts but this doesn't integrate well with the need to keep our version centralized (package.json)
Cheers
When using grunt ts built in watch, have an option to specify the polling interval. Default is 100ms. See : https://www.npmjs.org/package/chokidar
Not really an issue, more a question of a newbie. Is there a way to move all the objects which are created (Controllers etc) out of the global namespace. I tried to do yet so far no luck ... thanks
If you kill grunt while tsc is compiling, grunt-ts will leave behind a tscommand.
It should be able to clean up after the SIGINT signal.
This would be really nice and shouldn't be hard to do with grunt.
@basarat any reason we need this?
I would think we could just remove the comment as it isn't really that helpful for humans. Users should understand that this is one of the things they configured.
I just remove them by hand for now, but I'm thinking of just removing them from grunt-ts.
Are the JS and MAP files for each individual TS file supposed to be generated? I was under the impression that they are supposed to be generated.
I Have the a simply Gruntfile.js as follows:
module.exports = function (grunt) {
// load the task
grunt.loadNpmTasks("grunt-ts");
// Configure grunt here
grunt.initConfig({
ts: {
dev: {
src: ["public//*.ts"],
html: ["public//.html", "!public/vendor/__/", "!public/*/.tpl.html"],
reference: "public/reference.ts",
out: 'public/out.js',
watch: 'public',
}
}
});
grunt.registerTask("default", ["ts:dev"]);
}
Any insight would be greatly appreciated.
In the following documentation, it is not clear that the 'out' in 'dev' object is used for html-2-typescript or not. It will nice if the parameters can be explicitly prefixed by 'html' to indicate that is the case. For example, 'htmlOut'. At least, on my machine the 'out.js' only contains the JavaScript that is compiled via html-2-typescript code. Please verify that is intended.
ts: {
dev: { // a particular target
src: ["test/work/**/*.ts"], // The source typescript files, http://gruntjs.com/configuring-tasks#files
html: ["test/work/**/*.tpl.html"], // The source html files, https://github.com/basarat/grunt-ts#html-2-typescript-support
reference: "./test/reference.ts", // If specified, generate this file that you can use for your reference management
out: 'test/out.js', // If specified, generate an out.js file which is the merged js file
outDir: 'test/outputdirectory', // If specified, the generate javascript files are placed here. Only works if out is not specified
...
},
},
Thanks!
When I try to run multiple grunt processes in one project (like from grunt-concurrent
) I sometimes get an error when they race for control of tscommand.tmp.txt
Maybe some uniqueness in the temp-name would be good?
Say we have the JS structure:
ts
a.ts
foo
| b.ts
| c.ts
js
a.js
foo
| b.js
| c.js
If we compile with all three files with outDir set to js
its all okay. But if we only compile b.ts
or c.ts
with outDir set to js
then we would get:
js
| b.js
| c.js
Workaround is to create a temporary file under ts
called ignoreBaseDirFile.ts
and pass it to the tsc
compiler
Source maps are being generated even if {sourcemap: false} is given in the options.
I guess it's due to
options.sourceMap = options['sourcemap'] || options.sourceMap;
(line 632 in ts.ts) together with the default sourceMap: true.
When I generate a declaration any <reference>
in my project remains a <reference>
in the output declaration file (eg: nicely relative to my typings folder, including nested with some of my reference bundle files).
This makes the final file not self-contained / re-distributable.
Maybe we should resolve these? Optionally?
If you have a project like so:
public/
app/
main.ts
reference.ts
test/
reference.ts
then when you attempt to compile them both into the same directory with an AMD loader...
target/
js/
app/
main.ts
reference.js
amdloader.js
test/
reference.js
the outDir is "target/js" so the paths in amdloader are all set to "./../main.js" instead of "./main.js".
We should think about how we want to handle multiple reference files in a project. Maybe a separate ticket for this?
In this case, it would be simple enough to allow the user to specify the root path of the AMD loader (configuration is always a good option since people -- like myself -- always have exotic needs).
Alongside this though, I think we could more wisely default to using the path to reference file's directory appended with references (and then normalize the paths?)
@basarat what do you think?
Testing reference file generation, do you think this should work:
https://gist.github.com/pspi/6350429
Running the generated single-file output gives me this error that reminds me the usual files given in wrong order to typescript compiler.
$ grunt ts && node out
Running "ts:default" (ts) task
C:\dev\projects\tmp2\grunt-ts\out.js:4
__.prototype = b.prototype;
^
TypeError: Cannot read property 'prototype' of undefined
at __extends (C:\dev\projects\tmp2\grunt-ts\out.js:4:21)
at C:\dev\projects\tmp2\grunt-ts\out.js:8:5
at Object.<anonymous> (C:\dev\projects\tmp2\grunt-ts\out.js:13:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
Assumes installing necessary npm modules:
$ npm install -g grunt-cli
$ npm install grunt-ts
When running unit tests with Jasmine out of the box, I see a bunch of failures about angular not being defined and other things. I think it is important for the angular community to know that there is a simple and fast way to get started with unit tests.
I think the easiest option might be to create a grunt-contrib-jasmine template that loads the amd loader file before loading all the test scripts.
We need codegen to simplify external modules. So you can simply add a new TypeScript file and start writing code without unnecessary ceremony required by the javascript module system.
See README: https://github.com/grunt-ts/grunt-ts/blob/feature/modules/test/modules/README.md
Currently grunt-ts uses typescript 0.9.5. Please upgrade to allow for use of the newest version.
@jeffmay I'll try and add you as an owner on npm : https://npmjs.org/doc/cli/npm-owner.html
I am new to this but could not find your name on npm do you have an account: https://npmjs.org/login?
There's no way to compile without the --module
option?
Neither module: null
or module: false
appears to work.
Hence no way to use this task to compile a non-module?
When I use your grunt plugin I get the error below:
Roberts-Mac-mini:_build codebelt$ grunt ts
Running "ts:website" (ts) task
module.js:340
throw err;
^
Error: Cannot find module '/Users/codebelt/Sites/3mred/web/public/src/StructureTS/_build/node_modules/grunt-ts/node_modules/typescript/bin\tsc'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:903:3
Compilation failed:
Warning: Task "ts:website" failed. Use --force to continue.
Aborted due to warnings.
Not sure where this belongs, or maybe there exists an alternate way to do this:
Would it be possible to limit what files/modules get output in the generated declaration file?
My project 's (and uses) a lot of internal libraries and helpers I don't like them in the public API.
Any idea how to get this effect?
Using grunt-ts, compiling takes almost twice as long as the tsc compiler.
$ time tsc main.ts -out test.js
real 0m6.366s
$ grunt cm
Running "ts:api" (ts) task
Compiling.
Success: 14.38s for 1 typescript files
I'm hammering on #51; I have it up for new code, but got a question:
I see in the grunt-ts code there is some compiler look-up thing going on. Can anybody clarify what this is expected to do?
The way I see it it should look for peer (sibling) module next to the grunt-ts module install and use that if it exists, and if that fails then use the grunt-ts bundled compiler (v0.9.5).
Is this correct? Would it need to look up even further as the current code does? Seems overkill?
(current implementation doesn't work for me)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.