create-application-template 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +21 -0
- package/.eslintrc.js +304 -0
- package/.husky/pre-commit +3 -0
- package/.stylelintrc.js +13 -0
- package/LICENSE +21 -0
- package/README.md +88 -0
- package/bin/create-application-template.js +75 -0
- package/jest/cssTransform.js +13 -0
- package/jest/setup.js +5 -0
- package/jest/setupTests.js +15 -0
- package/jest/svgTransform.js +12 -0
- package/jest.config.js +50 -0
- package/package.json +101 -0
- package/src/app.d.ts +6 -0
- package/src/assets/cat.svg +14 -0
- package/src/assets/favicon.ico +0 -0
- package/src/components/App.spec.tsx +8 -0
- package/src/components/App.tsx +24 -0
- package/src/components/Counter.spec.tsx +15 -0
- package/src/components/Counter.tsx +21 -0
- package/src/fonts/Exo2-Regular.ttf +0 -0
- package/src/index.html +17 -0
- package/src/index.tsx +13 -0
- package/src/public/robots.txt +3 -0
- package/src/styles/app.css +53 -0
- package/src/styles/counter.css +14 -0
- package/src/styles/index.css +16 -0
- package/tsconfig.json +30 -0
- package/webpack/utilities/createEnvironmentHash.js +8 -0
- package/webpack/utilities/env.js +8 -0
- package/webpack/utilities/generateAssetManifest.js +16 -0
- package/webpack/utilities/getPaths.js +57 -0
- package/webpack/utilities/getTerserOptions.js +47 -0
- package/webpack/webpack.common.js +161 -0
- package/webpack/webpack.config.js +14 -0
- package/webpack/webpack.dev.js +40 -0
- package/webpack/webpack.prod.js +34 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { merge } = require('webpack-merge')
|
|
2
|
+
const commonConfig = require('./webpack.common.js')
|
|
3
|
+
|
|
4
|
+
require('dotenv-flow').config()
|
|
5
|
+
|
|
6
|
+
module.exports = (webpackEnv) => {
|
|
7
|
+
const { BUNDLER_ENV } = webpackEnv
|
|
8
|
+
|
|
9
|
+
const envConfig = require(`./webpack.${BUNDLER_ENV}.js`)
|
|
10
|
+
|
|
11
|
+
const config = merge(commonConfig(webpackEnv), envConfig(webpackEnv))
|
|
12
|
+
|
|
13
|
+
return config
|
|
14
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const webpack = require('webpack')
|
|
2
|
+
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin')
|
|
3
|
+
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin')
|
|
4
|
+
const packageJson = require('../package.json')
|
|
5
|
+
|
|
6
|
+
module.exports = () => {
|
|
7
|
+
const { PORT } = process.env
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
mode: 'development', // NODE_ENV
|
|
11
|
+
devtool: 'cheap-module-source-map',
|
|
12
|
+
devServer: {
|
|
13
|
+
// static: {
|
|
14
|
+
// directory: paths.build,
|
|
15
|
+
// },
|
|
16
|
+
hot: true,
|
|
17
|
+
open: true,
|
|
18
|
+
port: PORT || 3333,
|
|
19
|
+
proxy: [
|
|
20
|
+
{
|
|
21
|
+
context: ['/'],
|
|
22
|
+
target: packageJson.proxy,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
historyApiFallback: true,
|
|
26
|
+
},
|
|
27
|
+
plugins: [
|
|
28
|
+
new webpack.DefinePlugin({
|
|
29
|
+
'process.env.EXAMPLE': JSON.stringify('devconfig'),
|
|
30
|
+
}),
|
|
31
|
+
// NOTE per the docs added "react-refresh/babel" (r-r/b) to
|
|
32
|
+
// .babelrc and babel-loader, but seems to work without r-r/b...
|
|
33
|
+
// docs also used to say use webpack.HotModuleRepalcementPlugin,
|
|
34
|
+
// which also seemed to be unneeded, and now they don't...
|
|
35
|
+
// so be on the lookout for doc changes related to r-r/b too
|
|
36
|
+
new ReactRefreshWebpackPlugin(),
|
|
37
|
+
new CaseSensitivePathsPlugin(),
|
|
38
|
+
],
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const webpack = require('webpack')
|
|
2
|
+
const TerserPlugin = require('terser-webpack-plugin')
|
|
3
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
|
4
|
+
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
|
|
5
|
+
const getPaths = require('./utilities/getPaths')
|
|
6
|
+
const getTerserOptions = require('./utilities/getTerserOptions')
|
|
7
|
+
|
|
8
|
+
module.exports = (webpackEnv) => {
|
|
9
|
+
const { BUNDLER_ENV, BUNDLER_WITH_PROFILING } = webpackEnv
|
|
10
|
+
|
|
11
|
+
const paths = getPaths({ BUNDLER_ENV })
|
|
12
|
+
const terserOptions = getTerserOptions({ BUNDLER_WITH_PROFILING })
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
mode: 'production', // NODE_ENV
|
|
16
|
+
devtool: 'source-map',
|
|
17
|
+
optimization: {
|
|
18
|
+
minimize: true,
|
|
19
|
+
minimizer: [
|
|
20
|
+
new TerserPlugin({ terserOptions }),
|
|
21
|
+
new CssMinimizerPlugin(),
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
plugins: [
|
|
25
|
+
new webpack.DefinePlugin({
|
|
26
|
+
'process.env.EXAMPLE': JSON.stringify('prodconfig'),
|
|
27
|
+
}),
|
|
28
|
+
new MiniCssExtractPlugin({
|
|
29
|
+
filename: paths.static.css.filenameCss,
|
|
30
|
+
chunkFilename: paths.static.css.chunkFilenameCss,
|
|
31
|
+
}),
|
|
32
|
+
],
|
|
33
|
+
}
|
|
34
|
+
}
|