crisbeto / angular-svg-round-progressbar

Angular module that uses SVG to create a circular progressbar
https://crisbeto.github.io/angular-svg-round-progressbar/
MIT License
742 stars 173 forks source link

Added a module.exports declaration to the build file. #90

Closed jasonconway-williams closed 8 years ago

crisbeto commented 8 years ago

Note that just adding module.exports = 'angular-svg-round-progressbar'; will throw an error in non-CommonJS environments. You should wrap it like this:

if (typeof module !== 'undefined') {
  module.exports = 'angular-svg-round-progressbar';
}
jasonconway-williams commented 8 years ago

crisbeto, I have removed the text in the footer declaration and have added an index.js file instead. This follows the usual standard of implementing both a modular and non-modular artefact.

Non npm/commonjs users will be able to add a reference to the roundProgress.js script in their HTML, users who want to take the modular approach will be able to require the npm module name in their js scripts. This approach will prevent any errors occurring in the browser.

crisbeto commented 8 years ago

In that case, couldn't you just add a index.js? No need to generate it via Grunt.

jasonconway-williams commented 8 years ago

crisbeto could do but how likely is it that the build directory will be deleted since it is used to store generated files?

crisbeto commented 8 years ago

The build directory doesn't get cleared on builds. You can see that the index.html for the demo is there as well.

jasonconway-williams commented 8 years ago

crisbeto, I will remove the grunt file create task and leave the index.js file in the build directory.

jasonconway-williams commented 8 years ago

All done crisbeto, good catch.

crisbeto commented 8 years ago

Thank you, I'll release this right away.

jasonconway-williams commented 8 years ago

crisbeto, are you also going to perform an npm update to publish these changes to npm so we only have to reference the package name in the package.json file rather than the github url?

crisbeto commented 8 years ago

Yes, it's already updated on NPM.