mirror of https://github.com/freeCodeCamp/devdocs
parent
72c0bbe936
commit
f5dc69391b
@ -0,0 +1,26 @@
|
|||||||
|
module Docs
|
||||||
|
class Yarn
|
||||||
|
class CleanHtmlBerryFilter < Filter
|
||||||
|
def call
|
||||||
|
# Version notice
|
||||||
|
css('#gatsby-focus-wrapper > div').remove
|
||||||
|
|
||||||
|
# Logo and menu
|
||||||
|
css('header > div:first-child').remove
|
||||||
|
|
||||||
|
# Left nav and TOC
|
||||||
|
css('main > div > div:first-child', 'aside').remove
|
||||||
|
|
||||||
|
# Title and edit link
|
||||||
|
css('article > div:first-child').remove
|
||||||
|
|
||||||
|
# Bottom divider on index
|
||||||
|
if slug == ''
|
||||||
|
css('main > hr').remove
|
||||||
|
end
|
||||||
|
|
||||||
|
doc
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,21 @@
|
|||||||
|
module Docs
|
||||||
|
class Yarn
|
||||||
|
class EntriesBerryFilter < Docs::EntriesFilter
|
||||||
|
def get_name
|
||||||
|
name = at_css('h1').content
|
||||||
|
|
||||||
|
name
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_type
|
||||||
|
if slug.start_with?('sdks') || slug.start_with?('pnpify')
|
||||||
|
'CLI'
|
||||||
|
else
|
||||||
|
type = at_css('header div:nth-child(2) .active').content.strip
|
||||||
|
type.remove! 'Home'
|
||||||
|
type
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -1,28 +1,41 @@
|
|||||||
module Docs
|
module Docs
|
||||||
class Yarn < UrlScraper
|
class Yarn < UrlScraper
|
||||||
self.type = 'simple'
|
self.type = 'simple'
|
||||||
self.release = '1.22.17'
|
|
||||||
self.base_url = 'https://classic.yarnpkg.com/en/docs/'
|
|
||||||
self.links = {
|
|
||||||
home: 'https://classic.yarnpkg.com/',
|
|
||||||
code: 'https://github.com/yarnpkg/yarn'
|
|
||||||
}
|
|
||||||
|
|
||||||
html_filters.push 'yarn/entries', 'yarn/clean_html', 'title'
|
|
||||||
|
|
||||||
options[:root_title] = 'Yarn'
|
options[:root_title] = 'Yarn'
|
||||||
options[:trailing_slash] = false
|
options[:trailing_slash] = false
|
||||||
|
|
||||||
options[:skip] = %w(nightly)
|
options[:skip] = %w(nightly)
|
||||||
options[:skip_patterns] = [/\Aorg\//]
|
|
||||||
|
|
||||||
options[:attribution] = <<-HTML
|
options[:attribution] = <<-HTML
|
||||||
© 2016–present Yarn Contributors<br>
|
© 2016–present Yarn Contributors<br>
|
||||||
Licensed under the BSD License.
|
Licensed under the BSD License.
|
||||||
HTML
|
HTML
|
||||||
|
|
||||||
|
version 'Berry' do
|
||||||
|
self.release = '3.1.1'
|
||||||
|
self.base_url = 'https://yarnpkg.com/'
|
||||||
|
self.links = {
|
||||||
|
home: 'https://yarnpkg.com/',
|
||||||
|
code: 'https://github.com/yarnpkg/berry'
|
||||||
|
}
|
||||||
|
html_filters.push 'yarn/entries_berry', 'yarn/clean_html_berry', 'title'
|
||||||
|
options[:skip_patterns] = [/\Aapi/, /\Apackage/]
|
||||||
|
end
|
||||||
|
|
||||||
|
version 'Classic' do
|
||||||
|
self.release = '1.22.17'
|
||||||
|
self.base_url = 'https://classic.yarnpkg.com/en/docs/'
|
||||||
|
self.links = {
|
||||||
|
home: 'https://classic.yarnpkg.com/',
|
||||||
|
code: 'https://github.com/yarnpkg/yarn'
|
||||||
|
}
|
||||||
|
html_filters.push 'yarn/entries', 'yarn/clean_html', 'title'
|
||||||
|
options[:skip_patterns] = [/\Aorg\//]
|
||||||
|
end
|
||||||
|
|
||||||
def get_latest_version(opts)
|
def get_latest_version(opts)
|
||||||
get_latest_github_release('yarnpkg', 'yarn', opts)
|
get_latest_github_release('yarnpkg', 'berry', opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in new issue