question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Support specifying which version of Angular Package Format to use

See original GitHub issue

Type of Issue

[ ] Bug Report
[X ] Feature Request

Description

Currently each major version of ng-packagr only supports one version of the Angular Package Format, thus only targets one version of Angular:

  • 1.x supports Angular 4
  • 2.x supports Angular 5
  • 3.x supports Angular 6

#344 Demonstrates that a package built targeting Angular 5 cannot be consumed by Angular 4. As a library developer, I want my package to be consumed by as many versions of Angular as possible.

I know I can simply stick to the 1.x version of ng-packagr to target Angular 4, but I still want to have all of the other goodies and bug fixes that you are releasing with the latest version.

I propose having some kind of command-line switch or a property added to ng-package.schema.json that would support specifying which version of the APF I want to target.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dhergescommented, Apr 29, 2018

It’s a matrix-compatibility thing.

Thoughts:

  1. Angular compiler 5 introduced metadata version 4. You cannot use metadata v4 in Angular 4 or prior.
  2. APF is a set of artefacts trying to support a broad range of tools. You will be able to create an APF 6 package that continues to work even with older versions of Angular as long as you used an “appropriate” compiler version. (In fact, the angular compiler has version constraints on typescript and that’s why ng-packagr uses the typescript and angular compiler version that the user has already installed in the project).
  3. However, by the evolution of the Angular tooling some features (e.g. resource inlining) are being moved to the Angular compiler and thus (partially) removed from ng-packagr. At that point, ng-packagr has some version constraints on the angular compiler version (much like angular has on typescript).
  4. In turn, ng-packagr has version constraints on angular compiler and that has version constraints on typescript and on and on and on. At some point, it implies constraints on both authors and consumers of a library. Example: you won’t get an Angular 6-compiled metadata v4 library to go get to work in an Angular 4 app.

As you said there are much factors influencing what versions are supported. That’s where the “matrix-compatibility” term comes in. It’s at most possible to support a limited set of version combinations. And it’s impossible to make any guarantees or long-term plans for such upfront. Right now, ng-packagr@3 works with both ng@5 and ng@6 but who am I to know whether that continues in ng@7? I do not know the future 🌵

Conclusion for me:

  • If you want the new and shiny things, go update.
  • v1 will continue to work
  • v2 will continue to work
1reaction
cyrilletuzicommented, Apr 29, 2018

Sooner or later, this feature need to be done, even if it is difficult.

You should always encourage your users to migrate to the latest version and not have legacy code.

Even in a dream world where everyone want and can update quickly, it is absolutely impossible that all Angular apps are up to date on day one of a new major release. So even in this dream world, there is a least a few days/weeks/months where some apps will be on the older version, and some others will already be updated.

In fact, now that ng-packagr is an official part of the CLI, this feature is a requirement if Angular wants to respect LTS support.

One option would be to have a directory for each major version with its own node_modules.

As a library author, this issue is why I don’t use ng-packagr as I want to provide proper LTS support for users.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular package format
This document describes the Angular Package Format (APF). APF is an Angular specific specification for the structure and format of npm packages that...
Read more >
Angular versioning and releases
Angular version numbers indicate the level of changes that are introduced by the release. This use of semantic versioning helps you understand the...
Read more >
Angular v13 is now Available
This latest release brings all sorts of updates and features to help your teams build great apps. Get Angular v13 now by running...
Read more >
Feature modules - Angular
A feature module delivers a cohesive set of functionality focused on a specific application need such as a user workflow, routing, or forms....
Read more >
Workspace npm dependencies - Angular
The Angular Framework, Angular CLI, and components used by Angular applications are packaged as npm packages and distributed using the npm registry.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found