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: reinstate typings bundle(s) #5796
Comments
Yes! |
@alexeagle Just quickly, the way |
cc @rkirov |
If I use this tsconfig.json in my project:
new typescript compiler generates single ES6 .js bundle file and single definition .d.ts file for whole project. Resulting .d.ts looks like:
If there exists similar process for both angular2 and rxjs projects, everybody could develop and build angular2 solution _without NPM_, using HTML page like:
Am I right? It could be a huge step for VS.NET developers to easily adopt angular2. |
@PavelPZ yes, I have been meaning to try that since it was added in TS. Earlier we were blocked by inability to compile ng2 with TS 1.8. We should be able to do it now, as soon as I get some time. Or you could try contributing this. The tricky thing is that we don't compile angular2 with a single tsc execution right now, instead we have the broccoli builder in |
I am nor NPM not node.js expert, so I made some one hour reverse engineering in order to create rxjs and angular 2 d.ts file, see rxjs-Angular2-DefinitelyTyped. Basic idea is:
Whole magic is to specify typescript source files, which allow bug free typescript compilation. |
@PavelPZ very clever, the file you built looks really good, it has comments, the right module names, and all the deps included. |
Basically when we run the compiler over one unit of angular2 (eg. the "core barrel"), we want to do it again with the modified compiler settings to produce one file. Also I don't think there should be a single file with the dependencies. This means if you use a different version of rxjs with a given version of angular2, you have no way to select matching typings. Instead, we should have a typings bundle for rxjs (we can ask them to produce one as well, once we have the recipe figured out) and one for each angular2 compilation unit (eg. a separate one for testing). |
@alexeagle, the Typescript is very clever, I only extracted correct Angular 2 x rxJS source files. I think that providing correct files to developers (one ZIP for every compilation variant) will be the most comprehensive way for them (ZIP could be similar to All other build products (d.ts files, ES6 JS bundle files, ES5 JS bundle files, minified, with embeded .MAP, with embeded TS sources etc.) is question of setting desired tsconfig.json. In addtion, all without NPM, just with the help of single tool - Typescript compiler. Regarding different angular2 x rxjs definitions: I absolutely agree with you. |
Producing equivalent bundles with TypeScript is way outside my scope right On Sun, Mar 13, 2016 at 9:55 AM Pavel Zika notifications@github.com wrote:
|
@alexeagle, my basic problem is to select correct technology for my company (choosing React x Angular). After a month studying React I am examining Angular 2 now (from many points of view, NPM less development environment is one of them). Now I stopped it due to problem with implementing basic things like breadcrumb (#5318) and product catalogue (#2753). I hope that Angular will prove to be feasible as soon as possible and I will be able to continue in this discussion. |
@alexeagle is this still relevant? |
It's relevant, in that we still ship typings in individual files, not bundled like the new flat ESM JS packages. But, I think we can close it anyway, because I don't know of a good reason that someone would need this. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Hi,
Typings has always been an issue on Angular 2 and different strategies have been followed since the very beginning of the project (example: #3082)
PS: I'm available to implement this if the team feels like it's the way to go forward. I'm also available to provide more justification/clarification to this topic if you want.
Motivation
The latest strategy (#5248) although very suitable for a ToDo app, fails to work on more complicated environments (targeting ES6 on typescript is an example).
Deploying Angular2 with anything but NPM will also not work. Better than me, you all know that bower (and other) package managers are used and there is no need to have the entire angular source code in every dev machine when the bundle suffices.
Also,
breaks compatibility on typings with global definitions and internal modules and it's not yet fully supported on some IDE's (like Visual Studio - changing to cjs is not always an option).
Goal
Ease medium/large size projects development, allowing different distribution channels. Allow for ES6 direct compilation.
Proposal
Distribute typings packages to each module (angular/core, angular/common, ...). Dgeni should no longer be required (thus removing one more tool to maintain).
Use tools like https://github.com/SitePen/dts-generator or soon to be available compiler option microsoft/TypeScript#4433 to achieve this.
A simple test shown that if we cleanup somethings on the code (like this. where Promise is defined on es6-shim.d.ts but not declared on the file (nor catched by the generator), thus making hard even to read the code) dts-generator will work.
Example
Imagine a front-end project with the following structure:
This front-end project uses a framework (with business logic) that internally uses Angular2.
Both core and all the modules use other 3rd parties.
In this case, from angular we only need something like:
This simple structure can easily be distributed.
The text was updated successfully, but these errors were encountered: