-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(app): dynamic Techdocs addons #2238
Changes from all commits
23b3000
cee35e3
d69f8ca
6958eb5
467a73f
09ed184
b343180
1346906
26a8bbb
1475133
ca68ab9
7e39f13
c843059
0338e47
6041fb9
fa3186b
bf857fa
1a81e9c
ba2a8d9
e5be8c1
ae25993
49e1c74
b451675
da021e6
1179847
f94bbc3
84ccc28
5d5db04
808d713
57c94e1
b82b4b3
47fabd8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist-dynamic | ||
dist-scalprum |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const backstageConfig = require('@backstage/cli/config/eslint-factory')( | ||
__dirname, | ||
); | ||
|
||
module.exports = { | ||
...backstageConfig, | ||
rules: { | ||
...backstageConfig.rules, | ||
'react/react-in-jsx-scope': 'off', | ||
'react/jsx-uses-react': 'off', | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"name": "backstage-plugin-techdocs-module-addons-contrib", | ||
"version": "1.1.20", | ||
"main": "src/index.ts", | ||
"types": "src/index.ts", | ||
"license": "Apache-2.0", | ||
"publishConfig": { | ||
"access": "public", | ||
"main": "dist/index.cjs.js", | ||
"types": "dist/index.d.ts" | ||
}, | ||
"backstage": { | ||
"role": "frontend-plugin-module", | ||
"supported-versions": "1.35.1", | ||
"pluginId": "techdocs", | ||
"pluginPackage": "backstage-plugin-techdocs" | ||
}, | ||
"sideEffects": false, | ||
"scripts": { | ||
"tsc": "tsc", | ||
"build": "backstage-cli package build", | ||
"lint:check": "backstage-cli package lint", | ||
"test": "backstage-cli package test --passWithNoTests --coverage", | ||
"clean": "backstage-cli package clean", | ||
"export-dynamic": "janus-cli package export-dynamic-plugin --in-place", | ||
"export-dynamic:clean": "run export-dynamic --clean" | ||
}, | ||
"dependencies": { | ||
"@backstage/plugin-techdocs-module-addons-contrib": "1.1.20", | ||
"@backstage/plugin-techdocs-react": "1.2.13", | ||
"@material-ui/core": "4.12.4", | ||
"jss": "10.10.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "16.13.1 || ^17.0.0 || ^18.0.0" | ||
}, | ||
"devDependencies": { | ||
"@backstage/cli": "0.29.6", | ||
"@janus-idp/cli": "3.2.0", | ||
"react": "18.3.1", | ||
"typescript": "5.7.3" | ||
}, | ||
"files": [ | ||
"dist", | ||
"dist-scalprum" | ||
], | ||
"scalprum": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it necessary to add this config? Without it I believe the scalprum name would be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, not necessary. I have seen both versions being used, it would be great to unify this. |
||
"name": "backstage.plugin-techdocs-module-addons-contrib", | ||
"exposedModules": { | ||
"PluginRoot": "./src/index.ts" | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/redhat-developer/rhdh", | ||
"directory": "dynamic-plugins/wrappers/backstage-plugin-techdocs-module-addons-contrib" | ||
}, | ||
"maintainers": [ | ||
"@janus-idp/maintainers-showcase" | ||
], | ||
"author": "Red Hat", | ||
"homepage": "https://red.ht/rhdh", | ||
"bugs": "https://issues.redhat.com/browse/RHIDP", | ||
"keywords": [ | ||
"support:production", | ||
"lifecycle:active" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "@backstage/plugin-techdocs-module-addons-contrib"; | ||
export { ReportIssue } from "./addons"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "@backstage/cli/config/tsconfig.json", | ||
"include": ["src", "dev", "migrations"], | ||
"exclude": ["node_modules"], | ||
"compilerOptions": { | ||
"outDir": "../../../dist-types/dynamic-plugins/wrappers/backstage-plugin-techdocs-module-addons-contrib", | ||
"rootDir": ".", | ||
"jsx": "preserve" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": ["//"], | ||
"tasks": { | ||
"tsc": { | ||
"outputs": [ | ||
"../../../dist-types/dynamic-plugins/wrappers/backstage-plugin-techdocs-module-addons-contrib/**" | ||
] | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export * from '@backstage/plugin-techdocs'; | ||
export * from "@backstage/plugin-techdocs"; | ||
export { | ||
EntityTechdocsContent, TechDocsReaderPage, TechdocsSearchFilter, | ||
techdocsSearchType | ||
} from './wrapped'; | ||
|
||
EntityTechdocsContent, | ||
TechDocsReaderPage, | ||
TechdocsSearchFilter, | ||
techdocsSearchType, | ||
} from "./wrapped"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export type TechdocsAddon = { | ||
scope: string; | ||
module: string; | ||
importName: string; | ||
Component: React.ComponentType<React.PropsWithChildren>; | ||
config: { | ||
props?: Record<string, any>; | ||
}; | ||
}; | ||
|
||
export type DynamicConfig = { | ||
techdocsAddons: TechdocsAddon[]; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { DynamicConfig, TechdocsAddon } from "./types"; | ||
|
||
function getTechdocsAddonData(dynamicConfig: DynamicConfig): TechdocsAddon[] { | ||
return dynamicConfig?.techdocsAddons ?? []; | ||
} | ||
|
||
export function getTechdocsAddonComponents(dynamicConfig: DynamicConfig) { | ||
const techdocsAddonsData = getTechdocsAddonData(dynamicConfig); | ||
return techdocsAddonsData.map( | ||
({ scope, module, importName, Component, config }) => ( | ||
<Component key={`${scope}-${module}-${importName}`} {...config.props} /> | ||
), | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen both a
.
and a-
used as the org/package separator. I think we should consider that inconsistency here confuses users, and I wonder if we shouldn't just stick with using-
. I'll have a 2nd comment on this in the plugin'sscalprum
config :-)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would maybe let it be this way for now, but we can do a following bulk update for all the plugins that have it this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, I don't know if there's any formal convention here so maybe one needs to be established.