Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
client/out
server/out
server/src/perlnavigator.ts
browser-ext/out
node_modules
client/server
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@
"install-browser": "cd browser-ext && npm install",
"postinstall": "npm run-script install-client && npm run-script install-server && npm run-script install-browser",
"ci-client": "cd client && npm ci",
"ci-server": "cd server && npm ci",
"ci-server": "node update-version.js && cd server && npm ci",
"ci-all": "npm ci && npm run ci-client && npm run ci-server",
Comment on lines 386 to 388

Copilot AI Mar 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only ci-server runs update-version.js, but npm run compile/watch and the package/vscode:prepublish webpack build also compile server/src/server.ts. Without running the generator there, builds will fail due to the missing server/src/perlnavigator.ts module. Consider adding a dedicated generate-version step and invoking it from compile, watch, and package (and/or postinstall / install-server).

Copilot uses AI. Check for mistakes.
"clean": "rm -rf ./node-modules ./server/node-modules ./client/node-modules",
"foo": "(cd client && npm ci && cd ../); (cd server && npm c )",
Expand Down
11 changes: 11 additions & 0 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ import { getPerlAssetsPath } from "./assets";

var LRU = require("lru-cache");

import { VERSION, NAME } from "./perlnavigator";

Comment on lines +40 to +41

Copilot AI Mar 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

server.ts now imports ./perlnavigator, but server/src/perlnavigator.ts is generated (and gitignored) and does not exist in a fresh checkout. This will break TypeScript builds/webpack packaging unless version generation is wired into the normal build flow (e.g., pre-compile/package/watch/install-server) or the file is checked in with stable exports.

Suggested change
import { VERSION, NAME } from "./perlnavigator";
const DEFAULT_NAME = "Perl Navigator";
const DEFAULT_VERSION = "dev";
let NAME: string = DEFAULT_NAME;
let VERSION: string = DEFAULT_VERSION;
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const perlnavigator = require("./perlnavigator") as { NAME?: string; VERSION?: string };
if (perlnavigator.NAME) {
NAME = perlnavigator.NAME;
}
if (perlnavigator.VERSION) {
VERSION = perlnavigator.VERSION;
}
} catch {
// Fall back to default values when ./perlnavigator is not available.
}

Copilot uses AI. Check for mistakes.
if (process.argv.includes ("--version")) {
console.log(NAME + " " + VERSION);
process.exit(0);
}

// It the editor doesn't request node-ipc, use stdio instead. Make sure this runs before createConnection
if (process.argv.length <= 2) {
process.argv.push("--stdio");
Expand Down Expand Up @@ -82,6 +89,10 @@ connection.onInitialize(async (params: InitializeParams) => {
triggerCharacters: ["(", ",", ")"],
},
},
serverInfo: {
name: NAME,
version: VERSION,
}
};
if (hasWorkspaceFolderCapability) {
result.capabilities.workspace = {
Expand Down
10 changes: 10 additions & 0 deletions update-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const fs = require("node:fs");
const pkg = require("./package.json");

const content = `
export const VERSION = "${pkg.version}";
export const NAME = "${pkg.name}";
`;

fs.writeFileSync("server/src/perlnavigator.ts", content);
console.log("Generated server/src/perlnavigator.ts");
Comment on lines +2 to +10

Copilot AI Mar 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

writeFileSync("server/src/perlnavigator.ts", ...) (and the require("./package.json") above) depend on the current working directory being the repo root. Using __dirname + path.join(...) for both input and output paths would prevent failures if the script is run from a different CWD (e.g., tooling/CI).

Suggested change
const pkg = require("./package.json");
const content = `
export const VERSION = "${pkg.version}";
export const NAME = "${pkg.name}";
`;
fs.writeFileSync("server/src/perlnavigator.ts", content);
console.log("Generated server/src/perlnavigator.ts");
const path = require("node:path");
const pkg = require(path.join(__dirname, "package.json"));
const content = `
export const VERSION = "${pkg.version}";
export const NAME = "${pkg.name}";
`;
const outputPath = path.join(__dirname, "server", "src", "perlnavigator.ts");
fs.writeFileSync(outputPath, content);
console.log(`Generated ${outputPath}`);

Copilot uses AI. Check for mistakes.
Loading