Skip to content

Commit

Permalink
Merge pull request #125 from sliit-foss/feat/commander
Browse files Browse the repository at this point in the history
Feat!: automatic-versioning - invalidate turbo cache
  • Loading branch information
Akalanka47000 authored Dec 16, 2023
2 parents 6e790f0 + 9c17120 commit 0b8c571
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/automatic-versioning/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const defaultRootDir = "../../../../";
opts.root ??= defaultRootDir;
opts.ignorePrefixes = opts.ignorePrefixes?.split(",") ?? [];

console.log(`Running versioning script for ${opts.name}`.green);
console.info(`Running versioning script for ${opts.name}`.green);

if (opts.root !== defaultRootDir) {
const parentDir = path.resolve(__dirname, opts.root);
Expand Down
12 changes: 6 additions & 6 deletions packages/automatic-versioning/src/types/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const getCommitPrefix = async (recursive, ignorePrefixes, n = 1) => {
const runner = (name, noCommit, recursive = false, prereleaseTag, prereleaseBranch, ignorePrefixes) => {
run("git show --first-parent ./").then(async (diff) => {
if (diff) {
console.log(`Diff found, running versioning for ${name}`.green);
console.info(`Diff found, running versioning for ${name}`.green);
const { commitMessage, commitPrefix, noBump } = await getCommitPrefix(recursive, ignorePrefixes);
if (!noBump) {
let versionUpdate;
Expand All @@ -35,7 +35,7 @@ const runner = (name, noCommit, recursive = false, prereleaseTag, prereleaseBran
} else if (["prerelease", "prepatch", "preminor", "premajor"].includes(commitPrefix)) {
versionUpdate = commitPrefix;
} else {
console.log(`No suitable commit prefix found in commit message, skipping version bump`.yellow);
console.info(`No suitable commit prefix found in commit message, skipping version bump`.yellow);
return;
}
if (prereleaseBranch && ["major", "minor", "patch"].includes(versionUpdate)) {
Expand Down Expand Up @@ -84,19 +84,19 @@ const runner = (name, noCommit, recursive = false, prereleaseTag, prereleaseBran
}"`;
run("git add .").then(() => {
run(`git commit -m ${successMsg} --no-verify`).then(() => {
console.log(successMsg.green);
console.info(successMsg.green);
});
});
}
});
} else {
console.log(`No bump found in commit message, skipping version bump and editing commit message`.yellow);
console.info(`No bump found in commit message, skipping version bump and editing commit message`.yellow);
run(`git commit --amend -m "${commitMessage.replace(/--no-bump/g, "")}"`).then(() => {
console.log("Successfully edited commit message".green);
console.info("Successfully edited commit message".green);
});
}
} else {
console.log(`No diff found, skipping version bump for ${name}`.yellow);
console.info(`No diff found, skipping version bump for ${name}`.yellow);
}
});
};
Expand Down
4 changes: 2 additions & 2 deletions packages/automatic-versioning/src/types/tag-based.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ const runner = (name, noCommit) => {
const successMsg = `"CI: Bumped version of ${name} from ${initialVersion} to ${latest}"`;
run("git add .").then(() => {
run(`git commit -m ${successMsg}`).then(() => {
console.log(successMsg.green);
console.info(successMsg.green);
});
});
}
})
.catch(() => {});
} else {
console.log(`No tag diff found, skipping version bump for ${name}`.yellow);
console.info(`No tag diff found, skipping version bump for ${name}`.yellow);
}
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/automatic-versioning/src/utils/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const executor = (command) => {
return resolve(output);
})
.catch((error) => {
if (error) console.log(error.red);
if (error) console.error(error.red);
return reject(error);
});
});
Expand Down

0 comments on commit 0b8c571

Please sign in to comment.