bridgetown-core 0.11.2 → 0.12.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: '0906f551762562da1c9663539e264598ff83e4047206e443f333a12cfc3a59a4'
4
- data.tar.gz: bd8d4b58c92d6fbb7709e5022e4cd114dcea6c4de9cfb73e6992666585035f01
3
+ metadata.gz: 73f4610f5a38cc797e719301a59ce3c40ceef246702f3f20f6608a01cb05b23f
4
+ data.tar.gz: 749f92dfd628f60c5cce698b009aa6aed110fc48daa921b523b50f2617d7987e
5
5
  SHA512:
6
- metadata.gz: eb2a4a8592cb90a72d68c4f9cef2551c5fd2101699f2e39fe15f5ac0cc9ae6e3465128651a03a1de4cad327699001b8e5774c073612e5a533585f7152bf6518c
7
- data.tar.gz: 0d81b4b78a7877ab1ad308ceb9de3a723a05d42b8685392586524d3a1028704c3b6ad30deb6e82c413f915f80b188589cf7a48a590965cf69cafe47bc80ed250
6
+ metadata.gz: b1707b9be0641a5814fb6817633c5013e38aeb7293fb353e4cb6f9cde1cab7d09c3f91f3237fbcf435659f2cc61c8345d4c43162252b04308847c56233704df7
7
+ data.tar.gz: 3e859ebb2c76bacacbb87c53f803277042560d6e9579911912504b5dd470f22a8be314ad440134fd97c8558d8757b0d7ba6988466804031934d7aedfc6ea6afc
@@ -26,8 +26,8 @@ module Bridgetown
26
26
  # Adjust verbosity quickly
27
27
  Bridgetown.logger.adjust_verbosity(options)
28
28
 
29
- Bridgetown.logger.info "#", "Your Bridgetown #{Bridgetown::VERSION}" \
30
- " build is about to begin…"
29
+ Bridgetown.logger.info "Starting:", "Bridgetown v#{Bridgetown::VERSION.magenta}" \
30
+ " (codename \"#{Bridgetown::CODE_NAME.yellow}\")"
31
31
 
32
32
  options = configuration_from_options(options)
33
33
  @site = Bridgetown::Site.new(options)
@@ -66,7 +66,8 @@ module Bridgetown
66
66
  (incremental ? "enabled" : "disabled. Enable with --incremental")
67
67
  Bridgetown.logger.info "Generating…"
68
68
  process_site(@site)
69
- Bridgetown.logger.info "Done! 🎉", "Completed in #{(Time.now - t).round(3)} seconds."
69
+ Bridgetown.logger.info "Done! 🎉", "#{"Completed".green} in less than" \
70
+ " #{(Time.now - t).ceil(2)} seconds."
70
71
  end
71
72
 
72
73
  # Private: Watch for file changes and rebuild the site.
@@ -24,9 +24,10 @@ module Bridgetown
24
24
  # TODO: is there a way to add a unit test for this command?
25
25
  # rubocop:disable Style/GlobalVars, Metrics/AbcSize, Metrics/MethodLength
26
26
  def process(options)
27
- Bridgetown.logger.info "Starting Bridgetown #{Bridgetown::VERSION} console…"
27
+ Bridgetown.logger.info "Starting:", "Bridgetown v#{Bridgetown::VERSION}" \
28
+ " (codename \"#{Bridgetown::CODE_NAME}\")" \
29
+ " console…"
28
30
  site = Bridgetown::Site.new(configuration_from_options(options))
29
- Bridgetown.logger.info "Loading site…"
30
31
  site.reset
31
32
  site.read
32
33
  site.generate
@@ -37,7 +38,7 @@ module Bridgetown
37
38
  irb = IRB::Irb.new(workspace)
38
39
  IRB.conf[:MAIN_CONTEXT] = irb.context
39
40
  eval("site = $BRIDGETOWN_SITE", workspace.binding, __FILE__, __LINE__)
40
- Bridgetown.logger.info "", "Now loaded as " + "site".cyan + " variable."
41
+ Bridgetown.logger.info "Console:", "Now loaded as " + "site".cyan + " variable."
41
42
 
42
43
  trap("SIGINT") do
43
44
  irb.signal_handle
@@ -15,6 +15,7 @@ module Bridgetown
15
15
 
16
16
  c.option "force", "--force", "Force creation even if PATH already exists"
17
17
  c.option "skip-bundle", "--skip-bundle", "Skip 'bundle install'"
18
+ c.option "skip-yarn", "--skip-yarn", "Skip 'yarn install'"
18
19
 
19
20
  c.action do |args, options|
20
21
  Bridgetown::Commands::New.process(args, options)
@@ -109,32 +110,41 @@ module Bridgetown
109
110
  "src/_posts/0000-00-00-welcome-to-bridgetown.md.erb"
110
111
  end
111
112
 
112
- # After a new blog has been created, print a success notification and
113
- # then automatically execute bundle install from within the new blog dir
114
- # unless the user opts to generate a blank blog or skip 'bundle install'.
115
- # rubocop:disable Metrics/AbcSize #
113
+ # After a new site has been created, print a success notification and
114
+ # then automatically execute bundle install from within the new site dir
115
+ # unless the user opts to skip 'bundle install'.
116
+ # rubocop:disable Metrics/AbcSize, Metrics/MethodLength #
116
117
  def after_install(path, cli_path, options = {})
117
- unless options["blank"] || options["skip-bundle"]
118
+ logger = Bridgetown.logger
119
+ git_init path
120
+
121
+ unless options["skip-bundle"]
118
122
  begin
119
123
  require "bundler"
120
124
  bundle_install path
121
125
  rescue LoadError
122
- Bridgetown.logger.info "Could not load Bundler. Bundle install skipped."
126
+ logger.info "Could not load Bundler. Bundle install skipped."
123
127
  end
124
128
  end
125
129
 
126
- git_init path
130
+ yarn_install path unless options["skip-yarn"]
131
+
132
+ yarn_start = "yarn start"
127
133
 
128
- Bridgetown.logger.info "Success!".green, "🎉 Your new Bridgetown site was" \
129
- " generated in #{cli_path.cyan}."
130
- Bridgetown.logger.info "Execute cd #{cli_path.cyan} to get started."
131
- Bridgetown.logger.info "You'll probably also want to #{"yarn install".cyan}" \
132
- " to load in your frontend assets."
133
- Bridgetown.logger.info "Check out our online documentation for" \
134
- " next steps: #{DOCSURL.cyan}"
135
- Bridgetown.logger.info "Bundle install skipped." if options["skip-bundle"]
134
+ logger.info "Success!".green, "🎉 Your new Bridgetown site was" \
135
+ " generated in #{cli_path.cyan}."
136
+ if options["skip-yarn"]
137
+ logger.info "You can now #{"cd".cyan} #{cli_path.cyan} to get started."
138
+ logger.info "You'll probably also want to #{"yarn install".cyan}" \
139
+ " to load in your frontend assets."
140
+ else
141
+ logger.info "You can now #{"cd".cyan} and run #{yarn_start.cyan} to get started."
142
+ end
143
+ logger.info "Then check out our online documentation for" \
144
+ " next steps: #{DOCSURL.cyan}"
145
+ logger.info "Bundle install skipped." if options["skip-bundle"]
136
146
  end
137
- # rubocop:enable Metrics/AbcSize #
147
+ # rubocop:enable Metrics/AbcSize, Metrics/MethodLength #
138
148
 
139
149
  def bundle_install(path)
140
150
  Bridgetown.logger.info "Running bundle install in #{path.cyan}..."
@@ -159,6 +169,22 @@ module Bridgetown
159
169
  end
160
170
  rescue SystemCallError
161
171
  end
172
+
173
+ def yarn_install(path)
174
+ Bridgetown.logger.info "Running yarn install in #{path.cyan}..."
175
+ Dir.chdir(path) do
176
+ _process, output = Bridgetown::Utils::Exec.run("yarn", "install")
177
+ output.to_s.each_line do |line|
178
+ next if line.to_s.empty? ||
179
+ line.strip.start_with?("warning ") ||
180
+ line.include?("No lockfile found")
181
+
182
+ Bridgetown.logger.info("Yarn:".green, line.strip)
183
+ end
184
+ end
185
+ rescue SystemCallError
186
+ Bridgetown.logger.info "Could not load yarn. yarn install skipped."
187
+ end
162
188
  end
163
189
  end
164
190
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bridgetown
4
- VERSION = "0.11.2"
4
+ VERSION = "0.12.0"
5
+ CODE_NAME = "Lovejoy"
5
6
  end
@@ -125,7 +125,8 @@ module Bridgetown
125
125
  def process(site, time)
126
126
  begin
127
127
  site.process
128
- Bridgetown.logger.info "Done! 🎉", "Completed in #{(Time.now - time).round(3)} seconds."
128
+ Bridgetown.logger.info "Done! 🎉", "#{"Completed".green} in less than" \
129
+ " #{(Time.now - time).ceil(2)} seconds."
129
130
  rescue StandardError => e
130
131
  Bridgetown.logger.warn "Error:", e.message
131
132
  Bridgetown.logger.warn "Error:", "Run bridgetown build --trace for more information."
@@ -3,9 +3,13 @@
3
3
  "version": "1.0.0",
4
4
  "private": true,
5
5
  "scripts": {
6
- "build": "webpack --mode production",
7
- "deploy": "yarn build && bundle exec bridgetown build",
8
- "dev": "webpack --mode development -w"
6
+ "build": "bundle exec bridgetown build",
7
+ "serve": "bundle exec bridgetown serve",
8
+ "webpack-build": "webpack --mode production",
9
+ "webpack-dev": "webpack --mode development -w",
10
+ "deploy": "yarn webpack-build && yarn build",
11
+ "sync": "node sync.js",
12
+ "start": "node start.js"
9
13
  },
10
14
  "devDependencies": {
11
15
  "@babel/core": "^7.9.0",
@@ -13,6 +17,8 @@
13
17
  "@babel/plugin-transform-runtime": "^7.9.0",
14
18
  "@babel/preset-env": "^7.9.0",
15
19
  "babel-loader": "^8.1.0",
20
+ "browser-sync": "^2.26.7",
21
+ "concurrently": "^5.2.0",
16
22
  "css-loader": "^3.4.2",
17
23
  "file-loader": "^6.0.0",
18
24
  "mini-css-extract-plugin": "^0.9.0",
File without changes
@@ -0,0 +1,17 @@
1
+ const concurrently = require('concurrently');
2
+
3
+ // By default, configure Bridgetown to use port 4001 so Browsersync can use 4000
4
+ // See also Browsersync settings in sync.js
5
+ const port = 4001
6
+
7
+ /////////////////
8
+ // Concurrently
9
+ /////////////////
10
+ concurrently([
11
+ { command: "yarn webpack-dev", name: "Webpack", prefixColor: "yellow"},
12
+ { command: "sleep 4; yarn serve --port " + port, name: "Bridgetown", prefixColor: "green"},
13
+ { command: "sleep 8; yarn sync", name: "Live", prefixColor: "blue"}
14
+ ], {
15
+ restartTries: 3,
16
+ killOthers: ['failure', 'success'],
17
+ }).then(() => {}, () => {});
@@ -0,0 +1,35 @@
1
+ const browserSync = require("browser-sync").create();
2
+
3
+ // You can change these configuration values:
4
+ const proxy = "http://localhost:4001"
5
+ const port = 4000
6
+ const uiPort = 4002
7
+
8
+ ////////////////
9
+ // Browsersync
10
+ ////////////////
11
+ browserSync.init({
12
+ open: false,
13
+ notify: false,
14
+ proxy: proxy,
15
+ port: port,
16
+ files: "output/index.html",
17
+ ghostMode: {
18
+ clicks: false,
19
+ forms: false,
20
+ scroll: false,
21
+ },
22
+ reloadDelay: 0,
23
+ injectChanges: false,
24
+ ui: {
25
+ port: uiPort
26
+ },
27
+ snippetOptions: {
28
+ rule: {
29
+ match: /<\/head>/i,
30
+ fn: function (snippet, match) {
31
+ return snippet + match;
32
+ },
33
+ },
34
+ },
35
+ });
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: 0.11.2
4
+ version: 0.12.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: 2020-04-24 00:00:00.000000000 Z
11
+ date: 2020-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -281,7 +281,9 @@ files:
281
281
  - lib/site_template/frontend/javascript/index.js
282
282
  - lib/site_template/frontend/styles/index.scss
283
283
  - lib/site_template/package.json
284
+ - lib/site_template/plugins/.keep
284
285
  - lib/site_template/src/404.html
286
+ - lib/site_template/src/_components/.keep
285
287
  - lib/site_template/src/_data/site_metadata.yml
286
288
  - lib/site_template/src/_includes/footer.html
287
289
  - lib/site_template/src/_includes/head.html
@@ -293,6 +295,8 @@ files:
293
295
  - lib/site_template/src/_posts/0000-00-00-welcome-to-bridgetown.md.erb
294
296
  - lib/site_template/src/about.md
295
297
  - lib/site_template/src/index.md
298
+ - lib/site_template/start.js
299
+ - lib/site_template/sync.js
296
300
  - lib/site_template/webpack.config.js
297
301
  homepage: https://bridgetownrb.com
298
302
  licenses: