bridgetown-core 2.0.4 → 2.1.0.beta1
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 +4 -4
- data/.rubocop.yml +4 -2
- data/bin/bridgetown +19 -7
- data/bridgetown-core.gemspec +8 -6
- data/lib/bridgetown-core/collection.rb +4 -3
- data/lib/bridgetown-core/command.rb +97 -0
- data/lib/bridgetown-core/commands/application.rb +208 -0
- data/lib/bridgetown-core/commands/apply.rb +17 -29
- data/lib/bridgetown-core/commands/build.rb +9 -16
- data/lib/bridgetown-core/commands/clean.rb +7 -10
- data/lib/bridgetown-core/commands/concerns/{actions.rb → automations.rb} +103 -17
- data/lib/bridgetown-core/commands/concerns/build_options.rb +24 -60
- data/lib/bridgetown-core/commands/concerns/configuration_overridable.rb +2 -4
- data/lib/bridgetown-core/commands/configure.rb +24 -24
- data/lib/bridgetown-core/commands/console.rb +38 -34
- data/lib/bridgetown-core/commands/esbuild.rb +14 -24
- data/lib/bridgetown-core/commands/help.rb +24 -0
- data/lib/bridgetown-core/commands/new.rb +38 -60
- data/lib/bridgetown-core/commands/plugins.rb +237 -211
- data/lib/bridgetown-core/commands/registrations.rb +10 -1
- data/lib/bridgetown-core/commands/start.rb +23 -31
- data/lib/bridgetown-core/commands/thor_shim.rb +94 -0
- data/lib/bridgetown-core/component.rb +4 -4
- data/lib/bridgetown-core/concerns/publishable.rb +1 -3
- data/lib/bridgetown-core/concerns/site/localizable.rb +2 -0
- data/lib/bridgetown-core/configuration/configuration_dsl.rb +2 -2
- data/lib/bridgetown-core/configuration.rb +27 -7
- data/lib/bridgetown-core/converters/erb_templates.rb +31 -21
- data/lib/bridgetown-core/converters/ruby_templates.rb +14 -13
- data/lib/bridgetown-core/converters/serbea_templates.rb +5 -2
- data/lib/bridgetown-core/entry_filter.rb +1 -4
- data/lib/bridgetown-core/front_matter/defaults.rb +1 -1
- data/lib/bridgetown-core/front_matter/importer.rb +7 -1
- data/lib/bridgetown-core/front_matter/loaders.rb +1 -1
- data/lib/bridgetown-core/front_matter/ruby.rb +3 -9
- data/lib/bridgetown-core/generated_page.rb +2 -2
- data/lib/bridgetown-core/generators/prototype_generator.rb +1 -1
- data/lib/bridgetown-core/helpers.rb +10 -11
- data/lib/bridgetown-core/hooks.rb +2 -3
- data/lib/bridgetown-core/locale/en.yml +30 -0
- data/lib/bridgetown-core/model/base.rb +5 -5
- data/lib/bridgetown-core/model/builder_origin.rb +1 -1
- data/lib/bridgetown-core/model/origin.rb +5 -1
- data/lib/bridgetown-core/model/plugin_origin.rb +3 -1
- data/lib/bridgetown-core/model/repo_origin.rb +3 -1
- data/lib/bridgetown-core/rack/routes.rb +1 -1
- data/lib/bridgetown-core/reader.rb +2 -2
- data/lib/bridgetown-core/readers/plugin_content_reader.rb +31 -7
- data/lib/bridgetown-core/resource/base.rb +16 -7
- data/lib/bridgetown-core/resource/destination.rb +1 -1
- data/lib/bridgetown-core/resource/permalink_processor.rb +4 -4
- data/lib/bridgetown-core/static_file.rb +1 -1
- data/lib/bridgetown-core/tags/class_map.rb +0 -2
- data/lib/bridgetown-core/tasks/bridgetown_tasks.rake +8 -11
- data/lib/bridgetown-core/{ruby_template_view.rb → template_view.rb} +108 -4
- data/lib/bridgetown-core/utils/initializers.rb +28 -1
- data/lib/bridgetown-core/utils/loaders_manager.rb +2 -1
- data/lib/bridgetown-core/utils.rb +19 -1
- data/lib/bridgetown-core/watcher.rb +16 -8
- data/lib/bridgetown-core.rb +5 -10
- data/lib/roda/plugins/bridgetown_server.rb +1 -1
- data/lib/site_template/README.md +10 -8
- metadata +84 -70
- data/lib/bridgetown-core/commands/base.rb +0 -123
- data/lib/bridgetown-core/commands/concerns/summarizable.rb +0 -13
- data/lib/bridgetown-core/configurations/.keep +0 -0
- data/lib/bridgetown-core/configurations/stimulus.rb +0 -59
- data/lib/bridgetown-core/configurations/turbo/turbo_transitions.js +0 -48
- data/lib/bridgetown-core/configurations/turbo.rb +0 -35
- data/lib/bridgetown-core/configurations/vercel/vercel.json +0 -45
- data/lib/bridgetown-core/configurations/vercel/vercel_url.rb +0 -12
- data/lib/bridgetown-core/configurations/vercel.rb +0 -4
- data/lib/bridgetown-core/inflector.rb +0 -40
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
document.addEventListener("turbo:visit", () => {
|
|
2
|
-
let main = document.querySelector("main");
|
|
3
|
-
if (main.dataset.turboTransition == "false") return;
|
|
4
|
-
|
|
5
|
-
let [movement, scale] = ["15px", "0.99"];
|
|
6
|
-
|
|
7
|
-
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
8
|
-
[movement, scale] = ["7px", "1"]
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
main.style.transformOrigin = "50% 0%";
|
|
12
|
-
main.dataset.animatingOut = true;
|
|
13
|
-
|
|
14
|
-
main.animate(
|
|
15
|
-
[
|
|
16
|
-
{ opacity: 1, transform: "translateY(0px) scale(1)" },
|
|
17
|
-
{ opacity: 0, transform: `translateY(${movement}) scale(${scale})` }
|
|
18
|
-
],
|
|
19
|
-
{ duration: 300, easing: "cubic-bezier(0.45, 0, 0.55, 1)", fill: "forwards" }
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
Promise.all(main.getAnimations().map(animation => animation.finished)).then(() => {
|
|
23
|
-
if (main.dataset.animatingOut) main.style.visibility = "hidden"
|
|
24
|
-
})
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
document.addEventListener("turbo:load", () => {
|
|
28
|
-
let main = document.querySelector("main");
|
|
29
|
-
if (main.dataset.turboTransition == "false") return;
|
|
30
|
-
|
|
31
|
-
let [movement, scale] = ["-10px", "0.99"];
|
|
32
|
-
|
|
33
|
-
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
34
|
-
[movement, scale] = ["-5px", "1"]
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
main.style.visibility = "visible";
|
|
38
|
-
main.style.transformOrigin = "50% 0%";
|
|
39
|
-
delete main.dataset.animatingOut;
|
|
40
|
-
|
|
41
|
-
main.animate(
|
|
42
|
-
[
|
|
43
|
-
{ opacity: 0, transform: `translateY(${movement}) scale(${scale})` },
|
|
44
|
-
{ opacity: 1, transform: "translateY(0px) scale(1)" }
|
|
45
|
-
],
|
|
46
|
-
{ duration: 150, easing: "cubic-bezier(0.45, 0, 0.55, 1)" }
|
|
47
|
-
)
|
|
48
|
-
})
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
say_status :turbo, "Installing Turbo..."
|
|
4
|
-
|
|
5
|
-
add_npm_package "@hotwired/turbo turbo-shadow"
|
|
6
|
-
|
|
7
|
-
say_status :turbo, 'Adding Turbo to "frontend/javascript/index.js"...', :magenta
|
|
8
|
-
|
|
9
|
-
javascript_import do
|
|
10
|
-
<<~JS
|
|
11
|
-
import * as Turbo from "@hotwired/turbo"
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Adds support for declarative shadow DOM. Requires your HTML <head> to include:
|
|
15
|
-
* `<meta name="turbo-cache-control" content="no-cache" />`
|
|
16
|
-
*/
|
|
17
|
-
import * as TurboShadow from "turbo-shadow"
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Uncomment the line below to add transition animations when Turbo navigates.
|
|
21
|
-
* Use data-turbo-transition="false" on your <main> element for pages where
|
|
22
|
-
* you don't want any transition animation.
|
|
23
|
-
*/
|
|
24
|
-
// import "./turbo_transitions.js"
|
|
25
|
-
JS
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
copy_file in_templates_dir("turbo_transitions.js"), "frontend/javascript/turbo_transitions.js"
|
|
29
|
-
|
|
30
|
-
say_status :turbo, "Turbo successfully added!", :magenta
|
|
31
|
-
say_status :turbo, "For declarative shadow DOM support, you will need to update", :blue
|
|
32
|
-
say_status :turbo, "your HTML <head> to add the following code:", :blue
|
|
33
|
-
say %(<meta name="turbo-cache-control" content="no-cache" />)
|
|
34
|
-
say_status :turbo, "Check out your index.js file for optional animation setup.", :blue
|
|
35
|
-
say_status :turbo, 'For further reading, visit "https://turbo.hotwired.dev/"', :blue
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"cleanUrls": true,
|
|
3
|
-
"trailingSlash": false,
|
|
4
|
-
"redirects": [],
|
|
5
|
-
"headers": [
|
|
6
|
-
{
|
|
7
|
-
"source": "/(.*)",
|
|
8
|
-
"headers": [
|
|
9
|
-
{
|
|
10
|
-
"key": "X-Content-Type-Options",
|
|
11
|
-
"value": "nosniff"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"key": "X-Frame-Options",
|
|
15
|
-
"value": "DENY"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"key": "X-XSS-Protection",
|
|
19
|
-
"value": "1; mode=block"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"key": "Referrer-Policy",
|
|
23
|
-
"value": "strict-origin"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"key": "Permissions-Policy",
|
|
27
|
-
"value": "geolocation=(self), microphone=()"
|
|
28
|
-
}
|
|
29
|
-
]
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"source": "/feed.xml",
|
|
33
|
-
"headers": [
|
|
34
|
-
{
|
|
35
|
-
"key": "Content-Type",
|
|
36
|
-
"value": "application/rss+xml"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"key": "Cache-Control",
|
|
40
|
-
"value": "public, max-age=3600"
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class Builders::VercelUrl < SiteBuilder
|
|
4
|
-
def build
|
|
5
|
-
hook :site, :pre_render do |site|
|
|
6
|
-
next unless ENV["VERCEL_URL"] && ENV["VERCEL_ENV"] != "production"
|
|
7
|
-
|
|
8
|
-
Bridgetown.logger.info("Subbing Vercel URL")
|
|
9
|
-
site.config.update(url: "https://#{ENV["VERCEL_URL"]}")
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "dry/inflector"
|
|
4
|
-
|
|
5
|
-
module Bridgetown
|
|
6
|
-
class Inflector < Dry::Inflector
|
|
7
|
-
def initialize(&) # rubocop:disable Lint/MissingSuper
|
|
8
|
-
@inflections = Dry::Inflector::Inflections.build do |inflections|
|
|
9
|
-
inflections.acronym "HTML"
|
|
10
|
-
inflections.acronym "CSS"
|
|
11
|
-
inflections.acronym "JS"
|
|
12
|
-
end
|
|
13
|
-
configure(&) if block_given?
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def configure
|
|
17
|
-
yield inflections
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# for compatibility with Zeitwerk
|
|
21
|
-
def camelize(basename, *)
|
|
22
|
-
super(basename)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def to_s
|
|
26
|
-
"#<Bridgetown::Inflector>"
|
|
27
|
-
end
|
|
28
|
-
alias_method :inspect, :to_s
|
|
29
|
-
|
|
30
|
-
def ==(other)
|
|
31
|
-
return super unless other.is_a?(Bridgetown::Inflector)
|
|
32
|
-
|
|
33
|
-
# NOTE: strictly speaking, this might be wrong if two inflector instances have different
|
|
34
|
-
# rule sets…but as this equality check is mainly done within the automated test suite, we
|
|
35
|
-
# just assume two instances are equal. No production apps will need multiple,
|
|
36
|
-
# differently-configured inflectors running at once ;)
|
|
37
|
-
true
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|