javascript-winwheel icon indicating copy to clipboard operation
javascript-winwheel copied to clipboard

modified to work with NPM

Open roosht3 opened this issue 8 years ago • 3 comments

Added package.json and modified to work with NPM

roosht3 avatar Mar 08 '17 16:03 roosht3

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.

zarocknz avatar Mar 23 '17 07:03 zarocknz

/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,

  1. Winwheel.js exports the Winwheel function
  2. 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.

roosht3 avatar Mar 24 '17 04:03 roosht3

Having this available on NPM would be great

zizther avatar Oct 12 '21 16:10 zizther