generator-reackt 0.5.0 → 1.0.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.
Files changed (61) hide show
  1. package/.prettierrc +1 -1
  2. package/.stylelintrc +3 -102
  3. package/LICENSE +17 -5
  4. package/README.md +4 -2
  5. package/generators/app/index.js +1 -1
  6. package/generators/component/index.js +1 -1
  7. package/generators/module/index.js +1 -1
  8. package/generators/util/fs.js +1 -1
  9. package/package.json +53 -39
  10. package/templates/app/.lintstagedrc +1 -1
  11. package/templates/app/.prettierrc +1 -1
  12. package/templates/app/.storybook/main.ts +19 -0
  13. package/templates/app/.storybook/preview.ts +36 -0
  14. package/templates/app/.stylelintrc +2 -268
  15. package/templates/app/.yarnrc.yml +3 -0
  16. package/templates/app/_eslint.config.mjs +51 -0
  17. package/templates/app/{package.json → _package.json} +2 -2
  18. package/templates/app/_stories/SuspenseFallback.stories.tsx +17 -0
  19. package/templates/app/gitignore +1 -0
  20. package/templates/app/jest.config.js +1 -1
  21. package/templates/app/src/components/ErrorBoundary.tsx +45 -0
  22. package/templates/app/src/components/Layout.tsx +142 -0
  23. package/templates/app/src/components/SuspenseFallback.tsx +96 -0
  24. package/templates/app/src/{index.scss → index.nscss} +8 -7
  25. package/templates/app/src/index.tsx +60 -0
  26. package/templates/app/src/pages/index.tsx +3 -0
  27. package/templates/app/src/reducers/application.ts +36 -0
  28. package/templates/app/src/reducers/{index.js → index.ts} +1 -0
  29. package/templates/app/src/sagas/application.ts +9 -0
  30. package/templates/app/src/sagas/{index.js → index.ts} +1 -0
  31. package/templates/app/src/selectors/application.test.ts +18 -0
  32. package/templates/app/src/selectors/application.ts +6 -0
  33. package/templates/app/src/types/globals.d.ts +1 -0
  34. package/templates/app/src/types/index.ts +11 -0
  35. package/templates/app/src/utils/{index.js → index.ts} +3 -3
  36. package/templates/app/tsconfig.json +18 -0
  37. package/templates/app/webpack.config.nts +121 -0
  38. package/templates/component/index.stories.tsx +14 -0
  39. package/templates/component/{index.js → index.tsx} +2 -5
  40. package/generators/es.regexp.flags-ccfbed60.js +0 -1
  41. package/templates/app/.babelrc +0 -9
  42. package/templates/app/.eslintrc.js +0 -185
  43. package/templates/app/.storybook/addons.js +0 -1
  44. package/templates/app/.storybook/config.js +0 -14
  45. package/templates/app/.storybook/webpack.config.babel.js +0 -7
  46. package/templates/app/jsconfig.json +0 -8
  47. package/templates/app/src/components/App.js +0 -14
  48. package/templates/app/src/icons.js +0 -4
  49. package/templates/app/src/index.js +0 -50
  50. package/templates/app/src/reducers/application.js +0 -21
  51. package/templates/app/src/sagas/application.js +0 -9
  52. package/templates/app/src/selectors/application.js +0 -1
  53. package/templates/app/src/selectors/application.test.js +0 -13
  54. package/templates/app/webpack.config.babel.js +0 -103
  55. /package/templates/component/{index.test.js → index.test.tsx} +0 -0
  56. /package/templates/module/reducer/{index.test.js → index.test.ts} +0 -0
  57. /package/templates/module/reducer/{index.js → index.ts} +0 -0
  58. /package/templates/module/saga/{index.test.js → index.test.ts} +0 -0
  59. /package/templates/module/saga/{index.js → index.ts} +0 -0
  60. /package/templates/module/selector/{index.js → index.test.ts} +0 -0
  61. /package/templates/module/selector/{index.test.js → index.ts} +0 -0
@@ -0,0 +1,60 @@
1
+ import { Suspense } from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+ import { RouterProvider, createHashRouter } from 'react-router-dom';
4
+
5
+ <% if (flags.addRedux) { %>
6
+ import { Provider } from 'react-redux';
7
+ import createSagaMiddleware from 'redux-saga';
8
+ import { applyMiddleware, createStore, compose } from 'redux';
9
+ <% } %>
10
+
11
+ import './index.scss';
12
+ <% if (styleFramework === 'materialize') { %>
13
+ import 'materialize-css';
14
+ <% } %>
15
+ import Layout from './components/Layout';
16
+ import SuspenseFallback from './components/SuspenseFallback';
17
+ import ErrorBoundary from './components/ErrorBoundary';
18
+ <% if (flags.addRedux) { %>
19
+ import rootSaga from './sagas';
20
+ import rootReducer from './reducers';
21
+
22
+ const composer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
23
+ const sagaMiddleware = createSagaMiddleware();
24
+ const enhancers = composer(applyMiddleware(sagaMiddleware));
25
+
26
+ export const store = createStore(rootReducer, {}, enhancers);
27
+
28
+ sagaMiddleware.run(rootSaga);
29
+ <% } %>
30
+
31
+ const rootElem = document.getElementById('root');
32
+
33
+ if (rootElem) {
34
+ const root = createRoot(rootElem);
35
+ const router = createHashRouter([
36
+ {
37
+ path: '/',
38
+ element: <Layout />,
39
+ errorElement: <ErrorBoundary />,
40
+ children: [
41
+ {
42
+ index: true,
43
+ lazy: () => import(`./pages/index`)
44
+ }
45
+ ]
46
+ }
47
+ ]);
48
+
49
+ root.render(
50
+ <% if (flags.addRedux) { %>
51
+ <Provider store={store}>
52
+ <% } %>
53
+ <Suspense fallback={<SuspenseFallback />}>
54
+ <RouterProvider router={router} />
55
+ </Suspense>
56
+ <% if (flags.addRedux) { %>
57
+ </Provider>
58
+ <% } %>
59
+ )
60
+ }
@@ -0,0 +1,3 @@
1
+ export const Component = () => {
2
+ return <h1>Hello World</h1>;
3
+ };
@@ -0,0 +1,36 @@
1
+ import { ActionObject, AppState } from '../types';
2
+ import { buildActions } from '../utils';
3
+
4
+ export const types = buildActions('application', ['INIT_APP']);
5
+
6
+ const initApp = () => ({
7
+ type: types.INIT_APP
8
+ });
9
+
10
+ export const actions = {
11
+ initApp
12
+ };
13
+
14
+ export const initialState: AppState = {
15
+ application: {
16
+ inited: false
17
+ }
18
+ };
19
+
20
+ export const reducer = (
21
+ state: AppState = initialState,
22
+ action: ActionObject = {}
23
+ ) => {
24
+ switch (action.type) {
25
+ case types.INIT_APP:
26
+ return {
27
+ ...state,
28
+ application: {
29
+ ...state.application,
30
+ inited: true
31
+ }
32
+ };
33
+ default:
34
+ return state;
35
+ }
36
+ };
@@ -2,6 +2,7 @@ import { combineReducers } from 'redux';
2
2
 
3
3
  import { reducer as application } from './application';
4
4
 
5
+ // Remember to update this when you add a new module
5
6
  export default combineReducers({
6
7
  application
7
8
  });
@@ -0,0 +1,9 @@
1
+ import { all } from 'redux-saga/effects';
2
+
3
+ export const workers: Record<string, CallableFunction> = {};
4
+
5
+ export const watchers: Record<string, CallableFunction> = {};
6
+
7
+ export default function* saga() {
8
+ yield all(Object.values(watchers).map((watcher) => watcher()));
9
+ }
@@ -2,6 +2,7 @@ import { fork } from 'redux-saga/effects';
2
2
 
3
3
  import application from './application';
4
4
 
5
+ // Remember to update this when you add a new module
5
6
  export default function* saga() {
6
7
  yield fork(application);
7
8
  }
@@ -0,0 +1,18 @@
1
+ import { AppState } from '../types';
2
+ import { getApplication, getApplicationInited } from './application';
3
+
4
+ describe('application selectors', () => {
5
+ const state: AppState = {
6
+ application: {
7
+ inited: false
8
+ }
9
+ };
10
+
11
+ it('can getApplication', () => {
12
+ expect(getApplication(state)).toBe(state.application);
13
+ });
14
+
15
+ it('can getApplicationInited', () => {
16
+ expect(getApplicationInited(state).toBe(state.application.inited));
17
+ });
18
+ });
@@ -0,0 +1,6 @@
1
+ import { AppState } from '../types';
2
+
3
+ export const getApplication = (state: AppState) => state.application;
4
+
5
+ export const getApplicationInited = (state: AppState) =>
6
+ getApplication(state).inited;
@@ -0,0 +1 @@
1
+ declare module '*.scss';
@@ -0,0 +1,11 @@
1
+ <% if (flags.addRedux) { %>
2
+ export type AppState = {
3
+ application: {
4
+ inited: boolean;
5
+ };
6
+ };
7
+
8
+ export type ActionObject = {
9
+ type?: string;
10
+ };
11
+ <% } %>
@@ -1,5 +1,5 @@
1
1
  <% if (flags.addJest) { %>
2
- import { createElement } from 'react';
2
+ import { createElement, ComponentProps } from 'react';
3
3
  <% } %>
4
4
 
5
5
  <% if (flags.addRedux) { %>
@@ -28,9 +28,9 @@ export function buildActions(reducer, actions) {
28
28
  * Creates a mock component which will expose its props for snapshot testing purposes.
29
29
  *
30
30
  * @param {string} name The component/element name (e.g. "MyComponent")
31
- * @param {object} props An object containing props to setup
31
+ * @param {ComponentProps} props An object containing props to set
32
32
  * @return {object} Mock component with specified name and props
33
33
  */
34
- export const mockComponent = (name, props = {}) => () =>
34
+ export const mockComponent = (name: string, props: ComponentProps = {}) => () =>
35
35
  createElement(name, props, props.children);
36
36
  <% } %>
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "esnext",
4
+ "lib": ["esnext", "dom", "dom.iterable"],
5
+ "module": "esnext",
6
+ "moduleResolution": "bundler",
7
+ "rootDir": ".",
8
+ <% if (flags.addJest) { %>
9
+ "types": ["jest"],
10
+ <% } %>
11
+ <% if (styleFramework === 'uikit') { %>
12
+ // uikit-react ships a broken index.d.ts that would otherwise fail the build
13
+ "skipLibCheck": true,
14
+ <% } %>
15
+ "jsx": "react-jsx"
16
+ },
17
+ "include": ["src/", ".storybook/"]
18
+ }
@@ -0,0 +1,121 @@
1
+ import { fileURLToPath } from 'url';
2
+ import { dirname, resolve } from 'path';
3
+ import autoprefixer from 'autoprefixer';
4
+ import HtmlPlugin from 'html-webpack-plugin';
5
+ import ESLintPlugin from 'eslint-webpack-plugin';
6
+ import TerserPlugin from 'terser-webpack-plugin';
7
+ <% if (flags.addCnamePlugin) { %>
8
+ import CnameWebpackPlugin from 'cname-webpack-plugin';
9
+ <% } %>
10
+ import StylelintPlugin from 'stylelint-webpack-plugin';
11
+ import postcssFlexbugsFixes from 'postcss-flexbugs-fixes';
12
+ import MiniCssExtractPlugin from 'mini-css-extract-plugin';
13
+ import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
14
+ import { type Configuration, type WebpackPluginInstance } from 'webpack';
15
+ import { CleanWebpackPlugin as CleanPlugin } from 'clean-webpack-plugin';
16
+
17
+ import 'webpack-dev-server';
18
+
19
+ const dev = process.env.NODE_ENV === 'development';
20
+
21
+ const plugins: WebpackPluginInstance[] = [
22
+ new CleanPlugin(),
23
+ new HtmlPlugin({
24
+ template: './src/index.html'
25
+ }),
26
+ new MiniCssExtractPlugin(),
27
+ <% if (flags.addCnamePlugin) { %>
28
+ new CnameWebpackPlugin({
29
+ domain: '<%= deploy.domain %>'
30
+ })
31
+ <% } %>
32
+ ];
33
+
34
+ if (dev) {
35
+ plugins.push(
36
+ new StylelintPlugin({
37
+ configFile: '.stylelintrc',
38
+ context: 'src',
39
+ files: '**/*.scss',
40
+ failOnError: true,
41
+ quiet: false,
42
+ customSyntax: 'postcss-scss'
43
+ }),
44
+ new ESLintPlugin()
45
+ );
46
+ }
47
+
48
+ const config: Configuration = {
49
+ mode: dev ? 'development' : 'production',
50
+ devtool: dev ? 'eval-cheap-module-source-map' : false,
51
+ entry: './src/index.tsx',
52
+ devServer: {
53
+ open: true,
54
+ historyApiFallback: true,
55
+ client: {
56
+ overlay: {
57
+ warnings: false
58
+ }
59
+ }
60
+ },
61
+ module: {
62
+ rules: [
63
+ {
64
+ test: /\.tsx?$/,
65
+ use: ['ts-loader'],
66
+ exclude: [/\.stories\.tsx$/, /node_modules/]
67
+ },
68
+ {
69
+ test: /\.(sa|sc|c)ss$/,
70
+ use: [
71
+ MiniCssExtractPlugin.loader,
72
+ 'css-loader',
73
+ {
74
+ loader: 'postcss-loader',
75
+ options: {
76
+ postcssOptions: {
77
+ ident: 'postcss',
78
+ plugins: [autoprefixer, postcssFlexbugsFixes]
79
+ },
80
+ sourceMap: dev
81
+ }
82
+ },
83
+ {
84
+ loader: 'sass-loader',
85
+ options: {
86
+ sassOptions: {
87
+ quietDeps: true
88
+ }
89
+ }
90
+ }
91
+ ]
92
+ },
93
+ {
94
+ test: /\.html$/,
95
+ use: [
96
+ {
97
+ loader: 'html-loader',
98
+ options: { minimize: true }
99
+ }
100
+ ]
101
+ }
102
+ ]
103
+ },
104
+ output: {
105
+ path: resolve(dirname(fileURLToPath(import.meta.url)), 'dist'),
106
+ filename: '[name].js',
107
+ chunkFilename: '[name].js',
108
+ publicPath: '/'
109
+ },
110
+ plugins,
111
+ resolve: {
112
+ extensions: ['.js', '.ts', '.tsx', '.json'],
113
+ modules: ['node_modules', 'src']
114
+ },
115
+ optimization: {
116
+ minimizer: [new TerserPlugin(), new CssMinimizerPlugin()]
117
+ },
118
+ ignoreWarnings: [/import rules are/]
119
+ };
120
+
121
+ export default config;
@@ -0,0 +1,14 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+
3
+ import <%= component.name %> from './<%= component.name %>';
4
+
5
+ const meta = {
6
+ title: 'Components/<%= component.name %>',
7
+ component: <%= component.name %>
8
+ } satisfies Meta<typeof <%= component.name %>>;
9
+
10
+ export default meta;
11
+
12
+ type Story = StoryObj<typeof meta>;
13
+
14
+ export const Default: Story = {};
@@ -1,12 +1,9 @@
1
- import React, { Component } from 'react';
2
1
  <% if (flags.addRedux) { %>
3
2
  import { connect } from 'react-redux';
4
3
  <% } %>
5
4
 
6
- export class <%= component.name %> extends Component {
7
- render() {
8
- return <h1>Hello World</h1>;
9
- }
5
+ export default function <%= component.name %>() {
6
+ return <h1>Hello World</h1>;
10
7
  }
11
8
 
12
9
  <% if (flags.addRedux) { %>
@@ -1 +0,0 @@
1
- "use strict";var e=require("../internals/descriptors"),r=require("../internals/object-define-property"),t=require("../internals/regexp-flags"),i=require("../internals/fails"),s=RegExp.prototype;e&&i((function(){return"sy"!==Object.getOwnPropertyDescriptor(s,"flags").get.call({dotAll:!0,sticky:!0})}))&&r.f(s,"flags",{configurable:!0,get:t});
@@ -1,9 +0,0 @@
1
- {
2
- "presets": ["@babel/preset-env", ["@babel/preset-react", { "runtime": "automatic" }]],
3
- "plugins": [
4
- "@babel/plugin-proposal-class-properties",
5
- "@babel/plugin-proposal-object-rest-spread",
6
- "@babel/plugin-transform-runtime",
7
- "@babel/plugin-transform-regenerator"
8
- ]
9
- }
@@ -1,185 +0,0 @@
1
- const path = require('path');
2
-
3
- module.exports = {
4
- "env": {
5
- "browser": true,
6
- "es2020": true,
7
- <% if (flags.addJest) { %>
8
- "jest": true,
9
- <% } %>
10
- "node": true
11
- },
12
- "extends": [
13
- "eslint:recommended",
14
- "plugin:react/recommended",
15
- "plugin:prettier/recommended",
16
- "plugin:jsx-a11y/recommended",
17
- "plugin:import/recommended",
18
- "plugin:react-hooks/recommended",
19
- <% if (flags.addJest) { %>
20
- "plugin:jest/recommended"
21
- <% } %>
22
- ],
23
- "parser": "@babel/eslint-parser",
24
- "parserOptions": {
25
- "requireConfigFile": false,
26
- "ecmaFeatures": {
27
- "jsx": true
28
- },
29
- "ecmaVersion": 12
30
- },
31
- "rules": {
32
- "accessor-pairs": 2,
33
- "block-scoped-var": 2,
34
- "callback-return": 0,
35
- "camelcase": 2,
36
- "complexity": 0,
37
- "consistent-return": 0,
38
- "consistent-this": [2, "self"],
39
- "constructor-super": 2,
40
- "curly": 2,
41
- "default-case": 2,
42
- "dot-notation": 2,
43
- "eol-last": 0,
44
- "eqeqeq": 2,
45
- "func-names": [2, "never"],
46
- "func-style": [2, "declaration", { "allowArrowFunctions": true }],
47
- "guard-for-in": 2,
48
- "handle-callback-err": 0,
49
- "id-length": 0,
50
- "id-match": 0,
51
- "indent": [0, 4],
52
- "init-declarations": 0,
53
- "linebreak-style": 0,
54
- "lines-around-comment": 0,
55
- "max-depth": 0,
56
- "max-len": 0,
57
- "max-nested-callbacks": 0,
58
- "max-params": 0,
59
- "max-statements": 0,
60
- "new-cap": [2, { "properties": false }],
61
- "newline-after-var": 1,
62
- "no-alert": 2,
63
- "no-array-constructor": 2,
64
- "no-bitwise": 2,
65
- "no-caller": 2,
66
- "no-catch-shadow": 0,
67
- "no-class-assign": 2,
68
- "no-cond-assign": 2,
69
- "no-const-assign": 2,
70
- "no-constant-condition": 2,
71
- "no-continue": 2,
72
- "no-control-regex": 2,
73
- "no-delete-var": 2,
74
- "no-div-regex": 2,
75
- "no-dupe-args": 2,
76
- "no-dupe-keys": 2,
77
- "no-duplicate-case": 2,
78
- "no-else-return": 0,
79
- "no-empty-character-class": 2,
80
- "no-empty": 2,
81
- "no-eq-null": 2,
82
- "no-eval": 2,
83
- "no-ex-assign": 2,
84
- "no-extend-native": 2,
85
- "no-extra-bind": 2,
86
- "no-extra-boolean-cast": 2,
87
- "no-extra-parens": 0,
88
- "no-fallthrough": 2,
89
- "no-floating-decimal": 2,
90
- "no-func-assign": 2,
91
- "no-implicit-coercion": 2,
92
- "no-implied-eval": 2,
93
- "no-inline-comments": 0,
94
- "no-inner-declarations": 2,
95
- "no-invalid-regexp": 2,
96
- "no-invalid-this": 2,
97
- "no-irregular-whitespace": 1,
98
- "no-iterator": 2,
99
- "no-label-var": 2,
100
- "no-labels": 2,
101
- "no-lone-blocks": 2,
102
- "no-lonely-if": 2,
103
- "no-loop-func": 2,
104
- "no-mixed-requires": 2,
105
- "no-multi-str": 2,
106
- "no-native-reassign": 2,
107
- "no-negated-in-lhs": 2,
108
- "no-nested-ternary": 2,
109
- "no-new-func": 2,
110
- "no-new-object": 2,
111
- "no-new-require": 2,
112
- "no-new-wrappers": 2,
113
- "no-new": 2,
114
- "no-obj-calls": 2,
115
- "no-octal-escape": 2,
116
- "no-octal": 2,
117
- "no-param-reassign": 0,
118
- "no-path-concat": 2,
119
- "no-plusplus": 0,
120
- "no-process-env": 0,
121
- "no-process-exit": 2,
122
- "no-proto": 2,
123
- "no-redeclare": 2,
124
- "no-regex-spaces": 2,
125
- "no-restricted-modules": 2,
126
- "no-return-assign": 2,
127
- "no-script-url": 2,
128
- "no-self-compare": 2,
129
- "no-sequences": 2,
130
- "no-shadow-restricted-names": 0,
131
- "no-shadow": 2,
132
- "no-sparse-arrays": 2,
133
- "no-sync": 2,
134
- "no-ternary": 0,
135
- "no-this-before-super": 2,
136
- "no-throw-literal": 2,
137
- "no-undef-init": 2,
138
- "no-undef": 2,
139
- "no-undefined": 0,
140
- "no-underscore-dangle": 2,
141
- "no-unexpected-multiline": 2,
142
- "no-unneeded-ternary": 0,
143
- "no-unreachable": 2,
144
- "no-unused-expressions": 2,
145
- "no-unused-vars": 2,
146
- "no-use-before-define": 2,
147
- "no-useless-call": 2,
148
- "no-var": 0,
149
- "no-void": 0,
150
- "no-warning-comments": 1,
151
- "no-with": 2,
152
- "object-shorthand": 0,
153
- "one-var": 0,
154
- "operator-assignment": 2,
155
- "prefer-const": 2,
156
- "prefer-spread": 0,
157
- "radix": 2,
158
- "require-yield": 2,
159
- "sort-vars": 0,
160
- "space-return-throw-case": 0,
161
- "spaced-comment": 1,
162
- "strict": [2, "function"],
163
- "use-isnan": 2,
164
- "valid-jsdoc": 0,
165
- "valid-typeof": 2,
166
- "vars-on-top": 2,
167
- "yoda": 2,
168
- "no-console": 2,
169
- "no-debugger": 2,
170
- "prettier/prettier": 2,
171
- "jsx-a11y/label-has-for": 0,
172
- "react/jsx-uses-react": 0,
173
- "react/react-in-jsx-scope": 0
174
- },
175
- "settings": {
176
- "react": {
177
- "version": "detect"
178
- },
179
- "import/resolver": {
180
- "webpack": {
181
- "config": path.join(__dirname, 'webpack.config.babel.js')
182
- }
183
- }
184
- }
185
- };
@@ -1 +0,0 @@
1
- import '@storybook/addon-knobs/register';
@@ -1,14 +0,0 @@
1
- import { withKnobs } from '@storybook/addon-knobs';
2
- import { configure, addDecorator } from '@storybook/react';
3
-
4
- import '../src/index.scss';
5
-
6
- function loadStories() {
7
- const req = require.context('../src/components', true, /\.stories\.js$/);
8
-
9
- req.keys().forEach(filename => req(filename));
10
- }
11
-
12
- addDecorator(withKnobs);
13
-
14
- configure(loadStories, module);
@@ -1,7 +0,0 @@
1
- import webpack from '../webpack.config.babel';
2
-
3
- export default async ({ config }) => ({
4
- ...config,
5
- module: webpack.module,
6
- resolve: webpack.resolve
7
- });
@@ -1,8 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "jsx": "react",
5
- "baseUrl": "./src"
6
- },
7
- "include": ["src/"]
8
- }
@@ -1,14 +0,0 @@
1
- <% if (flags.addRedux) { %>
2
- import { connect } from 'react-redux';
3
- <% } %>
4
-
5
- export default function App() {
6
- return <h1>Hello World</h1>;
7
- }
8
-
9
- <% if (flags.addRedux) { %>
10
- export default connect(
11
- null,
12
- null
13
- )(App);
14
- <% } %>
@@ -1,4 +0,0 @@
1
- import { library } from '@fortawesome/fontawesome-svg-core';
2
- import { faCircle } from '@fortawesome/free-solid-svg-icons';
3
-
4
- library.add(faCircle);
@@ -1,50 +0,0 @@
1
- import 'core-js/stable';
2
- import 'regenerator-runtime/runtime';
3
-
4
- import ReactDOM from 'react-dom';
5
- import { BrowserRouter as Router } from 'react-router-dom';
6
- <% if (flags.addRedux) { %>
7
- import { Provider } from 'react-redux';
8
- import createSagaMiddleware from 'redux-saga';
9
- import { applyMiddleware, createStore, compose } from 'redux';
10
- <% } %>
11
-
12
- <% if (flags.addFontAwesome) { %>
13
- import './icons.js';
14
- <% } %>
15
- import './index.scss';
16
- import App from './components/App';
17
- <% if (flags.addRedux) { %>
18
- import rootSaga from './sagas';
19
- import rootReducer from './reducers';
20
-
21
- /* eslint-disable no-underscore-dangle */
22
- const composer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
23
- /* eslint-enable */
24
-
25
- const sagaMiddleware = createSagaMiddleware();
26
- const enhancers = composer(applyMiddleware(sagaMiddleware));
27
-
28
- export const store = createStore(rootReducer, {}, enhancers);
29
-
30
- if (module.hot) {
31
- module.hot.accept('./reducers', () => {
32
- store.replaceReducer(require('./reducers').default);
33
- });
34
- }
35
-
36
- sagaMiddleware.run(rootSaga);
37
- <% } %>
38
-
39
- ReactDOM.render(
40
- <Router>
41
- <% if (flags.addRedux) { %>
42
- <Provider store={store}>
43
- <App />
44
- </Provider>
45
- <% } else { %>
46
- <App />
47
- <% } %>
48
- </Router>,
49
- document.getElementById('root')
50
- );