MCPcopy
hub / github.com/midrender/revideo / loadVersion

Function loadVersion

packages/vite-plugin/src/versions.ts:13–22  ·  view source on GitHub ↗
(module: string)

Source from the content-addressed store, hash-verified

11}
12
13function loadVersion(module: string): string | null {
14 try {
15 const modulePath = path.dirname(require.resolve(`${module}/package.json`));
16 const packageJsonPath = path.resolve(modulePath, 'package.json');
17 const packageJson = JSON.parse(fs.readFileSync(packageJsonPath).toString());
18 return packageJson.version ?? null;
19 } catch (_) {
20 return null;
21 }
22}

Callers 1

getVersionsFunction · 0.85

Calls 2

parseMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected