ErnstHot / TypeScript-for-Max

TypeScript for Cycling '74 Max
Other
90 stars 12 forks source link

[question] publish npm package? #26

Closed FrancescElies closed 1 year ago

FrancescElies commented 1 year ago

Hi,

have you thought of publishing your TypeScript Declaration Files to npm so that one could install it easily as a development dependency?

Best & thanks for putting those .d.ts files together.

twhiston commented 1 year ago

+1 I'd also like to see this.

FrancescElies commented 1 year ago

@twhiston last commit was 3 years ago, I am starting to think that maybe we should fork and publish ourselves

twhiston commented 1 year ago

Yeah I suspect you are right. I suppose it could also use a refactor so it could be submitted to DefinitelyTyped (https://github.com/DefinitelyTyped/DefinitelyTyped). I appreciate that this repo currently tries to show some tsconfig.json best practices and examples etc. but for my needs a simple type definition package is all that's needed, and it would be nice to have that @types/max-msp imo. What do you think?

ErnstHot commented 1 year ago

Sorry for not answering sooner. If someone wants to take over this project I would very much appreciate it, I have neither the time nor the interest myself.

twhiston commented 1 year ago

I wouldn't mind doing that if you like, since I'm already using it in a few projects and I'm happy to put in the work to get it onto npm and into the @types

FrancescElies commented 1 year ago

(strikethrough 21-04-2023 17:11) ~As far as I know cycling is looking into improving the dev experience when writing js code but at the moment they won't be publishing types for js objects.~ @fde31 he maintains @types/max-api (last update here https://github.com/DefinitelyTyped/DefinitelyTyped/pull/65005) which offers types for max node api for node.script objects, maybe he has a suggestion for naming the new types package for js objects.

It would be worth to wait to hear his opinion on this.

twhiston commented 1 year ago

Out of interest where did you see that c74 are going to do some work on improving the experience with JS. I thought that their position was not to touch it, which is why we are stuck with es3 at the moment. See https://cycling74.com/forums/any-plans-to-update-support-for-recent-versions-of-js#reply-58ed21d5c2991221d9ccad8c

If @fde31 wants to drop in an opinion here on naming they are very welcome to!

twhiston commented 1 year ago

I made a pass at what I would do this to get the types ready for DefinitelyTyped and to update this repo in light of that.

Firstly there is a maxmsp branch in my fork of DefinitelyTyped https://github.com/DefinitelyTyped/DefinitelyTyped/compare/master...twhiston:DefinitelyTyped:maxmsp

Mostly there I consolidated the types into one file, performed the many many things that the DefinitelyTyped linter wanted, and put together the tests file. As a result of the test file I found a couple of places where I was able to make the definitions slightly better, fixing voids where there should be return types etc. If you have any comments that would be great.

@FrancescElies would you be interested in also becoming a DefinitionOwner i'd happily add you to the list there. I did not include @ErnstHot as he said he's not interested in it and it would just alert him then if people wanted to make changes to the definitions. Let me know if I got that wrong though!

The next step would be refactoring this repository so that it's more like a demo which requires the types via npm install @types/maxmsp --save-dev etc. You can see what this would look like in my branch here: https://github.com/twhiston/TypeScript-for-Max/tree/types-package obviously you can't actually npm install the types package yet as it does not exist, but if you create node_modules/@types/maxmsp and drop the files in the DefinitelyTyped branch above in everything will compile and run properly.

FrancescElies commented 1 year ago

@twhiston I strikedthrough a part of my previous message, I just want to clarify that I am not affiliated with cycling74 in any way or have any kind of insider information, my intention was to say that before putting any kind of serious amount of work on this it would be good to sync with cycling to see what their opinion is, I would like to avoid doing something that could fire back to use later on.

We have other options apart from publishing an npm package, we can also install types directly from github git+https://github.com/user/project.git, we can copy paste types into typings folder.

twhiston commented 1 year ago

I didn't assume that you were affiliated, more I hoped that you had seen something on their message boards which I had missed! ;)

The work is already done, check the links I posted above.

FrancescElies commented 1 year ago

@twhiston I will be away from keyboard for the next ~12 days, after that I will check the links, thanks for looking into that.

fde31 commented 1 year ago

Sorry for the delay here and thanks for working on types and making them available. Appreciated!

Naming is hard but no objections on my end on the proposed path at this point. If there is anything beyond that I can help with, please feel free to let me know.

To provide some context for the general aspects of [js]: The standpoint from the linked thread is still valid. We have long been interested in both updating our Javascript engine as well as providing better documentation, tools and support for Javascript in Max. We are actively working on both, but I'm afraid I cannot say when and to what extent this work will be publicly available at this point given the reasons mentioned by Joshua in the forum thread.

twhiston commented 1 year ago

Thanks very much for your input @fde31 and great to hear that c74 are working on improving the js eventually! As we have your blessing on the path i've made a PR to get them into DefinitelyTyped now https://github.com/DefinitelyTyped/DefinitelyTyped/pull/65253 Thanks!

ErnstHot commented 1 year ago

I've added @twhiston as a collaborator on this repository, so you can make whatever changes you deem necessary now, I assume? Please let me know if you need me to do anything else.

twhiston commented 1 year ago

Thanks very much @ErnstHot. Once the PR for the types is accepted over at DefinitelyTyped I'll make a PR here for the refactor of the examples and I'll check if I can merge it myself. Appreciate your trust in me with this.