Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions workspaces/scorecard/.changeset/brave-baths-strive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@red-hat-developer-hub/backstage-plugin-scorecard-backend': patch
---

Replace deprecated uuid dependency with the Node.js built-in `crypto.randomUUID`.
5 changes: 5 additions & 0 deletions workspaces/scorecard/.changeset/ninety-squids-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@red-hat-developer-hub/backstage-plugin-scorecard-node': patch
---

Remove unused uuid dependency
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"express": "^4.17.1",
"express-promise-router": "^4.1.0",
"knex": "^3.1.0",
"uuid": "^9.0.1",
"zod": "^3.22.4"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ import { mockDatabaseMetricValues } from '../../../__fixtures__/mockDatabaseMetr
import { CLEANUP_EXPIRED_METRICS_ID } from '../constants';
import { daysToMilliseconds } from './utils';

jest.mock('uuid', () => ({
v4: jest.fn(() => 'test-uuid-1234'),
}));

jest.mock('./utils', () => ({
daysToMilliseconds: jest.fn((days: number) => days * 24 * 60 * 60 * 1000),
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import {
SchedulerService,
SchedulerServiceTaskScheduleDefinition,
} from '@backstage/backend-plugin-api';
import { randomUUID } from 'node:crypto';
import { CLEANUP_EXPIRED_METRICS_ID } from '../constants';
import { v4 as uuid } from 'uuid';
import { daysToMilliseconds } from './utils';
import type { Config } from '@backstage/config';
import { SchedulerTask, SchedulerOptions } from '../types';
Expand Down Expand Up @@ -63,7 +63,7 @@ export class CleanupExpiredMetricsTask implements SchedulerTask {
fn: async () => {
const logger = this.logger.child({
taskId: CLEANUP_EXPIRED_METRICS_ID,
taskInstanceId: uuid(),
taskInstanceId: randomUUID(),
});

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import type { Config } from '@backstage/config';
import { CatalogService } from '@backstage/plugin-catalog-node';
import { MetricProvider } from '@red-hat-developer-hub/backstage-plugin-scorecard-node';
import { isMetricIdDisabled } from '../../utils/metricUtils';
import { randomUUID } from 'node:crypto';
import { normalizeOwnerRef } from '../../utils/normalizeOwnerRef';
import { v4 as uuid } from 'uuid';
import { stringifyEntityRef } from '@backstage/catalog-model';
import { DbMetricValueCreate } from '../../database/types';
import { SchedulerOptions, SchedulerTask } from '../types';
Expand Down Expand Up @@ -93,7 +93,7 @@ export class PullMetricsByProviderTask implements SchedulerTask {
const logger = this.logger.child({
class: this.constructor.name,
taskId: this.providerId,
taskInstanceId: uuid(),
taskInstanceId: randomUUID(),
});

try {
Expand Down
3 changes: 1 addition & 2 deletions workspaces/scorecard/plugins/scorecard-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
"@backstage/catalog-model": "^1.7.7",
"@backstage/errors": "^1.2.7",
"@backstage/plugin-catalog-node": "^2.1.0",
"@red-hat-developer-hub/backstage-plugin-scorecard-common": "workspace:^",
"uuid": "^9.0.1"
"@red-hat-developer-hub/backstage-plugin-scorecard-common": "workspace:^"
},
"devDependencies": {
"@backstage/backend-test-utils": "^1.11.1",
Expand Down
2 changes: 0 additions & 2 deletions workspaces/scorecard/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12325,7 +12325,6 @@ __metadata:
express-promise-router: "npm:^4.1.0"
knex: "npm:^3.1.0"
supertest: "npm:^6.2.4"
uuid: "npm:^9.0.1"
zod: "npm:^3.22.4"
languageName: unknown
linkType: soft
Expand All @@ -12351,7 +12350,6 @@ __metadata:
"@backstage/plugin-catalog-node": "npm:^2.1.0"
"@backstage/types": "npm:^1.2.2"
"@red-hat-developer-hub/backstage-plugin-scorecard-common": "workspace:^"
uuid: "npm:^9.0.1"
languageName: unknown
linkType: soft

Expand Down
Loading