Skip to content

Remove dead dependency snake-case#938

Open
StefanDBTLabs wants to merge 1 commit intogregberge:mainfrom
StefanDBTLabs:stefanhayden/snake-case
Open

Remove dead dependency snake-case#938
StefanDBTLabs wants to merge 1 commit intogregberge:mainfrom
StefanDBTLabs:stefanhayden/snake-case

Conversation

@StefanDBTLabs
Copy link
Copy Markdown

Summary

resolves #937

snake-case is a deprecated repo. just-snake-case does the same thing with fewer dependencies.

Test plan

image

@vercel
Copy link
Copy Markdown

vercel bot commented Jan 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
svgr ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 16, 2024 10:14pm

"dashify": "^2.0.0",
"glob": "^8.0.3",
"snake-case": "^3.0.4"
"just-snake-case": "^3.2.0"
Copy link
Copy Markdown

@zettca zettca Mar 28, 2024

Choose a reason for hiding this comment

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

Why not change-case instead?

  • It could also replace camelcase
  • It's what the author recommends (same author)
  • It's more popular (projects will more likely have change-case than just-snake-case already in their node_modules)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You could switch to change-case, but version 5.x is ESM-only, and I believe only support node 16.x and up.
Version 4.x of change-case also works, but I'm not sure that one is as small as the 5.x branch (it is at least still structured as a cluster of several sub-dependencies in v4.x).

You could argue that is still a better fit than changing to just-snake-case, though, in which case I'm happy to open a PR that replaces camelcase+snake-case to change-case 4.x!

Copy link
Copy Markdown

@zettca zettca Dec 4, 2024

Choose a reason for hiding this comment

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yeah, supporting only node 16 from now on would be good.
I think the issue I'm seeing is that this project still supports node 14 and still builds for commonjs:

Command failed: /Users/stiaje/Projects/svgr/packages/cli/bin/svgr --no-index __fixtures__/simple --out-dir=__fixtures_build__/no-index-case
    /Users/stiaje/Projects/svgr/packages/core/dist/index.js:4
    var changeCase = require('change-case');
                     ^

    Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/stiaje/Projects/svgr/node_modules/.pnpm/change-case@5.4.4/node_modules/change-case/dist/index.js from /Users/stiaje/Projects/svgr/packages/core/dist/index.js not supported.
    Instead change the require of /Users/stiaje/Projects/svgr/node_modules/.pnpm/change-case@5.4.4/node_modules/change-case/dist/index.js in /Users/stiaje/Projects/svgr/packages/core/dist/index.js to a dynamic import() which is available in all CommonJS modules.

If I'm just missing something stupid to be able to have jest also run on ESM code, though, that's great!

stianjensen added a commit to stianjensen/svgr that referenced this pull request Mar 23, 2025
I noticed this PR still hanging
gregberge#938, for this issue:
gregberge#937

This should resolve the suggestions by replacing both these old packages
with a new leaner one.

Using version 4.x of change-case, as 5.x has done a rewrite to ESM-only.

There is one behavior change in how pascalCase works (I haven't been
able to find any alternative library that retains the behavior of the
camelcase library wrt pascal-case after a leading number).
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.

Snake Case dependancy is depricated

3 participants