Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
211 changes: 200 additions & 11 deletions dist/index.mjs

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions src/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const getBiomeVersion = async (octokit: Octokit): Promise<string> => {

return (
getInput("version") ??
warnAboutMissingPackageJsonManifest(root) ??
(await extractVersionFromNpmLockFile(root)) ??
(await extractVersionFromPnpmLockFile(root)) ??
(await extractVersionFromYarnLockFile(root)) ??
Expand All @@ -57,6 +58,25 @@ export const getBiomeVersion = async (octokit: Octokit): Promise<string> => {
);
};

/**
* Warns the user if the package.json file is missing in the project root.
*
* If the package.json file is missing from the working directory, it is likely
* that the user has not checked out the repository. This function will
* display a warning message to the user, indicating that the package.json
* file is missing and suggesting that the user check out the repository.
*
* @returns {undefined} Always returns undefined.
*/
const warnAboutMissingPackageJsonManifest = (root: string) => {
if (!existsSync(join(root, "package.json"))) {
warning(
"Cannot find package.json in the working directory. Did you forget to checkout the repository?",
);
}
return undefined;
};

/**
* Extracts the Biome CLI version from the project's
* package-lock.json file.
Expand Down
Loading