@@ -12,17 +12,30 @@ class Yarn < UrlScraper
1212 Licensed under the BSD License.
1313 HTML
1414
15- version 'Berry' do
16- self . release = '3.1 .1'
15+ version do
16+ self . release = '4.5 .1'
1717 self . base_url = 'https://yarnpkg.com/'
1818 self . links = {
1919 home : 'https://yarnpkg.com/' ,
2020 code : 'https://github.com/yarnpkg/berry'
2121 }
22+ self . root_path = 'getting-started'
23+ html_filters . push 'yarn/entries_berry' , 'yarn/clean_html_berry'
24+ options [ :skip ] = [ 'cli' , 'cli/builder' , 'cli/pnpify' , 'cli/sdks' , 'protocols' ]
25+ options [ :skip_patterns ] = [ /\A api/ , /\A blog/ , /\A package/ , /\A assets/ ]
26+ end
27+
28+ version '3' do
29+ self . release = '3.1.1'
30+ self . base_url = 'https://v3.yarnpkg.com/'
31+ self . links = {
32+ home : 'https://v3.yarnpkg.com/' ,
33+ code : 'https://github.com/yarnpkg/berry'
34+ }
35+ self . root_path = 'getting-started'
2236 html_filters . push 'yarn/entries_berry' , 'yarn/clean_html_berry' , 'title'
2337 options [ :skip ] = [ 'features' , 'cli' , 'configuration' , 'advanced' ]
24- options [ :skip_patterns ] = [ /\A api/ , /\A package/ ]
25- end
38+ options [ :skip_patterns ] = [ /\A api/ , /\A package/ ] end
2639
2740 version 'Classic' do
2841 self . release = '1.22.17'
@@ -38,5 +51,13 @@ class Yarn < UrlScraper
3851 def get_latest_version ( opts )
3952 get_latest_github_release ( 'yarnpkg' , 'berry' , opts ) [ /[\d .]+/ ]
4053 end
54+
55+ private
56+
57+ # Some pages contain null bytes and cause the parser to fail
58+ def parse ( response )
59+ response . body . gsub! ( /[\x00 \u0000 \0 ]/ , '' )
60+ super
61+ end
4162 end
4263end
0 commit comments