Update npm documentation (10.2.5)

This commit is contained in:
Simon Legner 2024-01-06 11:03:52 +01:00
parent 93cc8b3978
commit bf89445d87
3 changed files with 12 additions and 14 deletions

View file

@ -2,18 +2,13 @@ module Docs
class Npm
class CleanHtmlFilter < Filter
def call
at_css('#___gatsby').before(at_css('h1'))
@doc = at_css('main')
css('details').remove
css('.dZYhXG', '.fONtKn').remove
css('.kSYjyK').remove
css('.cDvIaH').remove
css('.jRndWL').remove_attribute('style')
css('nav[aria-label="Breadcrumbs"]').remove
css('.gtWOdv').remove # Select CLI Version
css('.ezMiXD').remove # Navbox
css('.gOhcvK').remove # Edit this page on GitHub
css('pre').each do |node|
node.content = node.css('.token-line').map(&:content).join("\n")
@ -21,7 +16,6 @@ module Docs
end
doc
end
end
end

View file

@ -7,7 +7,7 @@ module Docs
end
def get_type
at_css('.active').content
at_css('nav[aria-label="Breadcrumbs"] li').content
end
def additional_entries
@ -21,6 +21,7 @@ module Docs
if name == 'package.json'
css('h3').each do |node|
next unless node['id']
entries << [node['id'], slug + '#' + node['id'], 'Package.json Settings']
end
end

View file

@ -2,7 +2,7 @@ module Docs
class Npm < UrlScraper
self.name = 'npm'
self.type = 'npm'
self.release = '8.3.0'
self.release = '10.2.5'
self.base_url = 'https://docs.npmjs.com/'
self.force_gzip = true
self.links = {
@ -12,7 +12,8 @@ module Docs
html_filters.push 'npm/entries', 'npm/clean_html'
options[:max_image_size] = 130_000
options[:download_images] = false
# options[:max_image_size] = 130_000
options[:skip] = [
'all',
@ -31,6 +32,8 @@ module Docs
/\Apolicies/,
/cli\/v6/,
/cli\/v7/,
/cli\/v8/,
/cli\/v9/,
/\/\Z/ # avoid pages with a trailing slash, those pages mess up the entries
]