Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"root": true,
"env": {
"node": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:import/errors",
"plugin:import/typescript",
"plugin:@typescript-eslint/eslint-recommended"
],
"globals": {},
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": "./tsconfig.json",
"tsconfigRootDir": "."
},
"plugins": ["@typescript-eslint", "simple-import-sort", "import"],
"settings": {
"import/resolver": {
"typescript": {
"alwaysTryTypes": true,
"project": "./tsconfig.json"
},
"node": {
"extensions": [".js", ".ts"]
}
},
"import/parsers": {
"@typescript-eslint/parser": [".ts"]
},
"import/extensions": [".js", ".ts"]
},
"rules": {
"no-unused-vars": "off", // Required by @typescript-eslint/no-unused-vars
"curly": "error",
"no-duplicate-imports": "off",
"padding-line-between-statements": [
"error",
{
"blankLine": "always",
"prev": ["class", "function"],
"next": "*"
},
{
"blankLine": "always",
"prev": "*",
"next": ["class", "function", "return", "try"]
},
{
"blankLine": "always",
"prev": ["import", "for", "if", "switch", "while"],
"next": ["const", "expression", "let"]
},
{
"blankLine": "always",
"prev": ["const", "expression", "let"],
"next": ["for", "if", "switch", "try", "while"]
},
{
"blankLine": "always",
"prev": ["const", "expression", "import", "let"],
"next": "export"
},
{
"blankLine": "always",
"prev": ["for", "switch", "while"],
"next": "if"
},
{
"blankLine": "always",
"prev": ["if", "switch", "while"],
"next": "for"
},
{
"blankLine": "always",
"prev": ["if", "for", "while"],
"next": "switch"
},
{
"blankLine": "always",
"prev": ["if", "for", "switch"],
"next": "while"
}
],
/* @typescript-eslint */
"@typescript-eslint/consistent-type-imports": [
"error",
{
"prefer": "type-imports",
"disallowTypeAnnotations": true,
"fixStyle": "separate-type-imports"
}
],
"@typescript-eslint/no-unused-vars": [
"error",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "all",
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/no-deprecated": "error",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error",
"import/no-unused-modules": ["warn", { "unusedExports": true, "ignoreExports": [] }],
"import/no-cycle": ["error", { "ignoreExternal": true }],
"import/no-default-export": "error",
"import/no-dynamic-require": "error",
"import/no-mutable-exports": "error",
"import/no-useless-path-segments": "error",
"import/no-self-import": "error"
}
}
22 changes: 22 additions & 0 deletions .github/workflows/contributors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Add contributor

on:
push:
branches:
- 'master'

jobs:
add-contributor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
submodules: recursive

- uses: akhilmhdh/[email protected]
with:
readme_path: CONTRIBUTORS.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59 changes: 59 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Publish Package

on:
push:
branches:
- '!*'
tags:
- 'v*'

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
submodules: recursive

- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run build
- run: bun publish --access public
env:
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Update CHANGELOG
id: changelog
continue-on-error: true
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}

- name: Create Release
continue-on-error: true
uses: ncipollo/release-action@v1
Copy link
Owner

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

Copy link
Contributor Author

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.

with:
allowUpdates: true
draft: false
makeLatest: true
name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}
artifacts: 'dist/*.js'
Copy link
Owner

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 ?

Copy link
Contributor Author

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.

Copy link
Owner

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.

Copy link
Contributor Author

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.

Copy link
Owner

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.

Copy link
Contributor Author

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

Copy link
Owner

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.

Copy link
Contributor Author

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


- name: Commit files
continue-on-error: true
run: |
git config --local user.email "[email protected]"
git config --local user.name "zaro"
git commit -m "Release: ${GITHUB_REF:11}" -a

- name: Push changes
continue-on-error: true
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.npmrc
node_modules/
node_modules/
dist/
2 changes: 0 additions & 2 deletions .npmignore

This file was deleted.

6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ignore artifacts:
dist
node_modules

# Ignore changelogs:
CHANGELOG.md
27 changes: 27 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"tabWidth": 4,
"singleQuote": true,
"printWidth": 120,
"endOfLine": "lf",
"overrides": [
{
"files": "*.md",
"options": {
"printWidth": 100,
"useTabs": false,
"trailingComma": "none",
"arrowParens": "avoid",
"proseWrap": "always"
}
},
{
"files": "*.{json,*rc,yml}",
"options": {
"useTabs": false,
"tabWidth": 2,
"printWidth": 120,
"trailingComma": "none"
}
}
]
}
53 changes: 53 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Contributors

## Maintainer

- **Svetlozar Argirov** ([@zaro](https://github.com/zaro)) - <[email protected]> - Original author
and current maintainer

## Contributors

<!-- readme: contributors -start -->

<!-- readme: contributors -end -->

## How to Contribute

We welcome contributions from the community! If you'd like to contribute to POEditorial, please
follow these steps:

1. Fork the repository
2. Create your feature branch from `master`: `git checkout -b feature/my-new-feature`
3. Commit your changes: `git commit -am 'feat: Add some feature'`
[Conventional Commit messages](https://www.conventionalcommits.org/en/v1.0.0-beta.2/)
4. Push to the branch: `git push origin feature/my-new-feature`
5. Submit a pull request

### Develop

To install dependencies:

```bash
bun install
```

To run:

```bash
bun run src/index.ts
```

Please make sure your code follows the existing style conventions and includes appropriate tests and
types.

## Acknowledgements

Special thanks to:

- [POEditor](https://poeditor.com/) for their translation management platform and API
- [Bun](https://bun.sh/) - The JavaScript runtime and toolkit used in this project
- All the open source libraries that make this project possible

---

\*This file is maintained by project contributors.
Loading