Skip to content

Commit

Permalink
fix: Fix supported link types for plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Sertaç Karahoda committed Nov 8, 2021
1 parent d2b256f commit 838f5df
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions PLUGIN.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ To extend the `connect` command, you can build a plugin for your own needs. Plug

### Implementation

1. Create a class that implements the [ConnectPlugin](./src/commands/connect/interfaces/plugin.d.ts) interface.
1. Create a class that implements the [ConnectPlugin](./src/commands/connect/interfaces/plugin.ts) interface.
- See [interface documentation](./docs/cli.connectplugin.md) for details.
- To get type definitions for plugin development install `@zeplin/cli` package as a development dependency.

Expand All @@ -33,7 +33,7 @@ To extend the `connect` command, you can build a plugin for your own needs. Plug

### Examples

Here's a boilerplate for a class that implements the [ConnectPlugin](./src/commands/connect/interfaces/plugin.d.ts) interface.
Here's a boilerplate for a class that implements the [ConnectPlugin](./src/commands/connect/interfaces/plugin.ts) interface.
```typescript
import { ConnectPlugin, ComponentConfig, ComponentData, PrismLang } from "@zeplin/cli";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export interface Link {
* Use `LinkType.custom` if you are not sure what to do
* @public
*/
export const enum LinkType {
export enum LinkType {
storybook = "storybook",
github = "github",
gitlab = "gitlab",
Expand Down
8 changes: 1 addition & 7 deletions src/commands/connect/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ import { getInstallCommand } from "../../util/text";
import { flat } from "../../util/array";
import { isDefined } from "../../util/object";

const ALLOWED_LINK_TYPES = [
LinkType.storybook,
LinkType.github,
LinkType.custom
];

interface ConnectPluginConstructor {
new(): ConnectPluginInstance;
}
Expand Down Expand Up @@ -84,7 +78,7 @@ const initializePlugins = async (
};

const processLink = (link: Link): Link => {
if (!ALLOWED_LINK_TYPES.includes(link.type)) {
if (!Object.values(LinkType).includes(link.type)) {
link.type = LinkType.custom;
}

Expand Down

0 comments on commit 838f5df

Please sign in to comment.