@@ -3,7 +3,7 @@ import deps from "../json/deps.json" with { type: "json" };
33import { PACKAGE_VERSION , readTemplate } from "../lib.ts" ;
44import type { WebFrameworkDescription } from "../types.ts" ;
55import { defaultDenoDependencies , defaultDevDependencies } from "./const.ts" ;
6- import { getInstruction , packageManagerToRuntime } from "./utils.ts" ;
6+ import { getInstruction , pmToRt } from "./utils.ts" ;
77
88const elysiaDescription : WebFrameworkDescription = {
99 label : "ElysiaJS" ,
@@ -43,13 +43,11 @@ const elysiaDescription: WebFrameworkDescription = {
4343 loggingFile : "src/logging.ts" ,
4444 files : {
4545 "src/index.ts" : ( await readTemplate (
46- `elysia/index/${ packageManagerToRuntime ( pm ) } .ts` ,
46+ `elysia/index/${ pmToRt ( pm ) } .ts` ,
4747 ) ) . replace ( / \/ \* l o g g e r \* \/ / , projectName ) ,
48- ...( pm !== "deno"
49- ? {
50- "eslint.config.ts" : await readTemplate ( "defaults/eslint.config.ts" ) ,
51- }
52- : { } ) ,
48+ ...( pm !== "deno" && {
49+ "eslint.config.ts" : await readTemplate ( "defaults/eslint.config.ts" ) ,
50+ } ) ,
5351 } ,
5452 compilerOptions : pm === "deno" || pm === "bun" ? undefined : {
5553 "lib" : [ "ESNext" , "DOM" ] ,
@@ -61,24 +59,28 @@ const elysiaDescription: WebFrameworkDescription = {
6159 "noEmit" : true ,
6260 "strict" : true ,
6361 } ,
64- tasks : {
65- "dev" : pm === "deno"
66- ? "deno serve --allow-env --allow-net --watch ./src/index.ts"
67- : pm === "bun"
68- ? "bun run --hot ./src/index.ts"
69- : "tsx watch src/index.ts" ,
70- ...( pm === "deno"
71- ? { "prod" : "deno serve --allow-env --allow-net ./src/index.ts" }
72- : pm === "bun"
73- ? { "prod" : "bun run ./src/index.ts" }
74- : {
75- "build" : "tsc src/index.ts --outDir dist" ,
76- "start" : "NODE_ENV=production node dist/index.js" ,
77- } ) ,
78- ...( pm !== "deno" ? { "lint" : "eslint ." } : { } ) ,
79- } ,
62+ tasks : TASKS [ pmToRt ( pm ) ] ,
8063 instruction : getInstruction ( pm , 3000 ) ,
8164 } ) ,
8265} ;
8366
8467export default elysiaDescription ;
68+
69+ const TASKS = {
70+ deno : {
71+ dev :
72+ "deno serve --allow-read --allow-env --allow-net --watch ./src/index.ts" ,
73+ prod : "deno serve --allow-read --allow-env --allow-net ./src/index.ts" ,
74+ } ,
75+ bun : {
76+ dev : "bun run --hot ./src/index.ts" ,
77+ prod : "bun run ./src/index.ts" ,
78+ lint : "eslint ." ,
79+ } ,
80+ node : {
81+ dev : "dotenvx run -- tsx watch src/index.ts" ,
82+ build : "tsc src/index.ts --outDir dist" ,
83+ start : "NODE_ENV=production node dist/index.js" ,
84+ lint : "eslint ." ,
85+ } ,
86+ } ;
0 commit comments