Skip to content

Commit 0347f88

Browse files
committed
Merge Commit 'd53a5c4': fix: (some minor improvements to configs and getPackageJson return behaviour) (google-gemini#12510)
2 parents c450ccb + d53a5c4 commit 0347f88

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

eslint.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export default tseslint.config(
2929
// Global ignores
3030
ignores: [
3131
'node_modules/*',
32-
'.integration-tests/**',
3332
'eslint.config.js',
3433
'packages/**/dist/**',
3534
'bundle/**',

packages/cli/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* SPDX-License-Identifier: Apache-2.0
77
*/
88

9-
import './src/gemini.js';
109
import { main } from './src/gemini.js';
1110
import { FatalError, writeToStderr } from '@google/gemini-cli-core';
1211
import { runExitCleanup } from './src/utils/cleanup.js';

packages/core/src/utils/package.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,26 @@ export type PackageJson = BasePackageJson & {
1515
};
1616
};
1717

18+
/**
19+
* Reads package.json from the current directory or any parent directory.
20+
*
21+
* @param cwd - The directory to start searching from (searches upward to filesystem root)
22+
* @returns The package.json object if found, or `undefined` if no package.json exists
23+
* in the directory hierarchy. This is expected behavior when called from
24+
* directories outside of a Node.js project.
25+
*
26+
* @example
27+
* ```ts
28+
* const pkg = await getPackageJson(__dirname);
29+
* const version = pkg?.version ?? 'unknown';
30+
* ```
31+
*/
1832
export async function getPackageJson(
1933
cwd: string,
2034
): Promise<PackageJson | undefined> {
2135
const result = await readPackageUp({ cwd });
2236
if (!result) {
23-
// TODO: Maybe bubble this up as an error.
24-
return;
37+
return undefined;
2538
}
2639

2740
return result.packageJson;

0 commit comments

Comments
 (0)