2023-03-22 17:22:27 -04:00
|
|
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
|
|
|
// See LICENSE.txt for license information.
|
|
|
|
|
|
|
|
|
|
/* eslint-disable no-console */
|
|
|
|
|
|
2024-11-06 13:40:19 -05:00
|
|
|
import chalk from 'chalk';
|
|
|
|
|
import concurrently from 'concurrently';
|
2023-03-22 17:22:27 -04:00
|
|
|
|
2024-11-06 13:40:19 -05:00
|
|
|
import {getExitCode, getPlatformCommands} from './utils.mjs';
|
2023-03-22 17:22:27 -04:00
|
|
|
|
|
|
|
|
async function buildAll() {
|
|
|
|
|
console.log(chalk.inverse.bold('Building subpackages...') + '\n');
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const {result} = concurrently(
|
|
|
|
|
getPlatformCommands('build'),
|
|
|
|
|
{
|
|
|
|
|
killOthers: 'failure',
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await result;
|
2023-10-10 11:17:24 -04:00
|
|
|
} catch (closeEvents) {
|
|
|
|
|
console.error(chalk.inverse.bold.red('Failed to build subpackages'), closeEvents);
|
|
|
|
|
return getExitCode(closeEvents);
|
2023-03-22 17:22:27 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log('\n' + chalk.inverse.bold('Subpackages built! Building web app...') + '\n');
|
|
|
|
|
|
|
|
|
|
// It's not necessary to run these commands through concurrently, but it makes the output consistent
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const {result} = concurrently([
|
|
|
|
|
{command: 'npm:build --workspace=channels', name: 'webapp', prefixColor: 'cyan'},
|
|
|
|
|
]);
|
|
|
|
|
await result;
|
2023-10-10 11:17:24 -04:00
|
|
|
} catch (closeEvents) {
|
|
|
|
|
console.error(chalk.inverse.bold.red('Failed to build web app'), closeEvents);
|
|
|
|
|
return getExitCode(closeEvents);
|
2023-03-22 17:22:27 -04:00
|
|
|
}
|
|
|
|
|
|
2023-10-10 11:17:24 -04:00
|
|
|
console.log('\n' + chalk.inverse.bold('Web app built!'));
|
|
|
|
|
return 0;
|
2023-03-22 17:22:27 -04:00
|
|
|
}
|
|
|
|
|
|
2023-10-10 11:17:24 -04:00
|
|
|
buildAll().then((exitCode) => {
|
|
|
|
|
process.exitCode = exitCode;
|
|
|
|
|
});
|