File tree Expand file tree Collapse file tree 2 files changed +220
-11
lines changed Expand file tree Collapse file tree 2 files changed +220
-11
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ export const getBiomeVersion = async (octokit: Octokit): Promise<string> => {
48
48
49
49
return (
50
50
getInput ( "version" ) ??
51
+ warnAboutMissingPackageJsonManifest ( root ) ??
51
52
( await extractVersionFromNpmLockFile ( root ) ) ??
52
53
( await extractVersionFromPnpmLockFile ( root ) ) ??
53
54
( await extractVersionFromYarnLockFile ( root ) ) ??
@@ -57,6 +58,25 @@ export const getBiomeVersion = async (octokit: Octokit): Promise<string> => {
57
58
) ;
58
59
} ;
59
60
61
+ /**
62
+ * Warns the user if the package.json file is missing in the project root.
63
+ *
64
+ * If the package.json file is missing from the working directory, it is likely
65
+ * that the user has not checked out the repository. This function will
66
+ * display a warning message to the user, indicating that the package.json
67
+ * file is missing and suggesting that the user check out the repository.
68
+ *
69
+ * @returns {undefined } Always returns undefined.
70
+ */
71
+ const warnAboutMissingPackageJsonManifest = ( root : string ) => {
72
+ if ( ! existsSync ( join ( root , "package.json" ) ) ) {
73
+ warning (
74
+ "Cannot find package.json in the working directory. Did you forget to checkout the repository?" ,
75
+ ) ;
76
+ }
77
+ return undefined ;
78
+ } ;
79
+
60
80
/**
61
81
* Extracts the Biome CLI version from the project's
62
82
* package-lock.json file.
You can’t perform that action at this time.
0 commit comments