javascript-winwheel
javascript-winwheel copied to clipboard
modified to work with NPM
Added package.json and modified to work with NPM
Hi @roosh-t3 can you please provide an example of how Winwheel.js would be used after being downloaded via NPM? Should trying to use the Winwheel.js in the /lib directory work or only the files in the /dist directory? Sorry my knowledge of NPM quite limited and I am having trouble testing the changes proposed in this merge request. Thanks.
/dist directory the distribution directory. NPM doesn't need this. but to distribute your codes for others such as non NPM users for an example. If you look at the composer.json, you will see the main file as index.js "main": "index.js" and the index file contains the simple code module.exports = require('./lib/Winwheel'); which requires Winwheel.js file and exports it. in the lib folder Winwheel.js file exports the entire function module.exports = Winwheel; So the mechanism can be explained as,
- Winwheel.js exports the
Winwheelfunction - index.js imports (using require) the Winwheel.js and exports it.
basically a user can simply, in his code let winwheel = require('winwheel);andlet instance = new winwheel();` I hope I explained well.
Having this available on NPM would be great