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

chore: configured knip #1582

Open
wants to merge 1 commit into
base: daily
Choose a base branch
from
Open
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
24 changes: 24 additions & 0 deletions .github/workflows/root-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Root - Pull Request

on:
pull_request:
branches:
- daily

jobs:
knip-report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: ./.github/actions/install-deps
with:
hash: ${{ hashFiles('**/pnpm-lock.yaml') }}

- uses: ./.github/actions/build-packages
with:
hash: ${{ github.sha }}

- name: Post the knip results
# uses: codex-/knip-reporter@v2
run: pnpm knip
35 changes: 35 additions & 0 deletions knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$schema": "https://unpkg.com/knip@5/schema.json",
"includeEntryExports": true,
"workspaces": {
"packages/@liexp/*": {
"entry": ["src/**/*.{ts,tsx}"],
"project": ["src/**/*.{ts,tsx}", "build/**/*.js"]
},
"services/web": {
"entry": ["src/client/index.tsx", "src/server/server.tsx", "src/server/entry.tsx"],
"includeEntryExports": false,
"project": ["src/**/*.{ts,tsx}", "build/**/*.js"]
},
"services/admin-web": {
"entry": ["src/index.tsx"],
"includeEntryExports": false,
"project": ["src/**/*.{ts,tsx}", "build/**/*.js"]
},
"services/api": {
"entry": [
"src/run.ts",
"src/bin/**/*.ts",
"src/**/*.{spec,e2e}.ts",
"src/worker/index.ts"
],
"project": [
"{src,test}/**/*.ts",
"!src/migrations/*.ts",
"!src/test/globalSetup.ts",
"!src/**/*.{spec,e2e}.ts",
"build/**/*.js"
]
}
}
}
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"web": "pnpm --filter 'web'",
"vitest": "vitest",
"vitest:expected-cov": "vitest run --coverage.enabled --coverage.thresholds.lines=90 --coverage.thresholds.functions=90 --coverage.thresholds.statements=90",
"vitest:cov": "vitest run --coverage.enabled"
"vitest:cov": "vitest run --coverage.enabled",
"knip": "knip"
},
"resolutions": {
"dotenv": "^16.4.5",
Expand All @@ -41,6 +42,7 @@
"devDependencies": {
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@types/node": "^20.16.11",
"@typescript-eslint/eslint-plugin": "^8.15.0",
"@typescript-eslint/parser": "^8.15.0",
"@vitest/coverage-v8": "^2.1.5",
Expand All @@ -54,10 +56,11 @@
"eslint-plugin-promise": "^7.1.0",
"husky": "^9.1.6",
"is-ci": "^3.0.1",
"knip": "^5.37.2",
"lint-staged": "^15.2.10",
"pm2": "^5.4.3",
"prettier": "^3.3.3",
"typescript": "^5.6.2",
"typescript": "^5.6.3",
"typescript-eslint": "^8.15.0",
"vitest": "^2.1.5"
},
Expand Down
5 changes: 4 additions & 1 deletion packages/@liexp/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
"puppeteer-core": "^23.5.1",
"puppeteer-extra": "^3.3.6",
"puppeteer-extra-plugin-stealth": "^2.11.2",
"typescript": "^5.6.2"
"typescript": "^5.6.2",
"vitest-mock-extended": "^2.0.2",
"vite-tsconfig-paths": "^5.1.3"
},
"peerDependencies": {
"@langchain/core": "^0.3.18",
Expand All @@ -65,6 +67,7 @@
"instagram-private-api": "^1.46.1",
"node-telegram-bot-api": "^0.66.0",
"page-metadata-parser": "^1.1.4",
"pdfjs-dist": "^4",
"puppeteer-core": "^23.5.1",
"puppeteer-extra": "^3.3.6",
"puppeteer-extra-plugin-stealth": "^2.11.2",
Expand Down
2 changes: 2 additions & 0 deletions packages/@liexp/backend/src/errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ export * from "./BadRequestError.js";
export * from "./NotAuthorizedError.js";
export * from "./NotFoundError.js";
export * from "./ServerError.js";

export { IOError } from "ts-io-error/lib/index.js";
2 changes: 1 addition & 1 deletion packages/@liexp/backend/src/providers/jwt/jwt.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const toError =
return new JWTError(e.message, {
kind: "ClientError",
status: (override?.status ?? 401) + "",
meta: e.stack,
meta: e.stack?.split("\n"),
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@liexp/core/src/frontend/vite/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const defineViteConfig = <A extends Record<string, any>>(
[key]: v,
};
}),
config.env.decode,
(env) => fp.E.right(env as A),
(env) => {
if (env._tag === "Left") {
// eslint-disable-next-line
Expand Down
7 changes: 0 additions & 7 deletions packages/@liexp/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,21 @@
"@blocknote/server-util": "^0.19.2",
"@liexp/core": "workspace:*",
"axios": "^1.7.7",
"bs58": "^5.0.0",
"date-fns": "^4.1.0",
"domino": "^2.1.6",
"fp-ts": "^2.16.9",
"io-ts": "^2.2.21",
"io-ts-types": "^0.5.19",
"jsonwebtoken": "^9.0.2",
"lodash": "^4.17.21",
"query-string": "^7.1.3",
"throttle-debounce": "^5.0.0",
"ts-endpoint": "^2.0.0",
"ts-io-error": "^2.0.0",
"uuid": "^10.0.0"
},
"devDependencies": {
"@liexp/test": "workspace:*",
"@types/bs58": "^4.0.4",
"@types/jsonwebtoken": "^9.0.6",
"@types/lodash": "^4.17.13",
"@types/react": "^18.3.8",
"@types/react-dom": "^18.3.0",
"@types/throttle-debounce": "^5.0.2",
"@types/uuid": "^10.0.0",
"@visx/network": "^3.3.0",
"cheerio": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@liexp/shared/src/io/http/Error/CoreError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const CoreError = t.strict(
{
name: t.string,
message: t.string,
details: t.union([t.undefined, t.array(t.string)]),
details: t.union([t.undefined, t.array(t.string), t.string]),
},
"CoreError",
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { type serializedType } from "ts-io-error/lib/Codec.js";
import { type EndpointsMapType } from "../../endpoints/Endpoints.js";
import { type ResourceEndpoints } from "../../endpoints/types.js";
import { toAPIError, type APIError } from "../../io/http/Error/APIError.js";
import { APIError, toAPIError } from "../../io/http/Error/APIError.js";
import { type APIRESTClient } from "../../providers/api-rest.provider.js";
import { fromValidationErrors } from "../../providers/http/http.provider.js";
import {
Expand All @@ -31,6 +31,10 @@ import {

const toError = (e: unknown): APIError => {
if (isAxiosError(e)) {
if (APIError.is(e.response?.data)) {
return e.response?.data;
}

return toAPIError(e.response?.data ?? e.cause);
}
return toAPIError(e);
Expand Down
33 changes: 19 additions & 14 deletions packages/@liexp/ui/src/components/Common/ErrorBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,31 @@ const ErrorBoxDetails: React.FC<{ error: APIError | CoreError }> = ({
const details = React.useMemo(() => {
const isAPIError = APIError.is(error) && (error.details?.length ?? 0) > 0;
if (isAPIError) {
const details = Array.isArray(error.details)
? error.details
: [error.details];
return (
<div>
{error.details?.map((detail: any, i) => (
<code key={i}>{detail}</code>
))}
{details?.map((detail: any, i) => <code key={i}>{detail}</code>)}
</div>
);
}

const isCoreError = CoreError.is(error) && (error.details?.length ?? 0) > 0;
if (isCoreError) {
return (
<div>
{error.details?.map((detail, i) => (
<Typography key={i} fontSize={"small"} display={"block"}>
{detail}
</Typography>
))}
</div>
);
if (CoreError.is(error)) {
const errorDetails = Array.isArray(error.details)
? error.details
: [error.details];
if (errorDetails.length > 0) {
return (
<div>
{errorDetails.map((detail, i) => (
<Typography key={i} fontSize={"small"} display={"block"}>
{detail}
</Typography>
))}
</div>
);
}
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion packages/@liexp/ui/src/state/queries/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useQuery, type UseQueryResult } from "@tanstack/react-query";
import axios from "axios";
import { type Configuration } from "../../context/ConfigurationContext.js";

export interface GithubRepo {
interface GithubRepo {
user: string;
repo: string;
}
Expand Down
Loading
Loading