mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-23 03:24:42 -07:00
refactor(core): Move getPackageJson utility to core package (#12224)
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import {
|
||||
readPackageUp,
|
||||
type PackageJson as BasePackageJson,
|
||||
} from 'read-package-up';
|
||||
|
||||
export type PackageJson = BasePackageJson & {
|
||||
config?: {
|
||||
sandboxImageUri?: string;
|
||||
};
|
||||
};
|
||||
|
||||
export async function getPackageJson(
|
||||
cwd: string,
|
||||
): Promise<PackageJson | undefined> {
|
||||
const result = await readPackageUp({ cwd });
|
||||
if (!result) {
|
||||
// TODO: Maybe bubble this up as an error.
|
||||
return;
|
||||
}
|
||||
|
||||
return result.packageJson;
|
||||
}
|
||||
Reference in New Issue
Block a user