rdkcentral / Lightning

Lightning - The WPE UI Framework for developing Apps and UX
Apache License 2.0
188 stars 109 forks source link

Introducing `core-es` package #503

Closed elsassph closed 1 year ago

elsassph commented 1 year ago

Following discussions on https://github.com/rdkcentral/Lightning/issues/501 with @frank-weindel, in order to address https://github.com/rdkcentral/Lightning/issues/490, I believe we should have 2 explicit libraries:

PR has 2 commits:

  1. Reorganises project into "packages", with current core library source moved under packages/core
  2. Adds package/core-es

The idea is that from this one repo, the 2 packages could be published.

rdkcmf-jenkins commented 1 year ago

Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 2 files pending identification.

elsassph commented 1 year ago

Is it maybe too radical? It can be made to work as a standalone repo with a build step pulling this repo.

rdkcmf-jenkins commented 1 year ago

WARNING: A Blackduck scan failure has been waived

A prior failure has been upvoted

frank-weindel commented 1 year ago

Thanks for submitting this @elsassph. I discussed with the team and we'd like to go with the simpler approach you laid out in #501. Is that something you'd be willing to revive?

elsassph commented 1 year ago

Thanks @frank-weindel. What about a separate repo for the ES exports?

There is a real concern IMHO that someone mistakenly imports both the global lng object and the ES source (VS Code can easily import it automatically) - which would unexpectedly significantly increase the size of a project.

frank-weindel commented 1 year ago

We would still transition to using the full source tree (built to dest) for the original ESM export. The new pure ESM export would import from that same source tree. So the worst that should happen is that users who mix will get all of Lightning in their bundle, as if they had just used the original ESM export anyway.

I'm not sure how much a separate repo would help. In any case, if a user installs it (assuming it's dependent on @lightningjs/core) and then installs an existing component library that still uses the @lightningjs/core's original ESM export they will be in the same boat as above.

As you've been able to utilize tree shaking in past Lightning versions without a separate package, what in your opinion would be the best way for you to achieve that again? I'm assuming your project does not use the Lightning SDK nor the two component libraries we have published in RDK Central as they use the original Lightning/'lng ESM export.