Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
fix: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dbhagen committed Nov 7, 2024
1 parent 5ee0742 commit 8c8a216
Show file tree
Hide file tree
Showing 10 changed files with 27,511 additions and 20,648 deletions.
50 changes: 25 additions & 25 deletions backstage-plugin-autogov-common/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2916,31 +2916,6 @@ __metadata:
languageName: node
linkType: hard

"@internal/backstage-plugin-autogov-common@workspace:.":
version: 0.0.0-use.local
resolution: "@internal/backstage-plugin-autogov-common@workspace:."
dependencies:
"@backstage/cli": "npm:^0.27.1"
"@backstage/core-app-api": "npm:^1.15.0"
"@backstage/core-components": "npm:^0.15.0"
"@backstage/core-plugin-api": "npm:^1.9.4"
"@backstage/dev-utils": "npm:^1.1.0"
"@backstage/test-utils": "npm:^1.6.0"
"@backstage/theme": "npm:^0.5.7"
"@material-ui/core": "npm:^4.9.13"
"@material-ui/icons": "npm:^4.9.1"
"@material-ui/lab": "npm:^4.0.0-alpha.61"
"@testing-library/jest-dom": "npm:^6.0.0"
"@testing-library/react": "npm:^14.0.0"
"@testing-library/user-event": "npm:^14.0.0"
msw: "npm:^1.0.0"
react: "npm:^16.13.1 || ^17.0.0 || ^18.0.0"
react-use: "npm:^17.2.4"
peerDependencies:
react: ^16.13.1 || ^17.0.0 || ^18.0.0
languageName: unknown
linkType: soft

"@isaacs/cliui@npm:^8.0.2":
version: 8.0.2
resolution: "@isaacs/cliui@npm:8.0.2"
Expand Down Expand Up @@ -3315,6 +3290,31 @@ __metadata:
languageName: node
linkType: hard

"@liatrio/backstage-plugin-autogov-common@workspace:.":
version: 0.0.0-use.local
resolution: "@liatrio/backstage-plugin-autogov-common@workspace:."
dependencies:
"@backstage/cli": "npm:^0.27.1"
"@backstage/core-app-api": "npm:^1.15.0"
"@backstage/core-components": "npm:^0.15.0"
"@backstage/core-plugin-api": "npm:^1.9.4"
"@backstage/dev-utils": "npm:^1.1.0"
"@backstage/test-utils": "npm:^1.6.0"
"@backstage/theme": "npm:^0.5.7"
"@material-ui/core": "npm:^4.9.13"
"@material-ui/icons": "npm:^4.9.1"
"@material-ui/lab": "npm:^4.0.0-alpha.61"
"@testing-library/jest-dom": "npm:^6.0.0"
"@testing-library/react": "npm:^14.0.0"
"@testing-library/user-event": "npm:^14.0.0"
msw: "npm:^1.0.0"
react: "npm:^16.13.1 || ^17.0.0 || ^18.0.0"
react-use: "npm:^17.2.4"
peerDependencies:
react: ^16.13.1 || ^17.0.0 || ^18.0.0
languageName: unknown
linkType: soft

"@manypkg/find-root@npm:^1.1.0":
version: 1.1.0
resolution: "@manypkg/find-root@npm:1.1.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
module.exports = require("@backstage/cli/config/eslint-factory")(__dirname);
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* @packageDocumentation
*/

export { catalogModuleAutogovProcessor as default } from './module';
export { catalogModuleAutogovProcessor as default } from "./module";
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
coreServices,
createBackendModule,
} from '@backstage/backend-plugin-api';
import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha';
import { AutogovProcessor } from './processor';
} from "@backstage/backend-plugin-api";
import { catalogProcessingExtensionPoint } from "@backstage/plugin-catalog-node/alpha";
import { AutogovProcessor } from "./processor";

export const catalogModuleAutogovProcessor = createBackendModule({
pluginId: 'catalog',
moduleId: 'autogov-processor',
pluginId: "catalog",
moduleId: "autogov-processor",
register(reg) {
reg.registerInit({
deps: {
Expand All @@ -16,7 +16,7 @@ export const catalogModuleAutogovProcessor = createBackendModule({
logger: coreServices.logger,
},
async init({ catalog, config, logger }) {
logger.info('Initializing Autogov Processor');
logger.info("Initializing Autogov Processor");
catalog.addProcessor(
AutogovProcessor.fromConfig(config, {
logger,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@
* @copyright 2024 Liatrio, Inc.
*/

import { LoggerService } from '@backstage/backend-plugin-api';
import { Config } from '@backstage/config';
import { LoggerService } from "@backstage/backend-plugin-api";
import { Config } from "@backstage/config";
import {
Entity,
getEntitySourceLocation,
stringifyEntityRef,
} from '@backstage/catalog-model';
} from "@backstage/catalog-model";
import {
CatalogProcessor,
CatalogProcessorCache,
} from '@backstage/plugin-catalog-node';
} from "@backstage/plugin-catalog-node";
import {
GithubIntegration,
ScmIntegrationRegistry,
ScmIntegrations,
} from '@backstage/integration';
import { durationToMilliseconds, HumanDuration } from '@backstage/types';
import fetch from 'node-fetch';
} from "@backstage/integration";
import { durationToMilliseconds, HumanDuration } from "@backstage/types";
import fetch from "node-fetch";

import {
AUTOGOV_STATUS_FILE_ANNOTATION,
AUTOGOV_STATUS_ANNOTATION,
AUTOGOV_STATUSES,
} from '@liatrio/backstage-plugin-autogov-common';
} from "@liatrio/backstage-plugin-autogov-common";

export type ShouldProcessEntity = (entity: Entity) => boolean;

Expand Down Expand Up @@ -116,7 +116,7 @@ export class AutogovProcessor implements CatalogProcessor {
private readonly requireAnnotation: boolean;
private readonly entityKinds: string[];
private readonly entityTypes: string[];
private readonly loggerMeta = { plugins: 'AutogovProcessor' };
private readonly loggerMeta = { plugins: "AutogovProcessor" };
private cacheTTLMilliseconds: number;

/**
Expand All @@ -135,7 +135,7 @@ export class AutogovProcessor implements CatalogProcessor {
private shouldProcessEntity: ShouldProcessEntity = (entity: Entity) => {
const entityKind = entity.kind.toLowerCase();
const entitySpecType =
typeof entity.spec?.type === 'string'
typeof entity.spec?.type === "string"
? entity.spec?.type?.toLowerCase()
: undefined;
this.logger.debug(
Expand All @@ -154,7 +154,7 @@ export class AutogovProcessor implements CatalogProcessor {
}, kind match ${this.entityKinds.includes(
entityKind,
)}, type match: ${this.entityTypes.includes(
entitySpecType || 'undefined',
entitySpecType || "undefined",
)}`,
{ ...this.loggerMeta },
);
Expand All @@ -175,7 +175,7 @@ export class AutogovProcessor implements CatalogProcessor {
* @returns {string} The name of the processor as 'github-autogov-processor'
*/
getProcessorName(): string {
return 'github-autogov-processor';
return "github-autogov-processor";
}

/**
Expand Down Expand Up @@ -206,7 +206,7 @@ export class AutogovProcessor implements CatalogProcessor {

this.resultsFile = {
allowOverride: options.resultsFile?.allowOverride ?? false,
default: options.resultsFile?.default ?? 'results',
default: options.resultsFile?.default ?? "results",
};
this.logger.debug(
`Autogov Processor results file set to ${JSON.stringify(
Expand All @@ -221,13 +221,13 @@ export class AutogovProcessor implements CatalogProcessor {
{ ...this.loggerMeta },
);

this.entityKinds = options.entityKinds ?? ['component'];
this.entityKinds = options.entityKinds ?? ["component"];
this.logger.debug(
`Autogov Processor entity kinds set to ${this.entityKinds}`,
{ ...this.loggerMeta },
);

this.entityTypes = options.entityTypes ?? ['website'];
this.entityTypes = options.entityTypes ?? ["website"];
this.logger.debug(
`Autogov Processor entity types set to ${this.entityTypes}`,
{ ...this.loggerMeta },
Expand Down Expand Up @@ -270,23 +270,23 @@ export class AutogovProcessor implements CatalogProcessor {
config: Config,
options: AutogovProcessorOptions,
): AutogovProcessor {
const c = config.getOptionalConfig('autogov');
const githubConfig = c?.getOptionalConfig('github');
const resultsFileConfig = githubConfig?.getOptionalConfig('resultsFile');
const c = config.getOptionalConfig("autogov");
const githubConfig = c?.getOptionalConfig("github");
const resultsFileConfig = githubConfig?.getOptionalConfig("resultsFile");
if (githubConfig) {
options.cacheTTL = githubConfig.getOptional('cacheTTL');
options.cacheTTL = githubConfig.getOptional("cacheTTL");
options.resultsFile = {
allowOverride: githubConfig.getOptional('resultsFile'),
default: resultsFileConfig?.getOptional('default'),
allowOverride: githubConfig.getOptional("resultsFile"),
default: resultsFileConfig?.getOptional("default"),
};
options.requireAnnotation =
githubConfig.getOptionalBoolean('requireAnnotation');
githubConfig.getOptionalBoolean("requireAnnotation");
options.entityKinds = githubConfig
.getOptionalStringArray('entityKinds')
?.map(v => v.toLowerCase());
.getOptionalStringArray("entityKinds")
?.map((v) => v.toLowerCase());
options.entityTypes = githubConfig
.getOptionalStringArray('entityTypes')
?.map(v => v.toLowerCase());
.getOptionalStringArray("entityTypes")
?.map((v) => v.toLowerCase());
}
const scmIntegrations = ScmIntegrations.fromConfig(config);
if (scmIntegrations) {
Expand Down Expand Up @@ -357,7 +357,7 @@ export class AutogovProcessor implements CatalogProcessor {

// Get project slug from entity annotations
const projectSlug =
entity?.metadata?.annotations['github.com/project-slug'];
entity?.metadata?.annotations["github.com/project-slug"];
if (!projectSlug) {
this.logger.error(`No project slug found in entity annotations`, {
...this.loggerMeta,
Expand All @@ -370,7 +370,7 @@ export class AutogovProcessor implements CatalogProcessor {
`${apiBaseUrl}/repos/${projectSlug}/releases/latest`,
{
headers: {
'Content-Type': 'application/json',
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
},
Expand All @@ -384,7 +384,7 @@ export class AutogovProcessor implements CatalogProcessor {

let latestRelease: Release = undefined;
try {
latestRelease = await latestReleaseResponse.json() as Release;
latestRelease = (await latestReleaseResponse.json()) as Release;
} catch (error) {
this.logger.error(`Error parsing latest release`, {
...this.loggerMeta,
Expand All @@ -409,7 +409,7 @@ export class AutogovProcessor implements CatalogProcessor {

const resultsFileContentResponse = await fetch(result.url, {
headers: {
Accept: 'application/octet-stream',
Accept: "application/octet-stream",
Authorization: `Bearer ${token}`,
},
});
Expand Down Expand Up @@ -553,7 +553,7 @@ export class AutogovProcessor implements CatalogProcessor {

// Skip entities that don't have a URL source location
const entitySourceLocation = getEntitySourceLocation(entity);
if (entitySourceLocation?.type !== 'url') {
if (entitySourceLocation?.type !== "url") {
this.logger.debug(`Skipping entity ${entityRef} because it's not a URL`, {
...this.loggerMeta,
});
Expand All @@ -580,7 +580,7 @@ export class AutogovProcessor implements CatalogProcessor {
const detectedIntegration = this.scmIntegrations.byUrl(
entitySourceLocation.target,
);
if (detectedIntegration?.type !== 'github') {
if (detectedIntegration?.type !== "github") {
this.logger.debug(
`Skipping entity ${entityRef} because not a Github URL`,
{ ...this.loggerMeta },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export type {
AutogovProcessorOptions,
ShouldProcessEntity,
} from './AutogovProcessor';
export { AutogovProcessor } from './AutogovProcessor';
} from "./AutogovProcessor";
export { AutogovProcessor } from "./AutogovProcessor";
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
"target": "es6",
"strict": true
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules"
]
}
"include": ["src/**/*"],
"exclude": ["node_modules"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "Apache-2.0",
"private": false,
"repository": {
"type": "git",
"url": "git+https://github.com/liatrio/backstage-github-autogov-plugin.git",
Expand Down
6 changes: 2 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
"backstage-plugin-github-releases-assets-backend/src",
"backstage-plugin-github-releases-autogov/src"
],
"exclude": [
"node_modules"
],
"exclude": ["node_modules"],
"compilerOptions": {
"outDir": "dist-types",
"rootDir": ".",
Expand All @@ -17,4 +15,4 @@
"allowSyntheticDefaultImports": true,
"skipLibCheck": true
}
}
}
Loading

0 comments on commit 8c8a216

Please sign in to comment.