-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(npm): add support for the new frontend-system (alpha) (#2453)
Signed-off-by: Christoph Jerolimov <[email protected]>
- Loading branch information
1 parent
9dd37d9
commit 1271dac
Showing
15 changed files
with
533 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@backstage-community/plugin-npm': minor | ||
--- | ||
|
||
add support for the new frontend-system (alpha) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{ | ||
"name": "app-next", | ||
"version": "0.0.0", | ||
"private": true, | ||
"bundled": true, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/backstage/community-plugins", | ||
"directory": "workspaces/npm/packages/app-next" | ||
}, | ||
"backstage": { | ||
"role": "frontend" | ||
}, | ||
"scripts": { | ||
"start": "backstage-cli package start", | ||
"build": "backstage-cli package build", | ||
"clean": "backstage-cli package clean", | ||
"test": "backstage-cli package test", | ||
"lint": "backstage-cli package lint" | ||
}, | ||
"dependencies": { | ||
"@backstage-community/plugin-npm": "workspace:^", | ||
"@backstage/app-defaults": "^1.5.15", | ||
"@backstage/catalog-model": "^1.7.2", | ||
"@backstage/cli": "^0.29.4", | ||
"@backstage/core-app-api": "^1.15.3", | ||
"@backstage/core-compat-api": "^0.3.4", | ||
"@backstage/core-components": "^0.16.2", | ||
"@backstage/core-plugin-api": "^1.10.2", | ||
"@backstage/frontend-app-api": "^0.10.3", | ||
"@backstage/frontend-defaults": "^0.1.4", | ||
"@backstage/frontend-plugin-api": "^0.9.3", | ||
"@backstage/integration-react": "^1.2.2", | ||
"@backstage/plugin-api-docs": "^0.12.2", | ||
"@backstage/plugin-catalog": "^1.26.0", | ||
"@backstage/plugin-catalog-common": "^1.1.2", | ||
"@backstage/plugin-catalog-graph": "^0.4.14", | ||
"@backstage/plugin-catalog-import": "^0.12.8", | ||
"@backstage/plugin-catalog-react": "^1.15.0", | ||
"@backstage/plugin-org": "^0.6.34", | ||
"@backstage/plugin-user-settings": "^0.8.17", | ||
"@backstage/theme": "^0.6.3", | ||
"@material-ui/core": "^4.12.2", | ||
"@material-ui/icons": "^4.9.1", | ||
"react": "^18.0.2", | ||
"react-dom": "^18.0.2", | ||
"react-router": "^6.3.0", | ||
"react-router-dom": "^6.3.0", | ||
"react-use": "^17.2.4", | ||
"styled-components": "^6.1.8" | ||
}, | ||
"devDependencies": { | ||
"@backstage/test-utils": "^1.7.3", | ||
"@playwright/test": "^1.32.3", | ||
"@testing-library/dom": "^9.0.0", | ||
"@testing-library/jest-dom": "^6.0.0", | ||
"@testing-library/react": "^14.0.0", | ||
"@testing-library/user-event": "^14.0.0", | ||
"@types/react-dom": "*" | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
}, | ||
"files": [ | ||
"dist" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright 2025 The Backstage Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { renderWithEffects } from '@backstage/test-utils'; | ||
|
||
// Rarely, and only in windows CI, do these tests take slightly more than the | ||
// default five seconds | ||
jest.setTimeout(15_000); | ||
|
||
describe('App', () => { | ||
it('should render', async () => { | ||
process.env = { | ||
NODE_ENV: 'test', | ||
APP_CONFIG: [ | ||
{ | ||
data: { | ||
app: { | ||
title: 'Test', | ||
support: { url: 'http://localhost:7007/support' }, | ||
}, | ||
backend: { baseUrl: 'http://localhost:7007' }, | ||
}, | ||
context: 'test', | ||
}, | ||
] as any, | ||
}; | ||
|
||
const { default: app } = await import('./App'); | ||
const rendered = await renderWithEffects(app); | ||
expect(rendered.baseElement).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2025 The Backstage Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import React from 'react'; | ||
import { Navigate } from 'react-router'; | ||
import { createApp } from '@backstage/frontend-defaults'; | ||
import { | ||
createFrontendModule, | ||
PageBlueprint, | ||
} from '@backstage/frontend-plugin-api'; | ||
import catalogPlugin from '@backstage/plugin-catalog/alpha'; | ||
import catalogImportPlugin from '@backstage/plugin-catalog-import/alpha'; | ||
import userSettingsPlugin from '@backstage/plugin-user-settings/alpha'; | ||
|
||
import npmPlugin from '@backstage-community/plugin-npm/alpha'; | ||
|
||
const homePageExtension = PageBlueprint.make({ | ||
name: 'homePage', | ||
params: { | ||
defaultPath: '/', | ||
loader: () => Promise.resolve(<Navigate to="catalog" />), | ||
}, | ||
}); | ||
|
||
export const app = createApp({ | ||
features: [ | ||
catalogPlugin, | ||
catalogImportPlugin, | ||
userSettingsPlugin, | ||
npmPlugin, | ||
createFrontendModule({ | ||
pluginId: 'app', | ||
extensions: [homePageExtension], | ||
}), | ||
], | ||
}); | ||
|
||
export default app.createRoot(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright 2025 The Backstage Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import '@backstage/cli/asset-types'; | ||
import ReactDOM from 'react-dom'; | ||
import app from './App'; | ||
|
||
ReactDOM.render(app, document.getElementById('root')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright 2025 The Backstage Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import '@testing-library/jest-dom'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "app", | ||
"version": "0.0.3", | ||
"version": "0.0.0", | ||
"private": true, | ||
"bundled": true, | ||
"repository": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## API Report File for "@backstage-community/plugin-npm" | ||
|
||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). | ||
```ts | ||
import { FrontendPlugin } from '@backstage/frontend-plugin-api'; | ||
|
||
// @alpha | ||
const _default: FrontendPlugin<{}, {}, {}>; | ||
export default _default; | ||
|
||
// @alpha | ||
export const entityNpmInfoCard: any; | ||
|
||
// @alpha | ||
export const entityNpmReleaseOverviewCard: any; | ||
|
||
// @alpha | ||
export const entityNpmReleaseTableCard: any; | ||
|
||
// (No @packageDocumentation comment for this package) | ||
``` |
Oops, something went wrong.