Skip to content

Commit

Permalink
Merge pull request #179 from yosupo06/patch/proto
Browse files Browse the repository at this point in the history
add proto dir
  • Loading branch information
yosupo06 authored Oct 22, 2023
2 parents 0be36bc + e236346 commit f48d9d4
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 22 deletions.
4 changes: 1 addition & 3 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ module.exports = {
plugins: ['@typescript-eslint'],
root: true,
ignorePatterns: [
"src/api/library_checker.ts",
"src/api/library_checker.client.ts",
"src/api/google/*"
"src/proto/*",
]
};
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
run: |
npm ci
- name: Generate protoc
run: npx protoc --ts_out src/api/ --proto_path ./library-checker-judge/api/proto ./library-checker-judge/api/proto/library_checker.proto
run: npm run protoc
env:
PROTO_PATH: ./library-checker-judge/api/proto
- name: Prettier
run: |
npm run prettier:check
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ jobs:
run: npm ci

- name: Generate protoc
run: npx protoc --ts_out src/api/ --proto_path ./library-checker-judge/api/proto ./library-checker-judge/api/proto/library_checker.proto
run: npm run protoc
env:
PROTO_PATH: ./library-checker-judge/api/proto

- name: Run npm build
run: npm run build -- --mode ${{ (inputs.env == 'prod' && 'production') || 'staging' }}
Expand Down
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/node_modules
/dist
/src/api/library_checker.ts
/src/api/library_checker.client.ts
/src/api/google/
/src/proto/*
!/src/proto/.gitkeep
4 changes: 1 addition & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
src/api/library_checker.ts
src/api/library_checker.client.ts
src/api/google/*
src/proto/*
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
```sh
npm install # or npm ci

npx protoc --ts_out src/api/ --proto_path ../library-checker-judge/api/proto ../library-checker-judge/api/proto/library_checker.proto
# generate API client code from protoc
PROTO_PATH=../library-checker-judge/api/proto npm run protoc

# access to the API server of local (you must launch api server in local)
npm run dev
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
"preview": "vite preview",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"prettier": "prettier --write \"src/**/*.{ts,js,tsx,jsx}\"",
"prettier:check": "prettier --check \"src/**/*.{ts,js,tsx,jsx}\""
"prettier:check": "prettier --check \"src/**/*.{ts,js,tsx,jsx}\"",
"protoc": "protoc --ts_out src/proto --proto_path ${PROTO_PATH} ${PROTO_PATH}/library_checker.proto"
},
"browserslist": {
"production": [
Expand Down
4 changes: 2 additions & 2 deletions src/api/client_wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
UseQueryResult,
} from "@tanstack/react-query";
import { AuthState } from "../contexts/AuthContext";
import { LibraryCheckerServiceClient } from "./library_checker.client";
import { LibraryCheckerServiceClient } from "../proto/library_checker.client";
import { GrpcWebFetchTransport } from "@protobuf-ts/grpcweb-transport";
import { RpcOptions } from "@protobuf-ts/runtime-rpc";
import {
Expand All @@ -16,7 +16,7 @@ import {
SubmissionInfoResponse,
SubmissionListResponse,
UserInfoResponse,
} from "./library_checker";
} from "../proto/library_checker";

export const authMetadata = (state: AuthState): RpcOptions | undefined => {
if (!state.token) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProblemList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import TableCell from "@mui/material/TableCell";
import TableContainer from "@mui/material/TableContainer";
import TableRow from "@mui/material/TableRow";
import React from "react";
import { Problem } from "../api/library_checker";
import { Problem } from "../proto/library_checker";
import { Link } from "react-router-dom";
import { lightGreen, cyan } from "@mui/material/colors";
import KatexTypography from "./katex/KatexTypography";
Expand Down
4 changes: 2 additions & 2 deletions src/components/SubmissionTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import "katex/dist/katex.min.css";
import React from "react";
import { Link } from "react-router-dom";
import { useLangList } from "../api/client_wrapper";
import { SubmissionOverview } from "../api/library_checker";
import { SubmissionOverview } from "../proto/library_checker";
import KatexTypography from "./katex/KatexTypography";
import { styled } from "@mui/system";
import { Timestamp } from "../api/google/protobuf/timestamp";
import { Timestamp } from "../proto/google/protobuf/timestamp";

interface Props {
overviews: SubmissionOverview[];
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ProblemInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import library_checker_client, {
useLangList,
useProblemInfo,
} from "../api/client_wrapper";
import { ProblemInfoResponse } from "../api/library_checker";
import { ProblemInfoResponse } from "../proto/library_checker";
import SourceEditor from "../components/SourceEditor";
import { AuthContext } from "../contexts/AuthContext";
import { GitHub, FlashOn, Person } from "@mui/icons-material";
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Problems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
useProblemList,
useUserInfo,
} from "../api/client_wrapper";
import { SolvedStatus } from "../api/library_checker";
import { SolvedStatus } from "../proto/library_checker";
import ProblemList from "../components/ProblemList";
import { AuthContext } from "../contexts/AuthContext";
import {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/SubmissionInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import CircularProgress from "@mui/material/CircularProgress";
import Link from "@mui/material/Link";
import { LibraryBooks } from "@mui/icons-material";
import { Collapse, Container, Divider, IconButton } from "@mui/material";
import { SubmissionCaseResult } from "../api/library_checker";
import { SubmissionCaseResult } from "../proto/library_checker";
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";

Expand Down
Empty file added src/proto/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion src/utils/ProblemCategorizer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Problem, ProblemCategory } from "../api/library_checker";
import { Problem, ProblemCategory } from "../proto/library_checker";

export type CategorisedProblems = {
name: string;
Expand Down

0 comments on commit f48d9d4

Please sign in to comment.