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

feat: add xml and html file type support #40

Merged
merged 10 commits into from
Jan 8, 2025

Conversation

pbarton-andovercos
Copy link
Contributor

@pbarton-andovercos pbarton-andovercos commented Jan 4, 2025

Added xml and html file type support.

Increased test case coverage.

Updated dependencies to latest:

  • @iarna/toml
  • ini
  • semver
  • mock-fs
  • sinon

Migrated to nodejs test runner from bron.

Closes #39

@pbarton-andovercos
Copy link
Contributor Author

pbarton-andovercos commented Jan 4, 2025

Hey @webpro 👋, when you find a moment, can you look at this PR? We need the XML support as without it, release-it/bumper updates all versions that match the current version in the input due to how text types work. While adding the XML support, it was easy enough to add support for HTML in case anyone ever needed it. I updated all dependencies to their latest version, as some had issues with node 20+. While doing this, I noticed your Bron test runner is deprecated and recommends using the Nodejs native test runner, so I went ahead and did this as well.

@webpro
Copy link
Contributor

webpro commented Jan 8, 2025

Thanks @pbarton-andovercos! Really appreciate all the work here and I'm happy to merge it.

I do have one concern and that's the size of jsdom. little bumper was so nice & tiny... how about using something more light-weight like LinkeDOM or cheerio?

@pbarton-andovercos
Copy link
Contributor Author

@webpro I'll try both quickly and push the change for Cheerio or LinkeDOM.

…heerio for xml/html support

cheerio improved the performance by more than 2x and is just as fast as the other file types now
@pbarton-andovercos
Copy link
Contributor Author

@webpro migrated to cheerio FTW! It improved the performance by more than 2x and it is just as fast as the other file types. Also, migrating to this allowed me to drop the dependencies for not only jsdom but w3c-xmlserializer and detect-newline as well. Let me know if you see any other changes needed before merging.

@webpro
Copy link
Contributor

webpro commented Jan 8, 2025

Thanks, bumper packs a punch now :)

For another time, would be good to separate pull requests into multiple so maintainers can discuss and merge the separately. Yet in this case I'm good with all of it, excellent stuff.

@webpro
Copy link
Contributor

webpro commented Jan 8, 2025

Looks like there's one EOL issue in the final test, any chance you could fix that up?

@pbarton-andovercos
Copy link
Contributor Author

@webpro I know I should have broken it up but I got a little carried away with this 😅, would you like me to file a separate issue to fix that json unit test on windows? Just an EOL bug in test, I think.

@webpro
Copy link
Contributor

webpro commented Jan 8, 2025

no worries! really, i think this could be fixed in this PR still?

@pbarton-andovercos
Copy link
Contributor Author

pbarton-andovercos commented Jan 8, 2025

@webpro I think that test should be fixed now, replaced \n in the assertion with ${EOL}

I am on Ubuntu, so this is all I see 😃

bumper ±|feature/gh-39|→ npm test

> @release-it/[email protected] test
> node --test test

▶ release-it bumper
  ✔ should not throw (28.327146ms)
  ✔ should read one and write different (23.577847ms)
  ✔ should read one and write multiple files and respect prefix (21.624447ms)
  ✔ should write various file types (36.393005ms)
  ✔ should not write in dry run (7.607531ms)
  ✔ should give precedence to mime type over file extension (16.459727ms)
▶ release-it bumper (46.256406ms)
✔ /home/actpxb/source/github/repos/bumper/test/globals/constants.js (25.686638ms)
✔ /home/actpxb/source/github/repos/bumper/test/globals/file-utils.js (28.346102ms)
▶ html file
  ✔ should return latest version (37.436715ms)
  ✔ should return latest version (XHTML) (27.498154ms)
  ✔ should write (47.801073ms)
  ✔ should write (XHTML) (45.591764ms)
  ✔ should write without defining the type (44.098922ms)
  ✔ should write without defining the type (XHTML) (42.854627ms)
  ✔ should read/write (41.836462ms)
  ✔ should read/write (XHTML) (40.45474ms)
  ✔ should read/write without defining the type (39.222006ms)
  ✔ should read/write without defining the type (XHTML) (38.139128ms)
▶ html file (64.374119ms)
▶ ini file
  ✔ should return latest version (22.887702ms)
  ✔ should return latest version without defining the type (17.206516ms)
  ✔ should return latest version from section (14.693343ms)
  ✔ should write (18.391328ms)
  ✔ should write without defining the type (16.790342ms)
  ✔ should read/write (15.688045ms)
  ✔ should read/write without defining the type (14.706304ms)
  ✔ should read/write with section (13.43277ms)
▶ ini file (30.164495ms)
▶ json file
  ✔ should return latest version (19.92735ms)
  ✔ should write indented (16.857746ms)
  ✔ should write new, indented (14.142815ms)
  ✔ should write version at path (12.648904ms)
  ✔ should write version at multiple paths (11.149902ms)
  ✔ should update version with prefix (9.758361ms)
▶ json file (23.026005ms)
▶ text file
  ✔ should return latest version (23.762701ms)
  ✔ should return latest version without defining the type (19.057075ms)
  ✔ should write (25.843983ms)
  ✔ should write default text type (23.154498ms)
  ✔ should read/write (24.317616ms)
  ✔ should read/write without defining the type (23.316996ms)
  ✔ should read one and write multiple files (39.079965ms)
  ✔ should read and overwrite out-of-date, completely (20.782614ms)
  ✔ should read but not update out-of-date (19.731508ms)
  ✔ should read but not update out-of-date (default implied) (18.553468ms)
▶ text file (54.446736ms)
▶ toml file
  ✔ should return latest version (19.937779ms)
  ✔ should write (20.994528ms)
  ✔ should write without defining the type (18.378341ms)
  ✔ should read/write (16.80009ms)
  ✔ should read/write without defining the type (15.239957ms)
  ✔ should read/write without formatting (13.829416ms)
▶ toml file (28.767453ms)
▶ xml file
  ✔ should return latest version (21.16322ms)
  ✔ should write (20.836517ms)
  ✔ should write without defining the type (18.380358ms)
  ✔ should read/write (16.768098ms)
  ✔ should read/write without defining the type (14.889306ms)
▶ xml file (30.295674ms)
▶ yaml file
  ✔ should return latest version (20.300587ms)
  ✔ should write (21.921696ms)
  ✔ should write without defining the type (19.778632ms)
  ✔ should read/write (18.129585ms)
  ✔ should read/write without defining the type (16.345306ms)
▶ yaml file (31.293295ms)
ℹ tests 58
ℹ suites 8
ℹ pass 58
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 1294.563667

@webpro
Copy link
Contributor

webpro commented Jan 8, 2025

This is where the tests are run in CI, including Windows: https://github.com/release-it/bumper/actions/runs/12673529525

@webpro webpro merged commit 9daf66a into release-it:master Jan 8, 2025
6 checks passed
@webpro
Copy link
Contributor

webpro commented Jan 8, 2025

🚀 This pull request is included in v7.0.0. See Release 7.0.0 for release notes.

@webpro
Copy link
Contributor

webpro commented Jan 8, 2025

Cool, I was also able to test a new beta feature of release-it - not perfect yet, but promising!

Thanks again 🚀

@pbarton-andovercos pbarton-andovercos deleted the feature/gh-39 branch January 8, 2025 17:36
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.

Add XML and HTML file support, increment to latest dependencies, and migrate to nodejs native test runner
2 participants