Skip to content

Commit

Permalink
Merge pull request #34 from minkimcello/modify-generateStats
Browse files Browse the repository at this point in the history
Display project & member stats in plugin
  • Loading branch information
aq1e committed Apr 15, 2024
2 parents 72adc95 + d3a12c3 commit f7d5a70
Show file tree
Hide file tree
Showing 34 changed files with 918 additions and 98 deletions.
6 changes: 6 additions & 0 deletions generated/landscape_stats.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@
}
}
},
"cncfProjectMaturitySummary": {
"sandbox": 117,
"incubating": 38,
"graduated": 27,
"archived": 8
},
"cncfSpecialSummary": {
"count": 289,
"commonKeys": [
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@types/node": "^20.10.4",
"cncf-common": "*",
"concurrently": "^8.0.0",
"landscape3-eslint-rules": "0.1.0",
"lerna": "^7.3.0",
"maketypes": "^1.1.2",
"node-gyp": "^9.0.0",
Expand Down
4 changes: 1 addition & 3 deletions packages/app/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
rules: {
'indent': ['error', 2],
}
rules: require('landscape3-eslint-rules'),
});
10 changes: 7 additions & 3 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@
"@backstage/plugin-techdocs-module-addons-contrib": "^1.1.1",
"@backstage/plugin-techdocs-react": "^1.1.12",
"@backstage/theme": "^0.4.3",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@mui/icons-material": "^5.15.15",
"@mui/material": "^5.15.15",
"@mui/styles": "^5.15.15",
"backstage-plugin-cncf-stats": "^0.1.0",
"history": "^5.0.0",
"react": "^17.0.2",
Expand All @@ -52,7 +55,8 @@
"@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^14.0.0",
"@types/react-dom": "*",
"cross-env": "^7.0.0"
"cross-env": "^7.0.0",
"landscape3-eslint-rules": "0.1.0"
},
"browserslist": {
"production": [
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { createApp } from '@backstage/app-defaults';
import { AppRouter, FlatRoutes } from '@backstage/core-app-api';
import { CatalogGraphPage } from '@backstage/plugin-catalog-graph';
import { UnifiedThemeProvider } from '@backstage/theme';
import { CssBaseline } from '@material-ui/core';
import CssBaseline from '@mui/material/CssBaseline';
import cncfTheme from './theme';
import { CncfStatsPage } from 'backstage-plugin-cncf-stats';

Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/components/Root/LogoFull.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { makeStyles } from '@material-ui/core';
import { makeStyles } from '@mui/styles';

const useStyles = makeStyles({
svg: {
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/components/Root/LogoIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { makeStyles } from '@material-ui/core';
import { makeStyles } from '@mui/styles';

const useStyles = makeStyles({
svg: {
Expand Down
22 changes: 11 additions & 11 deletions packages/app/src/components/Root/Root.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { PropsWithChildren } from 'react';
import { makeStyles } from '@material-ui/core';
import HomeIcon from '@material-ui/icons/Home';
import LibraryBooks from '@material-ui/icons/LibraryBooks';
import CreateComponentIcon from '@material-ui/icons/AddCircleOutline';
import ChartIcon from '@material-ui/icons/Assessment';
import { makeStyles } from '@mui/styles';
import HomeIcon from '@mui/icons-material/Home';
import LibraryBooks from '@mui/icons-material/LibraryBooks';
import CreateComponentIcon from '@mui/icons-material/AddCircleOutline';
import ChartIcon from '@mui/icons-material/Assessment';
import LogoFull from './LogoFull';
import LogoIcon from './LogoIcon';
import { SidebarSearchModal } from '@backstage/plugin-search';
Expand All @@ -17,8 +17,8 @@ import {
useSidebarOpenState,
Link,
} from '@backstage/core-components';
import MenuIcon from '@material-ui/icons/Menu';
import SearchIcon from '@material-ui/icons/Search';
import MenuIcon from '@mui/icons-material/Menu';
import SearchIcon from '@mui/icons-material/Search';

const useSidebarLogoStyles = makeStyles({
root: {
Expand Down Expand Up @@ -58,10 +58,10 @@ export const Root = ({ children }: PropsWithChildren<{}>) => (
<SidebarDivider />
<SidebarGroup label="Menu" icon={<MenuIcon />}>
{/* Global nav, not org-specific */}
<SidebarItem icon={HomeIcon} to="catalog" text="Home" />
<SidebarItem icon={ChartIcon} to="stats" text="Stats" />
<SidebarItem icon={LibraryBooks} to="docs" text="Docs" />
<SidebarItem icon={CreateComponentIcon} to="create" text="Create..." />
<SidebarItem icon={() => <HomeIcon />} to="catalog" text="Home" />
<SidebarItem icon={() => <ChartIcon />} to="stats" text="Stats" />
<SidebarItem icon={() => <LibraryBooks />} to="docs" text="Docs" />
<SidebarItem icon={() => <CreateComponentIcon />} to="create" text="Create..." />
{/* End global nav */}
</SidebarGroup>
</Sidebar>
Expand Down
3 changes: 2 additions & 1 deletion packages/app/src/components/catalog/EntityPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { Button, Grid } from '@material-ui/core';
import Button from '@mui/material/Button';
import Grid from '@mui/material/Grid';
import {
EntityApiDefinitionCard,
EntityConsumedApisCard,
Expand Down
5 changes: 4 additions & 1 deletion packages/app/src/components/search/SearchPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React from 'react';
import { makeStyles, Theme, Grid, Paper } from '@material-ui/core';
import Grid from '@mui/material/Grid';
import Paper from '@mui/material/Paper';
import { Theme } from '@mui/material/styles';
import { makeStyles } from '@mui/styles';

import { CatalogSearchResultListItem } from '@backstage/plugin-catalog';
import {
Expand Down
49 changes: 23 additions & 26 deletions packages/app/src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,31 @@ import {
genPageTheme,
shapes
} from "@backstage/theme";
import { PaletteOptions } from "@material-ui/core/styles/createPalette";

const cncfPalette: PaletteOptions = {
...palettes.light,
primary: {
main: "#d62293",
},
secondary: {
main: "#4d6a85",
},
background: {
default: "#fff",
},
navigation: {
...palettes.light.navigation,
background: "#fff",
color: "#196bcc",
indicator: "#4d6a85",
selectedColor: "#4d6a85",
navItem: {
hoverBackground: "#000",
}
}
};

const cncfTheme = createUnifiedTheme({
...createBaseThemeOptions({
palette: cncfPalette,
palette: {
...palettes.light,
primary: {
main: "#d62293",
},
secondary: {
main: "#4d6a85",
},
background: {
default: "#fff",
},
navigation: {
...palettes.light.navigation,
background: "#fff",
color: "#196bcc",
indicator: "#4d6a85",
selectedColor: "#4d6a85",
navItem: {
hoverBackground: "#000",
}
},
},
}),
defaultPageTheme: "home",
pageTheme: {
Expand All @@ -43,4 +40,4 @@ const cncfTheme = createUnifiedTheme({
},
});

export default cncfTheme;
export default cncfTheme;
4 changes: 1 addition & 3 deletions packages/backend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
rules: {
'indent': ['error', 2],
}
rules: require('landscape3-eslint-rules'),
});
3 changes: 2 additions & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"@types/dockerode": "^3.3.0",
"@types/express": "^4.17.6",
"@types/express-serve-static-core": "^4.17.5",
"@types/luxon": "^2.0.4"
"@types/luxon": "^2.0.4",
"landscape3-eslint-rules": "0.1.0"
},
"files": [
"dist"
Expand Down
4 changes: 1 addition & 3 deletions packages/cncf-common/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
rules: {
'indent': ['error', 2],
}
rules: require('landscape3-eslint-rules'),
});
3 changes: 2 additions & 1 deletion packages/cncf-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"postpack": "backstage-cli package postpack"
},
"devDependencies": {
"@backstage/cli": "^0.23.0"
"@backstage/cli": "^0.23.0",
"landscape3-eslint-rules": "0.1.0"
},
"files": [
"dist"
Expand Down
1 change: 1 addition & 0 deletions packages/cncf-common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export type {
StatsCategoryBreakdown,
StatsSubcategoryBreakdown,
CncfProject,
StatsProjectMaturityBreakdown,
} from './types';
4 changes: 4 additions & 0 deletions packages/cncf-common/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,7 @@ export interface CategoryStats {
categoryBreakdown: StatsCategoryBreakdown;
subcategoryBreakdown: StatsSubcategoryBreakdown;
}

export interface StatsProjectMaturityBreakdown {
[key:string]: number;
}
3 changes: 3 additions & 0 deletions packages/landscape3-eslint-rules/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
rules: require('landscape3-eslint-rules'),
});
12 changes: 12 additions & 0 deletions packages/landscape3-eslint-rules/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# eslint-rules

_This package was created through the Backstage CLI_.

## Installation

Install the package via Yarn:

```sh
cd <package-dir> # if within a monorepo
yarn add eslint-rules
```
31 changes: 31 additions & 0 deletions packages/landscape3-eslint-rules/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "landscape3-eslint-rules",
"version": "0.1.0",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
"private": true,
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
},
"backstage": {
"role": "node-library"
},
"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"
},
"devDependencies": {
"@backstage/cli": "^0.23.0"
},
"files": [
"dist"
]
}
6 changes: 6 additions & 0 deletions packages/landscape3-eslint-rules/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
'no-console': 0,
'indent': ['error', 2],
'no-multiple-empty-lines': ['error', { 'max': 1 }],
'eol-last': ['error', 'always']
};
1 change: 1 addition & 0 deletions packages/landscape3-eslint-rules/src/setupTests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
4 changes: 3 additions & 1 deletion plugins/cncf-stats-backend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
rules: require('landscape3-eslint-rules'),
});
1 change: 1 addition & 0 deletions plugins/cncf-stats-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"devDependencies": {
"@backstage/cli": "^0.23.0",
"@types/supertest": "^2.0.12",
"landscape3-eslint-rules": "0.1.0",
"msw": "^1.0.0",
"supertest": "^6.2.4"
},
Expand Down
4 changes: 3 additions & 1 deletion plugins/cncf-stats/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
rules: require('landscape3-eslint-rules'),
});
11 changes: 8 additions & 3 deletions plugins/cncf-stats/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@
"@backstage/core-components": "^0.13.6",
"@backstage/core-plugin-api": "^1.7.0",
"@backstage/theme": "^0.4.3",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.61",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@mui/icons-material": "^5.15.15",
"@mui/lab": "^5.0.0-alpha.170",
"@mui/material": "^5.15.15",
"@mui/styles": "^5.15.15",
"@mui/x-charts": "^6.19.3",
"cncf-common": "*",
"react-use": "^17.2.4"
},
Expand All @@ -44,6 +48,7 @@
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^14.0.0",
"landscape3-eslint-rules": "0.1.0",
"msw": "^1.0.0"
},
"files": [
Expand Down

0 comments on commit f7d5a70

Please sign in to comment.