Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoselect node version #188

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GO ?= $(shell command -v go 2> /dev/null)
NPM ?= $(shell command -v npm 2> /dev/null)
CURL ?= $(shell command -v curl 2> /dev/null)
VOLTA ?= $(shell command -v volta 2> /dev/null)
MM_DEBUG ?=
MANIFEST_FILE ?= plugin.json
GOPATH ?= $(shell go env GOPATH)
Expand Down Expand Up @@ -52,10 +52,7 @@ ifneq ($(HAS_WEBAPP),)
endif

ifneq ($(HAS_SERVER),)
@if ! [ -x "$$(command -v golangci-lint)" ]; then \
echo "golangci-lint is not installed. Please see https://github.com/golangci/golangci-lint#install for installation instructions."; \
exit 1; \
fi; \
$(GO) install github.com/golangci/golangci-lint/cmd/[email protected]

@echo Running golangci-lint
golangci-lint run ./...
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ 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/).

This template requires node v16 and npm v8. You can download and install nvm to manage your node versions by following the instructions [here](https://github.com/nvm-sh/nvm). Once you've setup the project simply run `nvm i` within the root folder to use the suggested version of node.
This template requires node v16 and npm v8. You can download and install `volta` to manage your node versions by following the instructions [here](https://docs.volta.sh/guide/getting-started).

## Prerequisites
Ensure you have the following tools installed:
1. [`go`](https://go.dev/doc/install) with version >= **1.21**
2. [`volta`](https://docs.volta.sh/guide/getting-started) (If you opt to not use `volta`, you need to install [`npm`](https://www.npmjs.com/get-npm) v8)


## Getting Started
Use GitHub's template feature to make a copy of this repository by clicking the "Use this template" button.
Expand All @@ -14,8 +20,6 @@ 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`.

Edit the following files:
1. `plugin.json` with your `id`, `name`, and `description`:
```json
Expand Down
4 changes: 3 additions & 1 deletion build/setup.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ HAS_MM_UTILITIES ?= $(wildcard $(MM_UTILITIES_DIR)/.)
# Store the current path for later use
PWD ?= $(shell pwd)

# Ensure that npm (and thus node) is installed.
ifneq ($(HAS_WEBAPP),)
ifeq ($(VOLTA),)
$(info volta is not available. You need to manually manage your npm version.)
ifeq ($(NPM),)
$(error "npm is not available: see https://www.npmjs.com/get-npm")
endif
endif
endif
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/mattermost/mattermost-plugin-starter-template

go 1.19
go 1.21

require (
github.com/mattermost/mattermost/server/public v0.0.6
Expand Down
4 changes: 4 additions & 0 deletions webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,9 @@
"<rootDir>/tests/setup.tsx"
],
"testURL": "http://localhost:8065"
},
"volta": {
"node": "16.20.2",
"npm": "8.19.4"
}
}