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 @@
11 [
22 [
33 "2022-10-09",
4− "New documentation: <a href=\"/fastapi/\">FastAPI</a>"
4+ "New documentations: <a href=\"/fastapi/\">FastAPI</a>, <a href=\"/vitest/\">Vitest</a>"
55 ],
66 [
77 "2022-10-02",
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -936,6 +936,11 @@ credits = [ · 935 unmodified lines
936936 '2019–present, Yuxi (Evan) You and Vite contributors',
937937 'MIT',
938938 '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'
939944 ], [
940945 'Vue Router',
941946 '2013-present Evan You',
lib/docs/filters/vite/clean_html.rb+1−0
@@ -2,6 +2,7 @@ module Docs · 1 unmodified line
22 class Vite
33 class CleanHtmlFilter < Filter
44 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'
56 return '<h1>Vite</h1>' if root_page?
67 @doc = at_css('main h1').parent
78
lib/docs/filters/vitest/entries.rb+28−0
@@ -0,0 +1,28 @@
1+module 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
28+end
lib/docs/scrapers/vitest.rb+28−0
@@ -0,0 +1,28 @@
1+module 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
28+end
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 @@
1+https://vitest.dev/logo.svg