-3

I have made a JavaScript function that I think could be useful to many people.

How would I do to "publish" it?

How can I make it as easy as possible for other people to include it in their projects?

(I'm not concerned about payment, licensing & such right now. If any, it should be free & permissive, although donations would be appreciated but not required).

Sebastian Norr
  • 7,686
  • 2
  • 12
  • 17
  • 2
    Have yout Tried Github or npm? – Konrud Nov 25 '19 at 13:38
  • 1
    Put it somewhere on the web.... – epascarello Nov 25 '19 at 13:41
  • 1
    Well it is a general comment like the general question which states "I have made a JavaScript function" which says nothing about what it does where people can point you to the best resource based on what it does. In the end it is a personal opinion on where you should put it and it is not a great fit for stackoverflow. – epascarello Nov 25 '19 at 13:44
  • You can create a public [gist](https://gist.github.com/) and write a proper description so it can be easier to find. – Goran Stoyanov Nov 25 '19 at 13:47
  • @epascarello I purposefully didn't explain what it is, you can see that when I managed to publish it. – Sebastian Norr Nov 25 '19 at 14:49
  • @Konrud I have considered Github & npm, they are high on the list, and it seams that most other answers here agree. I'm also curious if there are any other/better alternatives that I'm unaware of. – Sebastian Norr Nov 25 '19 at 14:54
  • 1
    It's difficult to say what is a "better" alternative without knowing what your function does and what are the expected usages. Basically github + npm (open repo + package fetchable via package managers) is the golden standart: fetchable package means that the installation is as simple as `npm i package-name`, open repo means that one can inspect the code/suggest changes. For certain packages CDN may be useful too, but without any context it's impossible to say whether it's reasonable to use it in your case – YakovL Nov 26 '19 at 14:11

3 Answers3

3

For javascript I'd recommend creating an npm package and register it at npmjs.com

Gijs Beijer
  • 560
  • 5
  • 19
3

1. If you want just to publish it, do it in https://www.npmjs.com/.

2. If you want to store your code in a repository, where other people will be able to contribute and help you building your product, the most popular source control system is https://github.com/. More, you can set up your account to receive donations by other people and companies as well.

3. Next step(not a part of the question) is to automate the whole process of building, testing, deployment from your source control system(https://github.com/ ) to the javascript packages storage(https://www.npmjs.com/) using CI/CD(continuous integration/continuous delivery) tools(e.g. https://jenkins.io/).

Antoan Elenkov
  • 711
  • 1
  • 5
  • 20
1

There are many ways in which you can do that. For the simpler stuff, you can use Pastebin (https://pastebin.com/) or CodePen (https://codepen.io/) for instance. You can also create a project on GitHub (https://github.com/) or publish a package over at NPM (https://www.npmjs.com/, https://docs.npmjs.com/cli/publish), either of these two being a must for a bigger library.

Also make sure to properly document your code and make it ease to find.