admin管理员组

文章数量:1023187

I have a very large project with numerous bower dependencies. In many cases it is unclear whether these dependencies are even still in use within the application or if the version specified was chosen for a reason. Ideally, I would like to be able to put a ment for each dependency to state for which part of the application it is required, so as functionality in the application is removed, we can also remove unnecessary packages from the bower_ponents. Something like:

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

Unfortunately, json doesn't support menting, but are there any possible solutions for annotating or better organizing a bower.json file to make it more understandable?

I have a very large project with numerous bower dependencies. In many cases it is unclear whether these dependencies are even still in use within the application or if the version specified was chosen for a reason. Ideally, I would like to be able to put a ment for each dependency to state for which part of the application it is required, so as functionality in the application is removed, we can also remove unnecessary packages from the bower_ponents. Something like:

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

Unfortunately, json doesn't support menting, but are there any possible solutions for annotating or better organizing a bower.json file to make it more understandable?

Share Improve this question asked Aug 10, 2016 at 15:41 alisonmsmithalisonmsmith 1175 bronze badges 9
  • 2 1) bower is a dead project. It has not been updated in months. 2) you cannot put ments in a json file. 3) Consider starting to use NPM. – Naftali Commented Aug 10, 2016 at 15:43
  • 4 In addition to what @Neal said, if you want to document your dependencies, you could always add a section to your README file that does just that. – TW80000 Commented Aug 10, 2016 at 15:44
  • 1 @Neal Completely wrong. I don't use bower but it has been updated recently. – VtoCorleone Commented Aug 10, 2016 at 15:45
  • Ha! I was just about to say that @TW80000 – Naftali Commented Aug 10, 2016 at 15:45
  • @VtoCorleone it has mainly been README changes... – Naftali Commented Aug 10, 2016 at 15:45
 |  Show 4 more ments

2 Answers 2

Reset to default 4

You cannot put ments in a JSON file. JSON is for data and nothing else.

If you would like to document your dependencies, consider adding a section to your README file that contains all of the information relevant to dependencies.

The classic approach to menting JSON files is to add fake entries, which hopefully will be ignored by the consumer, such as:

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

For longer ments, use arrays:

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

Of course, you'll have to put these somewhere where someone won't try to parse them. For instance, they could not go WITHIN "dependencies":.

I have a very large project with numerous bower dependencies. In many cases it is unclear whether these dependencies are even still in use within the application or if the version specified was chosen for a reason. Ideally, I would like to be able to put a ment for each dependency to state for which part of the application it is required, so as functionality in the application is removed, we can also remove unnecessary packages from the bower_ponents. Something like:

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

Unfortunately, json doesn't support menting, but are there any possible solutions for annotating or better organizing a bower.json file to make it more understandable?

I have a very large project with numerous bower dependencies. In many cases it is unclear whether these dependencies are even still in use within the application or if the version specified was chosen for a reason. Ideally, I would like to be able to put a ment for each dependency to state for which part of the application it is required, so as functionality in the application is removed, we can also remove unnecessary packages from the bower_ponents. Something like:

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

Unfortunately, json doesn't support menting, but are there any possible solutions for annotating or better organizing a bower.json file to make it more understandable?

Share Improve this question asked Aug 10, 2016 at 15:41 alisonmsmithalisonmsmith 1175 bronze badges 9
  • 2 1) bower is a dead project. It has not been updated in months. 2) you cannot put ments in a json file. 3) Consider starting to use NPM. – Naftali Commented Aug 10, 2016 at 15:43
  • 4 In addition to what @Neal said, if you want to document your dependencies, you could always add a section to your README file that does just that. – TW80000 Commented Aug 10, 2016 at 15:44
  • 1 @Neal Completely wrong. I don't use bower but it has been updated recently. – VtoCorleone Commented Aug 10, 2016 at 15:45
  • Ha! I was just about to say that @TW80000 – Naftali Commented Aug 10, 2016 at 15:45
  • @VtoCorleone it has mainly been README changes... – Naftali Commented Aug 10, 2016 at 15:45
 |  Show 4 more ments

2 Answers 2

Reset to default 4

You cannot put ments in a JSON file. JSON is for data and nothing else.

If you would like to document your dependencies, consider adding a section to your README file that contains all of the information relevant to dependencies.

The classic approach to menting JSON files is to add fake entries, which hopefully will be ignored by the consumer, such as:

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

For longer ments, use arrays:

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

Of course, you'll have to put these somewhere where someone won't try to parse them. For instance, they could not go WITHIN "dependencies":.

本文标签: javascriptIs there any way to comment in or better organize a bowerjson fileStack Overflow