# Flex Plugin Core Utils
A core utility package written in Node TypeScript which helps build plugins for Flex.

It uses Facebook's JSCodeshift to parse through Flex plugin code and perform different operations like migration/validation.

## Usage
### Validate
Validates the given plugin files (TSX/JSX/TS/JS) for violation of a list of rules for a given Flex UI version. These rules include checks against the following:
1. Flex UI API Compatibility
2. Flex UI Dependency Conflicts
3. Direct DOM Manipulation.
#### Method
```TS
validate(filePaths: string[], rules: Rules, config: RunnerConfig)
```
#### Arguments
- `filePaths` - Paths to plugin files which needs to be validated
- `rules` -  List of rules to check violations for in the given plugin files
- `config` - JSCodeshift runner configuration options

---
### Migrate
Migrates the given plugin files (TSX/JSX/TS/JS) to use the latest Flex Declarative Component API used to build on top of Flex.
#### Method
```TS
migrate(filePaths: string[], config: RunnerConfig)
```
#### Arguments
- `filePaths` - Paths to plugin files which needs to be migrated
- `config` - JSCodeshift runner configuration options

---

### Note:
> This is an utility package used by Twilio Flex Plugin Builder internally and is not meant to be used as a stand-alone package. We do not support it for use outside of Twilio.

