@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
package/storybook/mainSetup.ts
DELETED
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
/* https://storybook.js.org/docs/configure/integration/typescript */
|
|
2
|
-
/* eslint-disable no-unused-vars */
|
|
3
|
-
/* eslint-disable no-param-reassign */
|
|
4
|
-
/* eslint-disable global-require */
|
|
5
|
-
import webpack from 'webpack'
|
|
6
|
-
import type { StorybookConfig } from '@storybook/react-webpack5'
|
|
7
|
-
import { isEmptyObject } from '@papillonarts/library/object'
|
|
8
|
-
// import { getBabelLoaderAdvancedSetup } from '@papillonarts/setup/webpack'
|
|
9
|
-
import { getBabelLoaderAdvancedSetup } from '../webpack'
|
|
10
|
-
|
|
11
|
-
export function getStorybookMainSetup({ storiesBasePath, includeBasePath, modulesBasePath, rootAttributesDefaults }): StorybookConfig {
|
|
12
|
-
// https://storybook.js.org/docs/react/api/main-config
|
|
13
|
-
return {
|
|
14
|
-
// https://storybook.js.org/docs/api/main-config/main-config-preview-body
|
|
15
|
-
previewBody: (body) => {
|
|
16
|
-
if (rootAttributesDefaults) {
|
|
17
|
-
// https://github.com/storybookjs/storybook/issues/24429
|
|
18
|
-
return `
|
|
19
|
-
${body}
|
|
20
|
-
<script type="text/javascript">
|
|
21
|
-
(() => {
|
|
22
|
-
document.addEventListener('DOMContentLoaded', function() {
|
|
23
|
-
const storybookRootElement = document.getElementById("storybook-root")
|
|
24
|
-
|
|
25
|
-
// https://primer.style/foundations/primitives/getting-started
|
|
26
|
-
storybookRootElement.setAttribute("data-color-mode", "light")
|
|
27
|
-
storybookRootElement.setAttribute("data-light-theme", "light")
|
|
28
|
-
storybookRootElement.setAttribute("data-dark-theme", "dark")
|
|
29
|
-
});
|
|
30
|
-
})()
|
|
31
|
-
</script>
|
|
32
|
-
`
|
|
33
|
-
}
|
|
34
|
-
return `${body}`
|
|
35
|
-
},
|
|
36
|
-
// https://storybook.js.org/docs/react/configure/frameworks
|
|
37
|
-
framework: {
|
|
38
|
-
name: '@storybook/react-webpack5',
|
|
39
|
-
options: {
|
|
40
|
-
fastRefresh: false,
|
|
41
|
-
strictMode: false,
|
|
42
|
-
legacyRootApi: false,
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
// https://storybook.js.org/docs/react/api/main-config-stories
|
|
47
|
-
stories: [storiesBasePath],
|
|
48
|
-
|
|
49
|
-
// https://storybook.js.org/docs/react/api/main-config-addons
|
|
50
|
-
// https://storybook.js.org/docs/react/addons/introduction
|
|
51
|
-
// https://storybook.js.org/integrations
|
|
52
|
-
addons: [
|
|
53
|
-
// https://storybook.js.org/addons/@storybook/addon-a11y
|
|
54
|
-
'@storybook/addon-a11y',
|
|
55
|
-
|
|
56
|
-
// included by default in @storybook/addon-essentials
|
|
57
|
-
// https://storybook.js.org/docs/react/essentials/actions
|
|
58
|
-
// https://storybook.js.org/addons/@storybook/addon-actions
|
|
59
|
-
// '@storybook/addon-actions',
|
|
60
|
-
|
|
61
|
-
// included by default in @storybook/addon-essentials
|
|
62
|
-
// https://storybook.js.org/docs/react/essentials/backgrounds
|
|
63
|
-
// https://storybook.js.org/addons/@storybook/addon-backgrounds
|
|
64
|
-
// '@storybook/addon-backgrounds',
|
|
65
|
-
|
|
66
|
-
// https://storybook.js.org/addons/chromatic
|
|
67
|
-
// chromatic
|
|
68
|
-
|
|
69
|
-
// included by default in @storybook/addon-essentials
|
|
70
|
-
// https://storybook.js.org/docs/react/essentials/controls
|
|
71
|
-
// https://storybook.js.org/addons/@storybook/addon-controls
|
|
72
|
-
// '@storybook/addon-controls',
|
|
73
|
-
|
|
74
|
-
// https://storybook.js.org/addons/storybook-addon-designs
|
|
75
|
-
// storybook-addon-designs
|
|
76
|
-
|
|
77
|
-
// included by default in @storybook/addon-essentials
|
|
78
|
-
// https://storybook.js.org/docs/react/essentials/docs (404)
|
|
79
|
-
// https://storybook.js.org/addons/@storybook/addon-docs
|
|
80
|
-
// {
|
|
81
|
-
// name: '@storybook/addon-docs',
|
|
82
|
-
// options: {
|
|
83
|
-
// jsxOptions: {},
|
|
84
|
-
// csfPluginOptions: null,
|
|
85
|
-
// mdxPluginOptions: {},
|
|
86
|
-
// transcludeMarkdown: true,
|
|
87
|
-
// },
|
|
88
|
-
// },
|
|
89
|
-
|
|
90
|
-
// https://storybook.js.org/docs/react/essentials/introduction
|
|
91
|
-
// https://storybook.js.org/integrations/tag/essentials
|
|
92
|
-
// '@storybook/addon-essentials',
|
|
93
|
-
|
|
94
|
-
// included by default in @storybook/addon-essentials
|
|
95
|
-
// https://storybook.js.org/docs/react/essentials/highlight (404)
|
|
96
|
-
// https://storybook.js.org/addons/@storybook/addon-highlight
|
|
97
|
-
// '@storybook/addon-highlight',
|
|
98
|
-
|
|
99
|
-
// https://storybook.js.org/addons/@storybook/addon-interactions
|
|
100
|
-
// '@storybook/addon-interactions',
|
|
101
|
-
|
|
102
|
-
// https://storybook.js.org/addons/@storybook/addon-jest
|
|
103
|
-
'@storybook/addon-jest',
|
|
104
|
-
|
|
105
|
-
// https://storybook.js.org/addons/@storybook/addon-links
|
|
106
|
-
'@storybook/addon-links',
|
|
107
|
-
|
|
108
|
-
// https://storybook.js.org/addons/msw-storybook-addon
|
|
109
|
-
// msw-storybook-addon
|
|
110
|
-
|
|
111
|
-
// included by default in @storybook/addon-essentials
|
|
112
|
-
// https://storybook.js.org/docs/react/essentials/measure-and-outline
|
|
113
|
-
// https://storybook.js.org/addons/@storybook/addon-measure
|
|
114
|
-
// https://storybook.js.org/addons/@storybook/addon-outline
|
|
115
|
-
// '@storybook/addon-measure',
|
|
116
|
-
// '@storybook/addon-outline',
|
|
117
|
-
|
|
118
|
-
// included by default in @storybook/addon-essentials
|
|
119
|
-
// https://storybook.js.org/docs/react/essentials/toolbars-and-globals
|
|
120
|
-
// https://storybook.js.org/addons/@storybook/addon-toolbars
|
|
121
|
-
// '@storybook/addon-toolbars',
|
|
122
|
-
|
|
123
|
-
// included by default in @storybook/addon-essentials
|
|
124
|
-
// https://storybook.js.org/docs/react/essentials/viewport
|
|
125
|
-
// https://storybook.js.org/addons/@storybook/addon-viewport
|
|
126
|
-
// '@storybook/addon-viewport',
|
|
127
|
-
|
|
128
|
-
'@chromatic-com/storybook',
|
|
129
|
-
|
|
130
|
-
// https://storybook.js.org/addons/@storybook/addon-styling-webpack
|
|
131
|
-
'@storybook/addon-styling-webpack',
|
|
132
|
-
|
|
133
|
-
// https://storybook.js.org/addons/@storybook/addon-themes
|
|
134
|
-
'@storybook/addon-themes',
|
|
135
|
-
|
|
136
|
-
'@storybook/addon-webpack5-compiler-babel',
|
|
137
|
-
],
|
|
138
|
-
|
|
139
|
-
// https://storybook.js.org/docs/react/api/main-config-babel
|
|
140
|
-
// ...
|
|
141
|
-
|
|
142
|
-
// https://storybook.js.org/docs/react/api/main-config-babel-default
|
|
143
|
-
// ...
|
|
144
|
-
|
|
145
|
-
// https://storybook.js.org/docs/react/api/main-config-core
|
|
146
|
-
// https://storybook.js.org/docs/api/main-config/main-config-core#builder
|
|
147
|
-
core: { builder: { name: '@storybook/builder-webpack5', options: null } },
|
|
148
|
-
|
|
149
|
-
// https://storybook.js.org/docs/react/api/main-config-docs
|
|
150
|
-
// https://storybook.js.org/docs/react/writing-docs/autodocs
|
|
151
|
-
// https://storybook.js.org/docs/react/writing-docs/mdx
|
|
152
|
-
// https://storybook.js.org/docs/writing-docs/autodocs
|
|
153
|
-
docs: { defaultName: 'Documentation', docsMode: false },
|
|
154
|
-
|
|
155
|
-
// https://storybook.js.org/docs/react/api/main-config-env
|
|
156
|
-
// ...
|
|
157
|
-
|
|
158
|
-
// https://storybook.js.org/docs/react/api/main-config-features
|
|
159
|
-
// ...
|
|
160
|
-
|
|
161
|
-
// https://storybook.js.org/docs/react/api/main-config-log-level
|
|
162
|
-
logLevel: 'debug',
|
|
163
|
-
|
|
164
|
-
// https://storybook.js.org/docs/react/api/main-config-manager-head
|
|
165
|
-
// ...
|
|
166
|
-
|
|
167
|
-
// https://storybook.js.org/docs/react/api/main-config-preview-annotations
|
|
168
|
-
// ...
|
|
169
|
-
|
|
170
|
-
// https://storybook.js.org/docs/react/api/main-config-preview-body
|
|
171
|
-
// ...
|
|
172
|
-
|
|
173
|
-
// https://storybook.js.org/docs/react/api/main-config-preview-head
|
|
174
|
-
// ...
|
|
175
|
-
|
|
176
|
-
// https://storybook.js.org/docs/react/api/main-config-refs
|
|
177
|
-
// ...
|
|
178
|
-
|
|
179
|
-
// https://storybook.js.org/docs/react/api/main-config-static-dirs
|
|
180
|
-
// ...
|
|
181
|
-
|
|
182
|
-
// https://storybook.js.org/docs/react/api/main-config-typescript
|
|
183
|
-
// ...
|
|
184
|
-
|
|
185
|
-
// https://storybook.js.org/docs/react/api/main-config-webpack-final
|
|
186
|
-
webpackFinal: async (config, { configType }) => {
|
|
187
|
-
// @ts-ignore
|
|
188
|
-
const fileLoaderRuleSVG = config.module.rules.find((rule) => !isEmptyObject(rule) && rule.test.test?.('.svg'))
|
|
189
|
-
// @ts-ignore
|
|
190
|
-
fileLoaderRuleSVG.exclude = /\.svg$/
|
|
191
|
-
|
|
192
|
-
config.module.rules = config.module.rules.concat([
|
|
193
|
-
{
|
|
194
|
-
test: /\.(css|scss)$/,
|
|
195
|
-
use: [
|
|
196
|
-
{
|
|
197
|
-
loader: 'style-loader',
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
loader: 'css-loader',
|
|
201
|
-
options: {
|
|
202
|
-
importLoaders: 2,
|
|
203
|
-
sourceMap: true,
|
|
204
|
-
modules: {
|
|
205
|
-
localIdentName: '[name]__[local]___[hash:base64:5]',
|
|
206
|
-
/* https://webpack.js.org/loaders/css-loader/#exportlocalsconvention */
|
|
207
|
-
exportLocalsConvention: 'as-is',
|
|
208
|
-
},
|
|
209
|
-
/* https://stackoverflow.com/questions/78589664/style-loader-does-not-recoginize-default-imports-of-css-modules-in-storybooks */
|
|
210
|
-
esModule: false,
|
|
211
|
-
},
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
loader: 'postcss-loader',
|
|
215
|
-
options: {
|
|
216
|
-
postcssOptions: {
|
|
217
|
-
sourceMap: true,
|
|
218
|
-
plugins: () => [require('postcss-preset-env')()],
|
|
219
|
-
parser: 'postcss-scss',
|
|
220
|
-
},
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
loader: 'sass-loader',
|
|
225
|
-
options: {
|
|
226
|
-
sassOptions: {
|
|
227
|
-
includePaths: [modulesBasePath],
|
|
228
|
-
// https://sass-lang.com/documentation/js-api/interfaces/options/#quietDeps
|
|
229
|
-
// https://sass-lang.com/documentation/js-api/interfaces/options/#silenceDeprecations
|
|
230
|
-
// https://sass-lang.com/documentation/js-api/interfaces/deprecations/
|
|
231
|
-
quietDeps: true,
|
|
232
|
-
silenceDeprecations: ['import', 'global-builtin'],
|
|
233
|
-
},
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
],
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
test: /\.svg$/i,
|
|
240
|
-
issuer: /\.[jt]sx?$/,
|
|
241
|
-
use: ['@svgr/webpack'],
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
test: /\.int.story\.mdx$/,
|
|
245
|
-
use: [
|
|
246
|
-
{
|
|
247
|
-
loader: 'babel-loader',
|
|
248
|
-
options: {
|
|
249
|
-
plugins: ['@babel/plugin-transform-react-jsx'],
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
loader: '@mdx-js/loader',
|
|
254
|
-
options: {},
|
|
255
|
-
},
|
|
256
|
-
],
|
|
257
|
-
},
|
|
258
|
-
getBabelLoaderAdvancedSetup(),
|
|
259
|
-
])
|
|
260
|
-
config.plugins.push(
|
|
261
|
-
new webpack.ProvidePlugin({
|
|
262
|
-
process: 'process/browser',
|
|
263
|
-
}),
|
|
264
|
-
)
|
|
265
|
-
|
|
266
|
-
config.resolve.fallback = {
|
|
267
|
-
...config.resolve.fallback,
|
|
268
|
-
tty: require.resolve('tty-browserify'),
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
return config
|
|
272
|
-
},
|
|
273
|
-
typescript: {
|
|
274
|
-
reactDocgen: 'react-docgen-typescript',
|
|
275
|
-
check: true,
|
|
276
|
-
},
|
|
277
|
-
}
|
|
278
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { MemoryRouter } from 'react-router-dom'
|
|
2
|
-
import { DocsPage, DocsContainer } from '@storybook/addon-docs/blocks'
|
|
3
|
-
|
|
4
|
-
export function getStorybookPreviewSetup({ parameters: { a11y, decorators, docs } }) {
|
|
5
|
-
let parameters = {}
|
|
6
|
-
|
|
7
|
-
if (a11y) {
|
|
8
|
-
parameters = {
|
|
9
|
-
...parameters,
|
|
10
|
-
a11y: {
|
|
11
|
-
...{
|
|
12
|
-
// optional selector which element to inspect
|
|
13
|
-
// element: '#root',
|
|
14
|
-
// axe-core configurationOptions (https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#parameters-1)
|
|
15
|
-
config: {},
|
|
16
|
-
// axe-core optionsParameter (https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#options-parameter)
|
|
17
|
-
options: {},
|
|
18
|
-
// optional flag to prevent the automatic check
|
|
19
|
-
// manual: true,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (decorators) {
|
|
26
|
-
parameters = {
|
|
27
|
-
...parameters,
|
|
28
|
-
decorators: [
|
|
29
|
-
...[
|
|
30
|
-
(Story) => (
|
|
31
|
-
<MemoryRouter>
|
|
32
|
-
<Story />
|
|
33
|
-
</MemoryRouter>
|
|
34
|
-
),
|
|
35
|
-
],
|
|
36
|
-
],
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (docs) {
|
|
41
|
-
parameters = {
|
|
42
|
-
...parameters,
|
|
43
|
-
docs: {
|
|
44
|
-
...{ container: DocsContainer, page: DocsPage },
|
|
45
|
-
},
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return { parameters }
|
|
50
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export const coreJSVersion = '3.46.0'
|
|
2
|
-
|
|
3
|
-
export const targetBrowsers = {
|
|
4
|
-
production: ['> 1%', 'last 2 versions', 'Firefox ESR'],
|
|
5
|
-
legacyBrowsers: ['> 1%', 'last 2 versions', 'Firefox ESR'],
|
|
6
|
-
modernBrowsers: [
|
|
7
|
-
'last 2 Chrome versions',
|
|
8
|
-
'not Chrome < 60',
|
|
9
|
-
'last 2 Safari versions',
|
|
10
|
-
'not Safari < 10.1',
|
|
11
|
-
'last 2 iOS versions',
|
|
12
|
-
'not iOS < 10.3',
|
|
13
|
-
'last 2 Firefox versions',
|
|
14
|
-
'not Firefox < 54',
|
|
15
|
-
'last 2 Edge versions',
|
|
16
|
-
'not Edge < 15',
|
|
17
|
-
],
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const manifestFileName = 'manifest.json'
|
|
21
|
-
|
|
22
|
-
export const indexHTMLName = 'index.html'
|
|
23
|
-
|
|
24
|
-
export const extensions = ['.js', '.jsx', '.json', '.scss']
|
package/webpack/index.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export { getBabelLoaderAdvancedSetup } from './loader/babelLoader'
|
|
2
|
-
export { getCSSLoaderStandardSetup } from './loader/cssLoader'
|
|
3
|
-
export { getFontLoaderStandardSetup } from './loader/fontLoader'
|
|
4
|
-
export { getImageLoaderStandardSetup } from './loader/imageLoader'
|
|
5
|
-
export { getMarkdownLoaderStandardSetup } from './loader/markdownLoader'
|
|
6
|
-
export { getPostCSSLoaderStandardSetup } from './loader/postCSSLoader'
|
|
7
|
-
export { getSassLoaderStandardSetup } from './loader/sassLoader'
|
|
8
|
-
export { getSVGRLoaderStandardSetup, getSVGRLoaderAdvancedSetup } from './loader/svgrLoader'
|
|
9
|
-
export { getBannerPluginStandardSetup } from './plugin/bannerPlugin'
|
|
10
|
-
export { getCleanWebpackPluginStandardSetup, getCleanWebpackPluginAdvancedSetup } from './plugin/cleanWebpackPlugin'
|
|
11
|
-
export { getCopyWebpackPluginStandardSetup } from './plugin/copyWebpackPlugin'
|
|
12
|
-
export { getCSSMinimizerWebpackPluginStandardSetup } from './plugin/cssMinimizerWebpackPlugin'
|
|
13
|
-
export { getDotenvWebpackStandardSetup, getDotenvWebpackAdvancedSetup } from './plugin/dotenvWebpack'
|
|
14
|
-
export { getHotModuleReplacementPluginStandardSetup } from './plugin/hotModuleReplacementPlugin'
|
|
15
|
-
export { getHtmlWebpackPluginStandardSetup, getHtmlWebpackPluginAdvancedSetup } from './plugin/htmlWebpackPlugin'
|
|
16
|
-
export {
|
|
17
|
-
MiniCSSExtractPluginLoader,
|
|
18
|
-
getMiniCSSExtractPluginStandardSetup,
|
|
19
|
-
getMiniCSSExtractPluginAdvancedSetup,
|
|
20
|
-
} from './plugin/miniCSSExtractPlugin'
|
|
21
|
-
export { getModuleConcatenationPluginStandardSetup } from './plugin/moduleConcatenationPlugin'
|
|
22
|
-
export { getWebpackBundleAnalyzerStandardSetup } from './plugin/webpackBundleAnalyzer'
|
|
23
|
-
export { getWebpackManifestPluginStandardSetup } from './plugin/webpackManifestPlugin'
|
|
24
|
-
export { getDevServerStandardSetup } from './server/devServer'
|
|
25
|
-
export { getWebpackCommonSetup } from './setup/commonSetup'
|
|
26
|
-
export { getWebpackDevelopmentSetup } from './setup/developmentSetup'
|
|
27
|
-
export { getWebpackProductionSetup } from './setup/productionSetup'
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// https://github.com/babel/babel-loader
|
|
2
|
-
|
|
3
|
-
import { coreJSVersion, targetBrowsers } from '../constant'
|
|
4
|
-
|
|
5
|
-
export function getBabelLoaderAdvancedSetup() {
|
|
6
|
-
return {
|
|
7
|
-
test: /\.(js|jsx)$/,
|
|
8
|
-
exclude: /node_modules/,
|
|
9
|
-
use: {
|
|
10
|
-
loader: 'babel-loader',
|
|
11
|
-
options: {
|
|
12
|
-
presets: [
|
|
13
|
-
[
|
|
14
|
-
'@babel/preset-env',
|
|
15
|
-
{
|
|
16
|
-
modules: false,
|
|
17
|
-
useBuiltIns: 'entry',
|
|
18
|
-
corejs: coreJSVersion,
|
|
19
|
-
targets: { browsers: Object.values(targetBrowsers.modernBrowsers) },
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
'@babel/preset-react',
|
|
23
|
-
'@babel/preset-typescript',
|
|
24
|
-
],
|
|
25
|
-
plugins: [
|
|
26
|
-
[
|
|
27
|
-
'@babel/plugin-transform-react-jsx',
|
|
28
|
-
{
|
|
29
|
-
runtime: 'automatic',
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
'@babel/plugin-transform-runtime',
|
|
33
|
-
'syntax-async-functions',
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// https://github.com/webpack-contrib/html-loader
|
|
2
|
-
// https://github.com/peerigon/markdown-loader
|
|
3
|
-
|
|
4
|
-
export function getMarkdownLoaderStandardSetup() {
|
|
5
|
-
return {
|
|
6
|
-
test: /\.md$/,
|
|
7
|
-
use: [
|
|
8
|
-
{
|
|
9
|
-
loader: 'html-loader',
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
loader: 'markdown-loader',
|
|
13
|
-
options: {},
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// https://github.com/webpack-contrib/postcss-loader
|
|
2
|
-
|
|
3
|
-
export function getPostCSSLoaderStandardSetup() {
|
|
4
|
-
return {
|
|
5
|
-
loader: 'postcss-loader',
|
|
6
|
-
options: {
|
|
7
|
-
postcssOptions: {
|
|
8
|
-
sourceMap: true,
|
|
9
|
-
plugins: () => ['postcss-preset-env'],
|
|
10
|
-
parser: 'postcss-scss',
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// https://github.com/gregberge/svgr/tree/main/packages/webpack
|
|
2
|
-
|
|
3
|
-
export function getSVGRLoaderStandardSetup() {
|
|
4
|
-
return {
|
|
5
|
-
test: /\.svg$/,
|
|
6
|
-
use: ['@svgr/webpack'],
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function getSVGRLoaderAdvancedSetup() {
|
|
11
|
-
return {
|
|
12
|
-
test: /\.svg$/i,
|
|
13
|
-
issuer: /\.[jt]sx?$/,
|
|
14
|
-
resourceQuery: { not: [/url/] },
|
|
15
|
-
use: ['@svgr/webpack'],
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// https://webpack.js.org/plugins/banner-plugin/
|
|
2
|
-
|
|
3
|
-
import webpack from 'webpack'
|
|
4
|
-
|
|
5
|
-
export function getBannerPluginStandardSetup(packageJSON) {
|
|
6
|
-
return new webpack.BannerPlugin({
|
|
7
|
-
banner: [
|
|
8
|
-
'/*!',
|
|
9
|
-
` * @project ${packageJSON.name}`,
|
|
10
|
-
' * @name [filebase]',
|
|
11
|
-
` * @author ${packageJSON.author.name}`,
|
|
12
|
-
` * @copyright Copyright (c) ${new Date().getFullYear()} ${packageJSON.author.name}`,
|
|
13
|
-
' */',
|
|
14
|
-
'',
|
|
15
|
-
].join('\n'),
|
|
16
|
-
raw: true,
|
|
17
|
-
})
|
|
18
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// https://github.com/johnagan/clean-webpack-plugin
|
|
2
|
-
|
|
3
|
-
import { CleanWebpackPlugin } from 'clean-webpack-plugin'
|
|
4
|
-
|
|
5
|
-
export function getCleanWebpackPluginStandardSetup() {
|
|
6
|
-
return new CleanWebpackPlugin()
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function getCleanWebpackPluginAdvancedSetup({
|
|
10
|
-
dry,
|
|
11
|
-
verbose,
|
|
12
|
-
cleanStaleWebpackAssets,
|
|
13
|
-
protectWebpackAssets,
|
|
14
|
-
cleanOnceBeforeBuildPatterns,
|
|
15
|
-
cleanAfterEveryBuildPatterns,
|
|
16
|
-
dangerouslyAllowCleanPatternsOutsideProject,
|
|
17
|
-
}) {
|
|
18
|
-
return new CleanWebpackPlugin({
|
|
19
|
-
dry,
|
|
20
|
-
verbose,
|
|
21
|
-
cleanStaleWebpackAssets,
|
|
22
|
-
protectWebpackAssets,
|
|
23
|
-
cleanOnceBeforeBuildPatterns,
|
|
24
|
-
cleanAfterEveryBuildPatterns,
|
|
25
|
-
dangerouslyAllowCleanPatternsOutsideProject,
|
|
26
|
-
})
|
|
27
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// https://github.com/webpack-contrib/copy-webpack-plugin
|
|
2
|
-
|
|
3
|
-
import CopyWebpackPlugin from 'copy-webpack-plugin'
|
|
4
|
-
|
|
5
|
-
export function getCopyWebpackPluginStandardSetup({ from, to }) {
|
|
6
|
-
return new CopyWebpackPlugin({
|
|
7
|
-
patterns: [
|
|
8
|
-
{
|
|
9
|
-
from,
|
|
10
|
-
to,
|
|
11
|
-
globOptions: {
|
|
12
|
-
ignore: ['*.DS_Store'],
|
|
13
|
-
},
|
|
14
|
-
noErrorOnMissing: true,
|
|
15
|
-
},
|
|
16
|
-
],
|
|
17
|
-
})
|
|
18
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// https://github.com/mrsteele/dotenv-webpack
|
|
2
|
-
|
|
3
|
-
import DotenvWebpack from 'dotenv-webpack'
|
|
4
|
-
|
|
5
|
-
export function getDotenvWebpackStandardSetup({ path }) {
|
|
6
|
-
return new DotenvWebpack({ path })
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function getDotenvWebpackAdvancedSetup({ path, safe, allowEmptyValues, systemvars, silent, defaults, prefix }) {
|
|
10
|
-
return new DotenvWebpack({
|
|
11
|
-
path,
|
|
12
|
-
safe,
|
|
13
|
-
allowEmptyValues,
|
|
14
|
-
systemvars,
|
|
15
|
-
silent,
|
|
16
|
-
defaults,
|
|
17
|
-
prefix,
|
|
18
|
-
})
|
|
19
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// https://github.com/jantimon/html-webpack-plugin
|
|
2
|
-
|
|
3
|
-
import HtmlWebpackPlugin from 'html-webpack-plugin'
|
|
4
|
-
import { indexHTMLName } from '../constant'
|
|
5
|
-
|
|
6
|
-
export function getHtmlWebpackPluginStandardSetup({ title, micrositeWebpackFolderPath }) {
|
|
7
|
-
return new HtmlWebpackPlugin({
|
|
8
|
-
title,
|
|
9
|
-
meta: { viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no' },
|
|
10
|
-
template: `${micrositeWebpackFolderPath}/${indexHTMLName}`,
|
|
11
|
-
filename: indexHTMLName,
|
|
12
|
-
inject: 'body',
|
|
13
|
-
scriptLoading: 'defer',
|
|
14
|
-
})
|
|
15
|
-
}
|
|
16
|
-
export function getHtmlWebpackPluginAdvancedSetup({ title, meta, template, filename, inject, scriptLoading }) {
|
|
17
|
-
return new HtmlWebpackPlugin({
|
|
18
|
-
title,
|
|
19
|
-
meta,
|
|
20
|
-
template,
|
|
21
|
-
filename,
|
|
22
|
-
inject,
|
|
23
|
-
scriptLoading,
|
|
24
|
-
})
|
|
25
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// https://github.com/webpack-contrib/mini-css-extract-plugin
|
|
2
|
-
|
|
3
|
-
import MiniCssExtractPlugin from 'mini-css-extract-plugin'
|
|
4
|
-
|
|
5
|
-
export const MiniCSSExtractPluginLoader = MiniCssExtractPlugin.loader
|
|
6
|
-
|
|
7
|
-
export function getMiniCSSExtractPluginStandardSetup() {
|
|
8
|
-
return new MiniCssExtractPlugin()
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function getMiniCSSExtractPluginAdvancedSetup() {
|
|
12
|
-
return new MiniCssExtractPlugin({
|
|
13
|
-
filename: 'styles/[name].[contenthash].css',
|
|
14
|
-
chunkFilename: '[id].css',
|
|
15
|
-
})
|
|
16
|
-
}
|