Remove old version
Signed-off-by: Charles de Dreuille <charles.dedreuille@gmail.com>
This commit is contained in:
+8
-1
@@ -14,6 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
// TODO: Fix this story
|
||||
// There's a bug in Storybook that causes the build to fail
|
||||
// when using the `useEntityPermission` hook
|
||||
// https://github.com/storybookjs/storybook/issues/29378
|
||||
// This has been reported and it should hopefully be fixed after 8.4
|
||||
|
||||
import { GroupEntity } from '@backstage/catalog-model';
|
||||
import {
|
||||
CatalogApi,
|
||||
@@ -59,7 +66,7 @@ const defaultEntity: GroupEntity = {
|
||||
};
|
||||
|
||||
const catalogApi: Partial<CatalogApi> = {
|
||||
async refreshEntity() {},
|
||||
async refreshEntity() { },
|
||||
};
|
||||
|
||||
const permissionApi: typeof permissionApiRef.T = {
|
||||
@@ -1,2 +0,0 @@
|
||||
registry=https://registry.npmjs.org/
|
||||
engine-strict=true
|
||||
@@ -1,75 +0,0 @@
|
||||
import {
|
||||
AlertApiForwarder,
|
||||
ErrorAlerter,
|
||||
ErrorApiForwarder,
|
||||
GithubAuth,
|
||||
GitlabAuth,
|
||||
GoogleAuth,
|
||||
OAuthRequestManager,
|
||||
OktaAuth,
|
||||
ConfigReader,
|
||||
LocalStorageFeatureFlags,
|
||||
} from '@backstage/core-app-api';
|
||||
|
||||
import {
|
||||
alertApiRef,
|
||||
errorApiRef,
|
||||
githubAuthApiRef,
|
||||
gitlabAuthApiRef,
|
||||
googleAuthApiRef,
|
||||
identityApiRef,
|
||||
oauthRequestApiRef,
|
||||
oktaAuthApiRef,
|
||||
configApiRef,
|
||||
featureFlagsApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
import { translationApiRef } from '@backstage/core-plugin-api/alpha';
|
||||
import { MockTranslationApi } from '@backstage/test-utils/alpha';
|
||||
|
||||
const configApi = new ConfigReader({});
|
||||
const featureFlagsApi = new LocalStorageFeatureFlags();
|
||||
const alertApi = new AlertApiForwarder();
|
||||
const errorApi = new ErrorAlerter(alertApi, new ErrorApiForwarder());
|
||||
const identityApi = {
|
||||
getUserId: () => 'guest',
|
||||
getProfile: () => ({ email: 'guest@example.com' }),
|
||||
getIdToken: () => undefined,
|
||||
signOut: async () => {},
|
||||
};
|
||||
const oauthRequestApi = new OAuthRequestManager();
|
||||
const googleAuthApi = GoogleAuth.create({
|
||||
apiOrigin: 'http://localhost:7007',
|
||||
basePath: '/auth/',
|
||||
oauthRequestApi,
|
||||
});
|
||||
const githubAuthApi = GithubAuth.create({
|
||||
apiOrigin: 'http://localhost:7007',
|
||||
basePath: '/auth/',
|
||||
oauthRequestApi,
|
||||
});
|
||||
const gitlabAuthApi = GitlabAuth.create({
|
||||
apiOrigin: 'http://localhost:7007',
|
||||
basePath: '/auth/',
|
||||
oauthRequestApi,
|
||||
});
|
||||
const oktaAuthApi = OktaAuth.create({
|
||||
apiOrigin: 'http://localhost:7007',
|
||||
basePath: '/auth/',
|
||||
oauthRequestApi,
|
||||
});
|
||||
const translationApi = MockTranslationApi.create();
|
||||
|
||||
export const apis = [
|
||||
[configApiRef, configApi],
|
||||
[featureFlagsApiRef, featureFlagsApi],
|
||||
[alertApiRef, alertApi],
|
||||
[errorApiRef, errorApi],
|
||||
[identityApiRef, identityApi],
|
||||
[oauthRequestApiRef, oauthRequestApi],
|
||||
[googleAuthApiRef, googleAuthApi],
|
||||
[githubAuthApiRef, githubAuthApi],
|
||||
[gitlabAuthApiRef, gitlabAuthApi],
|
||||
[oktaAuthApiRef, oktaAuthApi],
|
||||
[translationApiRef, translationApi],
|
||||
];
|
||||
@@ -1,121 +0,0 @@
|
||||
const path = require('path');
|
||||
const WebpackPluginFailBuildOnWarning = require('./webpack-plugin-fail-build-on-warning');
|
||||
|
||||
/**
|
||||
* This set of stories are the ones that we publish to backstage.io.
|
||||
*/
|
||||
const BACKSTAGE_CORE_STORIES = [
|
||||
'packages/core-components',
|
||||
'packages/app',
|
||||
'plugins/org',
|
||||
'plugins/search',
|
||||
'plugins/search-react',
|
||||
'plugins/home',
|
||||
'plugins/catalog-react',
|
||||
];
|
||||
|
||||
// Some configuration needs to be available directly on the exported object
|
||||
const staticConfig = {
|
||||
core: {
|
||||
builder: 'webpack5',
|
||||
},
|
||||
addons: [
|
||||
'@storybook/addon-controls',
|
||||
'@storybook/addon-a11y',
|
||||
'@storybook/addon-actions',
|
||||
'@storybook/addon-links',
|
||||
'@storybook/addon-storysource',
|
||||
'storybook-dark-mode/register',
|
||||
],
|
||||
};
|
||||
|
||||
module.exports = Object.assign(({ args }) => {
|
||||
// Calling storybook with no args causes our default list of stories to be used.
|
||||
// This set of stories are the ones that we publish to backstage.io
|
||||
//
|
||||
// If it's called with args, each arg should be the path to a package that we will
|
||||
// show the stories from, for example `yarn storybook plugins/catalog`.
|
||||
|
||||
const rootPath = '../../';
|
||||
const storiesSrcGlob = 'src/**/*.stories.tsx';
|
||||
|
||||
const getStoriesPath = package =>
|
||||
path.posix.join(rootPath, package, storiesSrcGlob);
|
||||
|
||||
const packages = args.length === 0 ? BACKSTAGE_CORE_STORIES : args;
|
||||
const stories = packages.map(getStoriesPath);
|
||||
|
||||
return {
|
||||
...staticConfig,
|
||||
stories,
|
||||
webpackFinal: async config => {
|
||||
// Mirror config in packages/cli/src/lib/bundler
|
||||
config.resolve.mainFields = ['browser', 'module', 'main'];
|
||||
|
||||
// Remove the default babel-loader for js files, we're using swc instead
|
||||
const [jsLoader] = config.module.rules.splice(0, 1);
|
||||
if (!jsLoader.use[0].loader.includes('babel-loader')) {
|
||||
throw new Error(
|
||||
`Unexpected loader removed from storybook config, ${jsLoader.use[0].loader}`,
|
||||
);
|
||||
}
|
||||
|
||||
config.resolve.extensions.push('.ts', '.tsx');
|
||||
|
||||
config.module.rules.push(
|
||||
{
|
||||
test: /\.(tsx?)$/,
|
||||
exclude: /node_modules/,
|
||||
loader: require.resolve('swc-loader'),
|
||||
options: {
|
||||
jsc: {
|
||||
target: 'ES2022',
|
||||
parser: {
|
||||
syntax: 'typescript',
|
||||
tsx: true,
|
||||
dynamicImport: true,
|
||||
},
|
||||
transform: {
|
||||
react: {
|
||||
runtime: 'automatic',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.(jsx?|mjs|cjs)$/,
|
||||
exclude: /node_modules/,
|
||||
loader: require.resolve('swc-loader'),
|
||||
options: {
|
||||
jsc: {
|
||||
target: 'ES2022',
|
||||
parser: {
|
||||
syntax: 'ecmascript',
|
||||
jsx: true,
|
||||
dynamicImport: true,
|
||||
},
|
||||
transform: {
|
||||
react: {
|
||||
runtime: 'automatic',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
// Disable ProgressPlugin which logs verbose webpack build progress. Warnings and Errors are still logged.
|
||||
config.plugins = config.plugins.filter(
|
||||
({ constructor }) => constructor.name !== 'ProgressPlugin',
|
||||
);
|
||||
|
||||
// Fail storybook build on CI if there are webpack warnings.
|
||||
if (process.env.CI) {
|
||||
config.plugins.push(new WebpackPluginFailBuildOnWarning());
|
||||
}
|
||||
|
||||
return config;
|
||||
},
|
||||
};
|
||||
}, staticConfig);
|
||||
@@ -1,36 +0,0 @@
|
||||
import React from 'react';
|
||||
import { addDecorator, addParameters } from '@storybook/react';
|
||||
import { lightTheme, darkTheme } from '@backstage/theme';
|
||||
import { CssBaseline, ThemeProvider } from '@material-ui/core';
|
||||
import { useDarkMode } from 'storybook-dark-mode';
|
||||
import { apis } from './apis';
|
||||
|
||||
import { Content, AlertDisplay } from '@backstage/core-components';
|
||||
import { TestApiProvider } from '@backstage/test-utils';
|
||||
|
||||
addDecorator(story => (
|
||||
<TestApiProvider apis={apis}>
|
||||
<ThemeProvider theme={useDarkMode() ? darkTheme : lightTheme}>
|
||||
<CssBaseline>
|
||||
<AlertDisplay />
|
||||
<Content>{story()}</Content>
|
||||
</CssBaseline>
|
||||
</ThemeProvider>
|
||||
</TestApiProvider>
|
||||
));
|
||||
|
||||
addParameters({
|
||||
darkMode: {
|
||||
// Set the initial theme
|
||||
current: 'light',
|
||||
},
|
||||
layout: 'fullscreen',
|
||||
});
|
||||
|
||||
export const parameters = {
|
||||
options: {
|
||||
storySort: {
|
||||
order: ['Plugins', 'Layout', 'Navigation'],
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright 2020 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* When building storybook, we can have warnings which may cause issues in the future. One of the example case is
|
||||
* https://github.com/backstage/backstage/issues/718. To make sure new warnings are not introduced with new PRs, we
|
||||
* want to fail CI builds if there are warnings when building storybook.
|
||||
*
|
||||
* This webpack plugin makes sure the CI builds fail on Webpack warnings. We also have an allowlist of warnings here
|
||||
* which we think are non-critical.
|
||||
*
|
||||
* Note that this implementation will not detect other warnings emitted by storybook build that are separate from
|
||||
* Webpack. A better solution over this plugin should be preferred, possibly on Storybook level (CLI options etc.)
|
||||
*
|
||||
* The case with #718 is caused because we are using `ts-loader` for `webpack` to load all our JS/TS files, but we
|
||||
* have disabled type checking during build. This is done by setting `transpileOnly` to `true` in storybook/main.js
|
||||
* and it improves the Storybook build speed. Because of this, Webpack emits warnings when we try to re-export types.
|
||||
* Reference: https://github.com/TypeStrong/ts-loader#transpileonly
|
||||
*/
|
||||
class WebpackPluginFailBuildOnWarning {
|
||||
// Ignore the following warnings in the Webpack build.
|
||||
warningsAllowlist = new Set([
|
||||
'AssetsOverSizeLimitWarning',
|
||||
'EntrypointsOverSizeLimitWarning',
|
||||
'NoAsyncChunksWarning',
|
||||
'ModuleDependencyWarning', // @testing-library/react added support for React 19 which throws a warning https://github.com/testing-library/react-testing-library/pull/1294/files
|
||||
]);
|
||||
|
||||
/* Entry point for the Webpack plugin. */
|
||||
apply(compiler) {
|
||||
// Invoke plugin logic when Webpack build is 'done'.
|
||||
compiler.hooks.done.tap('FailBuildOnWarning', this.execute.bind(this));
|
||||
}
|
||||
|
||||
execute(stats) {
|
||||
// All the compilation warnings are stored in stats.compilation.warnings
|
||||
let warnings = stats.compilation.warnings;
|
||||
if (warnings.length > 0) {
|
||||
// Throw error if there are unexpected warnings.
|
||||
for (let warning of warnings) {
|
||||
if (!this.warningsAllowlist.has(warning.name)) {
|
||||
process.on('beforeExit', () => {
|
||||
console.log(
|
||||
`You have some unexpected warning(s) in your webpack build. Exiting process as error.`,
|
||||
);
|
||||
process.exit(1);
|
||||
});
|
||||
// No need to go over the rest of warnings from here.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WebpackPluginFailBuildOnWarning;
|
||||
@@ -1,36 +0,0 @@
|
||||
# storybook
|
||||
|
||||
## 0.2.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @backstage/core-plugin-api@0.6.0
|
||||
- @backstage/test-utils@0.2.3
|
||||
- @backstage/core-app-api@0.5.0
|
||||
|
||||
## 0.2.2-next.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @backstage/core-plugin-api@0.6.0-next.0
|
||||
- @backstage/core-app-api@0.5.0-next.0
|
||||
- @backstage/test-utils@0.2.3-next.0
|
||||
|
||||
## 0.2.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @backstage/test-utils@0.2.2
|
||||
- @backstage/core-plugin-api@0.5.0
|
||||
- @backstage/core-app-api@0.4.0
|
||||
|
||||
## 0.2.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [ae5983387]
|
||||
- Updated dependencies [0d4459c08]
|
||||
- @backstage/theme@0.2.0
|
||||
@@ -1,17 +0,0 @@
|
||||
# storybook
|
||||
|
||||
This package provides a Storybook build for Backstage. See https://backstage.io/storybook/.
|
||||
|
||||
## Usage
|
||||
|
||||
To run the storybook locally, call `yarn storybook` in repo root. This will show the default set of stories that we publish to https://backstage.io/storybook
|
||||
|
||||
If you want to show stories other than the default set, you can pass one or more package paths as an argument when calling storybook, for example:
|
||||
|
||||
```sh
|
||||
yarn storybook plugins/search
|
||||
```
|
||||
|
||||
## Why is this not part of `@backstage/core-components`?
|
||||
|
||||
This separate storybook package exists because of dependency conflicts with `@backstage/cli`. It uses `nohoist` to avoid the conflicts, and since you can only use that in private packages it has to be separated out of `@backstage/core-components`.
|
||||
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"name": "storybook",
|
||||
"version": "0.2.2",
|
||||
"description": "Storybook build for components package",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build-storybook": "build-storybook --output-dir dist",
|
||||
"start": "start-storybook -p 6006"
|
||||
},
|
||||
"resolutions": {
|
||||
"webpack": "^5.73.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@swc/core": "^1.3.46",
|
||||
"react": "^18.0.2",
|
||||
"react-dom": "^18.0.2",
|
||||
"react-hot-loader": "^4.13.0",
|
||||
"react-router-dom": "^6.25.1",
|
||||
"swc-loader": "^0.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@storybook/addon-a11y": "^6.5.9",
|
||||
"@storybook/addon-actions": "^6.5.9",
|
||||
"@storybook/addon-controls": "^6.5.9",
|
||||
"@storybook/addon-links": "^6.5.9",
|
||||
"@storybook/addon-storysource": "^6.5.9",
|
||||
"@storybook/addons": "^6.5.9",
|
||||
"@storybook/builder-webpack5": "^6.5.9",
|
||||
"@storybook/manager-webpack5": "^6.5.9",
|
||||
"@storybook/node-logger": "^6.5.9",
|
||||
"@storybook/react": "^6.5.9",
|
||||
"@storybook/testing-library": "^0.2.0",
|
||||
"storybook-dark-mode": "^1.1.0",
|
||||
"typescript": "~4.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@backstage/core-app-api": "*",
|
||||
"@backstage/core-plugin-api": "*",
|
||||
"@backstage/test-utils": "*",
|
||||
"@backstage/theme": "*"
|
||||
}
|
||||
}
|
||||
-12078
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user