microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.76k stars 12.46k forks source link

Add option for nesting TypeScript output in project #297

Closed SeriousM closed 8 years ago

SeriousM commented 10 years ago

When I save a TypeScript file it generates the javascript and map file as it should be. The problem is that the generated files are NOT automatically added to the project file references. This is a big problem since we're using T4MVC which doesn't create links to those files. Another problem is that the web-publish doesn't publish js files since they are unknown (not in project).

Are there any plans to nest the .js and .map files under the .ts files on generation?

As a back reference to codeplex: https://typescript.codeplex.com/workitem/2497

danquirk commented 10 years ago

This has been a tricky one as there are people on both sides of the camp. One reason they are not nested right now is because with the way Visual Studio is designed if you are nested then you inherit the same source control behavior as your parent. This means when you check in a TS file you have to check in its corresponding JS file, but then when you build it fails since the compiler tries to write to a bunch of locked JS files that are under source control.

There're also other issues with project options that affect these file relationships, for example you'd presumably not want the JS files to show up in Solution Explorer once you check 'use --out' in the project properties.

That said, I generally agree that the current state of affairs is not ideal in the abstract and just an artifact of some existing limitations (design wise and resource wise).

ChrisMBarr commented 9 years ago

I would also love to see an option for this added. Since there are good reasons on both sides, why not just keep the current behavior as the default, and add options in the Visual Studio preferences (Options > Text Editor > TypeScript > General).

paulvanbrenk commented 9 years ago

It's curious that the publishing doesn't work, since we made changes before to make it work with regular asp.net projects.

I'll investigate to see if can find something, but a small sample project which shows the problem would be greatly appreciated!

mhegazy commented 9 years ago

@paulvanbrenk we probably should open an new issue for this for 1.5

mhegazy commented 8 years ago

JS files (as well as .map, .d.ts) are considered outputs and thus not included in the project. Building, publishing, etc.. should all work correctly, if not these are bugs we need to fix. Nesting output files under sources is a feature that can be achieved manually or using a tool like WebEssetials, but it is out of scope of the TypeScript project.