Add Vitest documentation (0.24.0)

pull/1836/head
Simon Legner 2 years ago
parent 4d03b4aec6
commit cd41d39abc

@ -1,7 +1,7 @@
[
[
"2022-10-09",
"New documentation: <a href=\"/fastapi/\">FastAPI</a>"
"New documentations: <a href=\"/fastapi/\">FastAPI</a>, <a href=\"/vitest/\">Vitest</a>"
],
[
"2022-10-02",

@ -936,6 +936,11 @@ credits = [
'2019present, Yuxi (Evan) You and Vite contributors',
'MIT',
'https://github.com/vitejs/vite/blob/main/LICENSE'
], [
'Vitest',
'2021-Present Anthony Fu<br>2021-Present Matias Capeletto<br>',
'MIT',
'https://github.com/vitest-dev/vitest/blob/main/LICENSE'
], [
'Vue Router',
'2013-present Evan You',

@ -2,6 +2,7 @@ module Docs
class Vite
class CleanHtmlFilter < Filter
def call
return "<h1>Vitest</h1><p>A Vite-native unit test framework. It's fast!</p>" if root_page? && current_url.host == 'vitest.dev'
return '<h1>Vite</h1>' if root_page?
@doc = at_css('main h1').parent

@ -0,0 +1,28 @@
module Docs
class Vitest
class EntriesFilter < Docs::EntriesFilter
def get_name
name = at_css('h1').content
name.sub! %r{\s*#\s*}, ''
name
end
def get_type
name = at_css('h1').content
name.sub! %r{\s*#\s*}, ''
name
end
def additional_entries
return [] if root_page?
css('h2[id], h3[id]').each_with_object [] do |node, entries|
text = node.content.strip
text.sub! %r{\s*#\s*}, ''
next if text == 'Example'
text.prepend "#{name}: " unless slug.starts_with?('api') || slug.starts_with?('config')
entries << [text, node['id']]
end
end
end
end
end

@ -0,0 +1,28 @@
module Docs
class Vitest < UrlScraper
self.name = 'Vitest'
self.slug = 'vitest'
self.type = 'simple'
self.links = {
home: 'https://vitest.dev/',
code: 'https://github.com/vitest-dev/vitest'
}
options[:root_title] = 'Vitest'
options[:attribution] = <<-HTML
&copy; 2021-Present Anthony Fu<br>
&copy; 2021-Present Matias Capeletto<br>
Licensed under the MIT License.
HTML
self.release = '0.24.0'
self.base_url = 'https://vitest.dev/'
self.initial_paths = %w(guide/)
html_filters.push 'vitest/entries', 'vite/clean_html'
def get_latest_version(opts)
get_npm_version('vitest', opts)
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 893 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

@ -0,0 +1 @@
https://vitest.dev/logo.svg
Loading…
Cancel
Save