Prevent boards product from being included automatically (#23539)
* Prevent boards product from being included automatically * Fix config diff test * Update prepackaged plugin version Co-authored-by: Scott Bishel <scott.bishel@mattermost.com> * Readd boards/dist to the gitignore * Does not enable the focalboard plugin by default * Update plugin version to v7.10.3 --------- Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d8cb5f3a6e
Коммит
1215584665
@@ -58,11 +58,9 @@ build: node_modules ## Builds all web app packages
|
||||
npm run build
|
||||
|
||||
.PHONY: dist
|
||||
dist: build ## Builds all web app packages and copies Boards/Playbooks files into Channels dist folder
|
||||
dist: build ## Builds all web app packages and copies Playbooks files into Channels dist folder
|
||||
@echo Packaging Mattermost Web App
|
||||
|
||||
mkdir -p channels/dist/products/boards
|
||||
cp -R boards/dist/* channels/dist/products/boards
|
||||
mkdir -p channels/dist/products/playbooks
|
||||
cp -R playbooks/dist/* channels/dist/products/playbooks
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Mattermost Web App
|
||||
|
||||
This folder contains the client code for the Mattermost web app. It's broken up into multiple packages each of which either contains an area of the app (such as `playbooks` or `boards`) or shared logic used across other packages (such as the packages located in the `platform` directory). For anyone who's used to working in [the mattermost/mattermost-webapp repo](https://github.com/mattermost/mattermost-webapp), most of that is now located in `channels`.
|
||||
This folder contains the client code for the Mattermost web app. It's broken up into multiple packages each of which either contains an area of the app (such as `playbooks`) or shared logic used across other packages (such as the packages located in the `platform` directory). For anyone who's used to working in [the mattermost/mattermost-webapp repo](https://github.com/mattermost/mattermost-webapp), most of that is now located in `channels`.
|
||||
|
||||
## npm Workspaces
|
||||
|
||||
@@ -8,7 +8,7 @@ To interact with a workspace using npm, such as to add a dependency or run a scr
|
||||
|
||||
```sh
|
||||
# Add a dependency to a single package
|
||||
npm add react --workspace=boards
|
||||
npm add react --workspace=playbooks
|
||||
|
||||
# Build multiple packages
|
||||
npm run build --workspace=platform/client --workspace=platform/components
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Client4} from 'mattermost-redux/client';
|
||||
|
||||
import testConfigureStore from 'tests/test_store';
|
||||
|
||||
import {initializeProducts} from './products';
|
||||
|
||||
(window as any).REMOTE_CONTAINERS = {};
|
||||
|
||||
describe('initializeProducts', () => {
|
||||
test('should set Client4 to use the correct Boards URL for product mode', async () => {
|
||||
const store = testConfigureStore({
|
||||
entities: {
|
||||
general: {
|
||||
config: {
|
||||
FeatureFlagBoardsProduct: 'true',
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await store.dispatch(initializeProducts());
|
||||
|
||||
expect(Client4.getBoardsRoute().startsWith('/plugins/boards')).toBe(true);
|
||||
});
|
||||
|
||||
test('should set Client4 to use the correct Boards URL for plugin mode', async () => {
|
||||
const store = testConfigureStore({
|
||||
entities: {
|
||||
general: {
|
||||
config: {
|
||||
FeatureFlagBoardsProduct: 'false',
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await store.dispatch(initializeProducts());
|
||||
|
||||
expect(Client4.getBoardsRoute().startsWith('/plugins/focalboard')).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
import {Store} from 'redux';
|
||||
|
||||
import {Client4} from 'mattermost-redux/client';
|
||||
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
||||
import {DispatchFunc, GetStateFunc} from 'mattermost-redux/types/actions';
|
||||
|
||||
@@ -26,11 +25,8 @@ export function initializeProducts() {
|
||||
}
|
||||
|
||||
function configureClient() {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
return (dispatch: DispatchFunc, getState: GetStateFunc) => {
|
||||
const config = getConfig(getState());
|
||||
|
||||
Client4.setUseBoardsProduct(config.FeatureFlagBoardsProduct === 'true');
|
||||
|
||||
return Promise.resolve({data: true});
|
||||
};
|
||||
}
|
||||
@@ -48,20 +44,10 @@ function loadRemoteModules() {
|
||||
* can't be constructed based on the name of a product at runtime.
|
||||
*/
|
||||
let products = [
|
||||
{
|
||||
id: 'boards',
|
||||
load: () => ({
|
||||
index: import('boards'),
|
||||
|
||||
// manifest: import('boards/manifest'),
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: 'playbooks',
|
||||
load: () => ({
|
||||
index: import('playbooks'),
|
||||
|
||||
// manifest: import('boards/manifest'),
|
||||
}),
|
||||
},
|
||||
];
|
||||
|
||||
@@ -279,15 +279,10 @@ if (DEV) {
|
||||
config.plugins.push({
|
||||
apply: (compiler) => {
|
||||
compiler.hooks.afterEmit.tap('AfterEmitPlugin', () => {
|
||||
const boardsDist = path.resolve(__dirname, '../boards/dist');
|
||||
const boardsSymlink = './dist/products/boards';
|
||||
const playbooksDist = path.resolve(__dirname, '../playbooks/dist');
|
||||
const playbooksSymlink = './dist/products/playbooks';
|
||||
|
||||
fs.mkdir('./dist/products', () => {
|
||||
if (!fs.existsSync(boardsSymlink)) {
|
||||
fs.symlinkSync(boardsDist, boardsSymlink, 'dir');
|
||||
}
|
||||
if (!fs.existsSync(playbooksSymlink)) {
|
||||
fs.symlinkSync(playbooksDist, playbooksSymlink, 'dir');
|
||||
}
|
||||
@@ -334,7 +329,6 @@ async function initializeModuleFederation() {
|
||||
|
||||
async function getRemoteContainers() {
|
||||
const products = [
|
||||
{name: 'boards'},
|
||||
{name: 'playbooks'},
|
||||
];
|
||||
|
||||
|
||||
9342
webapp/package-lock.json
сгенерированный
9342
webapp/package-lock.json
сгенерированный
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@@ -52,7 +52,6 @@
|
||||
"platform/client",
|
||||
"platform/components",
|
||||
"platform/types",
|
||||
"playbooks",
|
||||
"boards"
|
||||
"playbooks"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -182,8 +182,6 @@ export default class Client4 {
|
||||
userRoles = '';
|
||||
telemetryHandler?: TelemetryHandler;
|
||||
|
||||
useBoardsProduct = false;
|
||||
|
||||
getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
@@ -247,10 +245,6 @@ export default class Client4 {
|
||||
this.telemetryHandler = telemetryHandler;
|
||||
}
|
||||
|
||||
setUseBoardsProduct(useBoardsProduct: boolean) {
|
||||
this.useBoardsProduct = useBoardsProduct;
|
||||
}
|
||||
|
||||
getServerVersion() {
|
||||
return this.serverVersion;
|
||||
}
|
||||
@@ -479,10 +473,6 @@ export default class Client4 {
|
||||
return `${this.getBaseRoute()}/drafts`;
|
||||
}
|
||||
|
||||
getBoardsRoute() {
|
||||
return `${this.url}/plugins/${this.useBoardsProduct ? 'boards' : 'focalboard'}/api/v2`;
|
||||
}
|
||||
|
||||
getCSRFFromCookie() {
|
||||
if (typeof document !== 'undefined' && typeof document.cookie !== 'undefined') {
|
||||
const cookies = document.cookie.split(';');
|
||||
|
||||
@@ -41,20 +41,6 @@ async function buildAll() {
|
||||
|
||||
console.log('\n' + chalk.inverse.bold('Web app built! '));
|
||||
|
||||
console.log(chalk.inverse.bold('Building Boards...') + '\n');
|
||||
|
||||
try {
|
||||
const {result} = concurrently([
|
||||
{command: 'npm:build --workspace=boards', name: 'boards', prefixColor: 'blue'},
|
||||
]);
|
||||
await result;
|
||||
} catch (e) {
|
||||
console.error(chalk.inverse.bold.red('Failed to build Boards'), e);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('\n' + chalk.inverse.bold('Boards built! '));
|
||||
|
||||
console.log(chalk.inverse.bold('Building Playbooks...') + '\n');
|
||||
|
||||
try {
|
||||
|
||||
@@ -13,7 +13,6 @@ async function watchAllWithDevServer() {
|
||||
|
||||
const commands = [
|
||||
{command: 'npm:dev-server --workspace=channels', name: 'webapp', prefixColor: 'cyan'},
|
||||
{command: 'npm:start:product --workspace=boards', name: 'boards', prefixColor: 'blue'},
|
||||
{command: 'npm:start:product --workspace=playbooks', name: 'playbooks', prefixColor: 'red'},
|
||||
];
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ async function watchAll(useRunner) {
|
||||
|
||||
const commands = [
|
||||
{command: 'npm:run --workspace=channels', name: 'webapp', prefixColor: 'cyan'},
|
||||
{command: 'npm:start:product --workspace=boards', name: 'boards', prefixColor: 'blue'},
|
||||
{command: 'npm:start:product --workspace=playbooks', name: 'playbooks', prefixColor: 'red'},
|
||||
];
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user