bridgetown-core 1.0.0.beta3 → 1.0.0

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: 34e42f164cec4d31c4904ed8f35ea1ac8079a60d79ec89fb97946b4e9799e65a
4
- data.tar.gz: a590bd4e904bbbd89d0fa57541280fc9c01c11bbac5974261940020a4bb9d832
3
+ metadata.gz: fdb62333635d80ceb9561a0cd9be68f0220ea729c8ac4505bb8e4460894075e1
4
+ data.tar.gz: f7377127b4d64846e694d8ba4c032706ed161ea1595cf8dbf3eca3d2b6e4692d
5
5
  SHA512:
6
- metadata.gz: 7a6654c80468f31af2d728bcef3820f1c265e67df5f0e8c92e8d495c4376d309da919d3c31a69b69ac87ad3b9d6849f93ec45e69630f2875e43c5282dbd54d4d
7
- data.tar.gz: 709855c6285071f112206bf7f2a96f5956abc74f35c8bbf591f2b13f222a6e75e83158d93062f948d34f878ee62048747a6c9337710ebe9f0da2ef4f18db25bd
6
+ metadata.gz: 051a34337053c1370745d37a7cc3def36e1623193e4c03e0b1006d06280303ad5442c289465185314f916dbcf2aa1b1123990ca196041b03bf3804a03b36f695
7
+ data.tar.gz: d5adcc3f8c7c7938bbc220329c002c7cea281f4e21f8ea2bab685dabaffe48c5acca3998482d1e0ec6d0c7c172751c0c6b34481821f51b5d1ccc687b137e55a5
@@ -5,23 +5,27 @@ const outputFolder = "output"
5
5
 
6
6
  // You can customize this as you wish, perhaps to add new esbuild plugins.
7
7
  //
8
- // Eg:
8
+ // ```
9
+ // const path = require("path")
10
+ // const esbuildCopy = require('esbuild-plugin-copy').default
11
+ // const esbuildOptions = {
12
+ // plugins: [
13
+ // esbuildCopy({
14
+ // assets: {
15
+ // from: [path.resolve(__dirname, 'node_modules/somepackage/files/*')],
16
+ // to: [path.resolve(__dirname, 'output/_bridgetown/somepackage/files')],
17
+ // },
18
+ // verbose: false
19
+ // }),
20
+ // ]
21
+ // }
22
+ // ```
9
23
  //
10
- // ```
11
- // const path = require("path")
12
- // const esbuildCopy = require('esbuild-plugin-copy').default
13
- // const esbuildOptions = {
14
- // plugins: [
15
- // esbuildCopy({
16
- // assets: {
17
- // from: [path.resolve(__dirname, 'node_modules/somepackage/files/*')],
18
- // to: [path.resolve(__dirname, 'output/_bridgetown/somepackage/files')],
19
- // },
20
- // verbose: false
21
- // }),
22
- // ]
23
- // }
24
- // ```
24
+ // You can also support custom base_path deployments via changing `publicPath`.
25
+ //
26
+ // ```
27
+ // const esbuildOptions = { publicPath: "/my_subfolder/_bridgetown/static" }
28
+ // ```
25
29
  const esbuildOptions = {}
26
30
 
27
31
  build(outputFolder, esbuildOptions)
@@ -0,0 +1,33 @@
1
+ name: Deploy to GitHub pages
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ deploy:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+
14
+ - name: Setup Ruby
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ bundler-cache: true
18
+
19
+ - name: Setup Node
20
+ uses: actions/setup-node@v2
21
+ with:
22
+ node-version: "16"
23
+ cache: "yarn"
24
+ - run: yarn install
25
+
26
+ - name: Build
27
+ run: bin/bridgetown deploy
28
+
29
+ - name: Deploy
30
+ uses: peaceiris/actions-gh-pages@v3
31
+ with:
32
+ github_token: ${{ secrets.GITHUB_TOKEN }}
33
+ publish_dir: ./output
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ `bundle lock --add-platform x86_64-linux`
4
+ copy_file in_templates_dir("gh-pages.yml"), ".github/workflows/gh-pages.yml"
5
+
6
+ # rubocop:disable Layout/LineLength
7
+ say "🎉 A GitHub action to deploy your site to GitHub pages has been configured!"
8
+ say ""
9
+
10
+ say "🛠️ After pushing the action, go to your repository settings and configure GitHub Pages to deploy from the branch `gh-pages`."
11
+ say ""
12
+
13
+ say "You'll likely also need to set `base_path` in your `bridgetown.config.yml` to your repository's name. If you do this you'll need to use the `relative_url` helper for all links and assets in your HTML."
14
+ say "If you're using esbuild for frontend assets, edit `esbuild.config.js` to update `publicPath`."
15
+ say ""
16
+ # rubocop:enable Layout/LineLength
@@ -48,8 +48,6 @@ module Bridgetown
48
48
  Bridgetown::Current.preloaded_configuration ||=
49
49
  self.class.opts[:bridgetown_preloaded_config]
50
50
 
51
- request.public
52
-
53
51
  request.root do
54
52
  output_folder = Bridgetown::Current.preloaded_configuration.destination
55
53
  File.read(File.join(output_folder, "index.html"))
@@ -41,6 +41,24 @@ module Bridgetown
41
41
  end
42
42
 
43
43
  def start!(roda_app)
44
+ if Bridgetown::Current.preloaded_configuration.base_path == "/"
45
+ load_all_routes roda_app
46
+ return
47
+ end
48
+
49
+ # Support custom base_path configurations
50
+ roda_app.request.on(
51
+ Bridgetown::Current.preloaded_configuration.base_path.delete_prefix("/")
52
+ ) do
53
+ load_all_routes roda_app
54
+ end
55
+
56
+ nil
57
+ end
58
+
59
+ def load_all_routes(roda_app)
60
+ roda_app.request.public
61
+
44
62
  if Bridgetown.env.development? &&
45
63
  !Bridgetown::Current.preloaded_configuration.skip_live_reload
46
64
  setup_live_reload roda_app
@@ -50,11 +68,9 @@ module Bridgetown
50
68
  klass.merge roda_app
51
69
  end
52
70
 
53
- if defined?(Bridgetown::Routes::RodaRouter)
54
- Bridgetown::Routes::RodaRouter.start!(roda_app)
55
- end
71
+ return unless defined?(Bridgetown::Routes::RodaRouter)
56
72
 
57
- nil
73
+ Bridgetown::Routes::RodaRouter.start!(roda_app)
58
74
  end
59
75
 
60
76
  def setup_live_reload(app) # rubocop:disable Metrics/AbcSize
@@ -457,7 +457,7 @@ module Bridgetown
457
457
  code = <<~JAVASCRIPT
458
458
  let lastmod = 0
459
459
  function startReloadConnection() {
460
- const evtSource = new EventSource("/_bridgetown/live_reload")
460
+ const evtSource = new EventSource("#{site.base_path(strip_slash_only: true)}/_bridgetown/live_reload")
461
461
  evtSource.onmessage = event => {
462
462
  if (event.data == "reloaded!") {
463
463
  location.reload()
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bridgetown
4
- VERSION = "1.0.0.beta3"
4
+ VERSION = "1.0.0"
5
5
  CODE_NAME = "Pearl"
6
6
  end
@@ -26,4 +26,4 @@ gem "bridgetown", "~> <%= Bridgetown::VERSION %>"
26
26
 
27
27
  # Puma is a Rack-compatible server used by Bridgetown
28
28
  # (you can optionally limit this to the "development" group)
29
- gem "puma", "~> 5.5"
29
+ gem "puma", "~> 5.6"
@@ -1,11 +1,11 @@
1
1
  <header>
2
- <img src="/images/logo.svg" alt="Logo" />
2
+ <img src="<%= relative_url '/images/logo.svg' %>" alt="Logo" />
3
3
  </header>
4
4
 
5
5
  <nav>
6
6
  <ul>
7
- <li><a href="/">Home</a></li>
8
- <li><a href="/about">About</a></li>
9
- <li><a href="/posts">Posts</a></li>
7
+ <li><a href="<%= relative_url '/' %>">Home</a></li>
8
+ <li><a href="<%= relative_url '/about' %>">About</a></li>
9
+ <li><a href="<%= relative_url '/posts' %>">Posts</a></li>
10
10
  </ul>
11
11
  </nav>
@@ -1,11 +1,11 @@
1
1
  <header>
2
- <img src="/images/logo.svg" alt="Logo" />
2
+ <img src="{{ '/images/logo.svg' | relative_url }}" alt="Logo" />
3
3
  </header>
4
4
 
5
5
  <nav>
6
6
  <ul>
7
- <li><a href="/">Home</a></li>
8
- <li><a href="/about">About</a></li>
9
- <li><a href="/posts">Posts</a></li>
7
+ <li><a href="{{ '/' | relative_url }}">Home</a></li>
8
+ <li><a href="{{ '/about' | relative_url }}">About</a></li>
9
+ <li><a href="{{ '/posts' | relative_url }}">Posts</a></li>
10
10
  </ul>
11
11
  </nav>
@@ -1,11 +1,11 @@
1
1
  <header>
2
- <img src="/images/logo.svg" alt="Logo" />
2
+ <img src="{{ '/images/logo.svg' | relative_url }}" alt="Logo" />
3
3
  </header>
4
4
 
5
5
  <nav>
6
6
  <ul>
7
- <li><a href="/">Home</a></li>
8
- <li><a href="/about">About</a></li>
9
- <li><a href="/posts">Posts</a></li>
7
+ <li><a href="{{ '/' | relative_url }}">Home</a></li>
8
+ <li><a href="{{ '/about' | relative_url }}">About</a></li>
9
+ <li><a href="{{ '/posts' | relative_url }}">Posts</a></li>
10
10
  </ul>
11
11
  </nav>
@@ -19,8 +19,12 @@ url: "" # the base hostname & protocol for your site, e.g. https://example.com
19
19
  permalink: pretty
20
20
 
21
21
  # Other options you might want to investigate:
22
- #
23
- # base_path: "/" # the subpath of your site, e.g. /blog
22
+ #
23
+ # base_path: "/" # the subpath of your site, e.g. /blog. If you set this option,
24
+ # ensure you use the `relative_url` helper for all links and assets in your HTML.
25
+ # If you're using esbuild for frontend assets, edit `esbuild.config.js` to
26
+ # update `publicPath`.
27
+
24
28
  # timezone: America/Los_Angeles
25
29
  # pagination:
26
- # enabled: true
30
+ # enabled: true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-18 00:00:00.000000000 Z
11
+ date: 2022-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -431,6 +431,8 @@ files:
431
431
  - lib/bridgetown-core/configurations/cypress/cypress_dir/support/commands.js
432
432
  - lib/bridgetown-core/configurations/cypress/cypress_dir/support/index.js
433
433
  - lib/bridgetown-core/configurations/cypress/cypress_tasks
434
+ - lib/bridgetown-core/configurations/gh-pages.rb
435
+ - lib/bridgetown-core/configurations/gh-pages/gh-pages.yml
434
436
  - lib/bridgetown-core/configurations/minitesting.rb
435
437
  - lib/bridgetown-core/configurations/netlify.rb
436
438
  - lib/bridgetown-core/configurations/netlify/netlify.sh
@@ -605,9 +607,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
605
607
  version: 2.7.0
606
608
  required_rubygems_version: !ruby/object:Gem::Requirement
607
609
  requirements:
608
- - - ">"
610
+ - - ">="
609
611
  - !ruby/object:Gem::Version
610
- version: 1.3.1
612
+ version: '0'
611
613
  requirements: []
612
614
  rubygems_version: 3.1.4
613
615
  signing_key: