History

Add Vitest documentation (0.24.0)

Simon Legner committed 4 years ago

Commit cd41d391 parent 4d03b4a8 files · +62 −-1Browse files

Unified · Split

8 files
  1. assets/javascripts/news.json +1 −1
  2. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  3. lib/docs/filters/vite/clean_html.rb +1 −0
  4. lib/docs/filters/vitest/entries.rb +28 −0
  5. lib/docs/scrapers/vitest.rb +28 −0
  6. public/icons/docs/vitest/16.png +0 −0
  7. public/icons/docs/vitest/16@2x.png +0 −0
  8. public/icons/docs/vitest/SOURCE +1 −0
assets/javascripts/news.json+1−1
@@ -1,7 +1,7 @@
1[1[
2 [2 [
3 "2022-10-09",3 "2022-10-09",
4 "New documentation: <a href=\"/fastapi/\">FastAPI</a>"4 "New documentations: <a href=\"/fastapi/\">FastAPI</a>, <a href=\"/vitest/\">Vitest</a>"
5 ],5 ],
6 [6 [
7 "2022-10-02",7 "2022-10-02",
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -936,6 +936,11 @@ credits = [ · 935 unmodified lines
936 '2019–present, Yuxi (Evan) You and Vite contributors',936 '2019–present, Yuxi (Evan) You and Vite contributors',
937 'MIT',937 'MIT',
938 'https://github.com/vitejs/vite/blob/main/LICENSE'938 'https://github.com/vitejs/vite/blob/main/LICENSE'
939 ], [
940 'Vitest',
941 '2021-Present Anthony Fu<br>2021-Present Matias Capeletto<br>',
942 'MIT',
943 'https://github.com/vitest-dev/vitest/blob/main/LICENSE'
939 ], [944 ], [
940 'Vue Router',945 'Vue Router',
941 '2013-present Evan You',946 '2013-present Evan You',
lib/docs/filters/vite/clean_html.rb+1−0
@@ -2,6 +2,7 @@ module Docs · 1 unmodified line
2 class Vite2 class Vite
3 class CleanHtmlFilter < Filter3 class CleanHtmlFilter < Filter
4 def call4 def call
5 return "<h1>Vitest</h1><p>A Vite-native unit test framework. It's fast!</p>" if root_page? && current_url.host == 'vitest.dev'
5 return '<h1>Vite</h1>' if root_page?6 return '<h1>Vite</h1>' if root_page?
6 @doc = at_css('main h1').parent7 @doc = at_css('main h1').parent
7 8
lib/docs/filters/vitest/entries.rb+28−0
@@ -0,0 +1,28 @@
1module Docs
2 class Vitest
3 class EntriesFilter < Docs::EntriesFilter
4 def get_name
5 name = at_css('h1').content
6 name.sub! %r{\s*#\s*}, ''
7 name
8 end
9
10 def get_type
11 name = at_css('h1').content
12 name.sub! %r{\s*#\s*}, ''
13 name
14 end
15
16 def additional_entries
17 return [] if root_page?
18 css('h2[id], h3[id]').each_with_object [] do |node, entries|
19 text = node.content.strip
20 text.sub! %r{\s*#\s*}, ''
21 next if text == 'Example'
22 text.prepend "#{name}: " unless slug.starts_with?('api') || slug.starts_with?('config')
23 entries << [text, node['id']]
24 end
25 end
26 end
27 end
28end
lib/docs/scrapers/vitest.rb+28−0
@@ -0,0 +1,28 @@
1module Docs
2 class Vitest < UrlScraper
3 self.name = 'Vitest'
4 self.slug = 'vitest'
5 self.type = 'simple'
6 self.links = {
7 home: 'https://vitest.dev/',
8 code: 'https://github.com/vitest-dev/vitest'
9 }
10
11 options[:root_title] = 'Vitest'
12
13 options[:attribution] = <<-HTML
14 &copy; 2021-Present Anthony Fu<br>
15 &copy; 2021-Present Matias Capeletto<br>
16 Licensed under the MIT License.
17 HTML
18
19 self.release = '0.24.0'
20 self.base_url = 'https://vitest.dev/'
21 self.initial_paths = %w(guide/)
22 html_filters.push 'vitest/entries', 'vite/clean_html'
23
24 def get_latest_version(opts)
25 get_npm_version('vitest', opts)
26 end
27 end
28end
public/icons/docs/vitest/16.png+0−0

Binary file not shown.

public/icons/docs/vitest/16@2x.png+0−0

Binary file not shown.

public/icons/docs/vitest/SOURCE+1−0
@@ -0,0 +1 @@
1https://vitest.dev/logo.svg