Skip to content

Replace version when npm version is called#9717

Merged
Falke-Design merged 3 commits into
Leaflet:mainfrom
Falke-Design:feat/release_version
May 14, 2025
Merged

Replace version when npm version is called#9717
Falke-Design merged 3 commits into
Leaflet:mainfrom
Falke-Design:feat/release_version

Conversation

@Falke-Design

Copy link
Copy Markdown
Member

With this change, the static version variable in Leaflet.js will be replaced automatically with the version of package.json everytime npm version is called.

With this solution Firefox versions before May can use the non-bundled code too. They didn't support json import: import pkg from '../package.json' with { type: "json" };

Solved issues with this approach:

  • It is possible to use the non-bundled code and we have always included the correct version instead of latest or some other placeholder
  • We have a static version instead of importing the version from package.json where the whole file was included. Named export of only the version is not possible.

    See Run test with the source files #9609 (comment). At the moment, the entire content of package.json ends up in the dist bundle.

  • We keep the git hash in the banner
  • We can remove the karma preprocessor

Looks like this then:
grafik

Supersedes #9657, #9662

@simon04 please review too

@Falke-Design Falke-Design requested a review from IvanSanchez May 13, 2025 16:56
Comment thread build/version.js Outdated
@Falke-Design Falke-Design added this to the 2.0 milestone May 13, 2025

@simon04 simon04 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Successfully tested locally.

Comment thread build/version.js
@Falke-Design Falke-Design merged commit f4eeb7f into Leaflet:main May 14, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants