Skip to content

Conversation

@FreakIsTea
Copy link

✨ Upgrade Accent CLI to @oclif/core v4

Summary

This PR modernizes the Accent CLI by upgrading from the deprecated @oclif/command/@oclif/config stack to the latest @oclif/core v4.
The upgrade improves compatibility with Node.js 18+, simplifies dependencies, and aligns the codebase with current oclif best practices.


🔧 Changes

  • Core upgrade

    • Removed deprecated @oclif/command, @oclif/config, cli-ux, form-data, mkdirp, and node-fetch.
    • Upgraded to:
      • @oclif/core@^4.5.2
      • @oclif/plugin-help@^6.2.x
      • @oclif/plugin-not-found@^3.2.x
    • Updated bin/run to use @oclif/core.run/flush/handle.
  • Flags & args

    • Converted static args = [] → new Args object map.
    • Added short alias -c for --config.
  • Base command

    • Updated base.ts to extend @oclif/core.Command.
    • Replaced cli-ux calls with ux from @oclif/core.
    • Simplified config pre-parsing.
    • Used this.error instead of deprecated CLIError.
  • File + network handling

    • Removed form-data and fs.ReadStream usage.
    • Switched to Node 18’s native fetch, FormData, File, Blob.
    • Replaced mkdirp with fs.mkdir({recursive:true}).
    • Rewrote file download logic using response.arrayBuffer().
  • Build scripts

    • Removed use of rm; replaced with cross-platform Node command rimraf.
    • Dropped @oclif/dev-cli; replaced with modern oclif commands (readme, manifest).
  • Repo cleanup

    • Added .cmd to .gitignore.
    • Removed tracked bin/run.cmd (npm will auto-generate on install).
  • Docs

    • Regenerated README with oclif readme.
    • Updated OPTIONS to show -c, --config.

✅ Testing

  • Verified CLI runs locally via:
    • npm build && npm link # generate command "accent" according to package.json
    • accent sync --add-translations -c "accent.json"
    • accent jipt key_lang --config "accent.json"
    • accent jipt key_lang --config="D:\<path-to-file>\accent.json"
  • Confirmed new flags/args show up correctly in accent help.
  • Verified file upload/download commands with native fetch.

@FreakIsTea
Copy link
Author

FreakIsTea commented Sep 5, 2025

@simonprev I'm unsure if I missed tests for the CLI. If there are any, please tell me where so I can test the new version against them.

I'm also not sure if it'd be preferred to change how the config flag gets read, since it's now working with a pre parser. If you think this could be changed, I can change that as well.

@AerunDev
Copy link

AerunDev commented Dec 2, 2025

What a great contribution! Thanks. I think this will fix this issue tho: #485

@simonprev
Copy link
Member

Thanks for the pull request!

I’m trying to make it work locally but it’s difficult with the changes to the version number and other packages added/removed.

Can you remove those changes to just scope the PR with oclif upgrade? 🙏

Thank you!

@FreakIsTea
Copy link
Author

Hi @simonprev

I can try, but most of the packages won't be compatible. I had to swap out deprecated packages for newer ones or replace them completely. Did you run the commands which I've provided in the PR to test my solution? What exactly are you having trouble with?

I also realized that the node version constraint is not correct, as it has some compatibility issues with decamelize. I'll fix that as soon as I can. But I'll have to check my PR again, as it's been some time and I'm using my fork to work with accent cli which works for our special case.

Maybe there's still some work to be done so that the PR matches the general usage of the tool => we've made further improvements which I'd like to give back into the accent repo, but this one is the first. I hope to update the PR in the next few days.

@FreakIsTea
Copy link
Author

Hi @simonprev

I changed the minimal version to reflect the correct node versions to use. I tested it again locally on my device and it is working without any problems. If you encounter any issues, please let me know and I'll try to assist you.

Copy link

@AllianceGroup12 AllianceGroup12 left a comment

Choose a reason for hiding this comment

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

👍🏼

@simonprev
Copy link
Member

Thanks for the PR, I copied the file and remove things I did not need 😄

Closed by #484

@simonprev simonprev closed this Dec 23, 2025
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.

4 participants