@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 +1 -1
- package/src/cli.ts +1 -0
- package/src/init.ts +15 -4
package/package.json
CHANGED
package/src/cli.ts
CHANGED
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}": "
|
|
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
|
|
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>
|