Upgrade node to 16.13 (#163)

* Updated base packages and regenerated package-lock

* Added babel plugin to eslint, cleaned up webpack config

* Version requirements for node/npm in README

* Readded compass and css, removed by mistake

* Fixed jest testing

* Fixing lint issues.

* Moved import to use webapp redux package

* Fixed final jest issue

* Modified packages and rebuild packagelock for node 16.14

* Add src and mattermost-redux alias

* Update README.md

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* Adding nvm and removing the default type from the package

* Delete root package-lock.json

* Pinned to webapp v7, rebuild package log

* fixed imports with TS

* change tsconfig location pointer

* updates for vscode-eslint to work with tsconfig subpath

* don't import webapp for tests

* remove "v" from .nvmrc

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
Colton Shaw 2023-02-22 02:23:38 -05:00 committed by GitHub
parent c0b3c8b760
commit 121997e77a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 27601 additions and 13223 deletions

3
.gitignore vendored
View file

@ -3,8 +3,5 @@ dist/
# Mac
.DS_Store
# VSCode
.vscode/
# Jetbrains
.idea/

2
.nvmrc
View file

@ -1 +1 @@
14.21.1
16.13.1

5
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,5 @@
{
"eslint.workingDirectories": [
"webapp"
]
}

View file

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

File diff suppressed because it is too large Load diff

39314
webapp/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -13,62 +13,73 @@
"check-types": "tsc"
},
"devDependencies": {
"@babel/cli": "7.10.4",
"@babel/core": "7.10.4",
"@babel/plugin-proposal-class-properties": "7.10.4",
"@babel/plugin-proposal-object-rest-spread": "7.10.4",
"@babel/plugin-proposal-optional-chaining": "7.10.4",
"@babel/cli": "7.16.8",
"@babel/core": "7.16.12",
"@babel/plugin-proposal-class-properties": "7.16.7",
"@babel/plugin-proposal-object-rest-spread": "7.16.7",
"@babel/plugin-proposal-optional-chaining": "7.16.7",
"@babel/plugin-syntax-dynamic-import": "7.8.3",
"@babel/polyfill": "7.10.4",
"@babel/preset-env": "7.10.4",
"@babel/preset-react": "7.10.4",
"@babel/preset-typescript": "7.10.4",
"@babel/runtime": "7.10.4",
"@emotion/babel-preset-css-prop": "10.0.27",
"@emotion/core": "10.0.28",
"@types/enzyme": "3.10.5",
"@types/jest": "26.0.4",
"@types/node": "14.0.20",
"@types/react": "16.9.41",
"@types/react-dom": "16.9.8",
"@types/react-intl": "3.0.0",
"@types/react-redux": "7.1.9",
"@babel/preset-env": "7.16.11",
"@babel/preset-react": "7.16.7",
"@babel/preset-typescript": "7.16.7",
"@babel/runtime": "7.16.7",
"@emotion/babel-preset-css-prop": "11.2.0",
"@emotion/core": "10.3.1",
"@mattermost/types": "6.7.0-0",
"@testing-library/jest-dom": "5.16.1",
"@types/babel__core": "7.1.18",
"@types/babel__template": "7.4.1",
"@types/enzyme": "3.10.11",
"@types/jest": "27.4.0",
"@types/node": "17.0.12",
"@types/react": "16.14.26",
"@types/react-dom": "17.0.11",
"@types/react-redux": "7.1.22",
"@types/react-router-dom": "5.1.5",
"@types/react-transition-group": "4.4.0",
"@typescript-eslint/eslint-plugin": "3.6.0",
"@typescript-eslint/parser": "3.6.0",
"@typescript-eslint/eslint-plugin": "5.10.1",
"@typescript-eslint/parser": "5.10.1",
"@typescript-eslint/typescript-estree": "5.52.0",
"babel-eslint": "10.1.0",
"babel-jest": "26.1.0",
"babel-loader": "8.1.0",
"babel-plugin-typescript-to-proptypes": "1.3.2",
"css-loader": "3.6.0",
"babel-loader": "8.2.2",
"babel-plugin-formatjs": "10.3.7",
"babel-plugin-typescript-to-proptypes": "2.0.0",
"css-loader": "6.5.1",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.2",
"enzyme-to-json": "3.5.0",
"eslint": "7.4.0",
"eslint-import-resolver-webpack": "0.12.2",
"eslint-plugin-import": "2.22.0",
"eslint-plugin-react": "7.20.3",
"eslint-plugin-react-hooks": "4.0.6",
"file-loader": "6.0.0",
"enzyme-adapter-react-16": "1.15.6",
"enzyme-to-json": "3.6.2",
"eslint": "8.8.0",
"eslint-import-resolver-alias": "1.1.2",
"eslint-import-resolver-typescript": "2.7.1",
"eslint-import-resolver-webpack": "0.13.2",
"eslint-plugin-babel": "5.3.1",
"eslint-plugin-cypress": "2.12.1",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-jest": "26.5.3",
"eslint-plugin-mattermost": "github:mattermost/eslint-plugin-mattermost",
"eslint-plugin-no-only-tests": "2.6.0",
"eslint-plugin-react": "7.28.0",
"eslint-plugin-react-hooks": "4.3.0",
"file-loader": "6.2.0",
"identity-obj-proxy": "3.0.0",
"jest": "26.1.0",
"jest-canvas-mock": "2.2.0",
"jest-junit": "11.0.1",
"mattermost-webapp": "github:mattermost/mattermost-webapp#23f5f93d9f12a7e2b5623e5cee6814366abd9a0f",
"node-sass": "4.14.1",
"sass-loader": "9.0.2",
"style-loader": "1.2.1",
"webpack": "4.43.0",
"webpack-cli": "3.3.12"
"isomorphic-fetch": "3.0.0",
"jest": "27.4.7",
"jest-canvas-mock": "2.3.1",
"jest-junit": "13.0.0",
"sass": "1.52.3",
"sass-loader": "13.0.0",
"style-loader": "3.3.1",
"webpack": "5.75.0",
"webpack-cli": "5.0.1"
},
"dependencies": {
"core-js": "3.6.5",
"mattermost-redux": "5.27.0",
"react": "16.13.1",
"react-redux": "7.2.0",
"redux": "4.0.5",
"typescript": "3.9.6"
"@mattermost/webapp": "github:mattermost/mattermost-webapp",
"core-js": "3.22.8",
"react": "^16.14.0",
"react-redux": "8.0.2",
"redux": "4.2.0",
"typescript": "4.6.4"
},
"jest": {
"snapshotSerializers": [

View file

@ -1,11 +1,10 @@
import {Store, Action} from 'redux';
import {GlobalState} from 'mattermost-redux/types/store';
import {GlobalState} from '@mattermost/types/lib/store';
import manifest from './manifest';
import {manifest} from '@/manifest';
// eslint-disable-next-line import/no-unresolved
import {PluginRegistry} from './types/mattermost-webapp';
import {PluginRegistry} from '@/types/mattermost-webapp';
export default class Plugin {
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
@ -16,7 +15,7 @@ export default class Plugin {
declare global {
interface Window {
registerPlugin(id: string, plugin: Plugin): void
registerPlugin(pluginId: string, plugin: Plugin): void
}
}

View file

@ -1,4 +1,4 @@
import manifest, {id, version} from './manifest';
import {manifest} from './manifest';
test('Plugin manifest, id and version are defined', () => {
expect(manifest).toBeDefined();
@ -8,6 +8,6 @@ test('Plugin manifest, id and version are defined', () => {
// To ease migration, verify separate export of id and version.
test('Plugin id and version are defined', () => {
expect(id).toBeDefined();
expect(version).toBeDefined();
expect(manifest.id).toBeDefined();
expect(manifest.version).toBeDefined();
});

View file

@ -1,5 +1,3 @@
import manifest from '../../plugin.json';
import manifest from '@/../../plugin.json';
export default manifest;
export const id = manifest.id;
export const version = manifest.version;
export {manifest};

View file

@ -1,4 +1,6 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import 'mattermost-webapp/tests/setup';
// import '@mattermost/webapp/tests/setup';
export {};

View file

@ -1,6 +1,11 @@
{
"compilerOptions": {
"target": "esnext",
"baseUrl": "./",
"paths": {
"@/*": ["src/*"],
"mattermost-redux/*": ["../node_modules/@mattermost/webapp/packages/mattermost-redux/src/*"],
},
"lib": [
"dom",
"dom.iterable",
@ -19,12 +24,11 @@
"isolatedModules": true,
"noEmit": true,
"experimentalDecorators": true,
"jsx": "react",
"baseUrl": "./src",
"typeRoots": [ "./src/types", "./node_modules/@types"],
"jsx": "react"
},
"include": [
"src"
"src",
"tests"
],
"exclude": [
"dist",

View file

@ -5,12 +5,7 @@ const path = require('path');
const PLUGIN_ID = require('../plugin.json').id;
const NPM_TARGET = process.env.npm_lifecycle_event; //eslint-disable-line no-process-env
let mode = 'production';
let devtool = '';
if (NPM_TARGET === 'debug' || NPM_TARGET === 'debug:watch') {
mode = 'development';
devtool = 'source-map';
}
const isDev = NPM_TARGET === 'debug' || NPM_TARGET === 'debug:watch';
const plugins = [];
if (NPM_TARGET === 'build:watch' || NPM_TARGET === 'debug:watch') {
@ -34,11 +29,15 @@ if (NPM_TARGET === 'build:watch' || NPM_TARGET === 'debug:watch') {
});
}
module.exports = {
const config = {
entry: [
'./src/index.tsx',
],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
'mattermost-redux': path.resolve(__dirname, 'node_modules/@mattermost/webapp/packages/mattermost-redux/src'),
},
modules: [
'src',
'node_modules',
@ -94,7 +93,12 @@ module.exports = {
publicPath: '/',
filename: 'main.js',
},
devtool,
mode,
mode: (isDev) ? 'eval-source-map' : 'production',
plugins,
};
if (isDev) {
Object.assign(config, {devtool: 'eval-source-map'});
}
module.exports = config;