From 418bf9ba8a196ff87a312b9ea2a7081bcebfabd2 Mon Sep 17 00:00:00 2001 From: Thuc Pham <51660321+thucpn@users.noreply.github.com> Date: Mon, 22 Apr 2024 09:04:37 +0700 Subject: [PATCH] refactor: use tsx instead of ts-node (#54) --- .changeset/lovely-mayflies-appear.md | 5 +++++ CONTRIBUTING.md | 2 +- helpers/typescript.ts | 2 +- templates/types/streaming/express/package.json | 2 +- templates/types/streaming/express/tsconfig.json | 5 ----- templates/types/streaming/nextjs/package.json | 2 +- templates/types/streaming/nextjs/tsconfig.json | 7 +------ 7 files changed, 10 insertions(+), 15 deletions(-) create mode 100644 .changeset/lovely-mayflies-appear.md diff --git a/.changeset/lovely-mayflies-appear.md b/.changeset/lovely-mayflies-appear.md new file mode 100644 index 00000000..8038e3d8 --- /dev/null +++ b/.changeset/lovely-mayflies-appear.md @@ -0,0 +1,5 @@ +--- +"create-llama": patch +--- + +refactor: use tsx instead of ts-node diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2b82150d..1226bda9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,7 @@ Install NodeJS. Preferably v18 using nvm or n. Inside the `create-llama` directory: ``` -npm i -g pnpm ts-node +npm i -g pnpm pnpm install ``` diff --git a/helpers/typescript.ts b/helpers/typescript.ts index e9553371..24440352 100644 --- a/helpers/typescript.ts +++ b/helpers/typescript.ts @@ -205,7 +205,7 @@ async function updatePackageJson({ // add generate script if using context engine packageJson.scripts = { ...packageJson.scripts, - generate: `ts-node ${path.join( + generate: `tsx ${path.join( relativeEngineDestPath, "engine", "generate.ts", diff --git a/templates/types/streaming/express/package.json b/templates/types/streaming/express/package.json index 53845d97..834841f5 100644 --- a/templates/types/streaming/express/package.json +++ b/templates/types/streaming/express/package.json @@ -26,7 +26,7 @@ "nodemon": "^3.0.1", "prettier": "^3.2.5", "prettier-plugin-organize-imports": "^3.2.4", - "ts-node": "^10.9.2", + "tsx": "^4.7.2", "tsup": "^8.0.1", "typescript": "^5.3.2" } diff --git a/templates/types/streaming/express/tsconfig.json b/templates/types/streaming/express/tsconfig.json index b103d12f..c242d5fa 100644 --- a/templates/types/streaming/express/tsconfig.json +++ b/templates/types/streaming/express/tsconfig.json @@ -9,10 +9,5 @@ "paths": { "@/*": ["./*"] } - }, - "ts-node": { - "compilerOptions": { - "module": "commonjs" - } } } diff --git a/templates/types/streaming/nextjs/package.json b/templates/types/streaming/nextjs/package.json index 82d984d5..baddb358 100644 --- a/templates/types/streaming/nextjs/package.json +++ b/templates/types/streaming/nextjs/package.json @@ -44,7 +44,7 @@ "prettier": "^3.2.5", "prettier-plugin-organize-imports": "^3.2.4", "tailwindcss": "^3.3.6", - "ts-node": "^10.9.2", + "tsx": "^4.7.2", "typescript": "^5.3.2" } } diff --git a/templates/types/streaming/nextjs/tsconfig.json b/templates/types/streaming/nextjs/tsconfig.json index 65e2ba60..40c136b8 100644 --- a/templates/types/streaming/nextjs/tsconfig.json +++ b/templates/types/streaming/nextjs/tsconfig.json @@ -24,10 +24,5 @@ "forceConsistentCasingInFileNames": true }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], - "exclude": ["node_modules"], - "ts-node": { - "compilerOptions": { - "module": "commonjs" - } - } + "exclude": ["node_modules"] } -- GitLab