fix: add micromatch to package deps (#1020)

This commit is contained in:
Brandon Keiji
2025-06-13 22:18:05 +00:00
committed by GitHub
parent a2fe3d2ad0
commit 209381f06f
4 changed files with 45 additions and 12 deletions

View File

@@ -0,0 +1,38 @@
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {
readPackageUp,
type PackageJson as BasePackageJson,
} from 'read-package-up';
import { fileURLToPath } from 'url';
import path from 'path';
export type PackageJson = BasePackageJson & {
config?: {
sandboxImageUri?: string;
};
};
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
let packageJson: PackageJson | undefined;
export async function getPackageJson(): Promise<PackageJson | undefined> {
if (packageJson) {
return packageJson;
}
const result = await readPackageUp({ cwd: __dirname });
if (!result) {
// TODO: Maybe bubble this up as an error.
return;
}
packageJson = result.packageJson;
return packageJson;
}