-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
small refactoring to existing script
base setup for how the check would work in the bump-oss script change export test comment Revert "test comment" This reverts commit 84312514ba365debbd5e64fc200df9a099f40a66. another test fix another fix remove comment checkpoint tweak add the command to package.json asd refactoring tweak missing ROOT fix fix keep going fix fix tweak fix for root one more tweak tweak twy twea asd remove blocking comment cleanup
- Loading branch information
Showing
4 changed files
with
131 additions
and
28 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
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
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,49 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
*/ | ||
|
||
const chalk = require('chalk'); | ||
const {echo, exec} = require('shelljs'); | ||
|
||
const detectPackageUnreleasedChanges = ( | ||
packageRelativePathFromRoot, | ||
packageName, | ||
ROOT_LOCATION, | ||
) => { | ||
const hashOfLastCommitInsidePackage = exec( | ||
`git log -n 1 --format=format:%H -- ${packageRelativePathFromRoot}`, | ||
{cwd: ROOT_LOCATION, silent: true}, | ||
).stdout.trim(); | ||
|
||
const hashOfLastCommitThatChangedVersion = exec( | ||
`git log -G\\"version\\": --format=format:%H -n 1 -- ${packageRelativePathFromRoot}/package.json`, | ||
{cwd: ROOT_LOCATION, silent: true}, | ||
).stdout.trim(); | ||
|
||
if (hashOfLastCommitInsidePackage === hashOfLastCommitThatChangedVersion) { | ||
echo( | ||
`\uD83D\uDD0E No changes for package ${chalk.green( | ||
packageName, | ||
)} since last version bump`, | ||
); | ||
return false; | ||
} else { | ||
echo(`\uD83D\uDCA1 Found changes for ${chalk.yellow(packageName)}:`); | ||
exec( | ||
`git log --pretty=oneline ${hashOfLastCommitThatChangedVersion}..${hashOfLastCommitInsidePackage} ${packageRelativePathFromRoot}`, | ||
{ | ||
cwd: ROOT_LOCATION, | ||
}, | ||
); | ||
echo(); | ||
|
||
return true; | ||
} | ||
}; | ||
|
||
module.exports = detectPackageUnreleasedChanges; |
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