Streamline updating plugin repositories to match starter-template

Description

From time to time, we update https://github.com/mattermost/mattermost-plugin-starter-template with tooling improvements, build changes, and dependency updates, themselves sometimes in relation to security patches.

Let's build a tool – located inside the starter template – that streamlines this process. Specific file considerations include:

  • go.mod (go.sum?): merge with version in the target repository

  • webapp/package.json (package-lock.json?): merge with version in the target repository

  • webapp/i18n/en.json: merge with version in target repository

  • webapp/src/manifest.js: already controlled by build process

  • webapp/src/manifest.test.js, server/manifest.go: already controlled by build process

  • build/: replace all

  • Makefile, .editorconfig, webapp/.babelrc, webapp/webpack.config.js, webapp/tsconfig.json, webapp/.eslintrc.json, webapp/src/index.js, server/configuration.go, server/plugin.go, server/plugin_test.go, public/hello.html, .circleci/config.yml: hashing based approach described below

It may not be possible to merge with changes to existing files. For the files listed above, the tool could maintain a hash of all known versions in the starter-template repository to determine if it's "safe to replace", or take some other action.

There will be other migration considerations to include. For example, moving from `github.com/mattermost/mattermost-server` to `github.com/mattermost/mattermost-server/v5` (or in the future, v6), and rewriting all existing `.go` source. This might be easiest if the starter template version from which the repository is being migrated could be determined with some confidence.

The script itself should be written in Go live in `build/upgrade`. It should be possible to run the tooling against a repository in a specified directory, but once upgraded, it would be interesting to have a `make upgrade-from-starter-template` that fetches the latest version and helps with this automation. The script should likely be interactive, though with version control, all changes could be reviewed anyway. If unavoidable merge conflicts were detected, it might be nice to detect a Git repository format and generate artificial merge conflicts to enable use of existing tooling to decide how to proceed.

This ticket is somewhat open ended, but the end result should allow us to easily upgrade the demo and other Mattermost plugins to the latest "starter-template" tooling with minimal manual effort.

QA Test Steps

None

Reporter

None

Status

Mana

None

Assignee

Mattermost Community

QA Assignee

None

Reporter

Jesse Hallam

Epic Link

None

Fix versions

Mattermost Team

Toolkit

Sprint

None

Labels

None

QA Testing Areas

None

GitHub Issue

None

Components

None
Configure