@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@papillonarts/setup",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Papillon Arts Setup",
|
|
5
5
|
"homepage": "https://github.com/papillonarts/papillonarts/tree/master/packages/setup",
|
|
6
6
|
"repository": {
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"clean-up": "rm -rf build node_modules package-lock.json",
|
|
25
25
|
"install-packages": "npm i",
|
|
26
26
|
"install-papillonarts-latest": "echo \"setup skipping install-papillonarts-latest\" && exit 0",
|
|
27
|
-
"build": "rm -rf build && babel --copy-files --no-copy-ignored --out-dir build src --ignore **/__tests__",
|
|
27
|
+
"build": "rm -rf build && babel --copy-files --no-copy-ignored --extensions '.js,.jsx,.ts,.tsx' --out-dir build src --ignore **/__tests__",
|
|
28
28
|
"build-test": "npm run build",
|
|
29
29
|
"build-acceptance": "npm run build",
|
|
30
30
|
"build-release": "npm run build"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "afb8232b4029b44881fa5613b3069ad2d3032f16"
|
|
33
33
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "getStorybookMainSetup", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _mainSetup.getStorybookMainSetup;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "getStorybookPreviewSetup", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _previewSetup.getStorybookPreviewSetup;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "setStorybookManagerSetup", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _managerSetup.setStorybookManagerSetup;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _mainSetup = require("./mainSetup");
|
|
25
|
+
var _managerSetup = require("./managerSetup");
|
|
26
|
+
var _previewSetup = require("./previewSetup");
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getStorybookMainSetup = getStorybookMainSetup;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _webpack = _interopRequireDefault(require("webpack"));
|
|
12
|
+
var _object = require("@papillonarts/library/object");
|
|
13
|
+
var _webpack2 = require("@papillonarts/setup/webpack");
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /* https://storybook.js.org/docs/configure/integration/typescript */ /* eslint-disable no-unused-vars */ /* eslint-disable no-param-reassign */ /* eslint-disable global-require */
|
|
16
|
+
function getStorybookMainSetup(_ref) {
|
|
17
|
+
var storiesBasePath = _ref.storiesBasePath,
|
|
18
|
+
includeBasePath = _ref.includeBasePath,
|
|
19
|
+
modulesBasePath = _ref.modulesBasePath,
|
|
20
|
+
rootAttributesDefaults = _ref.rootAttributesDefaults;
|
|
21
|
+
// https://storybook.js.org/docs/react/api/main-config
|
|
22
|
+
return {
|
|
23
|
+
// https://storybook.js.org/docs/api/main-config/main-config-preview-body
|
|
24
|
+
previewBody: function previewBody(body) {
|
|
25
|
+
if (rootAttributesDefaults) {
|
|
26
|
+
// https://github.com/storybookjs/storybook/issues/24429
|
|
27
|
+
return "\n ".concat(body, "\n <script type=\"text/javascript\">\n (() => {\n document.addEventListener('DOMContentLoaded', function() {\n const storybookRootElement = document.getElementById(\"storybook-root\")\n\n // https://primer.style/foundations/primitives/getting-started\n storybookRootElement.setAttribute(\"data-color-mode\", \"light\")\n storybookRootElement.setAttribute(\"data-light-theme\", \"light\")\n storybookRootElement.setAttribute(\"data-dark-theme\", \"dark\")\n });\n })()\n </script>\n ");
|
|
28
|
+
}
|
|
29
|
+
return "".concat(body);
|
|
30
|
+
},
|
|
31
|
+
// https://storybook.js.org/docs/react/configure/frameworks
|
|
32
|
+
framework: {
|
|
33
|
+
name: '@storybook/react-webpack5',
|
|
34
|
+
options: {
|
|
35
|
+
fastRefresh: false,
|
|
36
|
+
strictMode: false,
|
|
37
|
+
legacyRootApi: false
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
// https://storybook.js.org/docs/react/api/main-config-stories
|
|
41
|
+
stories: [storiesBasePath],
|
|
42
|
+
// https://storybook.js.org/docs/react/api/main-config-addons
|
|
43
|
+
// https://storybook.js.org/docs/react/addons/introduction
|
|
44
|
+
// https://storybook.js.org/integrations
|
|
45
|
+
addons: [
|
|
46
|
+
// https://storybook.js.org/addons/@storybook/addon-a11y
|
|
47
|
+
'@storybook/addon-a11y',
|
|
48
|
+
// included by default in @storybook/addon-essentials
|
|
49
|
+
// https://storybook.js.org/docs/react/essentials/actions
|
|
50
|
+
// https://storybook.js.org/addons/@storybook/addon-actions
|
|
51
|
+
// '@storybook/addon-actions',
|
|
52
|
+
|
|
53
|
+
// included by default in @storybook/addon-essentials
|
|
54
|
+
// https://storybook.js.org/docs/react/essentials/backgrounds
|
|
55
|
+
// https://storybook.js.org/addons/@storybook/addon-backgrounds
|
|
56
|
+
// '@storybook/addon-backgrounds',
|
|
57
|
+
|
|
58
|
+
// https://storybook.js.org/addons/chromatic
|
|
59
|
+
// chromatic
|
|
60
|
+
|
|
61
|
+
// included by default in @storybook/addon-essentials
|
|
62
|
+
// https://storybook.js.org/docs/react/essentials/controls
|
|
63
|
+
// https://storybook.js.org/addons/@storybook/addon-controls
|
|
64
|
+
// '@storybook/addon-controls',
|
|
65
|
+
|
|
66
|
+
// https://storybook.js.org/addons/storybook-addon-designs
|
|
67
|
+
// storybook-addon-designs
|
|
68
|
+
|
|
69
|
+
// included by default in @storybook/addon-essentials
|
|
70
|
+
// https://storybook.js.org/docs/react/essentials/docs (404)
|
|
71
|
+
// https://storybook.js.org/addons/@storybook/addon-docs
|
|
72
|
+
// {
|
|
73
|
+
// name: '@storybook/addon-docs',
|
|
74
|
+
// options: {
|
|
75
|
+
// jsxOptions: {},
|
|
76
|
+
// csfPluginOptions: null,
|
|
77
|
+
// mdxPluginOptions: {},
|
|
78
|
+
// transcludeMarkdown: true,
|
|
79
|
+
// },
|
|
80
|
+
// },
|
|
81
|
+
|
|
82
|
+
// https://storybook.js.org/docs/react/essentials/introduction
|
|
83
|
+
// https://storybook.js.org/integrations/tag/essentials
|
|
84
|
+
// '@storybook/addon-essentials',
|
|
85
|
+
|
|
86
|
+
// included by default in @storybook/addon-essentials
|
|
87
|
+
// https://storybook.js.org/docs/react/essentials/highlight (404)
|
|
88
|
+
// https://storybook.js.org/addons/@storybook/addon-highlight
|
|
89
|
+
// '@storybook/addon-highlight',
|
|
90
|
+
|
|
91
|
+
// https://storybook.js.org/addons/@storybook/addon-interactions
|
|
92
|
+
// '@storybook/addon-interactions',
|
|
93
|
+
|
|
94
|
+
// https://storybook.js.org/addons/@storybook/addon-jest
|
|
95
|
+
'@storybook/addon-jest',
|
|
96
|
+
// https://storybook.js.org/addons/@storybook/addon-links
|
|
97
|
+
'@storybook/addon-links',
|
|
98
|
+
// https://storybook.js.org/addons/msw-storybook-addon
|
|
99
|
+
// msw-storybook-addon
|
|
100
|
+
|
|
101
|
+
// included by default in @storybook/addon-essentials
|
|
102
|
+
// https://storybook.js.org/docs/react/essentials/measure-and-outline
|
|
103
|
+
// https://storybook.js.org/addons/@storybook/addon-measure
|
|
104
|
+
// https://storybook.js.org/addons/@storybook/addon-outline
|
|
105
|
+
// '@storybook/addon-measure',
|
|
106
|
+
// '@storybook/addon-outline',
|
|
107
|
+
|
|
108
|
+
// included by default in @storybook/addon-essentials
|
|
109
|
+
// https://storybook.js.org/docs/react/essentials/toolbars-and-globals
|
|
110
|
+
// https://storybook.js.org/addons/@storybook/addon-toolbars
|
|
111
|
+
// '@storybook/addon-toolbars',
|
|
112
|
+
|
|
113
|
+
// included by default in @storybook/addon-essentials
|
|
114
|
+
// https://storybook.js.org/docs/react/essentials/viewport
|
|
115
|
+
// https://storybook.js.org/addons/@storybook/addon-viewport
|
|
116
|
+
// '@storybook/addon-viewport',
|
|
117
|
+
|
|
118
|
+
'@chromatic-com/storybook',
|
|
119
|
+
// https://storybook.js.org/addons/@storybook/addon-styling-webpack
|
|
120
|
+
'@storybook/addon-styling-webpack',
|
|
121
|
+
// https://storybook.js.org/addons/@storybook/addon-themes
|
|
122
|
+
'@storybook/addon-themes', '@storybook/addon-webpack5-compiler-babel'],
|
|
123
|
+
// https://storybook.js.org/docs/react/api/main-config-babel
|
|
124
|
+
// ...
|
|
125
|
+
|
|
126
|
+
// https://storybook.js.org/docs/react/api/main-config-babel-default
|
|
127
|
+
// ...
|
|
128
|
+
|
|
129
|
+
// https://storybook.js.org/docs/react/api/main-config-core
|
|
130
|
+
// https://storybook.js.org/docs/api/main-config/main-config-core#builder
|
|
131
|
+
core: {
|
|
132
|
+
builder: {
|
|
133
|
+
name: '@storybook/builder-webpack5',
|
|
134
|
+
options: null
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
// https://storybook.js.org/docs/react/api/main-config-docs
|
|
138
|
+
// https://storybook.js.org/docs/react/writing-docs/autodocs
|
|
139
|
+
// https://storybook.js.org/docs/react/writing-docs/mdx
|
|
140
|
+
// https://storybook.js.org/docs/writing-docs/autodocs
|
|
141
|
+
docs: {
|
|
142
|
+
defaultName: 'Documentation',
|
|
143
|
+
docsMode: false
|
|
144
|
+
},
|
|
145
|
+
// https://storybook.js.org/docs/react/api/main-config-env
|
|
146
|
+
// ...
|
|
147
|
+
|
|
148
|
+
// https://storybook.js.org/docs/react/api/main-config-features
|
|
149
|
+
// ...
|
|
150
|
+
|
|
151
|
+
// https://storybook.js.org/docs/react/api/main-config-log-level
|
|
152
|
+
logLevel: 'debug',
|
|
153
|
+
// https://storybook.js.org/docs/react/api/main-config-manager-head
|
|
154
|
+
// ...
|
|
155
|
+
|
|
156
|
+
// https://storybook.js.org/docs/react/api/main-config-preview-annotations
|
|
157
|
+
// ...
|
|
158
|
+
|
|
159
|
+
// https://storybook.js.org/docs/react/api/main-config-preview-body
|
|
160
|
+
// ...
|
|
161
|
+
|
|
162
|
+
// https://storybook.js.org/docs/react/api/main-config-preview-head
|
|
163
|
+
// ...
|
|
164
|
+
|
|
165
|
+
// https://storybook.js.org/docs/react/api/main-config-refs
|
|
166
|
+
// ...
|
|
167
|
+
|
|
168
|
+
// https://storybook.js.org/docs/react/api/main-config-static-dirs
|
|
169
|
+
// ...
|
|
170
|
+
|
|
171
|
+
// https://storybook.js.org/docs/react/api/main-config-typescript
|
|
172
|
+
// ...
|
|
173
|
+
|
|
174
|
+
// https://storybook.js.org/docs/react/api/main-config-webpack-final
|
|
175
|
+
webpackFinal: function () {
|
|
176
|
+
var _webpackFinal = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(config, _ref2) {
|
|
177
|
+
var configType, fileLoaderRuleSVG;
|
|
178
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
179
|
+
while (1) switch (_context.prev = _context.next) {
|
|
180
|
+
case 0:
|
|
181
|
+
configType = _ref2.configType;
|
|
182
|
+
// @ts-ignore
|
|
183
|
+
fileLoaderRuleSVG = config.module.rules.find(function (rule) {
|
|
184
|
+
var _rule$test$test, _rule$test;
|
|
185
|
+
return !(0, _object.isEmptyObject)(rule) && ((_rule$test$test = (_rule$test = rule.test).test) === null || _rule$test$test === void 0 ? void 0 : _rule$test$test.call(_rule$test, '.svg'));
|
|
186
|
+
}); // @ts-ignore
|
|
187
|
+
fileLoaderRuleSVG.exclude = /\.svg$/;
|
|
188
|
+
config.module.rules = config.module.rules.concat([{
|
|
189
|
+
test: /\.(css|scss)$/,
|
|
190
|
+
use: [{
|
|
191
|
+
loader: 'style-loader'
|
|
192
|
+
}, {
|
|
193
|
+
loader: 'css-loader',
|
|
194
|
+
options: {
|
|
195
|
+
importLoaders: 2,
|
|
196
|
+
sourceMap: true,
|
|
197
|
+
modules: {
|
|
198
|
+
localIdentName: '[name]__[local]___[hash:base64:5]',
|
|
199
|
+
/* https://webpack.js.org/loaders/css-loader/#exportlocalsconvention */
|
|
200
|
+
exportLocalsConvention: 'as-is'
|
|
201
|
+
},
|
|
202
|
+
/* https://stackoverflow.com/questions/78589664/style-loader-does-not-recoginize-default-imports-of-css-modules-in-storybooks */
|
|
203
|
+
esModule: false
|
|
204
|
+
}
|
|
205
|
+
}, {
|
|
206
|
+
loader: 'postcss-loader',
|
|
207
|
+
options: {
|
|
208
|
+
postcssOptions: {
|
|
209
|
+
sourceMap: true,
|
|
210
|
+
plugins: function plugins() {
|
|
211
|
+
return [require('postcss-preset-env')()];
|
|
212
|
+
},
|
|
213
|
+
parser: 'postcss-scss'
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}, {
|
|
217
|
+
loader: 'sass-loader',
|
|
218
|
+
options: {
|
|
219
|
+
sassOptions: {
|
|
220
|
+
includePaths: [modulesBasePath],
|
|
221
|
+
// https://sass-lang.com/documentation/js-api/interfaces/options/#quietDeps
|
|
222
|
+
// https://sass-lang.com/documentation/js-api/interfaces/options/#silenceDeprecations
|
|
223
|
+
// https://sass-lang.com/documentation/js-api/interfaces/deprecations/
|
|
224
|
+
quietDeps: true,
|
|
225
|
+
silenceDeprecations: ['import', 'global-builtin']
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}]
|
|
229
|
+
}, {
|
|
230
|
+
test: /\.svg$/i,
|
|
231
|
+
issuer: /\.[jt]sx?$/,
|
|
232
|
+
use: ['@svgr/webpack']
|
|
233
|
+
}, {
|
|
234
|
+
test: /\.int.story\.mdx$/,
|
|
235
|
+
use: [{
|
|
236
|
+
loader: 'babel-loader',
|
|
237
|
+
options: {
|
|
238
|
+
plugins: ['@babel/plugin-transform-react-jsx']
|
|
239
|
+
}
|
|
240
|
+
}, {
|
|
241
|
+
loader: '@mdx-js/loader',
|
|
242
|
+
options: {}
|
|
243
|
+
}]
|
|
244
|
+
}, (0, _webpack2.getBabelLoaderAdvancedSetup)()]);
|
|
245
|
+
config.plugins.push(new _webpack["default"].ProvidePlugin({
|
|
246
|
+
process: 'process/browser'
|
|
247
|
+
}));
|
|
248
|
+
config.resolve.fallback = _objectSpread(_objectSpread({}, config.resolve.fallback), {}, {
|
|
249
|
+
tty: require.resolve('tty-browserify')
|
|
250
|
+
});
|
|
251
|
+
return _context.abrupt("return", config);
|
|
252
|
+
case 1:
|
|
253
|
+
case "end":
|
|
254
|
+
return _context.stop();
|
|
255
|
+
}
|
|
256
|
+
}, _callee);
|
|
257
|
+
}));
|
|
258
|
+
function webpackFinal(_x, _x2) {
|
|
259
|
+
return _webpackFinal.apply(this, arguments);
|
|
260
|
+
}
|
|
261
|
+
return webpackFinal;
|
|
262
|
+
}(),
|
|
263
|
+
typescript: {
|
|
264
|
+
reactDocgen: 'react-docgen-typescript',
|
|
265
|
+
check: true
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.setStorybookManagerSetup = setStorybookManagerSetup;
|
|
7
|
+
var _managerApi = require("storybook/manager-api");
|
|
8
|
+
var _theming = require("storybook/theming");
|
|
9
|
+
function setStorybookManagerSetup(_ref) {
|
|
10
|
+
var panelPosition = _ref.panelPosition,
|
|
11
|
+
theme = _ref.theme;
|
|
12
|
+
_managerApi.addons.setConfig({
|
|
13
|
+
panelPosition: panelPosition,
|
|
14
|
+
theme: (0, _theming.create)(theme)
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getStorybookPreviewSetup = getStorybookPreviewSetup;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _reactRouterDom = require("react-router-dom");
|
|
10
|
+
var _blocks = require("@storybook/addon-docs/blocks");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
function getStorybookPreviewSetup(_ref) {
|
|
15
|
+
var _ref$parameters = _ref.parameters,
|
|
16
|
+
a11y = _ref$parameters.a11y,
|
|
17
|
+
decorators = _ref$parameters.decorators,
|
|
18
|
+
docs = _ref$parameters.docs;
|
|
19
|
+
var parameters = {};
|
|
20
|
+
if (a11y) {
|
|
21
|
+
parameters = _objectSpread(_objectSpread({}, parameters), {}, {
|
|
22
|
+
a11y: _objectSpread({}, {
|
|
23
|
+
// optional selector which element to inspect
|
|
24
|
+
// element: '#root',
|
|
25
|
+
// axe-core configurationOptions (https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#parameters-1)
|
|
26
|
+
config: {},
|
|
27
|
+
// axe-core optionsParameter (https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#options-parameter)
|
|
28
|
+
options: {}
|
|
29
|
+
// optional flag to prevent the automatic check
|
|
30
|
+
// manual: true,
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (decorators) {
|
|
35
|
+
parameters = _objectSpread(_objectSpread({}, parameters), {}, {
|
|
36
|
+
decorators: [function (Story) {
|
|
37
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.MemoryRouter, {
|
|
38
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Story, {})
|
|
39
|
+
});
|
|
40
|
+
}].concat()
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (docs) {
|
|
44
|
+
parameters = _objectSpread(_objectSpread({}, parameters), {}, {
|
|
45
|
+
docs: _objectSpread({}, {
|
|
46
|
+
container: _blocks.DocsContainer,
|
|
47
|
+
page: _blocks.DocsPage
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
parameters: parameters
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.targetBrowsers = exports.manifestFileName = exports.indexHTMLName = exports.extensions = exports.coreJSVersion = void 0;
|
|
7
|
+
var coreJSVersion = exports.coreJSVersion = '3.46.0';
|
|
8
|
+
var targetBrowsers = exports.targetBrowsers = {
|
|
9
|
+
production: ['> 1%', 'last 2 versions', 'Firefox ESR'],
|
|
10
|
+
legacyBrowsers: ['> 1%', 'last 2 versions', 'Firefox ESR'],
|
|
11
|
+
modernBrowsers: ['last 2 Chrome versions', 'not Chrome < 60', 'last 2 Safari versions', 'not Safari < 10.1', 'last 2 iOS versions', 'not iOS < 10.3', 'last 2 Firefox versions', 'not Firefox < 54', 'last 2 Edge versions', 'not Edge < 15']
|
|
12
|
+
};
|
|
13
|
+
var manifestFileName = exports.manifestFileName = 'manifest.json';
|
|
14
|
+
var indexHTMLName = exports.indexHTMLName = 'index.html';
|
|
15
|
+
var extensions = exports.extensions = ['.js', '.jsx', '.json', '.scss'];
|
package/webpack/index.js
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "MiniCSSExtractPluginLoader", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _miniCSSExtractPlugin.MiniCSSExtractPluginLoader;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "getBabelLoaderAdvancedSetup", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _babelLoader.getBabelLoaderAdvancedSetup;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "getBannerPluginStandardSetup", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _bannerPlugin.getBannerPluginStandardSetup;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "getCSSLoaderStandardSetup", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _cssLoader.getCSSLoaderStandardSetup;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "getCSSMinimizerWebpackPluginStandardSetup", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _cssMinimizerWebpackPlugin.getCSSMinimizerWebpackPluginStandardSetup;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "getCleanWebpackPluginAdvancedSetup", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _cleanWebpackPlugin.getCleanWebpackPluginAdvancedSetup;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "getCleanWebpackPluginStandardSetup", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _cleanWebpackPlugin.getCleanWebpackPluginStandardSetup;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "getCopyWebpackPluginStandardSetup", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _copyWebpackPlugin.getCopyWebpackPluginStandardSetup;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "getDevServerStandardSetup", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function get() {
|
|
57
|
+
return _devServer.getDevServerStandardSetup;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "getDotenvWebpackAdvancedSetup", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function get() {
|
|
63
|
+
return _dotenvWebpack.getDotenvWebpackAdvancedSetup;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "getDotenvWebpackStandardSetup", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function get() {
|
|
69
|
+
return _dotenvWebpack.getDotenvWebpackStandardSetup;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "getFontLoaderStandardSetup", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function get() {
|
|
75
|
+
return _fontLoader.getFontLoaderStandardSetup;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "getHotModuleReplacementPluginStandardSetup", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function get() {
|
|
81
|
+
return _hotModuleReplacementPlugin.getHotModuleReplacementPluginStandardSetup;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "getHtmlWebpackPluginAdvancedSetup", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function get() {
|
|
87
|
+
return _htmlWebpackPlugin.getHtmlWebpackPluginAdvancedSetup;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "getHtmlWebpackPluginStandardSetup", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function get() {
|
|
93
|
+
return _htmlWebpackPlugin.getHtmlWebpackPluginStandardSetup;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "getImageLoaderStandardSetup", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function get() {
|
|
99
|
+
return _imageLoader.getImageLoaderStandardSetup;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
Object.defineProperty(exports, "getMarkdownLoaderStandardSetup", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function get() {
|
|
105
|
+
return _markdownLoader.getMarkdownLoaderStandardSetup;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
Object.defineProperty(exports, "getMiniCSSExtractPluginAdvancedSetup", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function get() {
|
|
111
|
+
return _miniCSSExtractPlugin.getMiniCSSExtractPluginAdvancedSetup;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(exports, "getMiniCSSExtractPluginStandardSetup", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function get() {
|
|
117
|
+
return _miniCSSExtractPlugin.getMiniCSSExtractPluginStandardSetup;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports, "getModuleConcatenationPluginStandardSetup", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function get() {
|
|
123
|
+
return _moduleConcatenationPlugin.getModuleConcatenationPluginStandardSetup;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(exports, "getPostCSSLoaderStandardSetup", {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function get() {
|
|
129
|
+
return _postCSSLoader.getPostCSSLoaderStandardSetup;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(exports, "getSVGRLoaderAdvancedSetup", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function get() {
|
|
135
|
+
return _svgrLoader.getSVGRLoaderAdvancedSetup;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(exports, "getSVGRLoaderStandardSetup", {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function get() {
|
|
141
|
+
return _svgrLoader.getSVGRLoaderStandardSetup;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
Object.defineProperty(exports, "getSassLoaderStandardSetup", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function get() {
|
|
147
|
+
return _sassLoader.getSassLoaderStandardSetup;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(exports, "getWebpackBundleAnalyzerStandardSetup", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function get() {
|
|
153
|
+
return _webpackBundleAnalyzer.getWebpackBundleAnalyzerStandardSetup;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(exports, "getWebpackCommonSetup", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function get() {
|
|
159
|
+
return _commonSetup.getWebpackCommonSetup;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
Object.defineProperty(exports, "getWebpackDevelopmentSetup", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function get() {
|
|
165
|
+
return _developmentSetup.getWebpackDevelopmentSetup;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
Object.defineProperty(exports, "getWebpackManifestPluginStandardSetup", {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
get: function get() {
|
|
171
|
+
return _webpackManifestPlugin.getWebpackManifestPluginStandardSetup;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
Object.defineProperty(exports, "getWebpackProductionSetup", {
|
|
175
|
+
enumerable: true,
|
|
176
|
+
get: function get() {
|
|
177
|
+
return _productionSetup.getWebpackProductionSetup;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
var _babelLoader = require("./loader/babelLoader");
|
|
181
|
+
var _cssLoader = require("./loader/cssLoader");
|
|
182
|
+
var _fontLoader = require("./loader/fontLoader");
|
|
183
|
+
var _imageLoader = require("./loader/imageLoader");
|
|
184
|
+
var _markdownLoader = require("./loader/markdownLoader");
|
|
185
|
+
var _postCSSLoader = require("./loader/postCSSLoader");
|
|
186
|
+
var _sassLoader = require("./loader/sassLoader");
|
|
187
|
+
var _svgrLoader = require("./loader/svgrLoader");
|
|
188
|
+
var _bannerPlugin = require("./plugin/bannerPlugin");
|
|
189
|
+
var _cleanWebpackPlugin = require("./plugin/cleanWebpackPlugin");
|
|
190
|
+
var _copyWebpackPlugin = require("./plugin/copyWebpackPlugin");
|
|
191
|
+
var _cssMinimizerWebpackPlugin = require("./plugin/cssMinimizerWebpackPlugin");
|
|
192
|
+
var _dotenvWebpack = require("./plugin/dotenvWebpack");
|
|
193
|
+
var _hotModuleReplacementPlugin = require("./plugin/hotModuleReplacementPlugin");
|
|
194
|
+
var _htmlWebpackPlugin = require("./plugin/htmlWebpackPlugin");
|
|
195
|
+
var _miniCSSExtractPlugin = require("./plugin/miniCSSExtractPlugin");
|
|
196
|
+
var _moduleConcatenationPlugin = require("./plugin/moduleConcatenationPlugin");
|
|
197
|
+
var _webpackBundleAnalyzer = require("./plugin/webpackBundleAnalyzer");
|
|
198
|
+
var _webpackManifestPlugin = require("./plugin/webpackManifestPlugin");
|
|
199
|
+
var _devServer = require("./server/devServer");
|
|
200
|
+
var _commonSetup = require("./setup/commonSetup");
|
|
201
|
+
var _developmentSetup = require("./setup/developmentSetup");
|
|
202
|
+
var _productionSetup = require("./setup/productionSetup");
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getBabelLoaderAdvancedSetup = getBabelLoaderAdvancedSetup;
|
|
7
|
+
var _constant = require("../constant");
|
|
8
|
+
// https://github.com/babel/babel-loader
|
|
9
|
+
|
|
10
|
+
function getBabelLoaderAdvancedSetup() {
|
|
11
|
+
return {
|
|
12
|
+
test: /\.(js|jsx)$/,
|
|
13
|
+
exclude: /node_modules/,
|
|
14
|
+
use: {
|
|
15
|
+
loader: 'babel-loader',
|
|
16
|
+
options: {
|
|
17
|
+
presets: [['@babel/preset-env', {
|
|
18
|
+
modules: false,
|
|
19
|
+
useBuiltIns: 'entry',
|
|
20
|
+
corejs: _constant.coreJSVersion,
|
|
21
|
+
targets: {
|
|
22
|
+
browsers: Object.values(_constant.targetBrowsers.modernBrowsers)
|
|
23
|
+
}
|
|
24
|
+
}], '@babel/preset-react', '@babel/preset-typescript'],
|
|
25
|
+
plugins: [['@babel/plugin-transform-react-jsx', {
|
|
26
|
+
runtime: 'automatic'
|
|
27
|
+
}], '@babel/plugin-transform-runtime', 'syntax-async-functions']
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getCSSLoaderStandardSetup = getCSSLoaderStandardSetup;
|
|
7
|
+
// https://github.com/webpack-contrib/css-loader
|
|
8
|
+
|
|
9
|
+
function getCSSLoaderStandardSetup(_ref) {
|
|
10
|
+
var sourceMap = _ref.sourceMap,
|
|
11
|
+
modules = _ref.modules,
|
|
12
|
+
esModule = _ref.esModule;
|
|
13
|
+
return {
|
|
14
|
+
loader: 'css-loader',
|
|
15
|
+
options: {
|
|
16
|
+
importLoaders: 2,
|
|
17
|
+
sourceMap: sourceMap,
|
|
18
|
+
modules: modules,
|
|
19
|
+
esModule: esModule
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getFontLoaderStandardSetup = getFontLoaderStandardSetup;
|
|
7
|
+
// https://webpack.js.org/guides/asset-management/#loading-fonts
|
|
8
|
+
|
|
9
|
+
function getFontLoaderStandardSetup() {
|
|
10
|
+
return {
|
|
11
|
+
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
12
|
+
type: 'asset/resource'
|
|
13
|
+
};
|
|
14
|
+
}
|