npm.rb 937 B

12345678910111213141516171819202122232425262728293031323334353637
  1. module Docs
  2. class Npm < UrlScraper
  3. self.name = 'npm'
  4. self.type = 'npm'
  5. self.release = '6.4.0'
  6. self.base_url = 'https://docs.npmjs.com/'
  7. self.force_gzip = true
  8. self.links = {
  9. home: 'https://www.npmjs.com/',
  10. code: 'https://github.com/npm/npm'
  11. }
  12. html_filters.push 'npm/entries', 'npm/clean_html', 'title'
  13. options[:max_image_size] = 130_000
  14. options[:container] = ->(filter) { filter.root_page? ? '.toc' : nil }
  15. options[:title] = false
  16. options[:root_title] = 'npm'
  17. options[:skip] = %w(all misc/index)
  18. options[:skip_patterns] = [
  19. /\Aenterprise/,
  20. /\Acompany/,
  21. /\Apolicies/
  22. ]
  23. options[:attribution] = <<-HTML
  24. &copy; npm, Inc. and Contributors<br>
  25. Licensed under the npm License.<br>
  26. npm is a trademark of npm, Inc.
  27. HTML
  28. def get_latest_version(opts)
  29. get_latest_github_release('npm', 'cli', opts)
  30. end
  31. end
  32. end