-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build(log-viewer-webui): Migrate server codebase to TypeScript and update dependencies. #647
base: main
Are you sure you want to change the base?
Changes from all commits
89dfb45
1f50cb1
85e6ff2
13192bd
58a434c
a11b15b
ef0aca7
49f7115
897351a
1aff249
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,7 +84,7 @@ tasks: | |
CHECKSUM_FILE: "{{.G_BUILD_DIR}}/{{.TASK}}.md5" | ||
OUTPUT_DIR: "{{.G_PACKAGE_BUILD_DIR}}" | ||
sources: | ||
- "{{.G_BUILD_DIR}}/log-viewer-webui-clients.md5" | ||
- "{{.G_BUILD_DIR}}/log-viewer-webui.md5" | ||
- "{{.G_BUILD_DIR}}/package-venv.md5" | ||
- "{{.G_BUILD_DIR}}/webui.md5" | ||
- "{{.G_BUILD_DIR}}/webui-nodejs.md5" | ||
|
@@ -93,10 +93,6 @@ tasks: | |
- "{{.G_CORE_COMPONENT_BUILD_DIR}}/clp" | ||
- "{{.G_CORE_COMPONENT_BUILD_DIR}}/clp-s" | ||
- "{{.G_CORE_COMPONENT_BUILD_DIR}}/reducer-server" | ||
- "{{.G_LOG_VIEWER_WEBUI_SRC_DIR}}/server/package.json" | ||
- "{{.G_LOG_VIEWER_WEBUI_SRC_DIR}}/server/package-lock.json" | ||
- "{{.G_LOG_VIEWER_WEBUI_SRC_DIR}}/server/settings.json" | ||
- "{{.G_LOG_VIEWER_WEBUI_SRC_DIR}}/server/src/**/*.js" | ||
- "{{.TASKFILE}}" | ||
- "/etc/os-release" | ||
- "components/clp-package-utils/dist/*.whl" | ||
|
@@ -110,7 +106,7 @@ tasks: | |
- "clp-py-utils" | ||
- "init" | ||
- "job-orchestration" | ||
- "log-viewer-webui-clients" | ||
- "log-viewer-webui" | ||
- "nodejs-14" | ||
- "package-venv" | ||
- task: "utils:validate-checksum" | ||
|
@@ -159,16 +155,10 @@ tasks: | |
PATH="{{.G_NODEJS_14_BIN_DIR}}":$PATH npm install | ||
- >- | ||
rsync -a | ||
"{{.G_LOG_VIEWER_WEBUI_BUILD_DIR}}/client" | ||
"{{.G_LOG_VIEWER_WEBUI_BUILD_DIR}}/yscope-log-viewer" | ||
"{{.OUTPUT_DIR}}/var/www/log_viewer_webui/" | ||
"{{.G_LOG_VIEWER_WEBUI_BUILD_DIR}}/" | ||
"{{.OUTPUT_DIR}}/var/www/log-viewer-webui" | ||
- |- | ||
cd components/log-viewer-webui/server/ | ||
rsync -a \ | ||
package.json package-lock.json settings.json src \ | ||
"{{.OUTPUT_DIR}}/var/www/log_viewer_webui/server/" | ||
- |- | ||
cd "{{.OUTPUT_DIR}}/var/www/log_viewer_webui/server" | ||
cd "{{.OUTPUT_DIR}}/var/www/log-viewer-webui/server" | ||
PATH="{{.G_NODEJS_22_BIN_DIR}}":$PATH npm clean-install | ||
# This command must be last | ||
- task: "utils:compute-checksum" | ||
|
@@ -217,7 +207,7 @@ tasks: | |
vars: | ||
COMPONENT: "{{.TASK}}" | ||
|
||
log-viewer-webui-clients: | ||
log-viewer-webui: | ||
vars: | ||
CHECKSUM_FILE: "{{.G_BUILD_DIR}}/{{.TASK}}.md5" | ||
OUTPUT_DIR: "{{.G_LOG_VIEWER_WEBUI_BUILD_DIR}}" | ||
|
@@ -228,6 +218,11 @@ tasks: | |
- "client/src/**/*.css" | ||
- "client/src/**/*.jsx" | ||
- "client/src/webpack.config.js" | ||
- "server/package.json" | ||
- "server/package-lock.json" | ||
- "server/settings.json" | ||
- "server/src/**/*.ts" | ||
- "server/tsconfig.json" | ||
- "yscope-log-viewer/package.json" | ||
- "yscope-log-viewer/public/**/*" | ||
- "yscope-log-viewer/src/**/*" | ||
|
@@ -245,6 +240,14 @@ tasks: | |
DATA_DIR: "{{.OUTPUT_DIR}}" | ||
cmds: | ||
- "rm -rf '{{.OUTPUT_DIR}}'" | ||
- "mkdir -p '{{.OUTPUT_DIR}}'" | ||
- |- | ||
cd "server" | ||
rsync -a \ | ||
package.json package-lock.json \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. stupid question, don't we need to sync "src" as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not at all. How TypeScript compilation works is that the compiler performs type-checking then transpiles the TypeScript code into JavaScript code. After we run |
||
"{{.OUTPUT_DIR}}/server/" | ||
PATH="{{.G_NODEJS_22_BIN_DIR}}":$PATH npm run build -- \ | ||
--outDir "{{.OUTPUT_DIR}}/server/dist" | ||
- for: | ||
- "client" | ||
- "yscope-log-viewer" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -905,10 +905,10 @@ def start_log_viewer_webui( | |
if container_exists(container_name): | ||
return | ||
|
||
container_log_viewer_webui_dir = CONTAINER_CLP_HOME / "var" / "www" / "log_viewer_webui" | ||
container_log_viewer_webui_dir = CONTAINER_CLP_HOME / "var" / "www" / "log-viewer-webui" | ||
node_path = str(container_log_viewer_webui_dir / "server" / "node_modules") | ||
settings_json_path = ( | ||
get_clp_home() / "var" / "www" / "log_viewer_webui" / "server" / "settings.json" | ||
get_clp_home() / "var" / "www" / "log-viewer-webui" / "server" / "dist" / "settings.json" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
) | ||
|
||
validate_log_viewer_webui_config(clp_config, settings_json_path) | ||
|
@@ -961,7 +961,7 @@ def start_log_viewer_webui( | |
|
||
node_cmd = [ | ||
str(CONTAINER_CLP_HOME / "bin" / "node-22"), | ||
str(container_log_viewer_webui_dir / "server" / "src" / "main.js"), | ||
str(container_log_viewer_webui_dir / "server" / "dist" / "src" / "main.js"), | ||
] | ||
cmd = container_cmd + node_cmd | ||
subprocess.run(cmd, stdout=subprocess.DEVNULL, check=True) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import CommonConfig from "eslint-config-yscope/CommonConfig.mjs"; | ||
import StylisticConfigArray from "eslint-config-yscope/StylisticConfigArray.mjs"; | ||
import TsConfigArray from "eslint-config-yscope/TsConfigArray.mjs"; | ||
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Fix eslint-config-yscope version inconsistency The package has different versions across the codebase:
Please update the server's package.json to use the same fixed version (0.0.32) to ensure consistent linting rules across the project. Also verify that the imported config files exist in the installed package, as they weren't found in the current codebase. 🔗 Analysis chainVerify the eslint-config-yscope package. The configuration imports from 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify eslint-config-yscope package configuration
# Check if the package is listed in package.json
echo "Checking package.json for eslint-config-yscope..."
cat components/log-viewer-webui/server/package.json | jq '.dependencies["eslint-config-yscope"] // .devDependencies["eslint-config-yscope"]'
# Verify the imported modules exist
echo "Verifying imported modules..."
fd -t f "CommonConfig.mjs|StylisticConfigArray.mjs|TsConfigArray.mjs" node_modules/eslint-config-yscope
Length of output: 556 Script: #!/bin/bash
# Check for package.json files and workspace configurations
echo "Checking for package.json files..."
fd package.json
echo -e "\nChecking for eslint config files..."
fd -e mjs -x grep -l "CommonConfig\|StylisticConfigArray\|TsConfigArray" {}
echo -e "\nChecking for workspace configurations..."
fd "pnpm-workspace.yaml|lerna.json|package.json" -d 1
Length of output: 675 Script: #!/bin/bash
# Check linter package and its exports
echo "Checking linter package.json..."
cat components/webui/linter/package.json
echo -e "\nChecking linter package files..."
fd . components/webui/linter -t f -e mjs -e js
echo -e "\nChecking for CommonConfig.mjs content..."
fd . components/webui/linter -t f -e mjs -e js -x grep -l "CommonConfig"
Length of output: 742 |
||
|
||
|
||
const EslintConfig = [ | ||
{ | ||
ignores: [ | ||
"dist/", | ||
"node_modules/", | ||
], | ||
}, | ||
CommonConfig, | ||
...TsConfigArray, | ||
...StylisticConfigArray, | ||
{ | ||
rules: { | ||
"@typescript-eslint/require-await": [ | ||
// Fastify recommends async syntax, but not all plugins require Promise resolution | ||
// in their function bodies. | ||
"off", | ||
], | ||
"new-cap": [ | ||
"error", | ||
{ | ||
capIsNewExceptions: [ | ||
"Type.Enum", | ||
"Type.Integer", | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
]; | ||
|
||
|
||
export default EslintConfig; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note
log_viewer_webui
is renamed aslog-viewer-webui
here.