Various tooling improvements from other plugins (#96)

This commit is contained in:
Jesse Hallam 2020-06-22 12:21:37 -03:00 committed by GitHub
parent c557d38b4d
commit a49d6f6dd4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 693 additions and 201 deletions

View file

@ -5,14 +5,14 @@ This plugin serves as a starting point for writing a Mattermost plugin. Feel fre
To learn more about plugins, see [our plugin documentation](https://developers.mattermost.com/extend/plugins/).
## Getting Started
Use GitHub's template feature to make a copy of this repository by clicking the "Use this template" button then clone outside of `$GOPATH`.
Use GitHub's template feature to make a copy of this repository by clicking the "Use this template" button.
Alternatively shallow clone the repository to a directory outside of `$GOPATH` matching your plugin name:
Alternatively shallow clone the repository matching your plugin name:
```
git clone --depth 1 https://github.com/mattermost/mattermost-plugin-starter-template com.example.my-plugin
```
Note that this project uses [Go modules](https://github.com/golang/go/wiki/Modules). Be sure to locate the project outside of `$GOPATH`, or allow the use of Go modules within your `$GOPATH` with an `export GO111MODULE=on`.
Note that this project uses [Go modules](https://github.com/golang/go/wiki/Modules). Be sure to locate the project outside of `$GOPATH`.
Edit `plugin.json` with your `id`, `name`, and `description`:
```
@ -34,7 +34,9 @@ This will produce a single plugin file (with support for multiple architectures)
dist/com.example.my-plugin.tar.gz
```
There is a build target to automate deploying and enabling the plugin to your server, but it requires login credentials:
## Development
To avoid having to manually install your plugin, build and deploy your plugin with login credentials:
```
export MM_SERVICESETTINGS_SITEURL=http://localhost:8065
export MM_ADMIN_USERNAME=admin
@ -42,16 +44,19 @@ export MM_ADMIN_PASSWORD=password
make deploy
```
or configuration of a [personal access token](https://docs.mattermost.com/developer/personal-access-tokens.html):
or with a [personal access token](https://docs.mattermost.com/developer/personal-access-tokens.html):
```
export MM_SERVICESETTINGS_SITEURL=http://localhost:8065
export MM_ADMIN_TOKEN=j44acwd8obn78cdcx7koid4jkr
make deploy
```
Alternatively, if you are running your `mattermost-server` out of a sibling directory by the same name, use the `deploy` target alone to unpack the files into the right directory. You will need to restart your server and manually enable your plugin.
In production, deploy and upload your plugin via the [System Console](https://about.mattermost.com/default-plugin-uploads).
If developing a plugin with a webapp, watch for changes and deploy those automatically:
```
export MM_SERVICESETTINGS_SITEURL=http://localhost:8065
export MM_ADMIN_TOKEN=j44acwd8obn78cdcx7koid4jkr
make watch
```
## Q&A
@ -80,4 +85,4 @@ if appErr := p.API.SetProfileImage(userID, profileImage); appErr != nil {
```
### How do I build the plugin with unminified JavaScript?
Use `make debug-dist` and `make debug-deploy` in place of `make dist` and `make deploy` to configure webpack to generate unminified Javascript.
Use `make dist-debug` and `make deploy-debug` in place of `make dist` and `make deploy` to configure webpack to generate unminified Javascript.