Skip to content

Commit

Permalink
Prepare for v4.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
glebm committed Sep 18, 2022
1 parent 78e7e0f commit db46be8
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bootstrap.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Gem::Specification.new do |s|
# SassC requires Ruby 2.3.3. Also specify here to make it obvious.
s.required_ruby_version = '>= 2.3.3'

s.add_runtime_dependency 'popper_js', '>= 1.14.3', '< 2'
s.add_runtime_dependency 'popper_js', '>= 1.16.1', '< 2'

s.add_runtime_dependency 'sassc-rails', '>= 2.0.0'
s.add_runtime_dependency 'autoprefixer-rails', '>= 9.1.0'
Expand Down
2 changes: 1 addition & 1 deletion lib/bootstrap/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

module Bootstrap
VERSION = '4.6.1'
BOOTSTRAP_SHA = '82a1f334cf02c6b1fbb27d5da6afb89a80223c31'
BOOTSTRAP_SHA = 'e5643aaa89eb67327a5b4abe7db976f0ea276b70'
end
24 changes: 18 additions & 6 deletions tasks/updater/js.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
require 'pathname'
require 'tsort'

class Updater
module Js
INLINED_SRCS = %w[index.js tools/sanitizer.js].freeze
EXTERNAL_JS = %w[popper.js].freeze

def update_javascript_assets
log_status 'Updating javascripts...'
save_to = @save_to[:js]
Expand Down Expand Up @@ -29,13 +33,15 @@ def update_javascript_assets

def bootstrap_js_files
@bootstrap_js_files ||= begin
src_files = get_paths_by_type('js/src', /\.js$/) - %w[index.js tools/sanitizer.js]
src_files = get_paths_by_type('js/src', /\.js$/) - INLINED_SRCS
puts "src_files: #{src_files.inspect}"
imports = Deps.new
# Get the imports from the ES6 files to order requires correctly.
read_files('js/src', src_files).each do |name, content|
imports.add name,
*content.scan(%r{import [a-zA-Z]* from '\./(\w+)})
.flatten(1).map { |f| "#{f}.js" }
file_imports = content.scan(%r{import *(?:[a-zA-Z]*|\{[a-zA-Z ,]*\}) *from '([\w/.-]+)}).flatten(1).map do |f|
Pathname.new(name).dirname.join(f.end_with?(".js") ? f : "#{f}.js").cleanpath.to_s
end.uniq
imports.add name, *(file_imports - INLINED_SRCS - EXTERNAL_JS)
end
imports.tsort
end
Expand All @@ -53,11 +59,17 @@ def initialize
end

def add(from, *tos)
(@imports[from] ||= []).push(*tos.sort)
imports = (@imports[from] ||= [])
imports.push(*tos)
imports.sort!
end

def tsort_each_child(node, &block)
@imports[node].each(&block)
node_imports = @imports[node]
if node_imports.nil?
raise "No imports found for #{node.inspect}\nImports:\n#{@imports.inspect}"
end
node_imports.each(&block)
end

def tsort_each_node(&block)
Expand Down
8 changes: 7 additions & 1 deletion tasks/updater/network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ def read_files(path, files)
log_http_get_files files, path_url, false
files.map do |name|
Thread.start {
contents[name] = URI.open("#{path_url}/#{name}").read
begin
url = "#{path_url}/#{name}"
contents[name] = URI.open(url).read
rescue Exception => e
log "Error downloading #{url}: #{e}"
exit 1
end
WRITE_FILES_MUTEX.synchronize { write_cached_files path, name => contents[name] }
}
end.each(&:join)
Expand Down

0 comments on commit db46be8

Please sign in to comment.