Skip to content

Commit

Permalink
chore: configured knip
Browse files Browse the repository at this point in the history
  • Loading branch information
ascariandrea committed Nov 30, 2024
1 parent 7f28d63 commit 62d41e8
Show file tree
Hide file tree
Showing 18 changed files with 409 additions and 716 deletions.
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.16.0",
"@typescript-eslint/parser": "^8.16.0",
"@vitest/coverage-v8": "^2.1.5",
Expand All @@ -54,10 +56,11 @@
"eslint-plugin-promise": "^7.2.1",
"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.16.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.9.0",
"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.19",
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.9.0",
"puppeteer-extra": "^3.3.6",
"puppeteer-extra-plugin-stealth": "^2.11.2",
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.8",
"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": "^11.0.3"
},
"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.1",
"@types/throttle-debounce": "^5.0.2",
"@types/uuid": "^10.0.0",
"@visx/network": "^3.12.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
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

0 comments on commit 62d41e8

Please sign in to comment.