-
Notifications
You must be signed in to change notification settings - Fork 427
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 combination
- Loading branch information
1 parent
f352db8
commit 4e2206f
Showing
2 changed files
with
40 additions
and
0 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 '@sanity/cli' | ||
|
||
/** | ||
* 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 { | ||
try { | ||
// eslint-disable-next-line no-sync | ||
return JSON.parse(fs.readFileSync(filePath, 'utf8')) | ||
} catch (err) { | ||
throw new Error(`Failed to read "${filePath}": ${err.message}`) | ||
} | ||
} |