Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Keeping Plugins Up-To-Date

When developing Flex Plugins, there are three sets of versions that you want to keep updated:

  1. The create-flex-plugin version used to initialize any new plugins
  2. The flex-plugin version of your plugin's development environment
  3. The versions of the plugins you create

Each of these is managed independently. Updating the Plugin Builder won't automatically update the development environment of your existing plugins. This allows you to trial new features in your latest plugins without risking backwards-incompatible changes in your other codebases.

Upgrading the Plugin Builder

When you create a new plugin, the version of the Plugin Builder you are using is based on the create-flex-plugin node package that is installed on your machine. You can use the following command to check which version you have installed:

$ npm list -g --depth 0

/Users/jdoe/n/lib
├── create-flex-plugin@3.0.0
├── npm@6.9.0
└── yarn@1.10.1

If create-flex-plugin is installed globally, that version will be used when generating your new plugin directory. If it is not installed globally, then the latest version will be used when executing the initializer.

npm init flex-plugin plugin-sample --install

Prior to npm@6, the initializer would not use a globally installed package. So if you directly called npx create-flex-plugin, it would also use the latest published version of the Plugin Builder.

For simplicity, we recommend not installing create-flex-plugin globally. This way, new plugins you create will automatically take advantage of the latest package. You can remove a global installation with:

npm uninstall -g create-flex-plugin

Upgrading Existing Plugins

Existing plugin directories are not automatically updated to use the latest features from the Plugin Builder. These must be individually migrated to add new build scripts or apply updated dependencies. You can verify the version of your plugin by checking the flex-plugin dependency within your plugin's package.json.

"dependencies": {
    "flex-plugin": "^1.1.1",
    ...,
}

To upgrade a plugin, we need to manually update plugin dependencies based on each subsequent major version release. To identify the latest version release:

$ npm show flex-plugin version

3.5.0

Using the below migration guides, update your plugin directory for each major release. Using the example above as a guide (a plugin starting at v1.1.1), we would follow both the v2 and v3 migration guides.

Checking Additional Dependencies

As you develop your plugins, you may include dependencies in addition to the ones we've provided as part of the create-flex-plugin template. The npm-check-updates library can check all of the dependencies in your package.json and identify the latest available versions. To use this library:

1. Install npm-check-updates globally.

npm install -g npm-check-updates​

2. Run the ncu command in the root directory of your plugin.

ncu -n
Checking ~/plugin-sample/package.json
[====================] 21/21 100%

 craco-config-flex-plugin  ^3.0.0  →  ^3.0.1

Run ncu -u to upgrade package.json​​

3. Update any of the identified dependencies in your package.json and run another npm install.

Upgrading Your Plugins

The Plugins API referenced below is in a pilot release. These features are not yet available to all developers.

If you have been using the Plugins API to release versions of your plugin, you may want to confirm which versions have been deployed and are live in each of your accounts. The following command can identify your live plugin versions.

To run this command, you must replace the AccountSid and AuthToken in the two curl requests with the details from your account. This command also uses the jq library to simplify combining these requests.

configSid=$(curl -X GET 'https://flex-api.twilio.com/v1/PluginService/Releases/Active' -u ACxx:authToken | jq -r '.configuration_sid') ; curl -X GET "https://flex-api.twilio.com/v1/PluginService/Configurations/${configSid}/Plugins" -u ACxx:authToken | jq '.plugins[] | [.unique_name, .version] | @tsv'

This will return a list of plugins that are active on your account.

plugin-sample            1.0.2
plugin-another-sample    0.3.0
Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.