# Versioning

As you develop and update your plugin, at some point, you may need to version the code.

For example, FormIt's APIs may change between releases, and while you may want the new version of your plugin to use new FormIt or WSM APIs, you'd also like to keep the plugin working in older clients.

Starting with FormIt **v18.0**, you can implement versioning for your plugin in 3 simple steps:

* Add a *versions.json* file to the root of your plugin directory
* Specify each compatible FormIt version, and the directory containing those plugin files, in *versions.json*
* Use the FormIt internal version number, or "Build Number", found in FormIt under Info > About.

### How to organize versioning for your plugin

Organize your plugin files and directories to match *versions.json*

Your *versions.json* should look like this:

```
        [
            {
                "version":{
                    "major":18,
                    "minor":0
                },
                "path":"v18_0"
            },
            {
                "version":{
                    "major":19,
                    "minor":1
                },
                "path":"v19_0"
            }
        ]
        
```

The above paths *v18\_0* and *v19\_0* must be valid subpaths from the root of your directory/repository.

![](https://193854745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVWdttpiARClwDWoDArlA%2Fuploads%2Fgit-blob-b0e71b2ae5f7c6c5808ac7ce288cb686eb53db2b%2Fi1.png?alt=media)

![](https://193854745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVWdttpiARClwDWoDArlA%2Fuploads%2Fgit-blob-6ddcda42f6935b6bfdce65a21daccbb71fd748c6%2Fi2.png?alt=media)

![](https://193854745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVWdttpiARClwDWoDArlA%2Fuploads%2Fgit-blob-9c48ec8d3673c6b1b79d89edcbc95b78263d2eaf%2Fi3.png?alt=media)

A great way to handle this is to move your plugin code into subdirectories. Using the above *versions.json*, a directory structure would look like this:

* **versions.json** (file)
* **v18\_0** (directory)
  * **manifest.json** (file)
  * **plugin.html** (file)
  * **plugin.js** (file)
* **v19\_0** (directory)
  * **manifest.json** (file)
  * **plugin.html** (file)
  * **plugin.js** (file)

Optional properties on version are "exactVersion" and "lastVersion". "exactVersion" indicates the version has to match FormIt's version exactly. "lastVersion" indicates the last version allowed to run in FormIt.\\

```
[
    {
      "version":{
        "major":18,
        "minor":0,
        "exactVersion":true
        },
        "path":"v18_0"
    },
    {
        "version":{
            "major":19,
            "minor":1,
            "lastVersion":true
       },
        "path":"v19_0"
    }
 ]
```

It's also possible to use git branches/tags/commits for your paths.

If you're working with a pre-release or beta build of FormIt, and would like to test changes to a plugin that only works with the pre-release version:

* Follow the steps above, except using the filename *versions\_prerelease.json*
* If you commit *versions\_prerelease* to your repo, you'll want to remove it when that pre-release version of FormIt is released
  * Otherwise, future pre-release FormIt versions will be loading the plugin from a location that could be stale or intended for an older version
