Skip to content

Commit

Permalink
Update formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ecraig12345 committed Sep 5, 2024
1 parent 34049ac commit 938c6a6
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 8 deletions.
19 changes: 17 additions & 2 deletions src/__tests__/changefile/changeTypes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ describe('getMaxChangeType', () => {
});

it('returns none if all given change types are disallowed', () => {
const changeType = getMaxChangeType('patch', 'major', ['major', 'minor', 'patch', 'prerelease', 'premajor', 'preminor', 'prepatch']);
const changeType = getMaxChangeType('patch', 'major', [
'major',
'minor',
'patch',
'prerelease',
'premajor',
'preminor',
'prepatch',
]);
expect(changeType).toBe('none');
});

Expand All @@ -29,7 +37,14 @@ describe('getMaxChangeType', () => {
});

it('handles prerelease only case', () => {
const changeType = getMaxChangeType('patch', 'major', ['major', 'minor', 'patch', 'premajor', 'preminor', 'prepatch']);
const changeType = getMaxChangeType('patch', 'major', [
'major',
'minor',
'patch',
'premajor',
'preminor',
'prepatch',
]);
expect(changeType).toBe('prerelease');
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/bump/bumpPackageInfoVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function bumpPackageInfoVersion(pkgName: string, bumpInfo: BumpInfo, opti
} else {
// Ensure we can bump the correct versions
let bumpAsPrerelease = false;
if (options.prereleasePrefix && ! ["premajor", "preminor", "prepatch"].includes(changeType)) {
if (options.prereleasePrefix && !['premajor', 'preminor', 'prepatch'].includes(changeType)) {
bumpAsPrerelease = true;
}

Expand Down
11 changes: 10 additions & 1 deletion src/changefile/changeTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@ import { ChangeSet, ChangeType } from '../types/ChangeInfo';
/**
* List of all change types from least to most significant.
*/
export const SortedChangeTypes: ChangeType[] = ['none', 'prerelease', 'prepatch', 'patch', 'preminor', 'minor', 'premajor', 'major'];
export const SortedChangeTypes: ChangeType[] = [
'none',
'prerelease',
'prepatch',
'patch',
'preminor',
'minor',
'premajor',
'major',
];

/**
* Change type with the smallest weight.
Expand Down
2 changes: 1 addition & 1 deletion src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ export const env = Object.freeze({
workspaceToolsGitDebug: !!process.env.GIT_DEBUG,
workspaceToolsGitMaxBuffer: (process.env.GIT_MAX_BUFFER && parseInt(process.env.GIT_MAX_BUFFER, 10)) || undefined,
// Override default NPM_CONCURRENCY
npmConcurrency: (process.env.NPM_CONCURRENCY && parseInt(process.env.NPM_CONCURRENCY)) || undefined
npmConcurrency: (process.env.NPM_CONCURRENCY && parseInt(process.env.NPM_CONCURRENCY)) || undefined,
});
2 changes: 1 addition & 1 deletion src/types/ChangeInfo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type ChangeType = 'prerelease' | 'prepatch' |'patch' | 'preminor' |'minor' | 'premajor' |'major' | 'none';
export type ChangeType = 'prerelease' | 'prepatch' | 'patch' | 'preminor' | 'minor' | 'premajor' | 'major' | 'none';

/**
* Info saved in each change file.
Expand Down
5 changes: 3 additions & 2 deletions src/validation/isValidDependentChangeType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export function isValidDependentChangeType(
const disallowedDependentChangeTypes = (disallowedChangeTypes || []).filter(t => t !== 'patch');

return (
['patch', 'major', 'minor', 'prerelease', 'prepatch', 'praminor', 'premajor', 'none'].includes(dependentChangeType) &&
!disallowedDependentChangeTypes.includes(dependentChangeType)
['patch', 'major', 'minor', 'prerelease', 'prepatch', 'praminor', 'premajor', 'none'].includes(
dependentChangeType
) && !disallowedDependentChangeTypes.includes(dependentChangeType)
);
}

0 comments on commit 938c6a6

Please sign in to comment.