Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: --bundle option should allow for restricting output to parts of a project #4729

Closed
SetTrend opened this issue Sep 10, 2015 · 6 comments
Labels
Declined The issue was declined as something which matches the TypeScript vision Suggestion An idea for TypeScript

Comments

@SetTrend
Copy link

Taking up issues #4225 and #4434 I like to propose that it should be possible to create groups of bundles within a project.

A project commonly consists of files constituting the task to accomplish (i.e. the "library" to create), a number of test cases and other supporting files.

Concatenating them all into a single file would not be the intention of the programmer.

Hence, I'd like to propose to add an optional parameter to the --bundle option allowing for selectively adding branches of the project to the generated file.

The suggested format is a JSON array, allowing for concatenating parts of a project into different JavaScript files.

.

Here's an example of such argument:

[ "./TypeScript/*.ts": "./js/combined.js"   // end glob either with wildcard or directory to search for input
, "./Lib/*.ts": "./js/Lib.js"   // syntax is: "source file list": "concatenated destination file"
, "./Test/TypeScript": "./Test/js/main.js"
]

... or a more vivid example:

[ "./Angular/**/*.ts": "./out/angular.js"
, "./Animation/**/*.ts": "./out/angular-animate.js"
, "./Aria/**/*.ts": "./out/angular-aria.js"
, "./Cookies/**/*.ts": "./out/angular-cookies.js"
, "./Loader/**/*.ts": "./out/angular-loader.js"
, "./Messages/**/*.ts": "./out/angular-messages.js"
, "./Touch/**/*.ts": "./out/angular-touch.js"
, "./~Test": "./out/Test/main.js"
]
@weswigham
Copy link
Member

Question: Why not just have multiple config files, one for each target?

@SetTrend
Copy link
Author

I'm not sure if Visual Studio project settings will allow for that.

@weswigham
Copy link
Member

Even if they don't presently, they probably could.

@cveld
Copy link

cveld commented Sep 11, 2015

Will we be moving completely from msbuild towards nodejs/gulp taskrunners?
Because I believe your requirement can already be met with this approach,
even within a classic msbuild project.

2015-09-11 11:31 GMT+02:00 Wesley Wigham notifications@github.com:

Even if they don't presently, they probably could.


Reply to this email directly or view it on GitHub
#4729 (comment)
.

@weswigham
Copy link
Member

Yeah, if you use gulp-typescript you can use as many tsconfigs as you'd like (and they needn't be named tsconfig.json). The tsc command line compiler itself can deal with multiple config files, too - it just has the odd limitation that the --project flag takes a folder and not a config file... but since tsconfig.json files can reference files outside their own subfolder... it works fine, it can just be a bit awkward to use, since you have to make a new folder for each config file.

@mhegazy mhegazy added Suggestion An idea for TypeScript Declined The issue was declined as something which matches the TypeScript vision labels Sep 11, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Sep 11, 2015

As @weswigham mentioned, this is something that is achievable by calling the compiler multiple times. The compiler is not meant to be a replacement to your build driver, e.g. gulp/grunt/msbuild etc.. and it can not assume all of their tasks.

@mhegazy mhegazy closed this as completed Sep 11, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Declined The issue was declined as something which matches the TypeScript vision Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants