vaderjs 2.3.20 ā 2.3.21
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/cli.ts +26 -7
- package/package.json +1 -1
package/cli.ts
CHANGED
|
@@ -74,9 +74,8 @@ export async function initProject(dir) {
|
|
|
74
74
|
|
|
75
75
|
await fs.writeFile(
|
|
76
76
|
path.join(projectDir, "app/index.jsx"),
|
|
77
|
-
`import { component, useState } from "vaderjs";
|
|
78
|
-
|
|
79
|
-
export default component(() => {
|
|
77
|
+
`import { component, useState } from "vaderjs";\n import * as Vader from "vaderjs";
|
|
78
|
+
const app = component(() => {
|
|
80
79
|
const [count, setCount] = useState(0);
|
|
81
80
|
|
|
82
81
|
return (
|
|
@@ -85,6 +84,7 @@ export default component(() => {
|
|
|
85
84
|
</button>
|
|
86
85
|
);
|
|
87
86
|
});
|
|
87
|
+
Vader.render(Vader.createElement(app), document.getElementById("app"));
|
|
88
88
|
`
|
|
89
89
|
);
|
|
90
90
|
|
|
@@ -104,7 +104,7 @@ export default defineConfig({
|
|
|
104
104
|
`
|
|
105
105
|
);
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
if (!fsSync.existsSync(path.join(projectDir, "package.json"))) {
|
|
108
108
|
await fs.writeFile(
|
|
109
109
|
path.join(projectDir, "package.json"),
|
|
110
110
|
JSON.stringify(
|
|
@@ -116,9 +116,9 @@ export default defineConfig({
|
|
|
116
116
|
build: "vaderjs build",
|
|
117
117
|
start: "vaderjs serve",
|
|
118
118
|
},
|
|
119
|
-
dependencies:
|
|
119
|
+
dependencies: {
|
|
120
120
|
vaderjs: "latest",
|
|
121
|
-
}
|
|
121
|
+
}
|
|
122
122
|
},
|
|
123
123
|
null,
|
|
124
124
|
2
|
|
@@ -128,7 +128,26 @@ export default defineConfig({
|
|
|
128
128
|
|
|
129
129
|
logSection("š¦ Installing dependencies");
|
|
130
130
|
await run("bun", ["install", "--force"]);
|
|
131
|
-
|
|
131
|
+
// Ensure package.json has correct dependencies (in case it was pre-existing)
|
|
132
|
+
if (!fsSync.existsSync(path.join(projectDir, "package.json"))) {
|
|
133
|
+
await fs.writeFile(
|
|
134
|
+
path.join(projectDir, "package.json"),
|
|
135
|
+
JSON.stringify(
|
|
136
|
+
{
|
|
137
|
+
name: path.basename(projectDir),
|
|
138
|
+
private: true,
|
|
139
|
+
scripts: {
|
|
140
|
+
dev: "vaderjs dev",
|
|
141
|
+
build: "vaderjs build",
|
|
142
|
+
start: "vaderjs serve",
|
|
143
|
+
},
|
|
144
|
+
dependencies: JSON.parse(await fs.readFile(path.join(projectDir, "package.json"), "utf8"))
|
|
145
|
+
},
|
|
146
|
+
null,
|
|
147
|
+
2
|
|
148
|
+
)
|
|
149
|
+
);
|
|
150
|
+
}
|
|
132
151
|
console.log("\nā
Project ready");
|
|
133
152
|
console.log("Run `bun run dev` to start");
|
|
134
153
|
}
|