-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
uses webpacker's 5.4.4 default setup
- Loading branch information
1 parent
89163b9
commit 04e6976
Showing
27 changed files
with
491 additions
and
427 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/** @jsxRuntime classic */ | ||
/** @jsx StatsUI.dom */ | ||
import numeral from 'numeral' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/** @jsxRuntime classic */ | ||
/** @jsx StatsUI.dom */ | ||
import moment from 'moment-timezone' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/** @jsxRuntime classic */ | ||
/** @jsx StatsUI.dom */ | ||
|
||
import pluralize from 'pluralize' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/** @jsxRuntime classic */ | ||
/** @jsx StatsUI.dom */ | ||
import $ from 'jquery' | ||
import numeral from 'numeral' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/** @jsxRuntime classic */ | ||
/** @jsx StatsUI.dom */ | ||
|
||
import { PeriodRangeDate } from 'Stats/lib/state' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/** @jsxRuntime classic */ | ||
/** @jsx StatsUI.dom */ | ||
|
||
import { PeriodRangeDate } from 'Stats/lib/state' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/** @jsxRuntime classic */ | ||
/** @jsx StatsUI.dom */ | ||
import 'core-js/fn/array/find' | ||
import moment from 'moment' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
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 && [ | ||
'@babel/preset-env', | ||
{ | ||
forceAllTransforms: true, | ||
targets: { | ||
node: 'current' | ||
}, | ||
modules: 'commonjs' | ||
}, | ||
'@babel/preset-react' | ||
], | ||
(isProductionEnv || isDevelopmentEnv) && [ | ||
'@babel/preset-env', | ||
{ | ||
forceAllTransforms: true, | ||
useBuiltIns: 'entry', | ||
corejs: 3, | ||
modules: false, | ||
exclude: ['transform-typeof-symbol'] | ||
} | ||
], | ||
[ | ||
'@babel/preset-react', | ||
{ | ||
runtime: 'automatic', | ||
development: isDevelopmentEnv || isTestEnv, | ||
useBuiltIns: true | ||
} | ||
], | ||
['@babel/preset-typescript', { 'allExtensions': true, 'isTSX': true }] | ||
].filter(Boolean), | ||
plugins: [ | ||
'babel-plugin-macros', | ||
'@babel/plugin-syntax-dynamic-import', | ||
isTestEnv && 'babel-plugin-dynamic-import-node', | ||
'@babel/plugin-transform-destructuring', | ||
[ | ||
'@babel/plugin-proposal-class-properties', | ||
{ | ||
loose: true | ||
} | ||
], | ||
[ | ||
'@babel/plugin-proposal-object-rest-spread', | ||
{ | ||
useBuiltIns: true | ||
} | ||
], | ||
[ | ||
'@babel/plugin-proposal-private-methods', | ||
{ | ||
loose: true | ||
} | ||
], | ||
[ | ||
'@babel/plugin-proposal-private-property-in-object', | ||
{ | ||
loose: true | ||
} | ||
], | ||
[ | ||
'@babel/plugin-transform-runtime', | ||
{ | ||
helpers: false, | ||
regenerator: true, | ||
corejs: false | ||
} | ||
], | ||
[ | ||
'@babel/plugin-transform-regenerator', | ||
{ | ||
async: false | ||
} | ||
], | ||
isProductionEnv && [ | ||
'babel-plugin-transform-react-remove-prop-types', | ||
{ | ||
removeImport: true | ||
} | ||
] | ||
].filter(Boolean) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,30 @@ | ||
const environment = require('./environment') | ||
process.env.NODE_ENV = process.env.NODE_ENV || 'development' | ||
|
||
// Add Webpack custom configs here | ||
environment.loaders.append('eslint', { | ||
test: /\.tsx?$/, | ||
exclude: /(node_modules)/, | ||
enforce: 'pre', | ||
loader: 'eslint-loader', | ||
options: { | ||
eslintPath: 'eslint', | ||
configFile: '.eslintrc' | ||
} | ||
}) | ||
const environment = require('./environment') | ||
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin"); | ||
const path = require('path') | ||
|
||
// HACK: this removes transpilation errors in tests during development. tsconfig includes them so | ||
// that VS Code can work with imports. Ideally we should have a specific config for VS Code but | ||
// the plugin automatically picks `tsconfig.json` and doesn't support a custom filename. | ||
const tsLoader = environment.loaders.get('ts') | ||
tsLoader.options.reportFiles = [/!(spec\/javascripts)/] | ||
// The default installation (by webpacker) only transpiles TS code using Babel. This enables type | ||
// checking as part of the Webpack compilation process (i.e. fail the build if there are TS errors). | ||
environment.plugins.append( | ||
"ForkTsCheckerWebpackPlugin", | ||
new ForkTsCheckerWebpackPlugin({ | ||
eslint: { | ||
files: [ | ||
'./app/javascript/**/*.{ts,tsx}', | ||
'./spec/javascripts/**/*.{ts,tsx}' | ||
] | ||
}, | ||
typescript: { | ||
configFile: path.resolve(__dirname, "../../tsconfig.json"), | ||
// TODO: this options is introduces in v8.0.0, it doesn't work yet. | ||
// Ignore transpilation errors in specs during development. tsconfig includes them so | ||
// that VS Code can work with imports. Ideally we should have a specific config for VS Code | ||
// but the extension doesn't support custom config files. | ||
reportFiles: ['app/javascript/**/*.{ts,tsx}'], | ||
}, | ||
async: false, | ||
}) | ||
); | ||
|
||
module.exports = environment.toWebpackConfig() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,19 @@ | ||
const TerserPlugin = require('terser-webpack-plugin') | ||
process.env.NODE_ENV = process.env.NODE_ENV || 'production' | ||
|
||
const environment = require('./environment') | ||
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin"); | ||
const path = require('path') | ||
|
||
// Add Webpack custom configs here | ||
environment.config.merge({ | ||
optimization: { | ||
minimizer: [ | ||
new TerserPlugin({ | ||
parallel: 4 | ||
}) | ||
] | ||
}, | ||
output: { | ||
pathinfo: false | ||
}, | ||
devtool: 'cheap-module-eval-source-map' | ||
}) | ||
|
||
const tsLoader = environment.loaders.get('ts') | ||
tsLoader.options.configFile = path.resolve(__dirname, '../../tsconfig.prod.json') | ||
// The default installation (by webpacker) only transpiles TS code using Babel. This enables type | ||
// checking as part of the Webpack compilation process (i.e. fail the build if there are TS errors). | ||
environment.plugins.append( | ||
"ForkTsCheckerWebpackPlugin", | ||
new ForkTsCheckerWebpackPlugin({ | ||
typescript: { | ||
configFile: path.resolve(__dirname, "../../tsconfig.prod.json"), | ||
}, | ||
async: false, | ||
}) | ||
); | ||
|
||
module.exports = environment.toWebpackConfig() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.