Closed joeyfigaro closed 9 months ago
Here's the initial pass at typescript declarations, along with map.
Hey @joeyfigaro, I was planning to add support for npm in the coming weeks. As for TS, I've never used it (I'm quite new to Javascript, actually), but I'll also take a look. Of course the lib is open to contributions. If I understand the above code correctly, you're only adding TS stuff to the functions that are exported. Is this right?
@acamposuribe re: npm, that's awesome–timing of that should work well for what I'd be contributing on the TS side of things. For the TS snippets, you understood correctly–my goal here is just to offer typings for the exports. It'll give enough helpful info for TS consumers and would be pretty painless to put up a PR for.
@acamposuribe putting PR up a little early to get your thoughts on changes so far. I wasn't sure where you were in setting up support for automated releases to npm, so I threw up something pretty rudimentary.
I need to test out the exports
configuration I've got in package.json to make sure all is working properly. I'll be focusing on that next–and addressing any questions/concerns/requests you may have. 💪🏻
@acamposuribe any questions or changes you'd like me to make for this guy?
Since I'm not used to NPM, I haven't had the time yet to check the PR thoroughly. Will try to do in the next days. Thanks a lot for the contribution!
@acamposuribe no worries and you're most welcome–I'll keep checking in over the next week. 💪🏻
I added some notes to the PR about NPM requirements; hopefully they're helpful.
@joeyfigaro I accepted the pull request Hopefully in the coming weeks/months I will be able to update myself to TS and NPM. For now you're in charge of that!
@acamposuribe I completely missed the notification for this, man! Now that I've seen it–love it. I'll get to work. 💪🏻
I'm diving into how people are managing to publish usable p5 addons to npm and found p5.js-svg
available on npm/github.
I don't want to make any changes to the work you've done so far since my intention is to keep these changes minimal and out of your hair, so I'll leave some links for your own exploration. You can take a look if you're interested in seeing how other p5 libraries are supporting installing via npm and using typescript for their work.
Main entry: https://github.com/zenozeng/p5.js-svg/blob/main/src/index.ts
Useful typings examples: https://github.com/zenozeng/p5.js-svg/blob/main/src/types.ts
You can see how people are expected to use the exported init
function in this example.
In the meantime, I'll carry on with automating new releases, type generation, and publishing.
Hey @joeyfigaro I've finally been able to dive into npm and ES6 standards and just created a new version of the repo that should work with npm. As for typescript, not planning to do that for now.... :D
@acamposuribe awesome! I'll be around if/when you're interested in introducing Typescript. Keep up the fantastic work. 💪🏻
Hey @acamposuribe! The work you've made available is phenomenal–I can't wait to play with it.
I wanted to ask about your future plans/intentions for publishing to NPM and adding support for Typescript.
There's a frustrating gap between working in modern JS/TS and p5, and p5.brush is by far one of the most promising tools I've seen in the p5 ecosystem–it'd be good for p5 if your work helped bridge the gap between JS 10 years ago and all of the lovely advancements that have been made since.
I'd love to help however I can if you're open to contributions.