Skip to content

Commit

Permalink
chore: review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Nov 3, 2022
1 parent 21ed0e1 commit 8e0de8c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
11 changes: 10 additions & 1 deletion src/plugins/node-workspace.ts
Expand Up @@ -346,7 +346,7 @@ export class NodeWorkspace extends WorkspacePlugin<Package> {

private detectRangePrefix(version: string): string {
return (
['^', '~', '>', '<', '<=', '>='].find(supportedRangePrefix =>
Object.values(SUPPORTED_RANGE_PREFIXES).find(supportedRangePrefix =>
version.startsWith(supportedRangePrefix)
) || ''
);
Expand All @@ -361,6 +361,15 @@ export class NodeWorkspace extends WorkspacePlugin<Package> {
}
}

enum SUPPORTED_RANGE_PREFIXES {
CARET = '^',
TILDE = '~',
GREATER_THAN = '>',
LESS_THAN = '<',
EQUAL_OR_GREATER_THAN = '>=',
EQUAL_OR_LESS_THAN = '<=',
}

function getChangelogDepsNotes(original: Package, updated: Package): string {
let depUpdateNotes = '';
type DT =
Expand Down
9 changes: 6 additions & 3 deletions test/plugins/node-workspace.ts
Expand Up @@ -172,11 +172,14 @@ describe('NodeWorkspace plugin', () => {
);
expect(nodeCandidate).to.not.be.undefined;
const updates = nodeCandidate!.pullRequest.updates;
assertHasUpdate(updates, 'plugin1/package.json');
assertHasUpdate(updates, 'node1/package.json');

expect(updates[1].updater).instanceof(RawContent);
const updater = updates[1].updater as RawContent;
const update = assertHasUpdate(
updates,
'plugin1/package.json',
RawContent
);
const updater = update.updater as RawContent;
snapshot(updater.rawContent);
});
it('combines node packages', async () => {
Expand Down

0 comments on commit 8e0de8c

Please sign in to comment.