Skip to content

Commit

Permalink
chore: update nextjs v15, react v19 and eslint v9 (#420)
Browse files Browse the repository at this point in the history
  • Loading branch information
thucpn authored Nov 14, 2024
1 parent a108911 commit 44b34fb
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 40 deletions.
5 changes: 5 additions & 0 deletions .changeset/swift-donuts-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-llama": patch
---

chore: update eslint 9, nextjs 15, react 19
8 changes: 3 additions & 5 deletions helpers/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,9 @@ export const installTSTemplate = async ({
console.log("\nUsing static site generation\n");
} else {
if (vectorDb === "milvus") {
nextConfigJson.experimental.serverComponentsExternalPackages =
nextConfigJson.experimental.serverComponentsExternalPackages ?? [];
nextConfigJson.experimental.serverComponentsExternalPackages.push(
"@zilliz/milvus2-sdk-node",
);
nextConfigJson.serverExternalPackages =
nextConfigJson.serverExternalPackages ?? [];
nextConfigJson.serverExternalPackages.push("@zilliz/milvus2-sdk-node");
}
}
await fs.writeFile(
Expand Down
31 changes: 31 additions & 0 deletions templates/types/streaming/express/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { FlatCompat } from "@eslint/eslintrc";
import js from "@eslint/js";
import path from "node:path";
import { fileURLToPath } from "node:url";
import tseslint from "typescript-eslint";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
...compat.extends("eslint:recommended", "prettier"),
...tseslint.configs.recommended,
{
ignores: ["prettier.config.cjs"],
},
{ files: ["**/*.{ts}"] },
{
rules: {
"max-params": ["error", 4],
"prefer-const": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unused-vars": "off",
},
},
];
10 changes: 0 additions & 10 deletions templates/types/streaming/express/eslintrc.json

This file was deleted.

1 change: 0 additions & 1 deletion templates/types/streaming/express/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable turbo/no-undeclared-env-vars */
import cors from "cors";
import "dotenv/config";
import express, { Express, Request, Response } from "express";
Expand Down
6 changes: 4 additions & 2 deletions templates/types/streaming/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"format:write": "prettier --ignore-unknown --write .",
"build": "tsup index.ts --format esm --dts",
"start": "node dist/index.js",
"dev": "concurrently \"tsup index.ts --format esm --dts --watch\" \"nodemon --watch dist/index.js\""
"dev": "concurrently \"tsup index.ts --format esm --dts --watch\" \"nodemon --watch dist/index.js\"",
"lint": "eslint ."
},
"dependencies": {
"ai": "3.3.42",
Expand All @@ -34,10 +35,11 @@
"@types/cors": "^2.8.16",
"@types/express": "^4.17.21",
"@types/node": "^20.9.5",
"typescript-eslint": "^8.14.0",
"@llamaindex/workflow": "^0.0.3",
"@types/papaparse": "^5.3.15",
"concurrently": "^8.2.2",
"eslint": "^8.54.0",
"eslint": "^9.14.0",
"eslint-config-prettier": "^8.10.0",
"nodemon": "^3.0.1",
"prettier": "^3.2.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { DATA_DIR } from "../../chat/engine/loader";
*/
export async function GET(
_request: NextRequest,
{ params }: { params: { slug: string[] } },
{ params }: { params: Promise<{ slug: string[] }> },
) {
const slug = params.slug;
const slug = (await params).slug;

if (!slug) {
return NextResponse.json({ detail: "Missing file slug" }, { status: 400 });
Expand All @@ -21,7 +21,7 @@ export async function GET(
return NextResponse.json({ detail: "Invalid file path" }, { status: 400 });
}

const [folder, ...pathTofile] = params.slug; // data, file.pdf
const [folder, ...pathTofile] = slug; // data, file.pdf
const allowedFolders = ["data", "output"];

if (!allowedFolders.includes(folder)) {
Expand Down
22 changes: 10 additions & 12 deletions templates/types/streaming/nextjs/next.config.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
{
"experimental": {
"outputFileTracingIncludes": {
"/*": ["./cache/**/*"]
},
"outputFileTracingExcludes": {
"/api/files/*": [
".next/**/*",
"node_modules/**/*",
"public/**/*",
"app/**/*"
]
}
"outputFileTracingIncludes": {
"/*": ["./cache/**/*"]
},
"outputFileTracingExcludes": {
"/api/files/*": [
".next/**/*",
"node_modules/**/*",
"public/**/*",
"app/**/*"
]
},
"transpilePackages": ["highlight.js"]
}
12 changes: 6 additions & 6 deletions templates/types/streaming/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
"got": "^14.4.1",
"llamaindex": "0.8.2",
"lucide-react": "^0.294.0",
"next": "^14.2.4",
"next": "^15.0.3",
"react": "19.0.0-rc-5c56b873-20241107",
"react-dom": "19.0.0-rc-5c56b873-20241107",
"papaparse": "^5.4.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"supports-color": "^8.1.1",
"tailwind-merge": "^2.1.0",
"tiktoken": "^1.0.15",
Expand All @@ -49,9 +49,9 @@
"@types/papaparse": "^5.3.15",
"autoprefixer": "^10.4.16",
"cross-env": "^7.0.3",
"eslint": "^8.55.0",
"eslint-config-next": "^14.2.4",
"eslint-config-prettier": "^8.10.0",
"eslint": "^9.14.0",
"eslint-config-next": "^15.0.3",
"eslint-config-prettier": "^9.1.0",
"postcss": "^8.4.32",
"prettier": "^3.2.5",
"prettier-plugin-organize-imports": "^3.2.4",
Expand Down
3 changes: 2 additions & 1 deletion templates/types/streaming/nextjs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
],
"paths": {
"@/*": ["./*"]
}
},
"target": "ES2017"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
Expand Down

0 comments on commit 44b34fb

Please sign in to comment.