Skip to content

Commit 23d413c

Browse files
committed
chore(app): extract out config parsing
This change extracts out the frontend configuration parsing functions into a separate app-utils package, to prepare making the old RHDH dynamic frontend configuration available to the new frontend system configuration bridge when it is implemented. Signed-off-by: Stan Lewis <[email protected]>
1 parent b5b6ff8 commit 23d413c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1671
-487
lines changed

.rhdh/docker/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ COPY $EXTERNAL_SOURCE_NESTED/packages/theme-wrapper/package.json ./packages/them
7272
COPY $EXTERNAL_SOURCE_NESTED/packages/plugin-utils/package.json ./packages/plugin-utils/package.json
7373
COPY $EXTERNAL_SOURCE_NESTED/packages/backend/package.json ./packages/backend/package.json
7474
COPY $EXTERNAL_SOURCE_NESTED/packages/app/package.json ./packages/app/package.json
75+
COPY $EXTERNAL_SOURCE_NESTED/packages/app-utils/package.json ./packages/app-utils/package.json
7576
COPY $EXTERNAL_SOURCE_NESTED/packages/app-next/package.json ./packages/app-next/package.json
7677
COPY $EXTERNAL_SOURCE_NESTED/package.json ./package.json
7778
# END COPY package.json files

docker/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ COPY $EXTERNAL_SOURCE_NESTED/packages/theme-wrapper/package.json ./packages/them
7272
COPY $EXTERNAL_SOURCE_NESTED/packages/plugin-utils/package.json ./packages/plugin-utils/package.json
7373
COPY $EXTERNAL_SOURCE_NESTED/packages/backend/package.json ./packages/backend/package.json
7474
COPY $EXTERNAL_SOURCE_NESTED/packages/app/package.json ./packages/app/package.json
75+
COPY $EXTERNAL_SOURCE_NESTED/packages/app-utils/package.json ./packages/app-utils/package.json
7576
COPY $EXTERNAL_SOURCE_NESTED/packages/app-next/package.json ./packages/app-next/package.json
7677
COPY $EXTERNAL_SOURCE_NESTED/package.json ./package.json
7778
# END COPY package.json files

packages/app-utils/.eslintrc.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const backstageConfig = require('@backstage/cli/config/eslint-factory')(
2+
__dirname,
3+
);
4+
5+
module.exports = {
6+
...backstageConfig,
7+
rules: {
8+
...backstageConfig.rules,
9+
'react/react-in-jsx-scope': 'off',
10+
'react/jsx-uses-react': 'off',
11+
},
12+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"*": "prettier --ignore-unknown --write",
3+
"*.{js,jsx,ts,tsx,mjs,cjs}": "backstage-cli package lint --fix"
4+
}

packages/app-utils/.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist
2+
coverage

packages/app-utils/.prettierrc.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// @ts-check
2+
3+
/** @type {import("@ianvs/prettier-plugin-sort-imports").PrettierConfig} */
4+
module.exports = {
5+
...require('@backstage/cli/config/prettier.json'),
6+
plugins: ['@ianvs/prettier-plugin-sort-imports'],
7+
importOrder: [
8+
'^react(.*)$',
9+
'',
10+
'^@backstage/(.*)$',
11+
'',
12+
'<THIRD_PARTY_MODULES>',
13+
'',
14+
'^@janus-idp/(.*)$',
15+
'',
16+
'<BUILTIN_MODULES>',
17+
'',
18+
'^[.]',
19+
],
20+
};

packages/app-utils/package.json

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"name": "@red-hat-developer-hub/app-utils",
3+
"version": "1.0.0",
4+
"main": "src/index.ts",
5+
"types": "src/index.ts",
6+
"license": "Apache-2.0",
7+
"publishConfig": {
8+
"access": "public",
9+
"main": "dist/index.esm.js",
10+
"module": "dist/index.esm.js",
11+
"types": "dist/index.d.ts"
12+
},
13+
"backstage": {
14+
"role": "common-library",
15+
"supported-versions": "1.0.0",
16+
"pluginId": "app-utils",
17+
"pluginPackage": "@red-hat-developer-hub/app-utils",
18+
"pluginPackages": [
19+
"@red-hat-developer-hub/app-utils"
20+
]
21+
},
22+
"scripts": {
23+
"build": "backstage-cli package build",
24+
"clean": "backstage-cli package clean",
25+
"test": "backstage-cli package test --passWithNoTests --coverage",
26+
"lint:check": "backstage-cli package lint",
27+
"lint:fix": "backstage-cli package lint --fix",
28+
"tsc": "tsc",
29+
"prettier:check": "prettier --ignore-unknown --check .",
30+
"prettier:fix": "prettier --ignore-unknown --write ."
31+
},
32+
"dependencies": {
33+
"@backstage/catalog-model": "1.7.4",
34+
"@backstage/config": "1.3.2",
35+
"@backstage/core-app-api": "1.17.0",
36+
"@backstage/core-plugin-api": "1.10.7",
37+
"@backstage/plugin-api-docs": "0.12.7",
38+
"@backstage/plugin-catalog": "1.30.0",
39+
"@backstage/plugin-catalog-import": "0.13.0",
40+
"@backstage/plugin-org": "0.6.39",
41+
"@backstage/plugin-scaffolder": "1.31.0",
42+
"@mui/material": "5.18.0",
43+
"lodash": "4.17.21"
44+
},
45+
"devDependencies": {
46+
"@backstage/cli": "0.32.1",
47+
"@backstage/test-utils": "1.7.8",
48+
"@testing-library/dom": "9.3.4",
49+
"@testing-library/jest-dom": "6.8.0",
50+
"@testing-library/react": "14.3.1",
51+
"@testing-library/react-hooks": "8.0.1",
52+
"@types/node": "22.16.3",
53+
"@types/react": "18.3.23",
54+
"@types/react-dom": "18.3.7",
55+
"prettier": "3.6.2",
56+
"react": "18.3.1",
57+
"typescript": "5.9.2"
58+
},
59+
"browserslist": {
60+
"production": [
61+
">0.2%",
62+
"not dead",
63+
"not op_mini all"
64+
],
65+
"development": [
66+
"last 1 chrome version",
67+
"last 1 firefox version",
68+
"last 1 safari version"
69+
]
70+
},
71+
"files": [
72+
"dist"
73+
],
74+
"peerDependencies": {
75+
"react": "16.13.1 || ^17.0.0 || ^18.2.0"
76+
}
77+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './MenuIcon';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './MenuIcon';

0 commit comments

Comments
 (0)