mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Update Webpacker in Action Text's test dummy app
This commit is contained in:
parent
82e3891f14
commit
4222acf152
13 changed files with 446 additions and 567 deletions
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"presets": [
|
|
||||||
["env", {
|
|
||||||
"modules": false,
|
|
||||||
"targets": {
|
|
||||||
"browsers": "> 1%",
|
|
||||||
"uglify": true
|
|
||||||
},
|
|
||||||
"useBuiltIns": true
|
|
||||||
}]
|
|
||||||
],
|
|
||||||
|
|
||||||
"plugins": [
|
|
||||||
"syntax-dynamic-import",
|
|
||||||
"transform-object-rest-spread",
|
|
||||||
["transform-class-properties", { "spec": true }]
|
|
||||||
]
|
|
||||||
}
|
|
1
actiontext/test/dummy/.browserslistrc
Normal file
1
actiontext/test/dummy/.browserslistrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
defaults
|
70
actiontext/test/dummy/babel.config.js
Normal file
70
actiontext/test/dummy/babel.config.js
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
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']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
].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-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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
].filter(Boolean)
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,3 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __dir__)
|
||||||
load Gem.bin_path('bundler', 'bundle')
|
load Gem.bin_path('bundler', 'bundle')
|
||||||
|
|
19
actiontext/test/dummy/bin/webpack
Executable file
19
actiontext/test/dummy/bin/webpack
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
|
||||||
|
ENV["NODE_ENV"] ||= "development"
|
||||||
|
|
||||||
|
require "pathname"
|
||||||
|
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
||||||
|
Pathname.new(__FILE__).realpath)
|
||||||
|
|
||||||
|
require "rubygems"
|
||||||
|
require "bundler/setup"
|
||||||
|
|
||||||
|
require "webpacker"
|
||||||
|
require "webpacker/webpack_runner"
|
||||||
|
|
||||||
|
APP_ROOT = File.expand_path("..", __dir__)
|
||||||
|
Dir.chdir(APP_ROOT) do
|
||||||
|
Webpacker::WebpackRunner.run(ARGV)
|
||||||
|
end
|
19
actiontext/test/dummy/bin/webpack-dev-server
Executable file
19
actiontext/test/dummy/bin/webpack-dev-server
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
|
||||||
|
ENV["NODE_ENV"] ||= "development"
|
||||||
|
|
||||||
|
require "pathname"
|
||||||
|
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
||||||
|
Pathname.new(__FILE__).realpath)
|
||||||
|
|
||||||
|
require "rubygems"
|
||||||
|
require "bundler/setup"
|
||||||
|
|
||||||
|
require "webpacker"
|
||||||
|
require "webpacker/dev_server_runner"
|
||||||
|
|
||||||
|
APP_ROOT = File.expand_path("..", __dir__)
|
||||||
|
Dir.chdir(APP_ROOT) do
|
||||||
|
Webpacker::DevServerRunner.run(ARGV)
|
||||||
|
end
|
|
@ -1,3 +1,5 @@
|
||||||
|
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
|
||||||
|
|
||||||
const environment = require('./environment')
|
const environment = require('./environment')
|
||||||
|
|
||||||
module.exports = environment.toWebpackConfig()
|
module.exports = environment.toWebpackConfig()
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
|
||||||
|
|
||||||
const environment = require('./environment')
|
const environment = require('./environment')
|
||||||
|
|
||||||
module.exports = environment.toWebpackConfig()
|
module.exports = environment.toWebpackConfig()
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
|
||||||
|
|
||||||
const environment = require('./environment')
|
const environment = require('./environment')
|
||||||
|
|
||||||
module.exports = environment.toWebpackConfig()
|
module.exports = environment.toWebpackConfig()
|
||||||
|
|
|
@ -3,8 +3,11 @@
|
||||||
default: &default
|
default: &default
|
||||||
source_path: app/javascript
|
source_path: app/javascript
|
||||||
source_entry_path: packs
|
source_entry_path: packs
|
||||||
|
public_root_path: public
|
||||||
public_output_path: packs
|
public_output_path: packs
|
||||||
cache_path: tmp/cache/webpacker
|
cache_path: tmp/cache/webpacker
|
||||||
|
check_yarn_integrity: false
|
||||||
|
webpack_compile_output: false
|
||||||
|
|
||||||
# Additional paths webpack should lookup modules
|
# Additional paths webpack should lookup modules
|
||||||
# ['app/assets', 'engine/foo/app/assets']
|
# ['app/assets', 'engine/foo/app/assets']
|
||||||
|
@ -13,11 +16,32 @@ default: &default
|
||||||
# Reload manifest.json on all requests so we reload latest compiled packs
|
# Reload manifest.json on all requests so we reload latest compiled packs
|
||||||
cache_manifest: false
|
cache_manifest: false
|
||||||
|
|
||||||
|
# Extract and emit a css file
|
||||||
|
extract_css: false
|
||||||
|
|
||||||
|
static_assets_extensions:
|
||||||
|
- .jpg
|
||||||
|
- .jpeg
|
||||||
|
- .png
|
||||||
|
- .gif
|
||||||
|
- .tiff
|
||||||
|
- .ico
|
||||||
|
- .svg
|
||||||
|
- .eot
|
||||||
|
- .otf
|
||||||
|
- .ttf
|
||||||
|
- .woff
|
||||||
|
- .woff2
|
||||||
|
|
||||||
extensions:
|
extensions:
|
||||||
|
- .mjs
|
||||||
- .js
|
- .js
|
||||||
- .sass
|
- .sass
|
||||||
- .scss
|
- .scss
|
||||||
- .css
|
- .css
|
||||||
|
- .module.sass
|
||||||
|
- .module.scss
|
||||||
|
- .module.css
|
||||||
- .png
|
- .png
|
||||||
- .svg
|
- .svg
|
||||||
- .gif
|
- .gif
|
||||||
|
@ -28,6 +52,9 @@ development:
|
||||||
<<: *default
|
<<: *default
|
||||||
compile: true
|
compile: true
|
||||||
|
|
||||||
|
# Verifies that versions and hashed value of the package contents in the project's package.json
|
||||||
|
check_yarn_integrity: true
|
||||||
|
|
||||||
# Reference: https://webpack.js.org/configuration/dev-server/
|
# Reference: https://webpack.js.org/configuration/dev-server/
|
||||||
dev_server:
|
dev_server:
|
||||||
https: false
|
https: false
|
||||||
|
@ -45,7 +72,7 @@ development:
|
||||||
headers:
|
headers:
|
||||||
'Access-Control-Allow-Origin': '*'
|
'Access-Control-Allow-Origin': '*'
|
||||||
watch_options:
|
watch_options:
|
||||||
ignored: /node_modules/
|
ignored: '**/node_modules/**'
|
||||||
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
|
@ -61,5 +88,8 @@ production:
|
||||||
# Production depends on precompilation of packs prior to booting for performance.
|
# Production depends on precompilation of packs prior to booting for performance.
|
||||||
compile: false
|
compile: false
|
||||||
|
|
||||||
|
# Extract and emit a css file
|
||||||
|
extract_css: true
|
||||||
|
|
||||||
# Cache manifest.json for performance
|
# Cache manifest.json for performance
|
||||||
cache_manifest: true
|
cache_manifest: true
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
"actiontext": "file:../.."
|
"actiontext": "file:../.."
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"webpack-dev-server": "^3.2.1"
|
"webpack-dev-server": "^3.3.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
12
actiontext/test/dummy/postcss.config.js
Normal file
12
actiontext/test/dummy/postcss.config.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
module.exports = {
|
||||||
|
plugins: [
|
||||||
|
require('postcss-import'),
|
||||||
|
require('postcss-flexbugs-fixes'),
|
||||||
|
require('postcss-preset-env')({
|
||||||
|
autoprefixer: {
|
||||||
|
flexbox: 'no-2009'
|
||||||
|
},
|
||||||
|
stage: 3
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue