Update babel to 7.12.6
Showing the changes to lib/docs (3 of 3 files). Show all
Unified · Split
| @@ -2,36 +2,21 @@ module Docs · 1 unmodified line | |||
| 2 | class Babel | 2 | class Babel |
| 3 | class CleanHtmlFilter < Filter | 3 | class CleanHtmlFilter < Filter |
| 4 | def call | 4 | def call |
| 5 | if root_page? | ||
| 6 | doc.inner_html = '<h1>Babel</h1>' | ||
| 7 | return doc | ||
| 8 | end | ||
| 9 | 5 | ||
| 10 | header = at_css('.docs-header .col-md-12') | 6 | css('.fixedHeaderContainer').remove |
| 11 | @doc = at_css('.docs-content') | ||
| 12 | doc.prepend_child(header) | ||
| 13 | 7 | ||
| 14 | css('.btn-clipboard', '.package-links').remove | 8 | css('.toc').remove |
| 15 | 9 | ||
| 16 | css('.col-md-12', 'h1 a', 'h2 a', 'h3 a', 'h4 a', 'h5 a', 'h5 a').each do |node| | 10 | css('.toc-headings').remove |
| 17 | node.before(node.children).remove | ||
| 18 | end | ||
| 19 | 11 | ||
| 20 | css('div.highlighter-rouge').each do |node| | 12 | css('.postHeader > a').remove |
| 21 | pre = node.at_css('pre') | ||
| 22 | 13 | ||
| 23 | lang = node['class'][/language-(\w+)/, 1] | 14 | css('.nav-footer').remove |
| 24 | lang = 'bash' if lang == 'sh' | ||
| 25 | pre['data-language'] = lang | ||
| 26 | 15 | ||
| 27 | pre.remove_attribute('class') | 16 | css('.docs-prevnext').remove |
| 28 | pre.content = pre.content | ||
| 29 | node.replace(pre) | ||
| 30 | end | ||
| 31 | |||
| 32 | css('code').remove_attr('class') | ||
| 33 | 17 | ||
| 34 | doc | 18 | doc |
| 19 | |||
| 35 | end | 20 | end |
| 36 | end | 21 | end |
| 37 | end | 22 | end |
| @@ -1,40 +1,28 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Babel | 2 | class Babel |
| 3 | class EntriesFilter < Docs::EntriesFilter | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | |||
| 5 | ENTRIES = { | ||
| 6 | 'Usage' => ['Options', 'Config Files', '@babel/cli', '@babel/polyfill', | ||
| 7 | '@babel/plugin-transform-runtime', '@babel/register'], | ||
| 8 | |||
| 9 | 'Presets' => ['@babel/preset-env', '@babel/preset-flow', '@babel/preset-react', '@babel/preset-typescript'], | ||
| 10 | |||
| 11 | 'Tooling' => ['@babel/parser', '@babel/core', '@babel/generator', '@babel/code-frame', | ||
| 12 | '@babel/helpers', '@babel/runtime', '@babel/template', '@babel/traverse', '@babel/types'] | ||
| 13 | } | ||
| 14 | |||
| 4 | def get_name | 15 | def get_name |
| 5 | at_css('h1').content | 16 | at_css('h1').content |
| 6 | end | 17 | end |
| 7 | 18 | ||
| 8 | def get_type | 19 | def get_type |
| 9 | if subpath.start_with?('plugins/preset') | 20 | ENTRIES.each do |key, value| |
| 10 | 'Presets' | 21 | return key if value.include?(name) |
| 11 | elsif subpath.start_with?('plugins/transform') | 22 | return 'Other Plugins' if subpath.include?('babel-plugin') |
| 12 | 'Transform Plugins' | ||
| 13 | elsif subpath.start_with?('plugins/minify') | ||
| 14 | 'Minification' | ||
| 15 | elsif subpath.start_with?('plugins/syntax') | ||
| 16 | 'Syntax Plugins' | ||
| 17 | elsif subpath.start_with?('plugins') | ||
| 18 | 'Plugins' | ||
| 19 | elsif subpath.start_with?('usage/') | ||
| 20 | 'Usage' | ||
| 21 | elsif subpath.start_with?('core-packages/') | ||
| 22 | 'Core Packages' | ||
| 23 | else | ||
| 24 | 'Miscellaneous' | ||
| 25 | end | 23 | end |
| 26 | end | 24 | end |
| 27 | 25 | ||
| 28 | def additional_entries | ||
| 29 | return [] unless slug.include?('api') | ||
| 30 | |||
| 31 | css('h2').each_with_object [] do |node, entries| | ||
| 32 | name = node.content.strip | ||
| 33 | next unless name.start_with?('babel.') | ||
| 34 | name.sub! %r{\(.*}, '()' | ||
| 35 | entries << [name, node['id']] | ||
| 36 | end | ||
| 37 | end | ||
| 38 | end | 26 | end |
| 39 | end | 27 | end |
| 40 | end | 28 | end |
| @@ -1,9 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Babel < UrlScraper | 2 | class Babel < UrlScraper |
| 3 | self.type = 'simple' | 3 | self.type = 'simple' |
| 4 | self.base_url = 'http://babeljs.io/docs/' | 4 | self.base_url = 'https://babeljs.io/docs/en/' |
| 5 | self.release = '6.26.1' | ||
| 6 | self.initial_paths = %w(core-packages/) | ||
| 7 | self.links = { | 5 | self.links = { |
| 8 | home: 'https://babeljs.io/', | 6 | home: 'https://babeljs.io/', |
| 9 | code: 'https://github.com/babel/babel' | 7 | code: 'https://github.com/babel/babel' |
| @@ -12,19 +10,36 @@ module Docs · 2 unmodified lines | |||
| 12 | html_filters.push 'babel/clean_html', 'babel/entries' | 10 | html_filters.push 'babel/clean_html', 'babel/entries' |
| 13 | 11 | ||
| 14 | options[:trailing_slash] = true | 12 | options[:trailing_slash] = true |
| 15 | options[:skip] = %w{setup/ editors/ community/videos/} | 13 | |
| 14 | options[:skip_patterns] = [ | ||
| 15 | /usage/, | ||
| 16 | /configuration/, | ||
| 17 | /learn/, | ||
| 18 | /v7-migration/, | ||
| 19 | /v7-migration-api/, | ||
| 20 | /editors/, | ||
| 21 | /presets/, | ||
| 22 | /caveats/, | ||
| 23 | /faq/, | ||
| 24 | /roadmap/ | ||
| 25 | ] | ||
| 16 | 26 | ||
| 17 | options[:attribution] = <<-HTML | 27 | options[:attribution] = <<-HTML |
| 18 | © 2018 Sebastian McKenzie<br> | 28 | © 2020 Sebastian McKenzie<br> |
| 19 | Licensed under the MIT License. | 29 | Licensed under the MIT License. |
| 20 | HTML | 30 | HTML |
| 21 | 31 | ||
| 22 | stub '' do | 32 | version '7' do |
| 23 | '<div></div>' | 33 | self.release = '7.12.6' |
| 34 | end | ||
| 35 | |||
| 36 | version '6' do | ||
| 37 | self.release = '6.26.1' | ||
| 24 | end | 38 | end |
| 25 | 39 | ||
| 26 | def get_latest_version(opts) | 40 | def get_latest_version(opts) |
| 27 | get_latest_github_release('babel', 'babel', opts) | 41 | get_latest_github_release('babel', 'babel', opts) |
| 28 | end | 42 | end |
| 43 | |||
| 29 | end | 44 | end |
| 30 | end | 45 | end |