A small utility tool to be used in CI/CD pipelines along with git
to trigger dependent libraries' workflows in a monorepo pattern.
yarn global add yarn-changed-workspaces
yarn-changed-workspaces --help
./package.json
{
"workspaces": ["packages/*"]
}
const getChangedWorkspaces = require("yarn-changed-workspaces");
(async () => {
const workspaces = await getChangedWorkspaces({
branch: "master",
projectRoot: process.cwd(),
});
console.log("changes", workspaces);
})();
./package.json
{
"private": true,
"workspaces": ["packages/*"]
}
./packages/app/package.json
{
"name": "@team/ui",
"version": "1.0.0",
"workspace": { "files": ["!**/*.(test|spec).(j|t)s(x)?"] }
}
git
is the core diffing tool. This library will not work if you use a different distributed version-control system for tracking changes in source code during software development