bridgetown-core 2.1.0.beta1 → 2.1.0.beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 696307e4270883706cdcff2ad44ea6d83120449aab4a5e74a67101fc3769fc3b
4
- data.tar.gz: 5596f15af73805b95d1f2c8df40e4da2256733363697b235828fe6f59a5469fe
3
+ metadata.gz: 1f895d51e27a507afdcb11da40c28ac1d39f2aa63992c8cc3e0fe70234624054
4
+ data.tar.gz: d7cfd9665c5df7bea956e474eaf09bcd2e2c01a7a3f13614998837293ed0bf34
5
5
  SHA512:
6
- metadata.gz: a72aa20636088803d8960f3880b48465702fa8961923b51ec6edc7b5245d8d6f9645c83c18b02993f396076c35cd7c461dfb5b97f04bcfc4f78d4f8984bd5eed
7
- data.tar.gz: 9f4bdb2e72807ddc0a6caf528a26931ea6ce02e4384c6c31f889ab12f6bd0887d0da6181d7d1ee4c54d06b62f9f646958cf1d0ad09f50c66e346b45b1e0b1ca8
6
+ metadata.gz: e6963b721efce454a663b32d3d866a83f3f8e34675f4be92342c3200198fcdeb2ea122f34af67aa14227fc5048b99f0ecfaaf867c2da2b2ad7e794456db858a1
7
+ data.tar.gz: 5ed2af1ac5a40dda08ce53742797106da1b8ed710c59a1aaa3f2c6469f4735faa2ba0a2e89631fca710d431dd477a107f38ac0c530be8f097d5d08fd3e1de8fd
data/.rubocop.yml CHANGED
@@ -12,7 +12,6 @@ AllCops:
12
12
  - tmp/**/*
13
13
  - test/source/**/*
14
14
  - test/resources/src/**/*.rb
15
- - lib/bridgetown-core/configurations/ruby2js/**/*
16
15
  - lib/bridgetown-core/rack/roda.rb
17
16
  - lib/site_template/TEMPLATES/**/*
18
17
  - lib/site_template/Rakefile
@@ -7,7 +7,6 @@ add_npm_package "@11ty/is-land"
7
7
  javascript_import do
8
8
  <<~JS
9
9
  import "@11ty/is-land/is-land.js"
10
- import "@11ty/is-land/is-land-autoinit.js"
11
10
  JS
12
11
  end
13
12
 
@@ -25,6 +25,8 @@ module Bridgetown
25
25
 
26
26
  def get(key) = @data[key]
27
27
 
28
+ def key?(key) = @data.key?(key)
29
+
28
30
  def set(key, value = nil, &block)
29
31
  # Handle nested data within a block
30
32
  if block
@@ -14,7 +14,7 @@ module Bridgetown
14
14
  }.freeze
15
15
 
16
16
  class << self
17
- # rubocop:disable Bridgetown/NoPutsAllowed, Metrics/MethodLength
17
+ # rubocop:disable Bridgetown/NoPutsAllowed, Metrics
18
18
  def print_routes
19
19
  # TODO: this needs to be fully documented
20
20
  routes = begin
@@ -26,24 +26,27 @@ module Bridgetown
26
26
  rescue StandardError
27
27
  []
28
28
  end
29
+
30
+ puts "Routes:".bold.green
29
31
  puts
30
- puts "Routes:"
31
- puts "=======\n"
32
+
32
33
  if routes.empty?
33
34
  puts "No routes found. Have you commented all of your routes?"
34
- puts "Documentation: https://github.com/jeremyevans/roda-route_list#basic-usage-"
35
+ puts "Documentation: https://github.com/jeremyevans/roda-route_list#label-Basic+Usage"
35
36
  end
36
37
 
37
- routes.each do |route|
38
- puts [
39
- route["methods"]&.join("|") || "GET",
40
- route["path"],
41
- route["file"] ? "\n File: #{route["file"]}" : nil,
42
- ].compact.join(" ")
38
+ routes.group_by { _1["file"] }.each do |file, file_routes|
39
+ file_routes.each_with_index do |route, index|
40
+ puts [
41
+ (route["methods"]&.join("|") || "GET").cyan,
42
+ route["path"],
43
+ file && index == file_routes.length - 1 ? "\n #{"File:".yellow} #{file}" : nil,
44
+ ].compact.join(" ")
45
+ end
46
+ puts
43
47
  end
44
- puts
45
48
  end
46
- # rubocop:enable Bridgetown/NoPutsAllowed, Metrics/MethodLength
49
+ # rubocop:enable Bridgetown/NoPutsAllowed, Metrics
47
50
 
48
51
  # @return [Proc]
49
52
  attr_accessor :router_block
@@ -5,11 +5,11 @@ module Bridgetown
5
5
  attr_reader :site, :manifest, :content_dirs
6
6
 
7
7
  # @param site [Bridgetown::Site]
8
- # @param manifest [Bridgetown::Plugin::SourceManifest]
8
+ # @param manifest [Bridgetown::Configuration::SourceManifest]
9
9
  def initialize(site, manifest)
10
10
  @site = site
11
11
  @manifest = manifest
12
- @content_dirs = manifest.contents
12
+ @content_dirs = manifest.contents || {}
13
13
  @content_files = Set.new
14
14
  @supports_bare_text = manifest.bare_text
15
15
  @bare_text_extensions = site.config.markdown_ext.split(",").map { ".#{_1}" } + [".html"]
@@ -40,10 +40,13 @@ end
40
40
  Bridgetown.initializer :parse_routes do |config|
41
41
  # This builds upon the work done here:
42
42
  # https://github.com/jeremyevans/roda-route_list/blob/master/bin/roda-parse_routes
43
+ config.roda do |app|
44
+ app.plugin :route_list, file: ".routes.json"
45
+ end
43
46
 
44
47
  require "roda-route_parser"
45
48
 
46
- route_files = Dir["#{config.root_dir}/server/**/*.rb"]
49
+ route_files = Dir["#{config.root_dir}/#{config.server_dir}/**/*.rb"]
47
50
  if config.key?(:routes)
48
51
  config.routes.source_paths.each do |routes_dir|
49
52
  routes_dir = File.expand_path(routes_dir, config.source)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.beta1
4
+ version: 2.1.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
@@ -71,14 +71,14 @@ dependencies:
71
71
  requirements:
72
72
  - - '='
73
73
  - !ruby/object:Gem::Version
74
- version: 2.1.0.beta1
74
+ version: 2.1.0.beta2
75
75
  type: :runtime
76
76
  prerelease: false
77
77
  version_requirements: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - '='
80
80
  - !ruby/object:Gem::Version
81
- version: 2.1.0.beta1
81
+ version: 2.1.0.beta2
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: csv
84
84
  requirement: !ruby/object:Gem::Requirement
@@ -501,9 +501,6 @@ files:
501
501
  - lib/bridgetown-core/configurations/purgecss.rb
502
502
  - lib/bridgetown-core/configurations/render.rb
503
503
  - lib/bridgetown-core/configurations/render/render.yaml.erb
504
- - lib/bridgetown-core/configurations/ruby2js.rb
505
- - lib/bridgetown-core/configurations/ruby2js/hello_world.js.rb
506
- - lib/bridgetown-core/configurations/ruby2js/ruby2js.rb
507
504
  - lib/bridgetown-core/configurations/seo.rb
508
505
  - lib/bridgetown-core/configurations/shoelace.rb
509
506
  - lib/bridgetown-core/configurations/tailwindcss.rb
@@ -1,9 +0,0 @@
1
- class HelloWorld < HTMLElement
2
- def connected_callback()
3
- self.inner_html = "<p><strong>Hello World!</strong></p>"
4
- end
5
- end
6
-
7
- # Try adding `<hello-world></hello-world>` somewhere on your site to see this
8
- # example web component in action!
9
- custom_elements.define "hello-world", HelloWorld
@@ -1,10 +0,0 @@
1
- # See docs on Ruby2JS options here: https://www.ruby2js.com/docs/options
2
-
3
- preset
4
-
5
- filter :camelCase
6
- filter :lit
7
-
8
- eslevel 2022
9
-
10
- autoexports :default
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- unless Bridgetown::Utils.frontend_bundler_type == :esbuild
4
- error_message = "#{"esbuild.config.js".bold} not found. (This configuration doesn't currently " \
5
- "support Webpack.)"
6
-
7
- @logger.error "\nError:".red, "🚨 #{error_message}"
8
-
9
- return
10
- end
11
-
12
- say_status :ruby2js, "Installing Ruby2JS..."
13
-
14
- add_gem "ruby2js"
15
- add_npm_package "-D @ruby2js/esbuild-plugin"
16
-
17
- insert_into_file "esbuild.config.js",
18
- after: 'const build = require("./config/esbuild.defaults.js")' do
19
- <<~JS
20
-
21
- const ruby2js = require("@ruby2js/esbuild-plugin")
22
- JS
23
- end
24
-
25
- insert_into_file "esbuild.config.js",
26
- after: "\n plugins: [\n" do
27
- <<-JS
28
- ruby2js(),
29
- JS
30
- end
31
-
32
- copy_file in_templates_dir("ruby2js.rb"), "config/ruby2js.rb"
33
- copy_file in_templates_dir("hello_world.js.rb"), "src/_components/hello_world.js.rb"
34
-
35
- say_status :ruby2js, "Ruby2JS is now configured!"
36
-
37
- say "Check out the example `hello_world.js.rb` file in `src/_components`", :blue
38
- say "Ruby2JS configuration options are saved in `config/ruby2js.rb`", :blue
39
- say 'For further reading, check out "https://www.ruby2js.com"', :blue