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

modularize, publish to npm #3

Closed
ghost opened this issue Feb 3, 2014 · 14 comments
Closed

modularize, publish to npm #3

ghost opened this issue Feb 3, 2014 · 14 comments

Comments

@ghost
Copy link

ghost commented Feb 3, 2014

In the main example there are 17 script tags:
https://github.com/lo-th/Oimo.js/blob/master/index.html#L16-L32

That's not a great way for third parties to consume this library. It's common practice to generate a umd build so that people using module systems such as commonjs or AMD can require() this module and people not using any module system will still have their window globals as usual, but with only a single <script> tag to include.

Once the code has been modularized, you can generate a package.json file with npm, which ships by node.js by default. Just do:

npm init

And the command will walk you through filling out the right fields. You should point the "main" field at the singular entry point for this package, which could be a dist build since the internals aren't modularized yet. A really simple way to do this with what you've already got is just to cat together all the files necessary and then append some exports.FOO=... statements, at least for commonjs. Once the build works, just publish to npm with:

npm publish

You can test the build with a tool like browserify.

@lo-th
Copy link
Owner

lo-th commented Feb 3, 2014

hum i have to test that, i don't use command or node.js
build folder is only containe final oimo.js version all other package is on js folder
no need external download. But i have many update to do like compound rigidbody, shooting ball...

@positlabs
Copy link
Contributor

IMO, it doesn't make sense to publish this library on npm. npm is for node packages, not client-side js libraries. If oimo.js is going to be published as a package, it should be on Bower. Bower is specifically used to manage front-end libraries like this one.

If I have time next week, I can try to take a stab at AMD modularization and publishing to Bower.

@lo-th lo-th closed this as completed Mar 27, 2014
@computersarecool
Copy link

@positlabs I disagree with you here. Babylon.js (which uses Oimo.js in its example documentation) is itself available at npm (as are many, many, many client side libaries). I think @substack makes a great point - if this were available on npm, a person could just npm install babylon.js and oimo in a matter of seconds. Please reconsider

@positlabs
Copy link
Contributor

@computersarecool ditto. It's no longer true that npm is mainly server-side packages. If I could use it for server and client packages consistently, it would be ideal.

@computersarecool
Copy link

perhaps @lo-th might reconsider...

@sndrgb
Copy link

sndrgb commented Jul 22, 2016

Any news about this?

@mwthink
Copy link

mwthink commented Aug 31, 2016

@lo-th should reconsider this for 2 reasons :

  1. Browserify. Being able to pull the package down through npm, list it as a project dependency (Just as with all my other depencendies) would be an invaluable asset. As already stated, npm is certainly no longer just for server-side packages.

  2. Server-side running. This should also be coupled with a rewrite of some code that makes Oimo depend on canvas to operate. This would be Oimo an absolute knock-out of the park for a lot of projects. I am currently working on a multiplayer browser game, but with server side features, such as collision detection (And other anti-cheat measures).

Obviously, my server has no need to be rendering graphics, but if I could run the same physics on the server that are running on the client, I wouldn't need to be resorting to a myriad of nasty hacks I've implemented in the mean time.

I'm sure myself and some others who are interested could go about building the Oimo code to work in such a manner. Not a lot needs to be changed, but it would make all the difference in the world.

@nathanosdev
Copy link

I agree with making this an NPM package,
using NodeJS modules to build client side applications is becoming a lot more common.
It's a small effort to provide a package.json and publish to NPM.

@quasipedia
Copy link

Beginner in 3D here.
Using BabylonJS (as most of the people starting out).
Using webpack + babel (as most of the people doing webapps professionally).
Oimo seemed perfect for me.
Oimo has no npm package.
yarn add cannon instead.
Problem solved.
One user lost for Oimo, one user gained for Cannon.

@tiaod
Copy link

tiaod commented Jan 18, 2017

@quasipedia Awesome! I'm going to use cannonjs now! 😄

@lo-th
Copy link
Owner

lo-th commented Jan 18, 2017

yea npm version is on way
now i know how process
like uil

i hope someday Saharan help me for adding creazy function

@lo-th lo-th reopened this Jan 18, 2017
@mwthink
Copy link

mwthink commented Jan 18, 2017

Great to hear about!
If there's any hiccups in the process, I'll see if there's anything I could contribute.

@lo-th
Copy link
Owner

lo-th commented Jan 23, 2017

is done !!!

@lo-th lo-th closed this as completed Jan 23, 2017
@quasipedia
Copy link

🕺 🎆 🙇 ❤️

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

No branches or pull requests

8 participants