@mauroandre/velojs 0.0.2 → 0.0.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mauroandre/velojs",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "description": "Fullstack web framework built on Hono + Preact with Vite-powered AST transforms",
6
6
  "keywords": [
package/src/cli.ts CHANGED
@@ -29,6 +29,7 @@ const runBuild = () => {
29
29
  };
30
30
 
31
31
  const runStart = () => {
32
+ process.env.NODE_ENV = "production";
32
33
  const serverPath = resolve(process.cwd(), "dist/server.js");
33
34
  runCommand("node", [serverPath]);
34
35
  };
package/src/init.ts CHANGED
@@ -1,8 +1,16 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
3
4
 
4
5
  const PACKAGE_NAME = "@mauroandre/velojs";
5
6
 
7
+ function getPackageVersion(): string {
8
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
+ const pkgPath = path.resolve(__dirname, "../package.json");
10
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
11
+ return pkg.version;
12
+ }
13
+
6
14
  const templates: Record<string, string> = {
7
15
  "package.json": `{
8
16
  "name": "my-velojs-app",
@@ -14,7 +22,11 @@ const templates: Record<string, string> = {
14
22
  "start": "velojs start"
15
23
  },
16
24
  "dependencies": {
17
- "${PACKAGE_NAME}": "^0.1.0"
25
+ "${PACKAGE_NAME}": "^${getPackageVersion()}"
26
+ },
27
+ "devDependencies": {
28
+ "@types/node": "latest",
29
+ "typescript": "latest"
18
30
  }
19
31
  }
20
32
  `,
@@ -30,6 +42,7 @@ export default { plugins: [veloPlugin()] };
30
42
  "moduleResolution": "bundler",
31
43
  "target": "esnext",
32
44
  "lib": ["esnext", "dom"],
45
+ "types": ["node", "vite/client"],
33
46
  "strict": true,
34
47
  "noUncheckedIndexedAccess": true,
35
48
  "verbatimModuleSyntax": true,
@@ -115,9 +128,7 @@ a:hover {
115
128
  }
116
129
  `,
117
130
 
118
- "app/pages/Home.tsx": `export const metadata = { title: "Home" };
119
-
120
- export const Component = () => {
131
+ "app/pages/Home.tsx": `export const Component = () => {
121
132
  return (
122
133
  <main style={{ maxWidth: 640, margin: "80px auto", padding: "0 20px" }}>
123
134
  <h1>Welcome to VeloJS</h1>