From 450a161569559f2434046f9bac7d7481faf6776a Mon Sep 17 00:00:00 2001 From: Enoc Date: Mon, 22 Nov 2021 22:41:24 -0600 Subject: [PATCH] Update npm documentation (8.1.4) --- lib/docs/filters/npm/clean_html.rb | 4 ++ lib/docs/scrapers/npm.rb | 62 ++++++++++++++++-------------- 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/lib/docs/filters/npm/clean_html.rb b/lib/docs/filters/npm/clean_html.rb index 3f85bf6c..23eebddb 100644 --- a/lib/docs/filters/npm/clean_html.rb +++ b/lib/docs/filters/npm/clean_html.rb @@ -3,6 +3,10 @@ module Docs class CleanHtmlFilter < Filter def call + at_css('#___gatsby').before(at_css('h1')) + + css('details').remove + css('.dZYhXG', '.fONtKn').remove css('.kSYjyK').remove diff --git a/lib/docs/scrapers/npm.rb b/lib/docs/scrapers/npm.rb index 7816c365..066e4f54 100644 --- a/lib/docs/scrapers/npm.rb +++ b/lib/docs/scrapers/npm.rb @@ -2,7 +2,7 @@ module Docs class Npm < UrlScraper self.name = 'npm' self.type = 'npm' - self.release = '7.10.0' + self.release = '8.1.4' self.base_url = 'https://docs.npmjs.com/' self.force_gzip = true self.links = { @@ -18,16 +18,20 @@ module Docs 'all', 'misc/index', 'cli', - 'orgs/', + 'organizations/', + 'orgs', 'removing-members-from-your-org', 'adding-members-to-your-org', - 'downloading-and-installing-packages' + 'downloading-and-installing-packages', ] options[:skip_patterns] = [ /\Aenterprise/, /\Acompany/, - /\Apolicies/ + /\Apolicies/, + /cli\/v6/, + /cli\/v7/, + /\/\Z/ # avoid pages with a trailing slash, those pages mess up the entries ] options[:attribution] = <<-HTML @@ -39,36 +43,38 @@ module Docs # fix duplicates options[:fix_urls] = -> (url) do url.sub!('private-modules/intro', 'creating-and-publishing-private-packages') - url.sub!('cli/audit', 'cli/v6/commands/npm-audit') - url.sub!('cli/uninstall', 'cli/v6/commands/npm-uninstall') - url.sub!('cli/npm', 'cli/v6/commands/npm') - url.sub!('cli-documentation', 'cli/v6') - url.sub!('misc/registry', 'cli/v6/using-npm/registry') - url.sub!('cli/adduser', 'cli/v6/commands/npm-adduser') - url.sub!('cli/profile', 'cli/v6/commands/npm-profile') - url.sub!('cli/token', 'cli/v6/commands/npm-token') - url.sub!('cli/publish', 'cli/v6/commands/npm-publish') - url.sub!('cli/unpublish', 'cli/v6/commands/npm-unpublish') - url.sub!('cli/deprecate', 'cli/v6/commands/npm-deprecate') - url.sub!('cli/access', 'cli/v6/commands/npm-access') - url.sub!('misc/config', 'cli/v6/using-npm/config') - url.sub!('misc/developers', 'cli/v6/using-npm/developers') url.sub!('managing-team-access-to-packages', 'managing-team-access-to-organization-packages') url.sub!('accepting-or-rejecting-an-org-invitation', 'accepting-or-rejecting-an-organization-invitation') url.sub!('org-roles-and-permissions', 'organization-roles-and-permissions') url.sub!('upgrading-to-a-paid-org-plan', 'upgrading-to-a-paid-organization-plan') - url.sub!('files/package.json', 'cli/v6/configuring-npm/package-json') url.sub!('managing-team-access-to-org-packages', 'managing-team-access-to-organization-packages') url.sub!('about-package-json-and-package-lock-json-files', 'creating-a-package-json-file') - url.sub!('cli/team', 'cli/v6/commands/npm-team') - url.sub!('cli/version', 'cli/v6/commands/npm-version') - url.sub!('creating-a-packge-json-file', 'cli/v6/configuring-npm/package-json') - url.sub!('cli/outdated', 'cli/v6/commands/npm-outdated') - url.sub!('cli/owner', 'cli/v6/commands/npm-owner') - url.sub!('cli/install', 'cli/v6/commands/npm-install') - url.sub!('cli/update', 'cli/v6/commands/npm-update') - url.sub!('cli/config', 'cli/v6/commands/npm-config') - url.sub!('cli/dist-tag', 'cli/v6/commands/npm-dist-tag') + url.sub!('cli/npm', 'cli/v8/commands/npm/') + url.sub!('cli/config', 'cli/v8/commands/npm-config/') + url.sub!('misc/registry', 'cli/v8/using-npm/registry/') + url.sub!('cli-documentation', 'cli/v8') + url.sub!('cli-documentation/files/npmrc', 'cli/v8/configuring-npm/npmrc/') + url.sub!('configuring-your-registry-settings-as-an-npm-enterprise-user', 'enterprise') + url.sub!('cli/publish', 'cli/v8/commands/npm-publish/') + url.sub!('cli/deprecate', 'cli/v8/commands/npm-deprecate/') + url.sub!('cli/access', 'cli/v8/commands/npm-access/') + url.sub!('cli/adduser', 'cli/v8/commands/npm-adduser/') + url.sub!('misc/config', 'cli/v8/using-npm/config/') + url.sub!('cli/token', 'cli/v8/commands/npm-token/') + url.sub!('cli/unpublish', 'cli/v8/commands/npm-unpublish/') + url.sub!('files/package.json', 'cli/v8/configuring-npm/package-json/') + url.sub!('cli/profile', 'cli/v8/commands/npm-profile/') + url.sub!('creating-a-packge-json-file', 'cli/v8/configuring-npm/package-json/') + url.sub!('cli/dist-tag', 'cli/v8/commands/npm-dist-tag/') + url.sub!('cli/team', 'cli/v8/commands/npm-team/') + url.sub!('cli/version', 'cli/v8/commands/npm-version/') + url.sub!('cli/owner', 'cli/v8/commands/npm-owner/') + url.sub!('cli/install', '/cli/v8/commands/npm-install/') + url.sub!('cli/audit', 'cli/v8/commands/npm-audit/') + url.sub!('cli/update', 'cli/v8/commands/npm-update/') + url.sub!('cli/outdated', 'cli/v8/commands/npm-outdated/') + url.sub!('cli/uninstall', 'cli/v8/commands/npm-uninstall/') + url.sub!('misc/developers', 'cli/v8/using-npm/developers//') url end