Skip to content

Commit 5c8e34c

Browse files
committed
#RI-4567 - Refactoring main.dev.js
1 parent bd76a67 commit 5c8e34c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+930
-825
lines changed

.eslintrc.js

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,63 @@
11
module.exports = {
22
root: true,
3+
env: {
4+
node: true,
5+
},
36
extends: ['airbnb-typescript'],
47
plugins: ['@typescript-eslint'],
58
parser: '@typescript-eslint/parser',
69
rules: {
7-
'max-len': ['warn', 120],
10+
semi: ['error', 'never'],
11+
quotes: [2, 'single', { avoidEscape: true }],
12+
'max-len': ['error', { ignoreComments: true, ignoreStrings: true, ignoreRegExpLiterals: true, code: 120 }],
813
'class-methods-use-this': 'off',
914
'import/no-extraneous-dependencies': 'off', // temporary disabled
15+
'@typescript-eslint/semi': ['error', 'never'],
16+
'object-curly-newline': 'off',
17+
'import/prefer-default-export': 'off',
18+
'@typescript-eslint/comma-dangle': 'off',
19+
'implicit-arrow-linebreak': 'off',
20+
'import/order': [
21+
1,
22+
{
23+
groups: [
24+
'external',
25+
'builtin',
26+
'internal',
27+
'sibling',
28+
'parent',
29+
'index',
30+
],
31+
pathGroups: [
32+
{
33+
pattern: 'desktopSrc/**',
34+
group: 'internal',
35+
position: 'after'
36+
},
37+
{
38+
pattern: 'uiSrc/**',
39+
group: 'internal',
40+
position: 'after'
41+
},
42+
{
43+
pattern: 'apiSrc/**',
44+
group: 'internal',
45+
position: 'after'
46+
},
47+
],
48+
warnOnUnassignedImports: true,
49+
pathGroupsExcludedImportTypes: ['builtin']
50+
},
51+
],
1052
},
1153
parserOptions: {
1254
project: './tsconfig.json',
55+
ecmaVersion: 2020,
56+
sourceType: 'module',
57+
createDefaultProgram: true,
1358
},
1459
ignorePatterns: [
1560
'redisinsight/ui',
61+
'redisinsight/api',
1662
],
17-
};
63+
}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ lerna-debug.log*
3636
.vscode
3737

3838
# App packaged
39-
redisinsight/electron/preload.js
4039
release
4140
main.prod.js
4241
main.prod.js.map

configs/webpack.config.base.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ const configuration: webpack.Configuration = {
3535
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx', '.scss'],
3636
modules: [webpackPaths.apiPath, 'node_modules'],
3737
plugins: [new TsconfigPathsPlugins()],
38-
alias: {
39-
src: webpackPaths.apiSrcPath,
40-
apiSrc: webpackPaths.apiSrcPath,
41-
uiSrc: webpackPaths.uiSrcPath,
42-
},
4338
},
4439

4540
plugins: [

configs/webpack.config.main.prod.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,8 @@ export default merge(baseConfig, {
2424
target: 'electron-main',
2525

2626
entry: {
27-
main: path.join(webpackPaths.electronPath, 'main.dev.ts'),
28-
preload: path.join(webpackPaths.electronPath, 'preload.ts'),
29-
},
30-
31-
resolve: {
32-
alias: {
33-
['apiSrc']: webpackPaths.apiSrcPath,
34-
['src']: webpackPaths.apiSrcPath,
35-
},
36-
extensions: ['.tsx', '.ts', '.js', '.jsx'],
27+
main: path.join(webpackPaths.desktopPath, 'index.ts'),
28+
preload: path.join(webpackPaths.desktopPath, 'preload.ts'),
3729
},
3830

3931
output: {

configs/webpack.config.preload.dev.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const configuration: webpack.Configuration = {
1212

1313
target: 'electron-preload',
1414

15-
entry: path.join(webpackPaths.electronPath, 'preload.ts'),
15+
entry: path.join(webpackPaths.desktopPath, 'preload.ts'),
1616

1717
output: {
1818
path: webpackPaths.dllPath,

configs/webpack.config.renderer.dev.dll.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default merge(baseConfig, {
5454
new webpack.LoaderOptionsPlugin({
5555
debug: true,
5656
options: {
57-
context: webpackPaths.electronPath,
57+
context: webpackPaths.desktopPath,
5858
output: {
5959
path: webpackPaths.dllPath,
6060
},

configs/webpack.config.renderer.dev.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,14 @@ const configuration: webpack.Configuration = {
5151
],
5252

5353
output: {
54-
path: webpackPaths.electronPath,
54+
path: webpackPaths.desktopPath,
5555
publicPath: '/',
5656
filename: 'renderer.dev.js',
5757
library: {
5858
type: 'umd',
5959
},
6060
},
6161

62-
resolve: {
63-
alias: {
64-
src: webpackPaths.apiSrcPath,
65-
apiSrc: webpackPaths.apiSrcPath,
66-
uiSrc: webpackPaths.uiSrcPath,
67-
},
68-
},
69-
7062
module: {
7163
rules: [
7264
{
@@ -243,7 +235,7 @@ const configuration: webpack.Configuration = {
243235

244236
new HtmlWebpackPlugin({
245237
filename: path.join('index.html'),
246-
template: path.join(webpackPaths.electronPath, 'index.ejs'),
238+
template: path.join(webpackPaths.desktopPath, 'index.ejs'),
247239
minify: {
248240
collapseWhitespace: true,
249241
removeAttributeQuotes: true,

configs/webpack.config.renderer.prod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ const configuration: webpack.Configuration = {
189189

190190
new HtmlWebpackPlugin({
191191
filename: 'index.html',
192-
template: path.join(webpackPaths.electronPath, 'index.ejs'),
192+
template: path.join(webpackPaths.desktopPath, 'index.ejs'),
193193
isBrowser: false,
194194
isDevelopment: false,
195195
}),

configs/webpack.config.web.common.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import webpack from 'webpack';
66
import HtmlWebpackPlugin from 'html-webpack-plugin';
77
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
88
import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin';
9+
import webpackPaths from './webpack.paths';
910
import { dependencies as externals } from '../redisinsight/package.json';
1011
import { dependencies as externalsApi } from '../redisinsight/api/package.json';
1112

@@ -18,12 +19,11 @@ export default {
1819
rules: [
1920
{
2021
test: /\.(js|jsx|ts|tsx)?$/,
21-
// exclude: /node_modules/,
22-
include: [path.resolve(__dirname, '../redisinsight/ui')],
22+
include: [webpackPaths.uiPath],
2323
exclude: [
2424
/node_modules/,
25-
path.resolve(__dirname, '../redisinsight/api'),
26-
path.resolve(__dirname, '../redisinsight/electron'),
25+
webpackPaths.apiPath,
26+
webpackPaths.desktopPath,
2727
],
2828
use: {
2929
loader: 'babel-loader',
@@ -44,8 +44,7 @@ export default {
4444
],
4545
},
4646

47-
// context: path.resolve(__dirname, '../redisinsight/api/src'),
48-
context: path.resolve(__dirname, '../redisinsight/ui'),
47+
context: webpackPaths.uiPath,
4948

5049
/**
5150
* Determine the array of extensions that should be used to resolve modules.

configs/webpack.paths.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ const apiPath = path.join(riPath, 'api');
88
const uiPath = path.join(riPath, 'ui');
99
const apiSrcPath = path.join(apiPath, 'src');
1010
const uiSrcPath = path.join(uiPath, 'src');
11-
const electronPath = path.join(riPath, 'electron');
12-
const srcMainPath = path.join(electronPath, 'main');
11+
const desktopPath = path.join(riPath, 'desktop');
12+
const desktopSrcPath = path.join(desktopPath, 'src');
1313

14-
const dllPath = path.join(electronPath, 'dll');
14+
const dllPath = path.join(desktopPath, 'dll');
1515

1616
const releasePath = path.join(rootPath, 'release');
1717
const appPackagePath = path.join(riPath, 'package.json');
@@ -32,9 +32,9 @@ export default {
3232
riPath,
3333
apiSrcPath,
3434
uiSrcPath,
35-
srcMainPath,
3635
releasePath,
37-
electronPath,
36+
desktopPath,
37+
desktopSrcPath,
3838
appPackagePath,
3939
appNodeModulesPath,
4040
srcNodeModulesPath,

0 commit comments

Comments
 (0)