Skip to content
Merged
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
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@
],
"scripts": {
"bootstrap": "node scripts/bootstrap-submodule.mjs",
"prebuild": "node scripts/bootstrap-submodule.mjs",
"build": "tsc -p tsconfig.build.json",
"pretest": "node scripts/bootstrap-submodule.mjs",
"test": "vitest --run",
"test:watch": "vitest",
"pretypecheck": "node scripts/bootstrap-submodule.mjs",
"typecheck": "tsc --noEmit",
"lint": "biome check src test",
"lint:fix": "biome check --write src test",
"precheck": "node scripts/bootstrap-submodule.mjs",
"check": "tsc --noEmit && biome check src test && tsc -p tsconfig.build.json"
},
"dependencies": {
Expand Down
13 changes: 12 additions & 1 deletion scripts/bootstrap-submodule.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/usr/bin/env node
// Bootstrap the lsp-tools-mcp git submodule for local development.
// CI runs the install+build steps explicitly in the workflow, so this
// script is for `npm run bootstrap` after a fresh clone.
// script is mostly for `npm run bootstrap` after a fresh clone and as a
// chained pre-step before typecheck / test / check so contributors do not
// have to remember it.
//
// Idempotent: skips when dist/cli.js already exists, unless --force is passed.
import { existsSync } from "node:fs";
import { execSync } from "node:child_process";
import { dirname, join } from "node:path";
Expand All @@ -10,6 +14,8 @@ import { fileURLToPath } from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url));
const submoduleDir = join(__dirname, "..", "packages", "lsp-tools-mcp");
const submodulePackageJson = join(submoduleDir, "package.json");
const submoduleDistCli = join(submoduleDir, "dist", "cli.js");
const force = process.argv.includes("--force");

if (!existsSync(submodulePackageJson)) {
console.error(
Expand All @@ -18,6 +24,11 @@ if (!existsSync(submodulePackageJson)) {
process.exit(1);
}

if (!force && existsSync(submoduleDistCli)) {
// Already built; nothing to do.
process.exit(0);
}

console.log("Installing lsp-tools-mcp dependencies...");
execSync("npm ci", { cwd: submoduleDir, stdio: "inherit" });

Expand Down
Loading