Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Upgrade webpacker

  • Loading branch information...
brtjkzl committed Dec 17, 2018
1 parent 30719d3 commit ff278c4923bd666038b2360e5326609cbf07edd5
Showing with 2,376 additions and 1,669 deletions.
  1. +0 −39 .babelrc
  2. +1 −0 .browserslistrc
  3. +0 −3 .postcssrc.yml
  4. +1 −1 Gemfile
  5. +3 −3 Gemfile.lock
  6. +85 −0 babel.config.js
  7. +5 −1 bin/webpack
  8. +5 −1 bin/webpack-dev-server
  9. +11 −10 config/initializers/content_security_policy.rb
  10. +23 −0 config/webpacker.yml
  11. +6 −7 package.json
  12. +12 −0 postcss.config.js
  13. +2,224 −1,604 yarn.lock

This file was deleted.

@@ -0,0 +1 @@
> 1%

This file was deleted.

@@ -5,7 +5,7 @@ ruby "2.5.1"
gem "rails", "~> 5.2.0"
gem "pg", ">= 0.18", "< 2.0"
gem "puma", "~> 3.11"
gem "webpacker"
gem "webpacker", "4.0.0.rc.2"
gem "bootsnap", ">= 1.1.0", require: false
gem "omniauth"
gem "omniauth-facebook"
@@ -118,7 +118,7 @@ GEM
powerpack (0.1.2)
puma (3.12.0)
rack (2.0.6)
rack-proxy (0.6.4)
rack-proxy (0.6.5)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
@@ -187,7 +187,7 @@ GEM
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
webpacker (3.5.5)
webpacker (4.0.0.rc.2)
activesupport (>= 4.2)
rack-proxy (>= 0.6.1)
railties (>= 4.2)
@@ -217,7 +217,7 @@ DEPENDENCIES
spring-watcher-listen (~> 2.0.0)
typhoeus
web-console (>= 3.3.0)
webpacker
webpacker (= 4.0.0.rc.2)

RUBY VERSION
ruby 2.5.1p57
@@ -0,0 +1,85 @@
module.exports = function(api) {
var validEnv = ["development", "test", "production"];
var currentEnv = api.env();
var isDevelopmentEnv = api.env("development");
var isProductionEnv = api.env("production");
var isTestEnv = api.env("test");

if (!validEnv.includes(currentEnv)) {
throw new Error(
"Please specify a valid `NODE_ENV` or " +
'`BABEL_ENV` environment variables. Valid values are "development", ' +
'"test", and "production". Instead, received: ' +
JSON.stringify(currentEnv) +
"."
);
}

return {
presets: [
isTestEnv && [
require("@babel/preset-env").default,
{
targets: {
node: "current"
}
}
],
(isProductionEnv || isDevelopmentEnv) && [
require("@babel/preset-env").default,
{
forceAllTransforms: true,
useBuiltIns: "entry",
modules: false,
exclude: ["transform-typeof-symbol"]
}
],
[
require("@babel/preset-react").default,
{
development: isDevelopmentEnv || isTestEnv,
useBuiltIns: true
}
],
require("@babel/preset-flow").default
].filter(Boolean),
plugins: [
require("babel-plugin-macros"),
require("@babel/plugin-syntax-dynamic-import").default,
isTestEnv && require("babel-plugin-dynamic-import-node"),
require("@babel/plugin-transform-destructuring").default,
require("babel-plugin-lodash").default,
[
require("@babel/plugin-proposal-class-properties").default,
{
loose: true
}
],
[
require("@babel/plugin-proposal-object-rest-spread").default,
{
useBuiltIns: true
}
],
[
require("@babel/plugin-transform-runtime").default,
{
helpers: false,
regenerator: true
}
],
[
require("@babel/plugin-transform-regenerator").default,
{
async: false
}
],
isProductionEnv && [
require("babel-plugin-react-remove-properties").default,
{
properties: ["data-cy"]
}
]
].filter(Boolean)
};
};
@@ -12,4 +12,8 @@ require "bundler/setup"

require "webpacker"
require "webpacker/webpack_runner"
Webpacker::WebpackRunner.run(ARGV)

APP_ROOT = File.expand_path("..", __dir__)
Dir.chdir(APP_ROOT) do
Webpacker::WebpackRunner.run(ARGV)
end
@@ -12,4 +12,8 @@ require "bundler/setup"

require "webpacker"
require "webpacker/dev_server_runner"
Webpacker::DevServerRunner.run(ARGV)

APP_ROOT = File.expand_path("..", __dir__)
Dir.chdir(APP_ROOT) do
Webpacker::DevServerRunner.run(ARGV)
end
@@ -4,17 +4,18 @@
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy

# Rails.application.config.content_security_policy do |policy|
# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https
Rails.application.config.content_security_policy do |policy|
# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https
policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?

# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# end
# Specify URI for violation reports
# policy.report_uri "/csp-violation-report-endpoint"
end

# If you are using UJS then enable automatic nonce generation
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
@@ -5,6 +5,8 @@ default: &default
source_entry_path: packs
public_output_path: packs
cache_path: tmp/cache/webpacker
check_yarn_integrity: false
webpack_compile_output: false

# Additional paths webpack should lookup modules
# ['app/assets', 'engine/foo/app/assets']
@@ -13,7 +15,24 @@ default: &default
# Reload manifest.json on all requests so we reload latest compiled packs
cache_manifest: false

# Extract and emit a css file
extract_css: false

static_assets_extensions:
- .jpg
- .jpeg
- .png
- .gif
- .tiff
- .ico
- .eot
- .otf
- .ttf
- .woff
- .woff2

extensions:
- .mjs
- .jsx
- .js
- .sass
@@ -31,6 +50,7 @@ default: &default
development:
<<: *default
compile: true
check_yarn_integrity: true

# Reference: https://webpack.js.org/configuration/dev-server/
dev_server:
@@ -71,5 +91,8 @@ production:
# Production depends on precompilation of packs prior to booting for performance.
compile: false

# Extract and emit a css file
extract_css: true

# Cache manifest.json for performance
cache_manifest: true
@@ -17,20 +17,19 @@
"cypress:server": "bundle exec rails server -p 4000 -e cypress"
},
"dependencies": {
"@rails/webpacker": "3.5",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@rails/webpacker": "https://github.com/rails/webpacker",
"axios": "^0.18.0",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-react-remove-properties": "^0.2.5",
"babel-plugin-transform-react-remove-prop-types": "^0.4.14",
"babel-preset-flow": "^6.23.0",
"babel-preset-react": "^6.24.1",
"classnames": "^2.2.6",
"gravatar": "^1.6.0",
"js-cookie": "^2.2.0",
"lodash": "^4.17.10",
"modern-normalize": "^0.5.0",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-redux": "^5.0.7",
"react-router-dom": "^4.3.1",
"react-svg-loader": "^2.1.0",
@@ -51,6 +50,6 @@
"jest": "^23.4.2",
"source-map-explorer": "^1.5.0",
"start-server-and-test": "^1.7.4",
"webpack-dev-server": "2.11.2"
"webpack-dev-server": "^3.1.10"
}
}
@@ -0,0 +1,12 @@
module.exports = {
plugins: [
require('postcss-import'),
require('postcss-flexbugs-fixes'),
require('postcss-preset-env')({
autoprefixer: {
flexbox: 'no-2009'
},
stage: 3
})
]
}

0 comments on commit ff278c4

Please sign in to comment.
You can’t perform that action at this time.