Is there any way to comment or is it better to organize the bower.json file?

I have a very large project with numerous Bower dependencies. In many cases, it is unclear whether these dependencies are still used in the application or if the specified version was selected for any reason. Ideally, I would like to be able to put a comment for each dependency to indicate which part of the application is required, since the functionality in the application has been removed, we can also remove unnecessary packages from bower_components. Sort of:

// videojs plug-in for adding navigable waveforms; used by the video component "videojs-wavesurfer": "^1.2.2" 

Unfortunately, json does not support commenting, but are there any possible solutions to annotate or better organize the bower.json file to make it more understandable?

+5
source share
2 answers

You cannot add comments to the JSON file. JSON is for data and nothing more.

If you want to document your dependencies, consider adding a section to your README file that contains all the information related to the dependencies.

+4
source

The classic approach to commenting out JSON files is to add fake entries, which I hope will be ignored by the consumer, for example:

 "video-wavesurfer-comment": "videojs plug-in for adding navigable waveforms; used by the video component" 

For longer comments use arrays:

 "video-wavesurfer-comment": [ "videojs plug-in for adding navigable waveforms; used by the video component", "Remove this for the non-video version." ] 

Of course, you will have to put them somewhere where someone will not try to take them apart. For example, they cannot go WITHIN "dependencies":

+2
source

All Articles