-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): add warning and docs for react-19 and Next.Js combined (#7660
) Co-authored-by: Ash <[email protected]> Co-authored-by: Espen Hovlandsdal <[email protected]>
- Loading branch information
1 parent
f352db8
commit 3e87891
Showing
2 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
packages/@sanity/cli/src/actions/init-project/readPackageJson.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import fs from 'node:fs' | ||
|
||
import {type PackageJson} from '../../types' | ||
|
||
/** | ||
* Read the `package.json` file at the given path | ||
* | ||
* @param filePath - Path to package.json to read | ||
* @returns The parsed package.json | ||
*/ | ||
export function readPackageJson(filePath: string): PackageJson | undefined { | ||
try { | ||
// eslint-disable-next-line no-sync | ||
return JSON.parse(fs.readFileSync(filePath, 'utf8')) | ||
} catch (err) { | ||
return undefined | ||
} | ||
} |