Skip to content
Merged
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
2 changes: 1 addition & 1 deletion packages/types/scripts/publish-npm.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function commitVersionChanges(version) {

try {
const status = execSync("git status --porcelain", { encoding: "utf8" })
const relevantChanges = status.split("\n").filter((line) => line.includes("packages/sdk/npm/package"))
const relevantChanges = status.split("\n").filter((line) => line.includes("packages/types/npm/package"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix! For future improvements, consider adding a validation check to ensure the path exists before filtering. This would make the script more robust:

Suggested change
const relevantChanges = status.split("\n").filter((line) => line.includes("packages/types/npm/package"))
const relevantChanges = status.split("
").filter((line) => {
const targetPath = "packages/types/npm/package";
if (!fs.existsSync(path.join(rootDir, "..", targetPath.split("/")[0]))) {
console.warn(` ⚠️ Path may not exist`);
}
return line.includes(targetPath);
})

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extracting this path to a constant at the top of the file (similar to how npmDir is defined) to avoid hardcoding and make future maintenance easier. For example:

const GIT_FILTER_PATH = "packages/types/npm/package";

Then use it here as .filter((line) => line.includes(GIT_FILTER_PATH))


if (relevantChanges.length === 0) {
console.log(" ⚠️ No version changes to commit")
Expand Down
Loading