refactor(tools): support an explicit project directory

This commit is contained in:
Sameh Khamis committed 2026-09-14 07:35:38 -07:00
1 parent 844c25212c
commit 6d5478ffa9
15 files changed
+169 -16

No files matched your search

+5 -4
View File
@@ -4,9 +4,10 @@ import { spawnSync } from 'node:child_process';
import path from 'node:path';
import { parseEnv } from 'node:util';
import { fileURLToPath } from 'node:url';
import { projectRoot } from './project-root.mjs';
import { selectMapStartupRoute } from '../src/mapStartup.js';
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const ROOT = projectRoot(import.meta.url);
export const CREDENTIALS = Object.freeze([
{ name: 'GOOGLE_MAPS_API_KEY', label: 'Google Maps', keychain: [['google-maps-api', 'api-key'], ['google-maps-api', 'default'], ['google-maps-api', 'key']] },
@@ -152,7 +153,7 @@ export function buildCapabilitySummary(credentials) {
};
}
export function inspectSetup({ includeKeychain = true, authoritativeEnvironment = false } = {}) {
export function inspectSetup({ includeKeychain = true, authoritativeEnvironment = false, rootDir = ROOT } = {}) {
const node = classifyNodeVersion();
const npm = npmProcessSpec();
const npmResult = spawnSync(npm.command, ['--version'], {
@@ -161,9 +162,9 @@ export function inspectSetup({ includeKeychain = true, authoritativeEnvironment
});
const credentials = Object.fromEntries(CREDENTIALS.map((spec) => [
spec.name,
resolveCredential(spec, { includeKeychain, authoritativeEnvironment }),
resolveCredential(spec, { includeKeychain, authoritativeEnvironment, rootDir }),
]));
const dependenciesInstalled = hasRequiredDependencies();
const dependenciesInstalled = hasRequiredDependencies(rootDir);
return {
ready: node.level !== 'error' && npmResult.status === 0 && dependenciesInstalled,
node: { version: process.versions.node, ...node },