From 66ce1b072b4f057862818e9b0f0e6419e3f67886 Mon Sep 17 00:00:00 2001 From: Mike Turley Date: Tue, 23 Aug 2022 12:59:22 -0400 Subject: [PATCH] feat(index): add warnings about moving package to `@migtools/lib-ui` (#110) --- .storybook/helpers/PackageMovedAlert.tsx | 37 +++++++++++++++++++ README.md | 6 +++ src/common/packageMovedConsoleWarning.ts | 8 ++++ .../StatusIcon/StatusIcon.stories.mdx | 3 ++ .../ValidatedTextInput.stories.mdx | 3 ++ .../useFormState/useFormState.stories.mdx | 3 ++ .../useLocalStorage.stories.mdx | 3 ++ .../useSelectionState.stories.mdx | 3 ++ src/index.ts | 4 ++ src/modules/kube-client/index.ts | 4 ++ 10 files changed, 74 insertions(+) create mode 100644 .storybook/helpers/PackageMovedAlert.tsx create mode 100644 src/common/packageMovedConsoleWarning.ts diff --git a/.storybook/helpers/PackageMovedAlert.tsx b/.storybook/helpers/PackageMovedAlert.tsx new file mode 100644 index 0000000..71d4736 --- /dev/null +++ b/.storybook/helpers/PackageMovedAlert.tsx @@ -0,0 +1,37 @@ +import * as React from 'react'; +import { Alert, AlertActionLink } from '@patternfly/react-core'; +import spacing from '@patternfly/react-styles/css/utilities/Spacing/spacing'; + +const navTo = (href: string) => window.top && (window.top.location.href = href); + +const PackageMovedAlert: React.FunctionComponent = () => ( + IMPORTANT: This library has moved!} + isInline + className={spacing.mbLg} + actionLinks={ + <> + navTo('https://www.npmjs.com/package/@migtools/lib-ui')}> + View new package on npm + + navTo('https://github.com/migtools/lib-ui')}> + View new package on GitHub + + navTo('https://migtools.github.io/lib-ui/')}> + View new documentation + + + } + > + The @konveyor/lib-ui package is deprecated and has been moved to{' '} + + @migtools/lib-ui + + . You must switch to that package for future upgrades. The version documented here is the final + release under the @konveyor/lib-ui name and is identical to the first release of{' '} + @migtools/lib-ui.{' '} + +); + +export default PackageMovedAlert; diff --git a/README.md b/README.md index cb0cccf..2b46e47 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # @konveyor/lib-ui +--- + +# IMPORTANT: The `@konveyor/lib-ui` npm package is deprecated and has moved to `@migtools/lib-ui`. + +--- + Reusable React components, hooks, and TypeScript modules shared between Konveyor UI projects. This library exists as a place to store and reuse abstractions that are useful for multiple Konveyor UI projects, and are either not available in PatternFly yet or not covered by PatternFly's scope. diff --git a/src/common/packageMovedConsoleWarning.ts b/src/common/packageMovedConsoleWarning.ts new file mode 100644 index 0000000..fbc8313 --- /dev/null +++ b/src/common/packageMovedConsoleWarning.ts @@ -0,0 +1,8 @@ +export const packageMovedConsoleWarning = ` +IMPORTANT: The @konveyor/lib-ui package is deprecated and has been moved to @migtools/lib-ui. You must switch to that package for future upgrades. +The version you are using is the final release under the @konveyor/lib-ui name and is identical to the first release of @migtools/lib-ui. + +New package on npm: https://www.npmjs.com/package/@migtools/lib-ui +New package on GitHub: https://github.com/migtools/lib-ui +New documentation: https://migtools.github.io/lib-ui/ +`; diff --git a/src/components/StatusIcon/StatusIcon.stories.mdx b/src/components/StatusIcon/StatusIcon.stories.mdx index 0710739..d202935 100644 --- a/src/components/StatusIcon/StatusIcon.stories.mdx +++ b/src/components/StatusIcon/StatusIcon.stories.mdx @@ -1,9 +1,12 @@ import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks'; import { StatusIcon } from './StatusIcon'; import GithubLink from '../../../.storybook/helpers/GithubLink'; +import PackageMovedAlert from '../../../.storybook/helpers/PackageMovedAlert'; + + # StatusIcon A small wrapper for PatternFly's CheckCircleIcon, diff --git a/src/components/ValidatedTextInput/ValidatedTextInput.stories.mdx b/src/components/ValidatedTextInput/ValidatedTextInput.stories.mdx index c3d893c..60acdac 100644 --- a/src/components/ValidatedTextInput/ValidatedTextInput.stories.mdx +++ b/src/components/ValidatedTextInput/ValidatedTextInput.stories.mdx @@ -2,9 +2,12 @@ import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks'; import { ValidatedTextInput } from './ValidatedTextInput'; import { PatternFlyTextFields } from './ValidatedTextInput.stories.tsx'; import GithubLink from '../../../.storybook/helpers/GithubLink'; +import PackageMovedAlert from '../../../.storybook/helpers/PackageMovedAlert'; + + # ValidatedTextInput A small wrapper for PatternFly's FormGroup, TextInput and TextArea components that integrates with the diff --git a/src/hooks/useFormState/useFormState.stories.mdx b/src/hooks/useFormState/useFormState.stories.mdx index 6271e16..4a433a7 100644 --- a/src/hooks/useFormState/useFormState.stories.mdx +++ b/src/hooks/useFormState/useFormState.stories.mdx @@ -8,9 +8,12 @@ import { ComplexFieldTypes, } from './useFormState.stories.tsx'; import GithubLink from '../../../.storybook/helpers/GithubLink'; +import PackageMovedAlert from '../../../.storybook/helpers/PackageMovedAlert'; + + # useFormState A custom hook for managing field values, validation, and other form state. diff --git a/src/hooks/useLocalStorage/useLocalStorage.stories.mdx b/src/hooks/useLocalStorage/useLocalStorage.stories.mdx index eff43d3..1353f73 100644 --- a/src/hooks/useLocalStorage/useLocalStorage.stories.mdx +++ b/src/hooks/useLocalStorage/useLocalStorage.stories.mdx @@ -11,9 +11,12 @@ import { ComplexValueExample, } from './useLocalStorage.stories.tsx'; import GithubLink from '../../../.storybook/helpers/GithubLink'; +import PackageMovedAlert from '../../../.storybook/helpers/PackageMovedAlert'; + + # useLocalStorage A custom hook resembling `React.useState` which persists and synchronizes any JSON-serializable value using the diff --git a/src/hooks/useSelectionState/useSelectionState.stories.mdx b/src/hooks/useSelectionState/useSelectionState.stories.mdx index fe76136..0ff9aa2 100644 --- a/src/hooks/useSelectionState/useSelectionState.stories.mdx +++ b/src/hooks/useSelectionState/useSelectionState.stories.mdx @@ -2,9 +2,12 @@ import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks'; import { useSelectionState } from './useSelectionState'; import { Checkboxes, ExpandableTable, ExternalState } from './useSelectionState.stories.tsx'; import GithubLink from '../../../.storybook/helpers/GithubLink'; +import PackageMovedAlert from '../../../.storybook/helpers/PackageMovedAlert'; + + # useSelectionState A custom hook for managing a subset of an array which represents the user's current selection of items in that array. diff --git a/src/index.ts b/src/index.ts index 0c9766b..782d762 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,5 @@ +import { packageMovedConsoleWarning } from './common/packageMovedConsoleWarning'; + export * from './components/StatusIcon'; export * from './components/ValidatedTextInput'; export * from './components/ResolvedQuery'; @@ -8,3 +10,5 @@ export * from './hooks/useFormState'; export * from './hooks/useLocalStorage'; export * from './modules/kube-client'; + +console.warn(packageMovedConsoleWarning); diff --git a/src/modules/kube-client/index.ts b/src/modules/kube-client/index.ts index da7b6d6..9268344 100644 --- a/src/modules/kube-client/index.ts +++ b/src/modules/kube-client/index.ts @@ -1,4 +1,8 @@ +import { packageMovedConsoleWarning } from '../../common/packageMovedConsoleWarning'; + export * from './client'; export * from './client_factory'; export * from './resources/common'; export * from './resources/core'; + +console.warn(packageMovedConsoleWarning);