46fdbf9048
* Initial Boards+Channels implementation * Adding draft code to list the boards in a channel * Adding the hability to link/unlink channels (fake channel for now) * Simplify slight the migrations * WIP * More changes to improve the implementation * Adding partial implementation of linking channel from board * Allow linking in both directions * Removing unused file * More work on channel binding * some refactoring * Improving code quality and interface * More improvements * Changing the API to search channels * Adding a limit of 10 channels in search * Add confirmation on linking public channels * Improve a bit the styling of the confirmation modal * Showing the current linked channel * Adding link board confirmation to channel interface * Fixing tests and linter errors * Fixing backend tests * Adding permissions tests * Fixing linter errors * Fixing small things * Fixing some typescript errors * Adding new boardSelectorItem tests * Improving a bit tests * Adding jest unit tests * Remove duplicated implementation (from merge, I guess) * Adding missed files * Addressing some of the PR review comments * Removing unneeded new wrapIntl implementation * Moving NotSupportedError to the store package to be share between all the store implementations or layers * Fixing one of the pendings ToDo * Creating a constructor for the NotSupportedError * Fixing linter error
149 lines
4.5 KiB
JavaScript
149 lines
4.5 KiB
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
const exec = require('child_process').exec;
|
|
|
|
const path = require('path');
|
|
|
|
const webpack = require('webpack');
|
|
|
|
const tsTransformer = require('@formatjs/ts-transformer');
|
|
|
|
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;
|
|
const plugins = [];
|
|
if (NPM_TARGET === 'debug' || NPM_TARGET === 'debug:watch') {
|
|
mode = 'development';
|
|
devtool = 'source-map';
|
|
plugins.push(
|
|
new webpack.DefinePlugin({
|
|
'process.env.NODE_ENV': JSON.stringify('development'),
|
|
}),
|
|
);
|
|
}
|
|
|
|
if (NPM_TARGET === 'build:watch' || NPM_TARGET === 'debug:watch' || NPM_TARGET === 'live-watch') {
|
|
plugins.push({
|
|
apply: (compiler) => {
|
|
compiler.hooks.watchRun.tap('WatchStartPlugin', () => {
|
|
// eslint-disable-next-line no-console
|
|
console.log('Change detected. Rebuilding webapp.');
|
|
});
|
|
compiler.hooks.afterEmit.tap('AfterEmitPlugin', () => {
|
|
let command = 'cd .. && make deploy-from-watch';
|
|
if (NPM_TARGET === 'live-watch') {
|
|
command = 'cd .. && make deploy-to-mattermost-directory';
|
|
}
|
|
exec(command, (err, stdout, stderr) => {
|
|
if (stdout) {
|
|
process.stdout.write(stdout);
|
|
}
|
|
if (stderr) {
|
|
process.stderr.write(stderr);
|
|
}
|
|
});
|
|
});
|
|
},
|
|
});
|
|
}
|
|
|
|
module.exports = {
|
|
entry: [
|
|
'./src/index.tsx',
|
|
],
|
|
resolve: {
|
|
modules: [
|
|
'src',
|
|
'node_modules',
|
|
path.resolve(__dirname),
|
|
],
|
|
alias: {
|
|
moment: path.resolve(__dirname, '../../webapp/node_modules/moment/'),
|
|
'react-intl': path.resolve(__dirname, '../../webapp/node_modules/react-intl/'),
|
|
},
|
|
extensions: ['*', '.js', '.jsx', '.ts', '.tsx'],
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
use: {
|
|
loader: 'ts-loader',
|
|
options: {
|
|
getCustomTransformers: {
|
|
before: [
|
|
tsTransformer.transform({
|
|
overrideIdFn: '[sha512:contenthash:base64:6]',
|
|
ast: true,
|
|
}),
|
|
],
|
|
},
|
|
},
|
|
},
|
|
exclude: [/node_modules/],
|
|
|
|
},
|
|
{
|
|
test: /\.html$/,
|
|
type: 'asset/resource',
|
|
},
|
|
{
|
|
test: /\.s[ac]ss$/i,
|
|
use: [
|
|
'style-loader',
|
|
'css-loader',
|
|
'sass-loader',
|
|
path.resolve(__dirname, 'loaders/globalScssClassLoader'),
|
|
],
|
|
},
|
|
{
|
|
test: /\.css$/i,
|
|
use: [
|
|
'style-loader',
|
|
'css-loader',
|
|
],
|
|
},
|
|
{
|
|
test: /\.(tsx?|js|jsx|mjs|html)$/,
|
|
use: [
|
|
],
|
|
exclude: [/node_modules/],
|
|
},
|
|
{
|
|
test: /\.(png|eot|tiff|svg|woff2|woff|ttf|jpg|gif)$/,
|
|
type: 'asset/resource',
|
|
generator: {
|
|
filename: 'static/[name].[ext]',
|
|
}
|
|
},
|
|
],
|
|
},
|
|
externals: {
|
|
react: 'React',
|
|
redux: 'Redux',
|
|
'react-redux': 'ReactRedux',
|
|
'mm-react-router-dom': 'ReactRouterDom',
|
|
'prop-types': 'PropTypes',
|
|
'react-bootstrap': 'ReactBootstrap',
|
|
|
|
},
|
|
output: {
|
|
devtoolNamespace: PLUGIN_ID,
|
|
path: path.join(__dirname, '/dist'),
|
|
publicPath: '/',
|
|
filename: 'main.js',
|
|
},
|
|
devtool,
|
|
mode,
|
|
plugins,
|
|
};
|
|
|
|
const env = {};
|
|
env.RUDDER_KEY = JSON.stringify(process.env.RUDDER_KEY || ''); //eslint-disable-line no-process-env
|
|
env.RUDDER_DATAPLANE_URL = JSON.stringify(process.env.RUDDER_DATAPLANE_URL || ''); //eslint-disable-line no-process-env
|
|
|
|
module.exports.plugins.push(new webpack.DefinePlugin({
|
|
'process.env': env,
|
|
}));
|