# Plugin Starter Template [![CircleCI branch](https://img.shields.io/circleci/project/github/mattermost/mattermost-plugin-attachments-remover/master.svg)](https://circleci.com/gh/mattermost/mattermost-plugin-attachments-remover) ## Features - Allows users and sysadmins to delete attachments from posts via a context menu option ## Development To avoid having to manually install your plugin, build and deploy your plugin using one of the following options. In order for the below options to work, you must first enable plugin uploads via your config.json or API and restart Mattermost. ```json "PluginSettings" : { ... "EnableUploads" : true } ``` ### Deploying with Local Mode If your Mattermost server is running locally, you can enable [local mode](https://docs.mattermost.com/administration/mmctl-cli-tool.html#local-mode) to streamline deploying your plugin. Edit your server configuration as follows: ```json { "ServiceSettings": { ... "EnableLocalMode": true, "LocalModeSocketLocation": "/var/tmp/mattermost_local.socket" }, } ``` and then deploy your plugin: ``` make deploy ``` You may also customize the Unix socket path: ```bash export MM_LOCALSOCKETPATH=/var/tmp/alternate_local.socket make deploy ``` If developing a plugin with a webapp, watch for changes and deploy those automatically: ```bash export MM_SERVICESETTINGS_SITEURL=http://localhost:8065 export MM_ADMIN_TOKEN=j44acwd8obn78cdcx7koid4jkr make watch ``` ### Deploying with credentials Alternatively, you can authenticate with the server's API with credentials: ```bash export MM_SERVICESETTINGS_SITEURL=http://localhost:8065 export MM_ADMIN_USERNAME=admin export MM_ADMIN_PASSWORD=password make deploy ``` or with a [personal access token](https://docs.mattermost.com/developer/personal-access-tokens.html): ```bash export MM_SERVICESETTINGS_SITEURL=http://localhost:8065 export MM_ADMIN_TOKEN=j44acwd8obn78cdcx7koid4jkr make deploy ``` ### Releasing new versions The version of a plugin is determined at compile time, automatically populating a `version` field in the [plugin manifest](plugin.json): * If the current commit matches a tag, the version will match after stripping any leading `v`, e.g. `1.3.1`. * Otherwise, the version will combine the nearest tag with `git rev-parse --short HEAD`, e.g. `1.3.1+d06e53e1`. * If there is no version tag, an empty version will be combined with the short hash, e.g. `0.0.0+76081421`. To disable this behaviour, manually populate and maintain the `version` field. ## How to Release To trigger a release, follow these steps: 1. **For Patch Release:** Run the following command: ``` make patch ``` This will release a patch change. 2. **For Minor Release:** Run the following command: ``` make minor ``` This will release a minor change. 3. **For Major Release:** Run the following command: ``` make major ``` This will release a major change. 4. **For Patch Release Candidate (RC):** Run the following command: ``` make patch-rc ``` This will release a patch release candidate. 5. **For Minor Release Candidate (RC):** Run the following command: ``` make minor-rc ``` This will release a minor release candidate. 6. **For Major Release Candidate (RC):** Run the following command: ``` make major-rc ``` This will release a major release candidate. ## Q&A ### How do I build the plugin with unminified JavaScript? Setting the `MM_DEBUG` environment variable will invoke the debug builds. The simplist way to do this is to simply include this variable in your calls to `make` (e.g. `make dist MM_DEBUG=1`).