Skip to content

Commit

Permalink
chore: rn useTagsForBump → pullTagsForPrerelease
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Oct 16, 2023
1 parent e8e0f6b commit f0f583a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const cli = meow(
--deps.bump Define deps version updating rule. Allowed: override, satisfy, inherit.
--deps.release Define release type for dependent package if any of its deps changes. Supported values: patch, minor, major, inherit.
--deps.prefix Optional prefix to be attached to the next dep version if '--deps.bump' set to 'override'. Supported values: '^' | '~' | '' (empty string as default).
--deps.useTagsForBump Optional flag to skip using release tags for evaluating prerelease version bumping. This is almost always the correct option since semantic-relesae will be creating tags for every dependency and it would lead to us bumping to a non-existent version. Set to false if you've already compensated for this in your workflow previously (true as default)
--deps.pullTagsForPrerelease Optional flag to control using release tags for evaluating prerelease version bumping. This is almost always the correct option since semantic-release will be creating tags for every dependency and it would lead to us bumping to a non-existent version. Set to false if you've already compensated for this in your workflow previously (true as default)
--ignore-packages Packages list to be ignored on bumping process
--ignore-private Exclude private packages. Enabled by default, pass 'no-ignore-private' to disable.
--tag-format Format to use for creating tag names. Should include "name" and "version" vars. Default: "\${name}@\${version}" generates "[email protected]"
Expand Down Expand Up @@ -60,7 +60,7 @@ const cli = meow(
"deps.prefix": {
type: "string",
},
"deps.useTagsForBump": {
"deps.pullTagsForPrerelease": {
type: "boolean",
},
ignorePrivate: {
Expand Down
4 changes: 2 additions & 2 deletions lib/getConfigMultiSemrel.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { createRequire } from "node:module";
* @property {'override' | 'satisfy' | 'inherit'} bump
* @property {'patch' | 'minor' | 'major' | 'inherit'} release
* @property {'^' | '~' | ''} prefix
* @property {boolean} useTagsForBump
* @property {boolean} pullTagsForPrerelease
*/

/**
Expand Down Expand Up @@ -94,7 +94,7 @@ export default async function getConfig(cwd, cliOptions) {
bump: "override",
release: "patch",
prefix: "",
useTagsForBump: false,
pullTagsForPrerelease: false,
},
silent: false,
},
Expand Down
10 changes: 5 additions & 5 deletions lib/multiSemanticRelease.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { createRequire } from "module";
* @param {context|void} context The semantic-release context for this package's release (filled in once semantic-release runs).
* @param {undefined|Result|false} result The result of semantic-release (object with lastRelease, nextRelease, commits, releases), false if this package was skipped (no changes or similar), or undefined if the package's release hasn't completed yet.
* @param {Object} options Aggregate of semantic-release options for the package
* @param {boolean} useTagsForBump if set to true, the package will use tags to determine if its dependencies need to change (legacy functionality)
* @param {boolean} pullTagsForPrerelease if set to true, the package will use tags to determine if its dependencies need to change (legacy functionality)
* @param {Object} _lastRelease The last release object for the package before its current release (set during anaylze-commit)
* @param {Object} _nextRelease The next release object (the release the package is releasing for this cycle) (set during generateNotes)
*/
Expand Down Expand Up @@ -94,7 +94,7 @@ async function multiSemanticRelease(
env,
stdout,
stderr,
useTagsForBump: flags.deps.useTagsForBump,
pullTagsForPrerelease: flags.deps.pullTagsForPrerelease,
};
const { queue, packages: _packages } = await topo({
cwd,
Expand Down Expand Up @@ -153,7 +153,7 @@ async function multiSemanticRelease(
*
* @internal
*/
async function getPackage(path, { globalOptions, inputOptions, env, cwd, stdout, stderr, useTagsForBump }) {
async function getPackage(path, { globalOptions, inputOptions, env, cwd, stdout, stderr, pullTagsForPrerelease }) {
// Make path absolute.
path = cleanPath(path, cwd);
const dir = dirname(path);
Expand Down Expand Up @@ -194,7 +194,7 @@ async function getPackage(path, { globalOptions, inputOptions, env, cwd, stdout,
options,
plugins,
fakeLogger: fakeLogger,
useTagsForBump: !!useTagsForBump,
pullTagsForPrerelease: !!pullTagsForPrerelease,
};
}

Expand Down Expand Up @@ -262,7 +262,7 @@ async function releasePackage(pkg, createInlinePlugin, multiContext, flags) {
function normalizeFlags(_flags) {
return {
deps: {
useTagsForBump: !!_flags.deps?.useTagsForBump,
pullTagsForPrerelease: !!_flags.deps?.pullTagsForPrerelease,
},
..._flags,
};
Expand Down
6 changes: 3 additions & 3 deletions lib/updateDeps.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const getVersionFromTag = (pkg, tag) => {
* Will resolve highest next version of either:
*
* 1. The last release for the package during this multi-release cycle
* 2. (if the package has useTagsForBump true):
* 2. (if the package has pullTagsForPrerelease true):
* a. the highest increment of the tags array provided
* b. the highest increment of the gitTags for the prerelease
*
Expand All @@ -61,7 +61,7 @@ const getNextPreVersion = (pkg, tags) => {
// Note: this is only set is a current multi-semantic-release released
const lastVersionForCurrentRelease = pkg._lastRelease && pkg._lastRelease.version;

if (!pkg.useTagsForBump && tags) {
if (!pkg.pullTagsForPrerelease && tags) {
throw new Error("Supplied tags for NextPreVersion but the package does not use tags for next prerelease");
}

Expand All @@ -71,7 +71,7 @@ const getNextPreVersion = (pkg, tags) => {
// 3. Resolve the versions from the tags
// TODO: replace {cwd: '.'} with multiContext.cwd
if (pkg.name) tagFilters.push(pkg.name);
if (!tags && pkg.useTagsForBump) {
if (!tags && pkg.pullTagsForPrerelease) {
try {
tags = getTags(pkg._branch, { cwd: pkg.dir }, tagFilters);
} catch (e) {
Expand Down
6 changes: 3 additions & 3 deletions test/lib/multiSemanticRelease.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ describe("multiSemanticRelease()", () => {
});

// Bug state that we want to keep for now in case of other people who have triaged it
test("Changes in some packages with bugged prerelease bumping (useTagsForBump: true)", async () => {
test("Changes in some packages with bugged prerelease bumping (pullTagsForPrerelease: true)", async () => {
const preReleaseBranch = "alpha";
// Create Git repo.
const cwd = gitInit(preReleaseBranch);
Expand Down Expand Up @@ -1097,7 +1097,7 @@ describe("multiSemanticRelease()", () => {
{ cwd, stdout, stderr, env },
{
deps: {
useTagsForBump: true,
pullTagsForPrerelease: true,
},
dryRun: false,
}
Expand Down Expand Up @@ -1232,7 +1232,7 @@ describe("multiSemanticRelease()", () => {
{ cwd, stdout: stdout2, stderr: stderr2, env },
{
deps: {
useTagsForBump: true,
pullTagsForPrerelease: true,
},
dryRun: false,
}
Expand Down
12 changes: 6 additions & 6 deletions test/lib/updateDeps.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ describe("getNextPreVersion()", () => {
_preRelease: preRelease,
_branch: "master",
name: "testing-package",
useTagsForBump: true,
pullTagsForPrerelease: true,
},
lastTags,
)).toBe(nextVersion);
Expand All @@ -265,14 +265,14 @@ describe("getNextPreVersion()", () => {
_preRelease: preRelease,
_branch: "master",
name: "testing-package",
useTagsForBump: true,
pullTagsForPrerelease: true,
},
// No Tags array means we look them up
)).toBe(nextVersion);
expect(getTags).toHaveBeenCalledTimes(1);
});
});
it("does not allow tags if useTagsForBump = false", () => {
it("does not allow tags if pullTagsForPrerelease = false", () => {
expect(() =>
getNextPreVersion(
{
Expand All @@ -281,7 +281,7 @@ describe("getNextPreVersion()", () => {
_preRelease: "dev",
_branch: "master",
name: "testing-package",
useTagsForBump: false,
pullTagsForPrerelease: false,
},
[]
)
Expand All @@ -301,7 +301,7 @@ describe("getNextPreVersion()", () => {
["1.0.0", "patch", "beta", "1.0.1-beta.1"],
];
noTagCases.forEach(([lastVersion, releaseType, preRelease, nextVersion]) => {
it(`${lastVersion} and ${releaseType} for channel ${preRelease} gives ${nextVersion} when useTagsForBump = false`, () => {
it(`${lastVersion} and ${releaseType} for channel ${preRelease} gives ${nextVersion} when pullTagsForPrerelease = false`, () => {
// prettier-ignore
expect(getNextPreVersion(
{
Expand All @@ -310,7 +310,7 @@ describe("getNextPreVersion()", () => {
_preRelease: preRelease,
_branch: "master",
name: "testing-package",
useTagsForBump: false,
pullTagsForPrerelease: false,
},
)).toBe(nextVersion);
});
Expand Down

0 comments on commit f0f583a

Please sign in to comment.