@papillonarts/setup 0.9.0 → 0.11.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/package.json +3 -3
- package/storybook/index.js +26 -0
- package/storybook/mainSetup.js +268 -0
- package/storybook/managerSetup.js +16 -0
- package/storybook/previewSetup.js +54 -0
- package/webpack/constant/index.js +15 -0
- package/webpack/index.js +202 -0
- package/webpack/loader/babelLoader.js +31 -0
- package/webpack/loader/cssLoader.js +22 -0
- package/webpack/loader/fontLoader.js +14 -0
- package/webpack/loader/imageLoader.js +14 -0
- package/webpack/loader/markdownLoader.js +20 -0
- package/webpack/loader/postCSSLoader.js +22 -0
- package/webpack/loader/{sassLoader.ts → sassLoader.js} +14 -7
- package/webpack/loader/svgrLoader.js +25 -0
- package/webpack/plugin/bannerPlugin.js +16 -0
- package/webpack/plugin/cleanWebpackPlugin.js +31 -0
- package/webpack/plugin/copyWebpackPlugin.js +24 -0
- package/webpack/plugin/cssMinimizerWebpackPlugin.js +13 -0
- package/webpack/plugin/dotenvWebpack.js +35 -0
- package/webpack/plugin/hotModuleReplacementPlugin.js +13 -0
- package/webpack/plugin/htmlWebpackPlugin.js +42 -0
- package/webpack/plugin/miniCSSExtractPlugin.js +22 -0
- package/webpack/plugin/moduleConcatenationPlugin.js +13 -0
- package/webpack/plugin/webpackBundleAnalyzer.js +15 -0
- package/webpack/plugin/webpackManifestPlugin.js +21 -0
- package/webpack/server/devServer.js +21 -0
- package/webpack/setup/commonSetup.js +37 -0
- package/webpack/setup/developmentSetup.js +54 -0
- package/webpack/setup/productionSetup.js +59 -0
- package/storybook/index.ts +0 -3
- package/storybook/mainSetup.ts +0 -278
- package/storybook/managerSetup.ts +0 -9
- package/storybook/previewSetup.tsx +0 -50
- package/webpack/constant/index.ts +0 -24
- package/webpack/index.ts +0 -27
- package/webpack/loader/babelLoader.ts +0 -38
- package/webpack/loader/cssLoader.ts +0 -13
- package/webpack/loader/fontLoader.ts +0 -8
- package/webpack/loader/imageLoader.ts +0 -8
- package/webpack/loader/markdownLoader.ts +0 -17
- package/webpack/loader/postCSSLoader.ts +0 -14
- package/webpack/loader/svgrLoader.ts +0 -17
- package/webpack/plugin/bannerPlugin.ts +0 -18
- package/webpack/plugin/cleanWebpackPlugin.ts +0 -27
- package/webpack/plugin/copyWebpackPlugin.ts +0 -18
- package/webpack/plugin/cssMinimizerWebpackPlugin.ts +0 -7
- package/webpack/plugin/dotenvWebpack.ts +0 -19
- package/webpack/plugin/hotModuleReplacementPlugin.ts +0 -7
- package/webpack/plugin/htmlWebpackPlugin.ts +0 -25
- package/webpack/plugin/miniCSSExtractPlugin.ts +0 -16
- package/webpack/plugin/moduleConcatenationPlugin.ts +0 -7
- package/webpack/plugin/webpackBundleAnalyzer.ts +0 -7
- package/webpack/plugin/webpackManifestPlugin.ts +0 -15
- package/webpack/server/devServer.ts +0 -13
- package/webpack/setup/commonSetup.ts +0 -36
- package/webpack/setup/developmentSetup.ts +0 -52
- package/webpack/setup/productionSetup.ts +0 -66
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// https://github.com/webpack-contrib/webpack-bundle-analyzer
|
|
2
|
-
|
|
3
|
-
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
|
|
4
|
-
|
|
5
|
-
export function getWebpackBundleAnalyzerStandardSetup() {
|
|
6
|
-
return new BundleAnalyzerPlugin({ analyzerMode: 'static', openAnalyzer: false })
|
|
7
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// https://github.com/shellscape/webpack-manifest-plugin
|
|
2
|
-
/* eslint-disable no-param-reassign */
|
|
3
|
-
import { WebpackManifestPlugin } from 'webpack-manifest-plugin'
|
|
4
|
-
import { manifestFileName } from '../constant'
|
|
5
|
-
|
|
6
|
-
export function getWebpackManifestPluginStandardSetup() {
|
|
7
|
-
return new WebpackManifestPlugin({
|
|
8
|
-
fileName: manifestFileName,
|
|
9
|
-
basePath: '',
|
|
10
|
-
map: (file) => {
|
|
11
|
-
file.name = file.name.replace(/(\.[a-f0-9]{32})(\..*)$/, '$2')
|
|
12
|
-
return file
|
|
13
|
-
},
|
|
14
|
-
})
|
|
15
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// https://webpack.js.org/configuration/dev-server/
|
|
2
|
-
|
|
3
|
-
export function getDevServerStandardSetup() {
|
|
4
|
-
return {
|
|
5
|
-
historyApiFallback: true,
|
|
6
|
-
open: true,
|
|
7
|
-
compress: true,
|
|
8
|
-
hot: true,
|
|
9
|
-
port: 8080,
|
|
10
|
-
host: 'localhost',
|
|
11
|
-
headers: { 'Access-Control-Allow-Origin': '*' },
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { getBabelLoaderAdvancedSetup } from '../loader/babelLoader'
|
|
2
|
-
import { getFontLoaderStandardSetup } from '../loader/fontLoader'
|
|
3
|
-
import { getImageLoaderStandardSetup } from '../loader/imageLoader'
|
|
4
|
-
import { getSVGRLoaderAdvancedSetup } from '../loader/svgrLoader'
|
|
5
|
-
import { getMarkdownLoaderStandardSetup } from '../loader/markdownLoader'
|
|
6
|
-
import { getCleanWebpackPluginStandardSetup } from '../plugin/cleanWebpackPlugin'
|
|
7
|
-
import { getCopyWebpackPluginStandardSetup } from '../plugin/copyWebpackPlugin'
|
|
8
|
-
import { getHtmlWebpackPluginStandardSetup } from '../plugin/htmlWebpackPlugin'
|
|
9
|
-
import { getWebpackManifestPluginStandardSetup } from '../plugin/webpackManifestPlugin'
|
|
10
|
-
import { extensions } from '../constant'
|
|
11
|
-
|
|
12
|
-
export function getWebpackCommonSetup({ micrositeFolderPaths, packageJSON }) {
|
|
13
|
-
return {
|
|
14
|
-
entry: [`${micrositeFolderPaths.src}/index.js`],
|
|
15
|
-
plugins: [
|
|
16
|
-
getCleanWebpackPluginStandardSetup(),
|
|
17
|
-
getCopyWebpackPluginStandardSetup({ from: micrositeFolderPaths.public, to: 'assets' }),
|
|
18
|
-
getHtmlWebpackPluginStandardSetup({ title: packageJSON.description, micrositeWebpackFolderPath: micrositeFolderPaths.webpack }),
|
|
19
|
-
getWebpackManifestPluginStandardSetup(),
|
|
20
|
-
],
|
|
21
|
-
module: {
|
|
22
|
-
rules: [
|
|
23
|
-
getBabelLoaderAdvancedSetup(),
|
|
24
|
-
getFontLoaderStandardSetup(),
|
|
25
|
-
getImageLoaderStandardSetup(),
|
|
26
|
-
getMarkdownLoaderStandardSetup(),
|
|
27
|
-
getSVGRLoaderAdvancedSetup(),
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
resolve: {
|
|
32
|
-
modules: [micrositeFolderPaths.src, micrositeFolderPaths.nodeModules],
|
|
33
|
-
extensions,
|
|
34
|
-
},
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { merge } from 'webpack-merge'
|
|
2
|
-
import { getCSSLoaderStandardSetup } from '../loader/cssLoader'
|
|
3
|
-
import { getPostCSSLoaderStandardSetup } from '../loader/postCSSLoader'
|
|
4
|
-
import { getSassLoaderStandardSetup } from '../loader/sassLoader'
|
|
5
|
-
import { getDotenvWebpackStandardSetup } from '../plugin/dotenvWebpack'
|
|
6
|
-
import { getHotModuleReplacementPluginStandardSetup } from '../plugin/hotModuleReplacementPlugin'
|
|
7
|
-
import { getDevServerStandardSetup } from '../server/devServer'
|
|
8
|
-
|
|
9
|
-
export function getWebpackDevelopmentSetup({
|
|
10
|
-
webpackCommonSetup,
|
|
11
|
-
environmentVariablesFilePath,
|
|
12
|
-
micrositeUrlPath,
|
|
13
|
-
micrositeFolderPaths,
|
|
14
|
-
includedSourceFilePaths,
|
|
15
|
-
}) {
|
|
16
|
-
return merge([
|
|
17
|
-
webpackCommonSetup,
|
|
18
|
-
{
|
|
19
|
-
mode: 'development',
|
|
20
|
-
devtool: 'inline-source-map',
|
|
21
|
-
devServer: getDevServerStandardSetup(),
|
|
22
|
-
output: { path: micrositeFolderPaths.build, publicPath: micrositeUrlPath, filename: '[name].bundle.js' },
|
|
23
|
-
optimization: {
|
|
24
|
-
concatenateModules: true,
|
|
25
|
-
},
|
|
26
|
-
plugins: [getDotenvWebpackStandardSetup({ path: environmentVariablesFilePath }), getHotModuleReplacementPluginStandardSetup()],
|
|
27
|
-
module: {
|
|
28
|
-
rules: [
|
|
29
|
-
{
|
|
30
|
-
test: /\.s[ac]ss$/i,
|
|
31
|
-
include: includedSourceFilePaths,
|
|
32
|
-
use: [
|
|
33
|
-
'style-loader',
|
|
34
|
-
getCSSLoaderStandardSetup({
|
|
35
|
-
sourceMap: false,
|
|
36
|
-
modules: {
|
|
37
|
-
localIdentName: '[name]_[local]_[hash:base64:5]',
|
|
38
|
-
/* https://webpack.js.org/loaders/css-loader/#exportlocalsconvention */
|
|
39
|
-
exportLocalsConvention: 'as-is',
|
|
40
|
-
},
|
|
41
|
-
/* https://stackoverflow.com/questions/78589664/style-loader-does-not-recoginize-default-imports-of-css-modules-in-storybooks */
|
|
42
|
-
esModule: false,
|
|
43
|
-
}),
|
|
44
|
-
getPostCSSLoaderStandardSetup(),
|
|
45
|
-
getSassLoaderStandardSetup({ includePaths: includedSourceFilePaths }),
|
|
46
|
-
],
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
])
|
|
52
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { merge } from 'webpack-merge'
|
|
2
|
-
import { getCSSLoaderStandardSetup } from '../loader/cssLoader'
|
|
3
|
-
import { getBannerPluginStandardSetup } from '../plugin/bannerPlugin'
|
|
4
|
-
import { getCSSMinimizerWebpackPluginStandardSetup } from '../plugin/cssMinimizerWebpackPlugin'
|
|
5
|
-
import { getDotenvWebpackStandardSetup } from '../plugin/dotenvWebpack'
|
|
6
|
-
import { MiniCSSExtractPluginLoader, getMiniCSSExtractPluginAdvancedSetup } from '../plugin/miniCSSExtractPlugin'
|
|
7
|
-
import { getWebpackBundleAnalyzerStandardSetup } from '../plugin/webpackBundleAnalyzer'
|
|
8
|
-
|
|
9
|
-
export function getWebpackProductionSetup({
|
|
10
|
-
webpackCommonSetup,
|
|
11
|
-
environmentVariablesFilePath,
|
|
12
|
-
micrositeUrlPath,
|
|
13
|
-
micrositeFolderPaths,
|
|
14
|
-
packageJSON,
|
|
15
|
-
}) {
|
|
16
|
-
return merge([
|
|
17
|
-
webpackCommonSetup,
|
|
18
|
-
{
|
|
19
|
-
mode: 'production',
|
|
20
|
-
devtool: false,
|
|
21
|
-
output: {
|
|
22
|
-
path: micrositeFolderPaths.build,
|
|
23
|
-
publicPath: micrositeUrlPath,
|
|
24
|
-
filename: 'js/[name].[contenthash].bundle.js',
|
|
25
|
-
},
|
|
26
|
-
performance: {
|
|
27
|
-
hints: false,
|
|
28
|
-
maxEntrypointSize: 512000,
|
|
29
|
-
maxAssetSize: 512000,
|
|
30
|
-
},
|
|
31
|
-
optimization: {
|
|
32
|
-
minimize: true,
|
|
33
|
-
minimizer: [getCSSMinimizerWebpackPluginStandardSetup(), '...'],
|
|
34
|
-
runtimeChunk: { name: 'runtime' },
|
|
35
|
-
},
|
|
36
|
-
plugins: [
|
|
37
|
-
getBannerPluginStandardSetup(packageJSON),
|
|
38
|
-
getDotenvWebpackStandardSetup({ path: environmentVariablesFilePath }),
|
|
39
|
-
getMiniCSSExtractPluginAdvancedSetup(),
|
|
40
|
-
getWebpackBundleAnalyzerStandardSetup(),
|
|
41
|
-
],
|
|
42
|
-
module: {
|
|
43
|
-
rules: [
|
|
44
|
-
{
|
|
45
|
-
test: /\.(sass|scss|css)$/,
|
|
46
|
-
use: [
|
|
47
|
-
MiniCSSExtractPluginLoader,
|
|
48
|
-
getCSSLoaderStandardSetup({
|
|
49
|
-
sourceMap: false,
|
|
50
|
-
modules: {
|
|
51
|
-
localIdentName: '[name]_[local]_[hash:base64:5]',
|
|
52
|
-
/* https://webpack.js.org/loaders/css-loader/#exportlocalsconvention */
|
|
53
|
-
exportLocalsConvention: 'as-is',
|
|
54
|
-
},
|
|
55
|
-
/* https://stackoverflow.com/questions/78589664/style-loader-does-not-recoginize-default-imports-of-css-modules-in-storybooks */
|
|
56
|
-
esModule: false,
|
|
57
|
-
}),
|
|
58
|
-
'postcss-loader',
|
|
59
|
-
'sass-loader',
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
])
|
|
66
|
-
}
|