-
Notifications
You must be signed in to change notification settings - Fork 4
feat: Refactor CLI tool #15
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
base: master
Are you sure you want to change the base?
Conversation
- Implemented `poEditorApiRequest` for API communication with error handling. - Created commands for exporting translations, listing projects, and uploading files. - Added configuration loading and validation for project settings. - Introduced terminal output utilities for consistent logging. - Integrated ESLint and Prettier for code quality and formatting. - Established TypeScript types for API responses and project configurations.
zaro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this is a complete rewrite ( probably with some AI), which I don't mind as it looks decent, but please check my comments.
Also did you test all the functionality ?
| "url": "https://github.com/zaro/poeditorial.git" | ||
| }, | ||
| "scripts": { | ||
| "build": "bun build src/index.ts --outdir=dist --target=node --packages external --splitting", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typescript is already devDependency. What is the point of uisng bun for building ?
I for example don't use bun, so it's one step more to building.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you publishing it from your local computer, then yes. I believe that github actions should publish the package automatically
|
|
||
| - name: Create Release | ||
| continue-on-error: true | ||
| uses: ncipollo/release-action@v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't make sense I believe.
The release should be to NPM, and this is simply publising to githbub releases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this is particular dedicated just for release notes.
| name: ${{ github.ref_name }} | ||
| body: ${{ steps.changelog.outputs.changes }} | ||
| token: ${{ github.token }} | ||
| artifacts: 'dist/*.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this action is only for release notes, why uploading the dist/*.js files to the relase ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case you can easily check the bundled output that was pushed to npm.
In some cases it's good to have it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can check that already on npmjs .org. It makes no sense to me, to upload only the JS files to a release on github.
Anyway, I hавing trouble understanding your reasoning .
The whole PR looks like AI generated, which might be fine, but only if it's thoroughly tested.
Anyway, what I would sugest, so we don't waste more time is go back to the original PR, just remove the node-fetch with built-in fetch, and I'll merge and release it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ai generated is only the core structure and some typings from poedit swagger documentation.
Everything else like Infrastructure, release and build process I did by hand. I included my own best practices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, sure.
No problem. It is not important, but here is the thing.
First this had dependency on bun . Why ? I understand you have personal preference to bun, but I have a personal preference to not care much about bun at this point.
Then, the pipelines ? What is this all about ? Just a sumple NPM publish on tag will be sufficient, but there are tons of other things, including adding compiles .js files are a release ...
I can go on, but i want to focus on the things we started talking about already ? And I want to clarify something for myself. What do you want to achieve with this total rewrite ? because refactor in the title is misleading, it is complete rewrite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not super important to merge this. We can drop this problem no problem.
I took a bunjs, because he can mark external dependencies and not include in bundle. Same can be achieved with vitejs. Also bun works out of the box- no extra configuration needed. And it is fast.
Lets keep this pr for a while and improve it according to your needs and preferences
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not against publishing from the pipeline, but if there will be publish from the pipeline at least it should be something like that : https://github.com/marketplace/actions/npm-publish
That actually publishes to NPM.
And then, bun. I am not saying bun is bad. Haven't used it , but it's interesting. My point is that anyway typescript is already a dependency, it should be used to building instead of bun.
Note I am not even talking about the massive over engineering this rewrite is. From a few hundred lines of simple script, now we have to discuss how bun is better of marking external dependencies. The truth is the script probably can be refactored w/o any external dependencies, fetch is already a built-in , and I guess the querystring built-in module can be used to construct the request body.
I hope that clarifies my standing here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your honest thoughts. I will improve this
poEditorApiRequestfor API communication with error handling.I understand - this PR crazy and scary - but I will try to explain in more details:
Development Tools
Code Quality:
bun run lint)bun run format)Git Hooks:
Testing:
bun testCI/CD Pipeline
GitHub Actions:
CONTRIBUTORS.mdPublishing Process:
NPM_TOKENsecret to be specified in repository settings)package.jsonversion, just follow git TAG semantic versioning.Contribution
Releasing process
git commit -am 'feat: Add some feature'(for fancy change log)masterbranchmasterbranchPublishUpdate
Also update a perdition to your GITHUB_TOKEN - more info https://github.com/ad-m/github-push-action/tree/master/

Also createto github repository secret
NPM_TOKEN- so github action could release a new package versionThanks in any case. It was a good challenge for me to make this :)