describe-all.js 808 B

1234567891011121314151617181920
  1. const definitions = require('./definitions.js')
  2. const localeCompare = require('@isaacs/string-locale-compare')('en')
  3. const describeAll = () => {
  4. // sort not-deprecated ones to the top
  5. /* istanbul ignore next - typically already sorted in the definitions file,
  6. * but this is here so that our help doc will stay consistent if we decide
  7. * to move them around. */
  8. const sort = ([keya, {deprecated: depa}], [keyb, {deprecated: depb}]) => {
  9. return depa && !depb ? 1
  10. : !depa && depb ? -1
  11. : localeCompare(keya, keyb)
  12. }
  13. return Object.entries(definitions).sort(sort)
  14. .map(([key, def]) => def.describe())
  15. .join(
  16. '\n\n<!-- automatically generated, do not edit manually -->\n' +
  17. '<!-- see lib/utils/config/definitions.js -->\n\n'
  18. )
  19. }
  20. module.exports = describeAll