Update Vuex documentation (3.6.2 and 4.0.0-rc.2)

This commit is contained in:
Simon Legner 2021-01-30 00:32:43 +01:00
parent 6087613630
commit bf248f0dff
3 changed files with 21 additions and 6 deletions

View file

@ -246,9 +246,9 @@ module Docs
JSON.parse fetch(url, opts)
end
def get_npm_version(package, opts)
def get_npm_version(package, opts, tag='latest')
json = fetch_json("https://registry.npmjs.com/#{package}", opts)
json['dist-tags']['latest']
json['dist-tags'][tag]
end
def get_latest_github_release(owner, repo, opts)

View file

@ -2,7 +2,7 @@ module Docs
class Vuex
class CleanHtmlFilter < Filter
def call
@doc = at_css('.content')
@doc = at_css('main')
# Remove video from root page
css('a[href="#"]').remove if root_page?
@ -10,6 +10,13 @@ module Docs
# Remove unneeded elements
css('.header-anchor').remove
# Remove data-v-* attributes
css('*').each do |node|
node.attributes.each_key do |attribute|
node.remove_attribute(attribute) if attribute.start_with? 'data-v-'
end
end
doc
end
end

View file

@ -1,8 +1,6 @@
module Docs
class Vuex < UrlScraper
self.type = 'simple'
self.release = '3.1.1'
self.base_url = 'https://vuex.vuejs.org/'
self.links = {
home: 'https://vuex.vuejs.org',
code: 'https://github.com/vuejs/vuex'
@ -20,8 +18,18 @@ module Docs
Licensed under the MIT License.
HTML
version '4' do
self.release = '4.0.0-rc.2'
self.base_url = 'https://next.vuex.vuejs.org/'
end
version '3' do
self.release = '3.6.2'
self.base_url = 'https://vuex.vuejs.org/'
end
def get_latest_version(opts)
get_npm_version('vuex', opts)
get_npm_version('vuex', opts, 'next')
end
end
end