multiavatar / Multiavatar

Multicultural Avatar Generator in JavaScript
https://multiavatar.com
Other
1.78k stars 172 forks source link

Publish on NPM #2

Closed shadowtime2000 closed 3 years ago

shadowtime2000 commented 4 years ago

Are you thinking about publishing the API on NPM in a format like CommonJS, UMD, or ES?

giekaton commented 4 years ago

Yes, I'm planning to publish it on NPM, probably this weekend, in CommonJS format. I will post the link here when it's ready.

giekaton commented 4 years ago

I have published it on npm: https://www.npmjs.com/package/@multiavatar/multiavatar

To install and use: npm i @multiavatar/multiavatar

const multiavatar = require('@multiavatar/multiavatar')
let svgCode = multiavatar('Binx Bond')

Suggestions on how to improve the package are appreciated, as Node.js is not my native environment. I have tested it on a simple Node.js app, and it works well.

In the future, I'm planning to create different integrations for a variety of platforms. Contributions are also welcome.

shadowtime2000 commented 4 years ago

@giekaton can you open source the actual package? Like with the package.json and stuff?

giekaton commented 4 years ago

When installed with npm, the package.json appears in /node_modules/@multiavatar/multiavatar folder. But it is not a part of this github repo, as I made a separate package just for npm.

Do you mean to merge both packages, so that npm package would also be a part of this github repo?

shadowtime2000 commented 4 years ago

@giekaton Yeah, I am talking about something like that, or making another repo for it, because then others can contribute to the package itself too.

giekaton commented 4 years ago

Having it as a separate github repo is also an option, thanks for the suggestion. I will prepare it and let you know.

giekaton commented 3 years ago

I have merged the npm package into this GitHub repository, as it is simpler to manage a single repo.

To prepare the package for npm: clone this repo, run npm run build, and then it can be published to npm.

Using the multiavatar.min.js from this repo, the build script creates the Node.js module (index.js) in the CommonJS format.