Skip to content

Commit

Permalink
feat: optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxy0551 committed Jul 11, 2024
1 parent 0466ffe commit 00e2546
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
1 change: 0 additions & 1 deletion apps/server/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { ValidationPipe } from './pipe/validation/validation.pipe';
ConfigModule.forRoot({
isGlobal: true,
envFilePath: [
join(__dirname, '../../../', '.env.prod'),
join(__dirname, '../../../', '.env.local'),
join(__dirname, '../../../', '.env'),
],
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ async function bootstrap() {
console.log(`${formatDate()} api docs: http://localhost:${APP_PORT}/docs`);
});
}

bootstrap();
6 changes: 3 additions & 3 deletions apps/web/src/const/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ export const IS_USEFUL_TEXT = [

/**
* 得分的颜色
* red #FF3333 0 ~ 49
* 平均值 orange #FFAA33 50 ~ 79
* green #00CC66 80 ~ 100
* 分数较低 red #FF3333
* 分数中等 orange #FFAA33
* 分数较高 green #00CC66
*/
const scoreColor = {
orangeMin: 50,
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/views/home/components/taskTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ export default function TaskTable(props: IPros) {
<span className="title">操作</span>
<Tooltip title="每 10 秒自动刷新">
<Switch
checkedChildren="自动刷新"
unCheckedChildren="自动刷新"
loading={versionListLoading || loading}
checked={autoRefresh}
onChange={handleAutoRefresh}
Expand Down
3 changes: 2 additions & 1 deletion docker/Dockerfile.server
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ COPY apps/web/package.json ./apps/web/
RUN pnpm install

# 复制项目文件
COPY . .
COPY apps/ ./apps/
COPY .env ./
# 减少 node_modules 的磁盘占用
RUN pnpm build \
&& find . -name "node_modules" -type d -prune -exec rm -rf '{}' + \
Expand Down
6 changes: 2 additions & 4 deletions scripts/deploy.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ $.verbose = false;
$.verbose = true;
// 本地应该使用 `.env.prod` 文件
echo(
await $`gtar -czf yice-performance${testStr}.tar.gz apps/server/dist pm2/config${testStr}.* apps/server/yice-report/README.md apps/web/dist scripts package.json apps/server/package.json apps/web/package.json pnpm-lock.yaml pnpm-workspace.yaml turbo.json .env .env.local ${
isTest ? '' : '.env.prod'
}`
await $`gtar -czf yice-performance${testStr}.tar.gz apps/server/dist pm2/config${testStr}.* apps/server/yice-report/README.md apps/web/dist scripts package.json apps/server/package.json apps/web/package.json pnpm-lock.yaml pnpm-workspace.yaml turbo.json .env .env.local`

This comment has been minimized.

Copy link
@antongolub

antongolub Jul 12, 2024

A small suggestion, if you don't mind: you can avoid imperative verbose mode switching and use $ options instead:

await $({verbose: true})`call cmd`

// or even

$v = $({verbose: true})

await $v`foo bar`
await $v`baz qux`

This comment has been minimized.

Copy link
@liuxy0551

liuxy0551 Jul 12, 2024

Author Collaborator

Thank you for your suggestion !
I will use $v = $({verbose: true}) when I deploy this project on server, now I use docker.
Thanks again.

);
$.verbose = false;
doneLog();
Expand All @@ -41,7 +39,7 @@ $.verbose = false;
infoLog('4. 开始在远程服务器解压、安装依赖并重启服务...');
$.verbose = true;
echo(
await $`ssh root@${yiceServerIP} "cd /opt/dtstack/yice-performance${testStr}/; tar -xzf yice-performance${testStr}.tar.gz; rm -rf yice-performance${testStr}.tar.gz; find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +; cp scripts/start${testStr}.sh ./; ls -lahS; ./start${testStr}.sh; du -h --max-depth=1 ./apps/server/yice-report"`
await $`ssh root@${yiceServerIP} "cd /opt/dtstack/yice-performance${testStr}/; tar -xzf yice-performance${testStr}.tar.gz; rm -rf yice-performance${testStr}.tar.gz; cp scripts/start${testStr}.sh ./; ls -lahS; ./start${testStr}.sh; du -h --max-depth=1 ./apps/server/yice-report;"`
);
$.verbose = false;
doneLog();
Expand Down

0 comments on commit 00e2546

Please sign in to comment.