Skip to content
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

Automatically install .d.ts types for imported snippets when someone runs snippets dev ./path/to/snippets.tsx #3

Closed
1 task
seveibar opened this issue Dec 15, 2024 · 20 comments · Fixed by #8

Comments

@seveibar
Copy link
Contributor

seveibar commented Dec 15, 2024

  • Automatically populate node_modules/@tsci/seveibar.red-led/index.d.ts with the content from the snippets api (snippet.dts), creating directories where necessary

/bounty $20

Copy link

algora-pbc bot commented Dec 15, 2024

💎 $20 bounty • tscircuit

Steps to solve:

  1. Start working: Comment /attempt #3 with your implementation plan
  2. Submit work: Create a pull request including /claim #3 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to tscircuit/snippets-cli!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🟢 @ShiboSoftwareDev Dec 15, 2024, 9:04:37 AM #8

@ShiboSoftwareDev
Copy link
Contributor

ShiboSoftwareDev commented Dec 15, 2024

/attempt #3

Algora profile Completed bounties Tech Active attempts Options
@ShiboSoftwareDev 25 tscircuit bounties
TypeScript, JavaScript,
MDX & more
Cancel attempt

@ShiboSoftwareDev
Copy link
Contributor

@seveibar how do i access the snippets api? is is the registry-api?

@seveibar
Copy link
Contributor Author

@ShiboSoftwareDev sorry for the delay, yes it's the registry api!

@seveibar
Copy link
Contributor Author

@ShiboSoftwareDev it shouldn't be needed but there's also a config manager that let's you access the auth token from the original cli

@ShiboSoftwareDev
Copy link
Contributor

ShiboSoftwareDev commented Dec 15, 2024

I injected the types, but they are not known inside the project, I commented the types inside the old type files. @seveibar
Image

@ShiboSoftwareDev
Copy link
Contributor

this is how the files look
Image

@seveibar
Copy link
Contributor Author

@ShiboSoftwareDev hmm not sure, we might need to put in a package json file too

@ShiboSoftwareDev
Copy link
Contributor

@seveibar I had one but maybe it's missing something, I don't have to do bun add don't I?
Image

@seveibar
Copy link
Contributor Author

Maybe set the main entry to "index.js"?

@seveibar
Copy link
Contributor Author

Technically you could insert the registry .npmrc and fully install the package normally with "bun add". That is acceptable but wont fix type issues because the registry may not support returning types (or it might not sure)

@seveibar
Copy link
Contributor Author

image

@seveibar
Copy link
Contributor Author

That full package installation isnt a bad idea to do even if its currently broken because it'll allow for theoretical future execution. The downside is you have to call to shell and npm installation is technically insecure

@seveibar
Copy link
Contributor Author

I guess im ok with either i guess but if you do installation i would make sure the code is pretty rock solid because itll will have operating system and runtime bugs....

It might be nice to have the minimal types version...

@ShiboSoftwareDev
Copy link
Contributor

I'll see what I can do

@ShiboSoftwareDev
Copy link
Contributor

@seveibar today it worked without I do anything, maybe removing the old test files caused a bug in my editor

@ShiboSoftwareDev
Copy link
Contributor

@seveibar this is the content from the fetched dts:
Image
does it look correct?

@seveibar
Copy link
Contributor Author

@ShiboSoftwareDev yes that looks right!

Copy link

algora-pbc bot commented Dec 16, 2024

💡 @ShiboSoftwareDev submitted a pull request that claims the bounty. You can visit your bounty board to reward.

Copy link

algora-pbc bot commented Dec 17, 2024

🎉🎈 @ShiboSoftwareDev has been awarded $20! 🎈🎊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants