Skip to content

Conversation

fabiovincenzi
Copy link
Contributor

@fabiovincenzi fabiovincenzi commented Feb 28, 2025

Overview
This PR introduces TypeScript to git-proxy and refactors relevant code to support it.

Changelog

  • Added TypeScript configuration (tsconfig.json) with essential settings for strict type checking, ES6 compatibility, and JSX support.
  • Added typescript and ts-node to manage TypeScript code compilation and execution.
  • Updated the package.json to include TypeScript dependencies.
  • Converted the main entry file from JavaScript (index.js) to TypeScript (index.ts).
  • Modified the start script to use ts-node for running TypeScript files.

Thanks to @jescalada for the work on fixing CI issues on G-Research#31, which helped guide the necessary changes in this PR.

Related issue: #927

Copy link

linux-foundation-easycla bot commented Feb 28, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link

netlify bot commented Feb 28, 2025

Deploy Preview for endearing-brigadeiros-63f9d0 canceled.

Name Link
🔨 Latest commit c1128c4
🔍 Latest deploy log https://app.netlify.com/projects/endearing-brigadeiros-63f9d0/deploys/6867c8d9f297eb0008db7990

Copy link

codecov bot commented Mar 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.25%. Comparing base (29d0e34) to head (c1128c4).
⚠️ Report is 187 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #929      +/-   ##
==========================================
+ Coverage   76.91%   79.25%   +2.33%     
==========================================
  Files          55       59       +4     
  Lines        2270     2694     +424     
  Branches      255      333      +78     
==========================================
+ Hits         1746     2135     +389     
- Misses        494      523      +29     
- Partials       30       36       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JamieSlome
Copy link
Member

@06kellyjac - can we get a review and confirm whether this would constitute a patch or minor bump?

Any opine welcome @jescalada too 👍

Copy link
Contributor

@06kellyjac 06kellyjac left a comment

Choose a reason for hiding this comment

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

These suggestions would ensure npx @finos/git-proxy continues to work.

Although the package in npm wouldn't work properly if someone is doing require("@finos/git-proxy") (or import) from plain JS. We probably want to build out valid JS with type defs for the published package

@06kellyjac
Copy link
Contributor

Squashing the commits down would be appreciated 🙂

@JamieSlome
Copy link
Member

@fabiovincenzi - can you take a look at the comments and we can get this merged?

@fabiovincenzi fabiovincenzi force-pushed the typescript-setup branch 2 times, most recently from a3f23bb to e7ec595 Compare March 19, 2025 15:47
@fabiovincenzi
Copy link
Contributor Author

Hey @06kellyjac, @JamieSlome,

I've addressed all the comments and cleaned up the commit history by squashing the relevant commits.
Let me know if there's anything else needed to get this merged!

Thanks! 😊

@JamieSlome
Copy link
Member

@06kellyjac - are we ready to merge?

What is the recommend version bump here, minor or patch?

@06kellyjac
Copy link
Contributor

No, I don't think this is importable from javascript as-is. We'll need to build out js and type definitions for the published package.

@fabiovincenzi
Copy link
Contributor Author

No, I don't think this is importable from javascript as-is. We'll need to build out js and type definitions for the published package.

Hey @06kellyjac,

Could you clarify what you mean by "not importable from JavaScript as-is"? I thought git-proxy was being executed directly through the index.js, as the package.json doesn't have a "main" entry.

Also, do you want us to generate the JS and type definitions and include them in the publishing workflow for npm? Let me know how you'd like to proceed.

Thanks! 😊

@fabiovincenzi fabiovincenzi linked an issue Apr 25, 2025 that may be closed by this pull request
3 tasks
@fabiovincenzi
Copy link
Contributor Author

fabiovincenzi commented Apr 25, 2025

Hi @06kellyjac, @JamieSlome,

I went ahead and implemented the changes to make the package importable from JavaScript/TypeScript:

  1. tsconfig.json: enabled "declaration": true and set outDir.
  2. package.json: added
    • "main": "dist/index.js"
    • "types": "dist/index.d.ts"
  3. CI/build workflow: now runs npx tsc to generate the .js and .d.ts files.

Could you take a look and let me know if this covers the requirements you asked for?

Thanks! 😊

@06kellyjac
Copy link
Contributor

Thanks, I'll have a play with it.
One thing I'll need to test is importing other files. ATM we know some users are importing individual files to extend git-proxy so need to check that. Once everything is exported well via index we shouldn't have problems in that regard.

@JamieSlome
Copy link
Member

Thanks, I'll have a play with it. One thing I'll need to test is importing other files. ATM we know some users are importing individual files to extend git-proxy so need to check that. Once everything is exported well via index we shouldn't have problems in that regard.

Thanks Jack. Keen to get this merged soon!

@JamieSlome
Copy link
Member

@jescalada - can we resolve conflicts? @06kellyjac - if no other issues, I'd like to merge this 👍

@@ -2,6 +2,8 @@
"name": "@finos/git-proxy",
"version": "1.11.0",
"description": "Deploy custom push protections and policies on top of Git.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Copy link
Contributor

Choose a reason for hiding this comment

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

moving to dist would break existing usecases
not everything is exported or accessible via main/index atm

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd love to go with this for a cut of v2 some time in the future

@coopernetes

This comment was marked as outdated.

@fabiovincenzi
Copy link
Contributor Author

Thanks for flagging this! @coopernetes

This PR has been open for quite a while and had fallen behind main, so earlier diffs were cluttered with commits that were already on the main branch.
I’ve just merged the latest main, now the diff only shows the actual TypeScript work

If the commit history still feels noisy, I can rebase or cherry-pick these changes onto a fresh branch.

@fabiovincenzi fabiovincenzi closed this by deleting the head repository Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants