Comments (14)
see the details at https://github.com/gruntjs/grunt-contrib-watch#compiling-files-as-needed
you need to set spawn : false
in watch options too.
also, not sure how to do this with grunt-ts
watch functionality.
from grunt-ts.
not sure how to do this with grunt-ts watch functionality.
grunt-ts runs in parallel now thanks to work by @Bartvds so simply using the passed file in https://github.com/grunt-ts/grunt-ts/blob/master/tasks/ts.ts#L984-L1002 would work.
from grunt-ts.
um, I have an issue. When use partial compilation, say if it detects one file changed, reference.ts is maintained wrongly. It always remove previous entries between
//grunt-start
//grunt-end
and enters currently changed file. If I change another file, it again clears previous and enter current. Is there a way to prevent removing previous reference, and do so only if physically remove a file?
from grunt-ts.
@bsr203 I didn't know you were going to start working on this :) . Here was my plan:
add a new flag fastcompile
to the target options (not the task options). If it is truthy we :
- compile only the changed files (either local watch or grunt watch)
- do not do any custom code generation. If a custom code generation option is specified in the target we warn the user.
To disable code generation we need to flag out https://github.com/grunt-ts/grunt-ts/blob/master/tasks/ts.ts#L907-L924 and https://github.com/grunt-ts/grunt-ts/blob/master/tasks/ts.ts#L946-L953
This was going to the the increment towards : #34
from grunt-ts.
@bsr203 I was going to work on this after I sorted #69 out over the weekend
from grunt-ts.
I misunderstood the feature:
//Only recompile the ts files that have actually changed.
var onChange = grunt.util._.debounce(function () {
grunt.config('ts.base.src', Object.keys(changedFiles));
changedFiles = Object.create(null);
}, 200);
grunt.event.on('watch', function (action, filepath) {
changedFiles[filepath] = action;
onChange();
});
Belongs in your gruntfile. I thought it was going to be a part of grunt-ts
. We need a way inside grunt-ts to find out if base
target src
i.e. base.src
has been tampered with by grunt-watch. If so we should disable code generation.
I don't know how we can detect this, any ideas @bsr203 ?
from grunt-ts.
@bsr203 you might want to see : #76
from grunt-ts.
thanks for the feature. I am not an expert on grunt and not sure how you detect the changes. cant wait to try this out. thanks.
from grunt-ts.
@bsr203 if you update to grunt-ts 1.8.0
all you need to do is specify fast:true
https://github.com/basarat/demo-fullstack/blob/fe562a9378a240765b0dafa4b5d696416fc9a108/src/Gruntfile.js#L29
And it will work with grunt-contrib-watch
or any other tool you want to use for watching :)
from grunt-ts.
thanks basarat. I have been using it from [email protected]
, but didn't test it thoroughly. still converting stuff from js -> ts. thanks for this feature and your hard work.
from grunt-ts.
@basarat can you please add info about the file which has been compiled.
Running "ts:app" (ts) task
Compiling...
Using tsc v1.0.0
Success: 4.99s for 1 typescript files
Done, without errors.
I always get the message, 1 typescript files
, even if I change multiple files. I use out
option so it compiles to one file. Is it because of that?.
from grunt-ts.
I use out option
fast compile will not work with --out
since tsc
will need to compile all the files. I should have shown you this message : https://github.com/grunt-ts/grunt-ts/blob/master/tasks/modules/compile.ts#L68
I always get the message, 1 typescript files
I'd like to see the repo if possible to see what's happening.
an you please add info about the file which has been compiled.
You should have seen this message : https://github.com/grunt-ts/grunt-ts/blob/master/tasks/modules/compile.ts#L195 for all of the files that changed.
Again : I'd like to see the repo to reproduce. Thanks for your time :)
from grunt-ts.
I think myissue here , http://stackoverflow.com/questions/33080502/grunt-ts-watch-not-working-when-file-changed, is related to this. The problem for me with the build in watch could be that my needed type definitions, "typings/vendors.d.ts","typings/tsd.d.ts", "!libs/*/.ts" in .src is not included when it compiles the changed filse (from reading this issue i concluded that the src of the task is updated to only changed files)
from grunt-ts.
my problem (using external watch) was that i missed:
options: {
spawn: false,
},
from grunt-ts.
Related Issues (20)
- grunt-ts hangs forever HOT 3
- TypeError: Cannot read property '_writeln' of undefined HOT 6
- help
- resolve paths relative to tsconfig.json HOT 6
- Module resolution fails when used Path mapping HOT 1
- Please publish a new version for grunt-ts in NPM HOT 1
- Mention that we do not support `paths` in the readme
- baseUrl not passed to tsc correctly when using "." in tsconfig.json HOT 5
- Error running grunt-ts from VS2015 after update to typescript 3.1.1 HOT 2
- Compile error HOT 1
- Need to support grunt v1.0.2 HOT 6
- alwaysStrict not read from tsconfig.json HOT 1
- Lodash prototype pollution vulnerability HOT 1
- Support for Project References HOT 3
- grunt-ts does not work with empty "types" array in tsconfig.json HOT 2
- error TS2732 ...Consider using '--resolveJsonModule' to import module with '.json' extension HOT 1
- Override tsconfig with command line
- update dependency chokidar to fix Regular expression denial of service glob-parent HOT 2
- options.process is undefined, even though it's defined. HOT 1
- Take over as maintainer HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grunt-ts.