-
Notifications
You must be signed in to change notification settings - Fork 418
fix(dev-cli): Add warning about Turbopack usage #6189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@clerk/dev-cli': patch | ||
| --- | ||
|
|
||
| Add warning regarding Turbopack usage. |
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,11 @@ | ||||||||||||||||||||||||||||||||||||||
| import { readFile } from 'node:fs/promises'; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||
| * Gets the contents of the provided package.json. | ||||||||||||||||||||||||||||||||||||||
| * @param {string} pathToPackageJSON | ||||||||||||||||||||||||||||||||||||||
| * @returns {Promise<{ scripts?: Record<string, string>, dependencies?: Record<string, string>, devDependencies?: Record<string, string>}>} | ||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||
| export async function getPackageJSON(pathToPackageJSON) { | ||||||||||||||||||||||||||||||||||||||
| const packageJSON = await readFile(pathToPackageJSON, 'utf-8'); | ||||||||||||||||||||||||||||||||||||||
| return JSON.parse(packageJSON); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+8
to
+11
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add error handling for file operations and JSON parsing. The function lacks error handling for common failure scenarios such as file not found or invalid JSON syntax. Consider adding try-catch blocks to provide more meaningful error messages. export async function getPackageJSON(pathToPackageJSON) {
- const packageJSON = await readFile(pathToPackageJSON, 'utf-8');
- return JSON.parse(packageJSON);
+ try {
+ const packageJSON = await readFile(pathToPackageJSON, 'utf-8');
+ return JSON.parse(packageJSON);
+ } catch (error) {
+ if (error.code === 'ENOENT') {
+ throw new Error(`package.json not found at: ${pathToPackageJSON}`);
+ }
+ if (error instanceof SyntaxError) {
+ throw new Error(`Invalid JSON in package.json at: ${pathToPackageJSON}`);
+ }
+ throw error;
+ }
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix optional chaining as suggested by static analysis.
The static analysis tool correctly identified that
pkgJSON.scripts.devshould use optional chaining to prevent potential runtime errors whenscriptsis undefined.📝 Committable suggestion
🧰 Tools
🪛 Biome (1.9.4)
[error] 254-254: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
🤖 Prompt for AI Agents