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

Commit

Permalink
Merge pull request #6 from liatrio/feat/autogov-commons-component
Browse files Browse the repository at this point in the history
feat: autogov commons component
  • Loading branch information
amber-beasley-liatrio authored Nov 6, 2024
2 parents 3f3baab + 34d63c3 commit f1ddaa6
Show file tree
Hide file tree
Showing 18 changed files with 43,510 additions and 18,146 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ dist
build/
dist-types
coverage
.yarn/*
*/.yarn/*
# Ignore TypeScript build info files
*.tsbuildinfo
# Ignore TypeScript declaration files
Expand Down
1 change: 1 addition & 0 deletions backstage-plugin-autogov-common/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
13 changes: 13 additions & 0 deletions backstage-plugin-autogov-common/README-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# autogov-common

Welcome to the autogov-common plugin!

_This plugin was created through the Backstage CLI_

## Getting started

Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/autogov-common](http://localhost:3000/autogov-common).

You can also serve the plugin in isolation by running `yarn start` in the plugin directory.
This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads.
It is only meant for local development, and the setup for it can be found inside the [/dev](./dev) directory.
1 change: 1 addition & 0 deletions backstage-plugin-autogov-common/eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@backstage/cli/config/eslint-factory")(__dirname);
54 changes: 54 additions & 0 deletions backstage-plugin-autogov-common/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "@liatrio/backstage-plugin-autogov-common",
"version": "1.1.0",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
"private": true,
"publishConfig": {
"access": "public",
"main": "dist/index.esm.js",
"types": "dist/index.d.ts"
},
"backstage": {
"role": "frontend-plugin",
"pluginId": "autogov-common",
"pluginPackages": []
},
"sideEffects": false,
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
"lint": "backstage-cli package lint",
"test": "backstage-cli package test",
"clean": "backstage-cli package clean",
"prepack": "backstage-cli package prepack",
"postpack": "backstage-cli package postpack"
},
"dependencies": {
"@backstage/core-components": "^0.15.0",
"@backstage/core-plugin-api": "^1.9.4",
"@backstage/theme": "^0.5.7",
"@material-ui/core": "^4.9.13",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.61",
"react-use": "^17.2.4"
},
"peerDependencies": {
"react": "^16.13.1 || ^17.0.0 || ^18.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.27.1",
"@backstage/core-app-api": "^1.15.0",
"@backstage/dev-utils": "^1.1.0",
"@backstage/test-utils": "^1.6.0",
"@testing-library/jest-dom": "^6.0.0",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.0.0",
"msw": "^1.0.0",
"react": "^16.13.1 || ^17.0.0 || ^18.0.0"
},
"files": [
"dist"
]
}
17 changes: 17 additions & 0 deletions backstage-plugin-autogov-common/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export const AUTOGOV_STATUS_FILE_ANNOTATION = "liatrio.com/autogov-result-file";
export const AUTOGOV_STATUS_ANNOTATION =
"liatrio.com/autogov-latest-release-status";

export enum AUTOGOV_STATUSES {
PASSED = "PASSED",
FAILED = "FAILED",
N_A = "N/A",
ERROR = "ERROR",
}

export enum AUTOGOV_STATUS_WEIGHT {
PASSED = 1,
FAILED = 2,
N_A = 3,
UNKNOWN = 4,
}
2 changes: 2 additions & 0 deletions backstage-plugin-autogov-common/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./constants";
export * from "./utils";
7 changes: 7 additions & 0 deletions backstage-plugin-autogov-common/src/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { autogovCommonPlugin } from "./plugin";

describe("autogov-common", () => {
it("should export plugin", () => {
expect(autogovCommonPlugin).toBeDefined();
});
});
5 changes: 5 additions & 0 deletions backstage-plugin-autogov-common/src/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createPlugin } from "@backstage/core-plugin-api";

export const autogovCommonPlugin = createPlugin({
id: "autogov-common",
});
1 change: 1 addition & 0 deletions backstage-plugin-autogov-common/src/setupTests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "@testing-library/jest-dom";
16 changes: 16 additions & 0 deletions backstage-plugin-autogov-common/src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { AUTOGOV_STATUSES, AUTOGOV_STATUS_WEIGHT } from "./constants";

export const getAutogovStatusWeight = (
status: string,
): AUTOGOV_STATUS_WEIGHT => {
switch (status) {
case AUTOGOV_STATUSES.PASSED:
return AUTOGOV_STATUS_WEIGHT.PASSED;
case AUTOGOV_STATUSES.FAILED:
return AUTOGOV_STATUS_WEIGHT.FAILED;
case AUTOGOV_STATUSES.N_A:
return AUTOGOV_STATUS_WEIGHT.N_A;
default:
return AUTOGOV_STATUS_WEIGHT.UNKNOWN;
}
};
16 changes: 16 additions & 0 deletions backstage-plugin-autogov-common/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "@backstage/cli/config/tsconfig.json",
"compilerOptions": {
"outDir": "dist", // Compiled JS files go to 'dist'
"rootDir": ".", // Use the root of the plugin folder to ensure the 'src' folder is preserved in output
"declaration": true, // Generate declaration files
"declarationDir": "../dist-types/backstage-plugin-autogov-common", // Output declaration files to correct path
"declarationMap": true,
"sourceMap": true,
"module": "commonjs",
"target": "es6",
"strict": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}
Loading

0 comments on commit f1ddaa6

Please sign in to comment.