vaderjs 2.3.1 → 2.3.2
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 +21 -12
- package/main.js +1 -1
- package/package.json +1 -1
package/cli.ts
CHANGED
|
@@ -36,7 +36,7 @@ async function run(cmd: string, args: string[] = []) {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
export async function init() {
|
|
40
40
|
console.log("🚀 Welcome to Vader.js project initializer!");
|
|
41
41
|
|
|
42
42
|
const cwd = process.cwd();
|
|
@@ -134,11 +134,11 @@ export default function Counter() {
|
|
|
134
134
|
console.log(`Created package.json`);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
// Install dependencies: vaderjs + optionally tailwindcss, postcss plugins
|
|
137
|
+
// Install dependencies: vaderjs + optionally tailwindcss, postcss plugins, autoprefixer
|
|
138
138
|
console.log("Installing dependencies with Bun...");
|
|
139
|
-
const deps = ["vaderjs"];
|
|
139
|
+
const deps = ["vaderjs", "autoprefixer"];
|
|
140
140
|
if (wantsTailwind) {
|
|
141
|
-
deps.push("tailwindcss", "@tailwindcss/postcss", "postcss-cli");
|
|
141
|
+
deps.push("tailwindcss@4", "@tailwindcss/postcss", "postcss-cli");
|
|
142
142
|
}
|
|
143
143
|
await run("bun", ["install", ...deps]);
|
|
144
144
|
console.log("✅ Dependencies installed.");
|
|
@@ -155,23 +155,35 @@ export default function Counter() {
|
|
|
155
155
|
await fs.writeFile(path.join(projectDir, "tailwind.config.cjs"), tailwindConfig);
|
|
156
156
|
console.log("Created tailwind.config.cjs");
|
|
157
157
|
|
|
158
|
-
const postcssConfig = `
|
|
158
|
+
const postcssConfig = `export default {
|
|
159
159
|
plugins: {
|
|
160
|
-
tailwindcss: {},
|
|
160
|
+
"@tailwindcss/postcss": {},
|
|
161
161
|
autoprefixer: {},
|
|
162
|
-
}
|
|
162
|
+
}
|
|
163
163
|
};`;
|
|
164
164
|
await fs.writeFile(path.join(projectDir, "postcss.config.cjs"), postcssConfig);
|
|
165
165
|
console.log("Created postcss.config.cjs");
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
// Create vaderjs.config.ts regardless, add Tailwind plugin if needed
|
|
169
|
+
const vaderConfig = `import defineConfig from "vaderjs/config";
|
|
170
|
+
${wantsTailwind ? 'import tailwind from "vaderjs/plugins/tailwind";' : ''}
|
|
171
|
+
|
|
172
|
+
export default defineConfig({
|
|
173
|
+
port: 3000,
|
|
174
|
+
plugins: [${wantsTailwind ? "tailwind" : ""}],
|
|
175
|
+
});`;
|
|
176
|
+
|
|
177
|
+
await fs.writeFile(path.join(projectDir, "vaderjs.config.ts"), vaderConfig);
|
|
178
|
+
console.log("Created vaderjs.config.ts");
|
|
179
|
+
|
|
168
180
|
// Create jsconfig.json for VSCode/IDE support
|
|
169
181
|
const jsConfig = {
|
|
170
182
|
compilerOptions: {
|
|
171
183
|
jsx: "react",
|
|
172
184
|
jsxFactory: "Vader.createElement",
|
|
173
|
-
jsxFragmentFactory: "Fragment"
|
|
174
|
-
}
|
|
185
|
+
jsxFragmentFactory: "Fragment",
|
|
186
|
+
},
|
|
175
187
|
};
|
|
176
188
|
await fs.writeFile(path.join(projectDir, "jsconfig.json"), JSON.stringify(jsConfig, null, 2));
|
|
177
189
|
console.log("Created jsconfig.json");
|
|
@@ -181,6 +193,3 @@ export default function Counter() {
|
|
|
181
193
|
console.log(`Run cd ${projectDir} to navigate into the project folder`);
|
|
182
194
|
console.log("Run `bun run dev` or your build script to get started.");
|
|
183
195
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
package/main.js
CHANGED
|
@@ -82,7 +82,7 @@ const vaderAPI = {
|
|
|
82
82
|
|
|
83
83
|
async function loadConfig() {
|
|
84
84
|
try {
|
|
85
|
-
const configModule = await import(path.join(PROJECT_ROOT, "
|
|
85
|
+
const configModule = await import(path.join(PROJECT_ROOT, "vaderjs.config.js"));
|
|
86
86
|
return configModule.default || configModule;
|
|
87
87
|
} catch {
|
|
88
88
|
logger.warn("No 'vader.config.js' found, using defaults.");
|