Skip to content

Commit

Permalink
feat(index): add warnings about moving package to @migtools/lib-ui (m…
Browse files Browse the repository at this point in the history
  • Loading branch information
mturley authored Aug 23, 2022
1 parent 7393042 commit 66ce1b0
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .storybook/helpers/PackageMovedAlert.tsx
Original file line number Diff line number Diff line change
@@ -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 = () => (
<Alert
variant="danger"
title={<>IMPORTANT: This library has moved!</>}
isInline
className={spacing.mbLg}
actionLinks={
<>
<AlertActionLink onClick={() => navTo('https://www.npmjs.com/package/@migtools/lib-ui')}>
View new package on npm
</AlertActionLink>
<AlertActionLink onClick={() => navTo('https://github.com/migtools/lib-ui')}>
View new package on GitHub
</AlertActionLink>
<AlertActionLink onClick={() => navTo('https://migtools.github.io/lib-ui/')}>
View new documentation
</AlertActionLink>
</>
}
>
The <code>@konveyor/lib-ui</code> package is deprecated and has been moved to{' '}
<a href="https://www.npmjs.com/package/@migtools/lib-ui">
<code>@migtools/lib-ui</code>
</a>
. You must switch to that package for future upgrades. The version documented here is the final
release under the <code>@konveyor/lib-ui</code> name and is identical to the first release of{' '}
<code>@migtools/lib-ui</code>.{' '}
</Alert>
);

export default PackageMovedAlert;
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
8 changes: 8 additions & 0 deletions src/common/packageMovedConsoleWarning.ts
Original file line number Diff line number Diff line change
@@ -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/
`;
3 changes: 3 additions & 0 deletions src/components/StatusIcon/StatusIcon.stories.mdx
Original file line number Diff line number Diff line change
@@ -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';

<Meta title="Components/StatusIcon" component={StatusIcon} />

<PackageMovedAlert />

# StatusIcon

A small wrapper for PatternFly's CheckCircleIcon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

<Meta title="Components/ValidatedTextInput" component={ValidatedTextInput} />

<PackageMovedAlert />

# ValidatedTextInput

A small wrapper for PatternFly's FormGroup, TextInput and TextArea components that integrates with the
Expand Down
3 changes: 3 additions & 0 deletions src/hooks/useFormState/useFormState.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ import {
ComplexFieldTypes,
} from './useFormState.stories.tsx';
import GithubLink from '../../../.storybook/helpers/GithubLink';
import PackageMovedAlert from '../../../.storybook/helpers/PackageMovedAlert';

<Meta title="Hooks/useFormState" component={useFormState} />

<PackageMovedAlert />

# useFormState

A custom hook for managing field values, validation, and other form state.
Expand Down
3 changes: 3 additions & 0 deletions src/hooks/useLocalStorage/useLocalStorage.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ import {
ComplexValueExample,
} from './useLocalStorage.stories.tsx';
import GithubLink from '../../../.storybook/helpers/GithubLink';
import PackageMovedAlert from '../../../.storybook/helpers/PackageMovedAlert';

<Meta title="Hooks/useLocalStorage" component={useLocalStorage} />

<PackageMovedAlert />

# useLocalStorage

A custom hook resembling `React.useState` which persists and synchronizes any JSON-serializable value using the
Expand Down
3 changes: 3 additions & 0 deletions src/hooks/useSelectionState/useSelectionState.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

<Meta title="Hooks/useSelectionState" component={useSelectionState} />

<PackageMovedAlert />

# useSelectionState

A custom hook for managing a subset of an array which represents the user's current selection of items in that array.
Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { packageMovedConsoleWarning } from './common/packageMovedConsoleWarning';

export * from './components/StatusIcon';
export * from './components/ValidatedTextInput';
export * from './components/ResolvedQuery';
Expand All @@ -8,3 +10,5 @@ export * from './hooks/useFormState';
export * from './hooks/useLocalStorage';

export * from './modules/kube-client';

console.warn(packageMovedConsoleWarning);
4 changes: 4 additions & 0 deletions src/modules/kube-client/index.ts
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 66ce1b0

Please sign in to comment.