Skip to content
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

devtoolsをホストする #33

Merged
merged 10 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 148 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tmtc-c2a/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ tonic = { version = "0.10", features = ["tls", "tls-roots-common", "tls-webpki-r
tonic-health = "0.10"
tonic-reflection = "0.10"
tonic-web = "0.10"
axum = { version = "0.6", default-features = false, features = ["http1", "tokio"] }
rust-embed = { version = "8.0.0", features = ["interpolate-folder-path"] }
mime_guess = "2.0.4"
sentry = { version = "0.31", default-features = false, features = ["backtrace", "contexts", "panic", "rustls", "reqwest"] }
sentry-tracing = "0.31"
tlmcmddb = "0.2.0"
Expand Down
21 changes: 21 additions & 0 deletions tmtc-c2a/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::process::Command;
use std::{env, path::PathBuf};

fn main() {
Expand All @@ -6,4 +7,24 @@ fn main() {
.file_descriptor_set_path(out_dir.join("tmtc_generic_c2a.bin"))
.compile(&["./proto/tmtc_generic_c2a.proto"], &["./proto"])
.unwrap_or_else(|e| panic!("Failed to compile protos {:?}", e));

if std::env::var("SKIP_FRONTEND_BUILD").is_err() {
println!("cargo:rerun-if-changed=devtools_frontend");
let status = Command::new("yarn")
.current_dir("devtools_frontend")
.status()
.expect("failed to build frontend");
assert!(status.success());
let devtools_out_dir = out_dir.join("devtools_dist");
let status = Command::new("yarn")
.current_dir("devtools_frontend")
.arg("run")
.arg("build:vite")
.arg("--")
.arg("--outDir")
.arg(&devtools_out_dir)
.status()
.expect("failed to build frontend");
assert!(status.success());
}
}
2 changes: 2 additions & 0 deletions tmtc-c2a/devtools_frontend/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/dist/
/src/proto/
23 changes: 23 additions & 0 deletions tmtc-c2a/devtools_frontend/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
env:
es2020: true
browser: true
node: true
extends:
- "eslint:recommended"
- "plugin:react/recommended"
- "plugin:@typescript-eslint/eslint-recommended"
- "prettier"
parser: "@typescript-eslint/parser"
plugins:
- "@typescript-eslint"
- "react-hooks"
parserOptions:
sourceType: module
settings:
react:
version: detect
rules:
no-unused-vars: "off"
react/prop-types: "off"
react-hooks/rules-of-hooks: "error"
react-hooks/exhaustive-deps: "warn"
5 changes: 5 additions & 0 deletions tmtc-c2a/devtools_frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/node_modules/
.DS_Store
/dist/
/dist-ssr/
*.local
4 changes: 4 additions & 0 deletions tmtc-c2a/devtools_frontend/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/dist/
/node_modules/
/deploy/
/src/proto/
12 changes: 12 additions & 0 deletions tmtc-c2a/devtools_frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>C2A DevTools</title>
</head>
<body class="bp5-dark bg-slate-950">
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
55 changes: 55 additions & 0 deletions tmtc-c2a/devtools_frontend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "c2a-devtools",
"version": "0.0.0",
"scripts": {
"codegen:proto:tco_tmiv": "protoc --ts_out src/proto --proto_path ../gaia/gaia-stub/proto ../gaia/gaia-stub/proto/tco_tmiv.proto",
"codegen:proto:broker": "protoc --ts_out src/proto --proto_path ../gaia/gaia-stub/proto ../gaia/gaia-stub/proto/broker.proto",
"codegen:proto:tmtc_generic_c2a": "protoc --ts_out src/proto --proto_path ../gaia/tmtc-c2a/proto ../gaia/tmtc-c2a/proto/tmtc_generic_c2a.proto",
"codegen:proto": "run-p codegen:proto:*",
"codegen": "run-s codegen:proto",
"dev:vite": "vite --host",
"dev": "run-p dev:*",
"build:vite": "vite build",
"build": "run-s build:vite",
"typecheck": "tsc",
"lint:prettier": "prettier . --check",
"lint:eslint": "eslint . --format stylish",
"lint": "run-p lint:*",
"fix:prettier": "yarn lint:prettier --write",
"fix:eslint": "yarn lint:eslint --fix",
"fix": "run-s fix:eslint fix:prettier"
},
"dependencies": {
"@blueprintjs/core": "5.7.1",
"@blueprintjs/icons": "5.4.1",
"@monaco-editor/react": "^4.5.0",
"@protobuf-ts/grpcweb-transport": "^2.8.2",
"monaco-editor": "^0.44.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-helmet-async": "^1.3.0",
"react-resizable-panels": "^0.0.63",
"react-router-dom": "^6.10.0",
"tailwindcss": "3.3.5"
},
"devDependencies": {
"@protobuf-ts/plugin": "^2.8.2",
"@types/react": "18.2.39",
"@types/react-dom": "18.2.17",
"@typescript-eslint/eslint-plugin": "6.13.1",
"@typescript-eslint/parser": "6.13.1",
"@vitejs/plugin-react": "4.2.0",
"autoprefixer": "10.4.16",
"eslint": "8.54.0",
"eslint-config-prettier": "9.0.0",
"eslint-config-react": "1.1.7",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"npm-run-all": "4.1.5",
"postcss": "8.4.31",
"prettier": "3.1.0",
"typescript": "5.3.2",
"vite": "4.5.0",
"vite-plugin-rewrite-all": "^1.0.1"
}
}
Loading