Skip to content

Drop webpacker 1 #784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ AllCops:
DisplayCopNames: true
Exclude:
- test/dummy_sprockets/**/*
- test/dummy_webpacker1/**/*
- test/dummy_webpacker2/**/*
- test/dummy_webpacker3/**/*
- node_modules/**/*
Expand Down
30 changes: 10 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ cache:
rvm:
- 2.3.0
- 2.1
- jruby-9.0.1.0
- jruby-9.1.9.0

gemfile:
# These have webpacker:
- gemfiles/rails_4.2_sprockets_4.gemfile
- gemfiles/rails_5_no_sprockets_webpacker_1_1.gemfile
- gemfiles/rails_5_no_sprockets_webpacker_1_x.gemfile
- gemfiles/rails_5_no_sprockets_webpacker_2.gemfile
- gemfiles/rails_5_no_sprockets_webpacker_3.gemfile
# These don't have webpacker:
Expand All @@ -23,6 +20,7 @@ gemfile:
- gemfiles/rails_4.1.gemfile
- gemfiles/rails_4.2_sprockets_2.gemfile
- gemfiles/rails_4.2_sprockets_3.gemfile
- gemfiles/rails_4.2_sprockets_4.gemfile
- gemfiles/rails_5_no_sprockets.gemfile
- gemfiles/rails_5.1_sprockets_4.gemfile

Expand All @@ -41,10 +39,6 @@ matrix:
gemfile: gemfiles/rails_4.2_sprockets_3.gemfile
- rvm: 2.1
gemfile: gemfiles/rails_4.2_sprockets_4.gemfile
- rvm: 2.1
gemfile: gemfiles/rails_5_no_sprockets_webpacker_1_1.gemfile
- rvm: 2.1
gemfile: gemfiles/rails_5_no_sprockets_webpacker_1_x.gemfile
- rvm: 2.1
gemfile: gemfiles/rails_5_no_sprockets_webpacker_2.gemfile
- rvm: 2.1
Expand All @@ -53,27 +47,23 @@ matrix:
gemfile: gemfiles/rails_5_no_sprockets.gemfile
- rvm: 2.1
gemfile: gemfiles/rails_5.1_sprockets_4.gemfile
- rvm: jruby-9.0.1.0
- rvm: jruby-9.1.9.0
gemfile: gemfiles/rails_4.0.gemfile
- rvm: jruby-9.0.1.0
- rvm: jruby-9.1.9.0
gemfile: rails_4.0_with_therubyracer.gemfile
- rvm: jruby-9.0.1.0
- rvm: jruby-9.1.9.0
gemfile: gemfiles/rails_4.1.gemfile
- rvm: jruby-9.0.1.0
- rvm: jruby-9.1.9.0
gemfile: gemfiles/rails_4.2_sprockets_2.gemfile
- rvm: jruby-9.0.1.0
gemfile: gemfiles/rails_5_no_sprockets_webpacker_1_1.gemfile
- rvm: jruby-9.0.1.0
gemfile: gemfiles/rails_5_no_sprockets_webpacker_1_x.gemfile
- rvm: jruby-9.0.1.0
- rvm: jruby-9.1.9.0
gemfile: gemfiles/rails_5_no_sprockets_webpacker_2.gemfile
- rvm: jruby-9.0.1.0
- rvm: jruby-9.1.9.0
gemfile: gemfiles/rails_5_no_sprockets_webpacker_3.gemfile
- rvm: jruby-9.0.1.0
- rvm: jruby-9.1.9.0
gemfile: gemfiles/rails_5_no_sprockets.gemfile

allow_failures:
- rvm: jruby-9.0.1.0
- rvm: jruby-9.1.9.0

before_install:
- nvm install 7.8.0 && nvm use 7.8.0
Expand Down
28 changes: 6 additions & 22 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ end

appraise 'rails-4.0-with-therubyracer' do
gem 'rails', '~> 4.0.13'
gem 'therubyracer', '0.12.0', :platform => :mri
gem 'therubyracer', '0.12.0', :platforms => :mri
gem 'turbolinks'
end

Expand Down Expand Up @@ -45,41 +45,25 @@ appraise 'rails-4.2-sprockets_4' do
gem 'turbolinks', '~> 2.5.0'
# This ExecJS backend provides stateful context
# which the default nodejs backend does not
gem 'mini_racer'
end

# no_sprockets is a magical name from sprockets_helper.rb in test to
# load in certain tests or not.
appraise 'rails-5_no_sprockets_webpacker_1_1' do
gem 'rails', '~> 5.0.0'
gem 'webpacker', '~> 1.1.0'
# This ExecJS backend provides stateful context
# which the default nodejs backend does not
gem 'therubyracer'
end

appraise 'rails-5_no_sprockets_webpacker_1_x' do
gem 'rails', '~> 5.0.0'
gem 'webpacker', '~> 1.2'
# This ExecJS backend provides stateful context
# which the default nodejs backend does not
gem 'therubyracer'
gem 'mini_racer', :platforms => :mri
end

appraise 'rails-5_no_sprockets_webpacker_2' do
gem 'rails', '~> 5.0.0'
gem 'webpacker', '~> 2.0'
# This ExecJS backend provides stateful context
# which the default nodejs backend does not
gem 'therubyracer'
gem 'therubyracer', :platforms => :mri
gem 'therubyrhino', :platforms => :jruby # Doesnt seem to run, excluded from Travis
end

appraise 'rails-5_no_sprockets_webpacker_3' do
gem 'rails', '~> 5.0.0'
gem 'webpacker', '>= 3.0'
# This ExecJS backend provides stateful context
# which the default nodejs backend does not
gem 'therubyracer'
gem 'therubyracer', :platforms => :mri
gem 'therubyrhino', :platforms => :jruby # Doesnt seem to run, excluded from Travis
end

appraise 'rails-5-no_sprockets' do
Expand Down
3 changes: 0 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ task :test_setup do
Dir.chdir('./test/dummy_sprockets') do
`yarn install`
end
Dir.chdir('./test/dummy_webpacker1') do
`yarn install`
end
Dir.chdir('./test/dummy_webpacker2') do
`yarn install`
end
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails_3.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ gem "rails", "~> 3.2.21"
gem "rack-cache", "~> 1.6.1"
gem "turbolinks", "~> 2.0"

gemspec :path => "../"
gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_4.0.5.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ source "http://rubygems.org"
gem "rails", "4.0.5"
gem "turbolinks"

gemspec :path => "../"
gemspec path: "../"
4 changes: 2 additions & 2 deletions gemfiles/rails_4.0_with_therubyracer.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source "http://rubygems.org"

gem "rails", "~> 4.0.13"
gem "therubyracer", "0.12.0", :platform => :mri
gem "therubyracer", "0.12.0", platforms: :mri
gem "turbolinks"

gemspec :path => "../"
gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_4.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ source "http://rubygems.org"
gem "rails", "~> 4.1.10"
gem "turbolinks", "~> 2.3.0"

gemspec :path => "../"
gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_4.2_sprockets_2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ gem "rails", "~> 4.2.1"
gem "sprockets", "~> 2.12"
gem "turbolinks"

gemspec :path => "../"
gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_4.2_sprockets_3.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ gem "rails", "~> 4.2.1"
gem "sprockets", "~> 3.5"
gem "turbolinks", "~> 2.5.0"

gemspec :path => "../"
gemspec path: "../"
4 changes: 2 additions & 2 deletions gemfiles/rails_4.2_sprockets_4.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ source "http://rubygems.org"
gem "rails", "~> 4.2.1"
gem "sprockets", "~> 4.0.x"
gem "turbolinks", "~> 2.5.0"
gem "mini_racer"
gem "mini_racer", platforms: :mri

gemspec :path => "../"
gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_5.1_sprockets_4.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ gem "rails", "~> 5.1"
gem "sprockets", "~> 4.0.x"
gem "turbolinks", "~> 5.0.0"

gemspec :path => "../"
gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_5_no_sprockets.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ source "http://rubygems.org"

gem "rails", "~> 5.0.0"

gemspec :path => "../"
gemspec path: "../"
9 changes: 0 additions & 9 deletions gemfiles/rails_5_no_sprockets_webpacker_1_1.gemfile

This file was deleted.

9 changes: 0 additions & 9 deletions gemfiles/rails_5_no_sprockets_webpacker_1_x.gemfile

This file was deleted.

5 changes: 3 additions & 2 deletions gemfiles/rails_5_no_sprockets_webpacker_2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "http://rubygems.org"

gem "rails", "~> 5.0.0"
gem "webpacker", "~> 2.0"
gem "therubyracer"
gem "therubyracer", platforms: :mri
gem "therubyrhino", platforms: :jruby

gemspec :path => "../"
gemspec path: "../"
5 changes: 3 additions & 2 deletions gemfiles/rails_5_no_sprockets_webpacker_3.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "http://rubygems.org"

gem "rails", "~> 5.0.0"
gem "webpacker", ">= 3.0"
gem "therubyracer"
gem "therubyracer", platforms: :mri
gem "therubyrhino", platforms: :jruby

gemspec :path => "../"
gemspec path: "../"
9 changes: 0 additions & 9 deletions gemfiles/rails_5_webpacker_1_1.gemfile

This file was deleted.

10 changes: 0 additions & 10 deletions gemfiles/rails_5_webpacker_1_x.gemfile

This file was deleted.

10 changes: 0 additions & 10 deletions gemfiles/rails_5_webpacker_2.gemfile

This file was deleted.

10 changes: 0 additions & 10 deletions gemfiles/rails_5_webpacker_3.gemfile

This file was deleted.

52 changes: 21 additions & 31 deletions lib/react/server_rendering/webpacker_manifest_container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ def self.compatible?
!!defined?(Webpacker)
end

def output_path
# Webpack1 /:output/:entry, Webpack3 /public/:output
config.respond_to?(:output_path) ? config.output_path : 'public'
end

if MAJOR < 3
def find_asset(logical_path)
# raises if not found
Expand All @@ -37,7 +42,19 @@ def find_asset(logical_path)
File.read(full_path)
end
end
else

def config
Webpacker::Configuration
end

def file_path path
manifest.lookup_path(path)
end

def manifest
Webpacker::Manifest
end
else # if MAJOR == 3
def find_asset(logical_path)
asset_path = Webpacker.manifest.lookup(logical_path).to_s
if Webpacker.dev_server.running?
Expand All @@ -49,45 +66,18 @@ def find_asset(logical_path)
File.read(file_path(logical_path))
end
end
end

if MAJOR < 3
def manifest
Webpacker::Manifest
end
else
def manifest
Webpacker.manifest
end
end

if MAJOR < 3
def config
Webpacker::Configuration
end
else
def config
Webpacker.config
end
end

if (MAJOR == 1 && MINOR >= 2) || MAJOR == 2
def file_path path
manifest.lookup_path(path)
def manifest
Webpacker.manifest
end
elsif MAJOR == 3

def file_path path
::Rails.root.join('public', manifest.lookup(path)[1..-1])
end
else # 1.0 and 1.1 support
def file_path path
File.join(output_path, manifest.lookup(path).split('/')[2..-1])
end
end

def output_path
# Webpack1 /:output/:entry, Webpack3 /public/:output
config.respond_to?(:output_path) ? config.output_path : 'public'
end
end
end
Expand Down
16 changes: 0 additions & 16 deletions test/dummy_webpacker1/.babelrc

This file was deleted.

Empty file removed test/dummy_webpacker1/.gitignore
Empty file.
4 changes: 0 additions & 4 deletions test/dummy_webpacker1/.postcssrc.yml

This file was deleted.

Loading