MCPcopy Create free account
hub / github.com/firebase/firebase-tools / packageJsonToAdminOrWebApp

Function packageJsonToAdminOrWebApp

src/appUtils.ts:177–204  ·  view source on GitHub ↗
(
  dirPath: string,
  packageJsonFile: string,
)

Source from the content-addressed store, hash-verified

175}
176
177async function packageJsonToAdminOrWebApp(
178 dirPath: string,
179 packageJsonFile: string,
180): Promise<App[]> {
181 try {
182 const fullPath = path.join(dirPath, packageJsonFile);
183 const packageJson = JSON.parse((await fs.readFile(fullPath)).toString()) as PackageJSON;
184 const allDeps = getAllDepsFromPackageJson(packageJson);
185 const detectedApps = [];
186 if (allDeps.includes("firebase-admin") || allDeps.includes("firebase-functions")) {
187 detectedApps.push({
188 platform: Platform.ADMIN_NODE,
189 directory: path.dirname(packageJsonFile),
190 });
191 }
192 if (allDeps.includes("firebase") || detectedApps.length === 0) {
193 detectedApps.push({
194 platform: Platform.WEB,
195 directory: path.dirname(packageJsonFile),
196 frameworks: getFrameworksFromPackageJson(packageJson),
197 });
198 }
199 return detectedApps;
200 } catch (err) {
201 // If there is a malformed package.json, don't crash
202 return [];
203 }
204}
205
206const WEB_FRAMEWORKS: Framework[] = Object.values(Framework);
207const WEB_FRAMEWORKS_SIGNALS: { [key in Framework]: string[] } = {

Callers 1

detectAppsFunction · 0.85

Calls 4

parseMethod · 0.80
toStringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…