Skip to content

Commit

Permalink
fix: build label before state label (#3828)
Browse files Browse the repository at this point in the history
.NET does versions like 4.14.0-rc0.preview, i.e. the "build label" comes before "preview".

Co-authored-by: Michael Richardson <40401643+mdrichardson@users.noreply.github.com>
  • Loading branch information
Josh Gummersall and mdrichardson authored Jul 2, 2021
1 parent e925861 commit 159c7c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions libraries/botbuilder-repo-utils/src/updateVersions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export const getPackageVersion = (
): PackageVersion => {
const prerelease = [];

if (options.buildLabel) {
prerelease.push(options.buildLabel);
}

if (pkg.deprecated) {
prerelease.push(options.deprecated);
} else if (pkg.internal) {
Expand All @@ -52,10 +56,6 @@ export const getPackageVersion = (
prerelease.push(options.preview);
}

if (options.buildLabel) {
prerelease.push(options.buildLabel);
}

if (options.commitSha) {
prerelease.push(options.commitSha);
}
Expand Down
8 changes: 4 additions & 4 deletions libraries/botbuilder-repo-utils/tests/updateVersions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('updateVersions', function () {
label: 'preview package with date, commitSha, and build label',
pkg: previewPackage,
options: { ...defaultOptions, buildLabel: 'BUILD', commitSha: 'COMMIT', date: 'DATE' },
expected: `${newVersion}-PREVIEW.BUILD.COMMIT+date-DATE`,
expected: `${newVersion}-BUILD.PREVIEW.COMMIT+date-DATE`,
},
{
label: 'deprecated package with defaults',
Expand Down Expand Up @@ -110,7 +110,7 @@ describe('updateVersions', function () {
label: 'deprecated package with date, commitSha, and buildLabel',
pkg: deprecatedPackage,
options: { ...defaultOptions, buildLabel: 'BUILD', commitSha: 'COMMIT', date: 'DATE' },
expected: `${newVersion}-DEPRECATED.BUILD.COMMIT+date-DATE`,
expected: `${newVersion}-BUILD.DEPRECATED.COMMIT+date-DATE`,
},
];

Expand Down Expand Up @@ -288,12 +288,12 @@ describe('updateVersions', function () {
const expectedVersion = new PackageVersion(`${packageVersion}-dev.COMMIT`, `date-${formattedDate}`);

const expectedPreviewVersion = new PackageVersion(
`${packageVersion}-preview.dev.COMMIT`,
`${packageVersion}-dev.preview.COMMIT`,
`date-${formattedDate}`
);

const expectedDeprecatedVersion = new PackageVersion(
`${packageVersion}-deprecated.dev.COMMIT`,
`${packageVersion}-dev.deprecated.COMMIT`,
`date-${formattedDate}`
);

Expand Down

0 comments on commit 159c7c5

Please sign in to comment.