Update npm documentation (10.2.5)

pull/2073/head
Simon Legner 1 year ago
parent 93cc8b3978
commit bf89445d87

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

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

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

Loading…
Cancel
Save