vagejs 0.3.2 → 0.3.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/dist/cli/index.js CHANGED
@@ -24,7 +24,7 @@ cli
24
24
  if (opts.json)
25
25
  return print({ ok: true, ...result });
26
26
  const rel = path.relative(process.cwd(), result.dir) || ".";
27
- console.log(`Created ${result.dir}\n\nNext steps:\n cd ${rel}\n npm install\n npm run dev`);
27
+ console.log(`Created ${result.dir}\n\nNext steps:\n cd ${rel}\n npm install\n npm start\n\nnpm start opens the site in your browser. npm run dev starts it without opening one.`);
28
28
  }));
29
29
  cli
30
30
  .command("dev", "Start the dev server with live reload")
@@ -20,10 +20,11 @@ import { redirect } from "./preview.js";
20
20
  */
21
21
  export async function startDevServer(root, options = {}) {
22
22
  // Vite reports watcher paths with symlinks resolved, so compare against the real path.
23
+ // .native also expands Windows 8.3 short names (RUNNER~1 -> runneradmin).
23
24
  root = path.resolve(root);
24
25
  if (!fs.existsSync(root))
25
26
  throw new VageError(`Project directory not found: ${root}`);
26
- root = fs.realpathSync(root);
27
+ root = fs.realpathSync.native(root);
27
28
  const pagesDir = path.join(root, "src", "pages");
28
29
  const srcDir = path.join(root, "src") + path.sep;
29
30
  const server = await createServer({
@@ -32,8 +33,12 @@ export async function startDevServer(root, options = {}) {
32
33
  server: { port: options.port, strictPort: options.port !== undefined, host: options.host },
33
34
  });
34
35
  const load = viteLoader(server);
36
+ // Vite reports "C:/..." on Windows; compare normalized paths, ignoring case there.
37
+ const key = (file) => (process.platform === "win32" ? path.resolve(file).toLowerCase() : path.resolve(file));
38
+ const srcKey = key(srcDir.slice(0, -1)) + path.sep;
35
39
  server.watcher.on("all", (_event, file) => {
36
- if (file.startsWith(srcDir) || file === findConfigFile(root)) {
40
+ const config = findConfigFile(root);
41
+ if (key(file).startsWith(srcKey) || (config && key(file) === key(config))) {
37
42
  server.ws.send({ type: "full-reload", path: "*" });
38
43
  }
39
44
  });
@@ -1,5 +1,4 @@
1
1
  import { execFileSync } from "node:child_process";
2
- import fs from "node:fs";
3
2
  import path from "node:path";
4
3
  /**
5
4
  * Last commit date (ISO) of every file under src/pages, from one `git log` call.
@@ -27,11 +26,11 @@ export function gitPageDates(root) {
27
26
  if (git(["rev-parse", "--is-shallow-repository"]).trim() === "true") {
28
27
  return { problem: "this is a shallow git clone, so every page would get the latest commit's date (in GitHub Actions, use actions/checkout with fetch-depth: 0)" };
29
28
  }
30
- const top = git(["rev-parse", "--show-toplevel"]).trim();
31
- // git prints real paths; compare against the project's real path (e.g. /var -> /private/var on macOS).
32
- const real = fs.realpathSync(root);
29
+ // --relative: names relative to the project folder, with "/" on every system. Comparing
30
+ // absolute paths breaks on Windows (8.3 short names, drive-letter case) and needs
31
+ // realpath on macOS (/var -> /private/var).
33
32
  // -z: NUL-separated, so file names with quotes, spaces or newlines come through exactly.
34
- const out = git(["log", "-z", "--format=@@%cI", "--name-only", "--no-renames", "--", path.join(root, "src", "pages")]);
33
+ const out = git(["log", "-z", "--format=@@%cI", "--name-only", "--no-renames", "--relative", "--", "src/pages"]);
35
34
  const dates = new Map();
36
35
  let current = "";
37
36
  for (const raw of out.split("\0")) {
@@ -43,7 +42,7 @@ export function gitPageDates(root) {
43
42
  if (header)
44
43
  current = header[1];
45
44
  if (name && current) {
46
- const rel = path.relative(real, path.join(top, name));
45
+ const rel = path.join(...name.split("/"));
47
46
  if (!dates.has(rel))
48
47
  dates.set(rel, current); // newest first: keep the first date seen
49
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vagejs",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "A free static site generator for AI website development: Markdown pages with built-in SEO, llms.txt, checks, spam protection and safe deploys.",
5
5
  "keywords": [
6
6
  "static-site-generator",
@@ -12,6 +12,6 @@
12
12
  "preview": "vage preview"
13
13
  },
14
14
  "devDependencies": {
15
- "vagejs": "^0.3.2"
15
+ "vagejs": "^0.3.4"
16
16
  }
17
17
  }