vite-elysia-forge 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +3 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bun
2
- import {spawnSync}from'child_process';import {existsSync,mkdirSync,writeFileSync,unlinkSync}from'fs';import {resolve,relative,sep}from'path';async function g(o="src/server/api.ts"){let n=resolve(process.cwd(),o);existsSync(n)||(console.error(`\u274C API entry file "${o}" not found.`),console.error(' By default, vite-elysia-forge looks for "src/server/api.ts".'),console.error(" If your API is located elsewhere, please specify the path:"),console.error(" $ vite-elysia-forge build <path-to-your-api-file>"),process.exit(1)),console.log("\u{1F4E6} Building Vite app...");let r=spawnSync("bun",["x","vite","build"],{stdio:"inherit",env:{...process.env,NODE_ENV:"production"}});r.status!==0&&(console.error("\u274C Vite build failed"),process.exit(r.status||1)),console.log("\u{1F95F} Building Elysia server for Bun...");let s=resolve(process.cwd(),".output");existsSync(s)||mkdirSync(s,{recursive:true});let t=resolve(s,".temp-prod.ts"),e=relative(s,n);e=e.split(sep).join("/"),e.startsWith(".")||(e="./"+e);let u=`
3
- import { startServer } from "@chijioke-udokporo/vite-elysia-forge/production";
2
+ import {spawnSync}from'child_process';import {existsSync,mkdirSync,writeFileSync,unlinkSync}from'fs';import {resolve,relative,sep}from'path';async function g(r="src/server/api.ts"){let n=resolve(process.cwd(),r);existsSync(n)||(console.error(`\u274C API entry file "${r}" not found.`),console.error(' By default, vite-elysia-forge looks for "src/server/api.ts".'),console.error(" If your API is located elsewhere, please specify the path:"),console.error(" $ vite-elysia-forge build <path-to-your-api-file>"),process.exit(1));let o=spawnSync("bun",["x","vite","build"],{stdio:"inherit",env:{...process.env,NODE_ENV:"production"}});o.status!==0&&(console.error("\u274C Vite build failed"),process.exit(o.status||1));let t=resolve(process.cwd(),".output");existsSync(t)||mkdirSync(t,{recursive:true});let s=resolve(t,".temp-prod.ts"),e=relative(t,n);e=e.split(sep).join("/"),e.startsWith(".")||(e="./"+e);let a=`
3
+ import { startServer } from "vite-elysia-forge/production";
4
4
  import { api } from "${e}";
5
5
 
6
6
  startServer({
@@ -8,4 +8,4 @@ startServer({
8
8
  port: process.env.PORT ? parseInt(process.env.PORT) : 3000,
9
9
  distDir: "dist",
10
10
  });
11
- `;writeFileSync(t,u);try{let i=await Bun.build({entrypoints:[t],outdir:"dist",target:"bun",minify:!0,naming:"server.js"});if(!i.success){console.error("\u274C Server build failed");for(let a of i.logs)console.error(a);process.exit(1);}}catch(i){console.error("\u274C Failed to build server. Ensure you are running this command with Bun."),console.error(i),process.exit(1);}finally{existsSync(t)&&unlinkSync(t);}console.log("\u2705 Build complete!"),console.log(" Run your production server with:"),console.log(" $ bun dist/server.js");}if(import.meta.main){let o=process.argv.slice(2);if(o[0]==="build"){let r=o[1];g(r);}else console.log("Usage: vite-elysia-forge build [api-entry]"),console.log(" api-entry: Path to your API entry file (default: src/server/api.ts)");}export{g as build};
11
+ `;writeFileSync(s,a);try{let i=await Bun.build({entrypoints:[s],outdir:"dist",target:"bun",minify:!0,naming:"server.js"});if(!i.success){console.error("\u274C Server build failed");for(let p of i.logs)console.error(p);process.exit(1);}}catch(i){console.error("\u274C Failed to build server. Ensure you are running this command with Bun."),console.error(i),process.exit(1);}finally{existsSync(s)&&unlinkSync(s);}}if(import.meta.main){let r=process.argv.slice(2);if(r[0]==="build"){let o=r[1];g(o);}else console.log("Usage: vite-elysia-forge build [api-entry]"),console.log(" api-entry: Path to your API entry file (default: src/server/api.ts)");}export{g as build};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-elysia-forge",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "A Vite plugin to seamlessly integrate ElysiaJS for full-stack development with Bun runtime.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",