MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / parsePackageJson

Function parsePackageJson

tools/templates/update-template-jsons.ts:35–55  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

33}
34
35function parsePackageJson(content: string): string[] {
36 const result: string[] = [];
37 let pkg: {
38 dependencies?: Record<string, unknown>;
39 devDependencies?: Record<string, unknown>;
40 };
41 try {
42 pkg = JSON.parse(content);
43 } catch {
44 return result;
45 }
46 for (const deps of [pkg.dependencies, pkg.devDependencies]) {
47 if (deps && typeof deps === 'object') {
48 for (const name of Object.keys(deps)) {
49 const normalized = normalizeNpmPackageName(name);
50 if (!shouldSkipPackage(normalized)) result.push(normalized);
51 }
52 }
53 }
54 return result;
55}
56
57/** Parse [dependencies] section from Cargo.toml. Keys only, no external deps. */
58function parseCargoToml(content: string): string[] {

Callers 1

collectDepsFromManifestsFunction · 0.85

Calls 5

normalizeNpmPackageNameFunction · 0.85
shouldSkipPackageFunction · 0.85
parseMethod · 0.45
keysMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…