Skip to content

Commit 471b385

Browse files
committed
#RI-5411 - Optimize builds
1 parent f965a9a commit 471b385

File tree

9 files changed

+56
-34
lines changed

9 files changed

+56
-34
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ vendor
7070
redisinsight/main.js.LICENSE.txt
7171
redisinsight/main.prod.js.LICENSE.txt
7272
licenses
73+
redisinsight/ui/src/packages/common/index*
7374

7475

7576
# E2E tests report

redisinsight/ui/src/packages/redisgraph/src/styles/styles.less renamed to redisinsight/ui/src/packages/redisgraph/src/styles/styles.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
@charset "UTF-8";
2-
// @import (less) "_dark_theme.less";
3-
// @import (less) "_light_theme.less";
42

53
* {
64
margin: 0px;

redisinsight/ui/src/packages/redistimeseries-app/src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { render } from 'react-dom'
44
import { appendIconComponentCache } from '@elastic/eui/es/components/icon/icon'
55
import { icon as EuiIconArrowRight } from '@elastic/eui/es/components/icon/assets/arrow_right'
66
import App from './App'
7-
import './styles/styles.less'
7+
import './styles/styles.scss'
88
import result from '../mockData/resultTimeSeries.json'
99

1010
appendIconComponentCache({
File renamed without changes.

redisinsight/ui/src/packages/ri-explain/src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { icon as EuiIconReportingApp } from '@elastic/eui/es/components/icon/ass
1212
import { icon as EuiIconArrowUp } from '@elastic/eui/es/components/icon/assets/arrow_up'
1313
import { icon as EuiIconArrowDown } from '@elastic/eui/es/components/icon/assets/arrow_down'
1414
import { App } from './App'
15-
import './styles/styles.less'
15+
import './styles/styles.scss'
1616
import result from '../mockData/resultExplain.json'
1717

1818
interface Props {

redisinsight/ui/src/packages/ri-explain/src/parser.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class Lexer {
9595
}
9696
this.Position = this.ReadPosition++
9797
}
98-
98+
9999
PeekChar() {
100100
if (this.ReadPosition >= this.Input.length) {
101101
return null
@@ -158,7 +158,7 @@ class Lexer {
158158

159159
ReadNumber(): string {
160160
let str = ''
161-
while (this.C !== undefined && (isDigit(this.C) || this.C === '.') && parseFloat(str + this.C) != NaN) {
161+
while (this.C !== undefined && (isDigit(this.C) || this.C === '.') && !Number.isNaN(parseFloat(str + this.C))) {
162162
str = str + this.C
163163
this.ReadChar()
164164
}
@@ -477,7 +477,7 @@ class Parser {
477477

478478
constructor(l: Lexer) {
479479
this.L = l
480-
480+
481481
this.Errors = []
482482
this.CurrentToken = new Token(TokenType.INIT, '')
483483
this.PeekToken = new Token(TokenType.INIT, '')
@@ -821,7 +821,7 @@ class Parser {
821821
this.nextToken()// read off RBRACE
822822

823823
// assertToken(TokenType.NEW_LINE, this.CurrentToken?.T)
824-
//
824+
//
825825
// this.nextToken() // read off new line
826826

827827
return new NumericExpr(left !== 'inf' ? parseFloat(left) : Infinity, lsign, identifier, rsign, right !== 'inf' ? parseFloat(right) : Infinity)
@@ -833,7 +833,7 @@ function Parse(data: string): SearchExpr {
833833
const l = new Lexer(data)
834834

835835
let p = new Parser(l)
836-
836+
837837
const t = p.CurrentToken.T;
838838

839839
if (p.CurrentToken?.T === TokenType.NUMERIC) {
@@ -1114,7 +1114,7 @@ export function ParseGraphV2(output: string[]) {
11141114
let children: EntityInfo[] = []
11151115

11161116
let pairs: [number, number][] = []
1117-
1117+
11181118
let s: number | null = null, e: number | null = null
11191119
let i = 1
11201120

redisinsight/ui/src/packages/ri-explain/src/styles/styles.less renamed to redisinsight/ui/src/packages/ri-explain/src/styles/styles.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
@charset "UTF-8";
2-
// @import "_dark_theme.less";
3-
// @import "_light_theme.less";
42

53
* {
64
margin: 0px;

scripts/build-statics.cmd

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,45 +13,61 @@ xcopy ".\redisinsight\ui\src\assets\fonts\inconsolata" ".\vendor\fonts\" /s /e /
1313
if not exist %PLUGINS_VENDOR_DIR% mkdir %PLUGINS_VENDOR_DIR%
1414
xcopy ".\vendor\." "%PLUGINS_VENDOR_DIR%" /s /e /y
1515

16-
:: Build all plugins and common libraries
16+
:: Install developing tools for plugins
1717
set REDISEARCH_DIR=".\redisinsight\ui\src\packages"
18-
call yarn --cwd "%REDISEARCH_DIR%" build
18+
call yarn --cwd "%REDISEARCH_DIR%"
1919

20-
:: Copy redisearch plugin
20+
:: Install plugins dependencies
2121
set REDISEARCH_DIR=".\redisinsight\ui\src\packages\redisearch"
2222
call yarn --cwd "%REDISEARCH_DIR%"
23+
24+
set REDISGRAPH_DIR=".\redisinsight\ui\src\packages\redisgraph"
25+
call yarn --cwd "%REDISGRAPH_DIR%"
26+
27+
set REDISTIMESERSIES_DIR=".\redisinsight\ui\src\packages\redistimeseries-app"
28+
call yarn --cwd "%REDISTIMESERSIES_DIR%"
29+
30+
set RI_EXPLIAIN_DIR=".\redisinsight\ui\src\packages\ri-explain"
31+
call yarn --cwd "%RI_EXPLIAIN_DIR%"
32+
33+
set CLIENTS_LIST_DIR=".\redisinsight\ui\src\packages\clients-list"
34+
call yarn --cwd "%CLIENTS_LIST_DIR%"
35+
36+
:: Build all plugins and common libraries
37+
call yarn --cwd "%REDISEARCH_DIR%" build
38+
39+
:: Copy common libraries to plugins
40+
set COMMON_DIR=".\redisinsight\ui\src\packages\common"
41+
if not exist "%PLUGINS_DIR%\common" mkdir "%PLUGINS_DIR%\common"
42+
xcopy /E /Y "%COMMON_DIR%\index*.js" "%PLUGINS_DIR%\common"
43+
copy "%COMMON_DIR%\package.json" "%PLUGINS_DIR%\common\"
44+
45+
46+
:: Copy redisearch plugin
2347
if not exist "%PLUGINS_DIR%\redisearch" mkdir "%PLUGINS_DIR%\redisearch"
2448
if not exist "%PLUGINS_DIR%\redisearch\dist" mkdir "%PLUGINS_DIR%\redisearch\dist"
2549
xcopy "%REDISEARCH_DIR%\dist" "%PLUGINS_DIR%\redisearch\dist\" /s /e /y
2650
copy "%REDISEARCH_DIR%\package.json" "%PLUGINS_DIR%\redisearch\"
2751

2852
:: Copy redisgraph plugin
29-
set REDISGRAPH_DIR=".\redisinsight\ui\src\packages\redisgraph"
30-
call yarn --cwd "%REDISGRAPH_DIR%"
3153
if not exist "%PLUGINS_DIR%\redisgraph" mkdir "%PLUGINS_DIR%\redisgraph"
3254
if not exist "%PLUGINS_DIR%\redisgraph\dist" mkdir "%PLUGINS_DIR%\redisgraph\dist"
3355
xcopy "%REDISGRAPH_DIR%\dist" "%PLUGINS_DIR%\redisgraph\dist\" /s /e /y
3456
copy "%REDISGRAPH_DIR%\package.json" "%PLUGINS_DIR%\redisgraph\"
3557

3658
:: Copy redistimeseries plugin
37-
set REDISTIMESERSIES_DIR=".\redisinsight\ui\src\packages\redistimeseries-app"
38-
call yarn --cwd "%REDISTIMESERSIES_DIR%"
3959
if not exist "%PLUGINS_DIR%\redistimeseries-app" mkdir "%PLUGINS_DIR%\redistimeseries-app"
4060
if not exist "%PLUGINS_DIR%\redistimeseries-app\dist" mkdir "%PLUGINS_DIR%\redistimeseries-app\dist"
4161
xcopy "%REDISTIMESERSIES_DIR%\dist" "%PLUGINS_DIR%\redistimeseries-app\dist\" /s /e /y
4262
copy "%REDISTIMESERSIES_DIR%\package.json" "%PLUGINS_DIR%\redistimeseries-app\"
4363

4464
:: Copy ri-explain plugin
45-
set RI_EXPLIAIN_DIR=".\redisinsight\ui\src\packages\ri-explain"
46-
call yarn --cwd "%RI_EXPLIAIN_DIR%"
4765
if not exist "%PLUGINS_DIR%\ri-explain" mkdir "%PLUGINS_DIR%\ri-explain"
4866
if not exist "%PLUGINS_DIR%\ri-explain\dist" mkdir "%PLUGINS_DIR%\ri-explain\dist"
4967
xcopy "%RI_EXPLIAIN_DIR%\dist" "%PLUGINS_DIR%\ri-explain\dist\" /s /e /y
5068
copy "%RI_EXPLIAIN_DIR%\package.json" "%PLUGINS_DIR%\ri-explain\"
5169

5270
:: Copy clients-list and json plugin
53-
set CLIENTS_LIST_DIR=".\redisinsight\ui\src\packages\clients-list"
54-
call yarn --cwd "%CLIENTS_LIST_DIR%"
5571
if not exist "%PLUGINS_DIR%\clients-list" mkdir "%PLUGINS_DIR%\clients-list"
5672
if not exist "%PLUGINS_DIR%\clients-list\dist" mkdir "%PLUGINS_DIR%\clients-list\dist"
5773
xcopy "%CLIENTS_LIST_DIR%\dist" "%PLUGINS_DIR%\clients-list\dist\" /s /e /y

scripts/build-statics.sh

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,27 @@ mkdir -p "${PLUGINS_VENDOR_DIR}"
1717
cp -R "./vendor/." "${PLUGINS_VENDOR_DIR}"
1818

1919

20-
# Build all plugins and common libraries
20+
# Install developing tools for plugins
2121
PACKAGES_DIR="./redisinsight/ui/src/packages"
22+
yarn --cwd "${PACKAGES_DIR}"
23+
24+
# Install plugins dependencies
25+
REDISEARCH_DIR="./redisinsight/ui/src/packages/redisearch"
26+
yarn --cwd "${REDISEARCH_DIR}"
27+
28+
REDISGRAPH_DIR="./redisinsight/ui/src/packages/redisgraph"
29+
yarn --cwd "${REDISGRAPH_DIR}"
30+
31+
REDISTIMESERIES_DIR="./redisinsight/ui/src/packages/redistimeseries-app"
32+
yarn --cwd "${REDISTIMESERIES_DIR}"
33+
34+
RI_EXPLIAIN_DIR="./redisinsight/ui/src/packages/ri-explain"
35+
yarn --cwd "${RI_EXPLIAIN_DIR}"
36+
37+
CLIENTS_LIST_DIR="./redisinsight/ui/src/packages/clients-list"
38+
yarn --cwd "${CLIENTS_LIST_DIR}"
39+
40+
# Build all plugins and common libraries
2241
yarn --cwd "${PACKAGES_DIR}" build
2342

2443
# Copy common libraries to plugins
@@ -29,41 +48,31 @@ if [ $pluginsOnlyInstall != 1 ]; then
2948
fi
3049

3150
# Copy redisearch plugin
32-
REDISEARCH_DIR="./redisinsight/ui/src/packages/redisearch"
33-
yarn --cwd "${REDISEARCH_DIR}"
3451
if [ $pluginsOnlyInstall != 1 ]; then
3552
mkdir -p "${PLUGINS_DIR}/redisearch"
3653
cp -R "${REDISEARCH_DIR}/dist" "${REDISEARCH_DIR}/package.json" "${PLUGINS_DIR}/redisearch"
3754
fi
3855

3956

4057
# Copy redisgraph plugin
41-
REDISGRAPH_DIR="./redisinsight/ui/src/packages/redisgraph"
42-
yarn --cwd "${REDISGRAPH_DIR}"
4358
if [ $pluginsOnlyInstall != 1 ]; then
4459
mkdir -p "${PLUGINS_DIR}/redisgraph"
4560
cp -R "${REDISGRAPH_DIR}/dist" "${REDISGRAPH_DIR}/package.json" "${PLUGINS_DIR}/redisgraph"
4661
fi
4762

4863
# Copy timeseries plugin
49-
REDISTIMESERIES_DIR="./redisinsight/ui/src/packages/redistimeseries-app"
50-
yarn --cwd "${REDISTIMESERIES_DIR}"
5164
if [ $pluginsOnlyInstall != 1 ]; then
5265
mkdir -p "${PLUGINS_DIR}/redistimeseries-app"
5366
cp -R "${REDISTIMESERIES_DIR}/dist" "${REDISTIMESERIES_DIR}/package.json" "${PLUGINS_DIR}/redistimeseries-app"
5467
fi
5568

5669
# Copy ri-explain plugin
57-
RI_EXPLIAIN_DIR="./redisinsight/ui/src/packages/ri-explain"
58-
yarn --cwd "${RI_EXPLIAIN_DIR}"
5970
if [ $pluginsOnlyInstall != 1 ]; then
6071
mkdir -p "${PLUGINS_DIR}/ri-explain"
6172
cp -R "${RI_EXPLIAIN_DIR}/dist" "${RI_EXPLIAIN_DIR}/package.json" "${PLUGINS_DIR}/ri-explain"
6273
fi
6374

6475
# Copy clients-list and json plugins
65-
CLIENTS_LIST_DIR="./redisinsight/ui/src/packages/clients-list"
66-
yarn --cwd "${CLIENTS_LIST_DIR}"
6776
if [ $pluginsOnlyInstall != 1 ]; then
6877
mkdir -p "${PLUGINS_DIR}/clients-list"
6978
cp -R "${CLIENTS_LIST_DIR}/dist" "${CLIENTS_LIST_DIR}/package.json" "${PLUGINS_DIR}/clients-list"

0 commit comments

Comments
 (0)