hunk.code_window:     const index = getWorkspaces().indexOf(workspace);
       return index === -1 ? chalk.white : workspaceColors[index % workspaceColors.length];
   }
   module.exports = {
  
hunk.labels: keep keep keep keep add keep
hunk.after_edit: /**
    * @param {import("concurrently").CloseEvent[]} closeEvents - An array of CloseEvents thrown by concurrently when waiting on a result
    * @param {number} codeOnSignal - Which error code to return when the process is interrupted
    */
   function getExitCode(closeEvents, codeOnSignal = 1) {
       const exitCode = closeEvents.find((event) => !event.killed && event.exitCode > 0)?.exitCode;
       if (typeof exitCode === 'string') {
           return codeOnSignal
       } else {
           return exitCode;
       }
   }
  
hunk.file_path: webapp/scripts/utils.js
hunk.type: add
file: // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
  // See LICENSE.txt for license information.
  
  /* eslint-disable no-console */
  
  const chalk = require('chalk');
  const concurrently = require('concurrently');
  
  const {getPlatformCommands} = require('./utils.js');
  
  async function buildAll() {
      console.log(chalk.inverse.bold('Building subpackages...') + '\n');
  
      try {
          const {result} = concurrently(
              getPlatformCommands('build'),
              {
                  killOthers: 'failure',
              },
          );
  
          await result;
      } catch (e) {
          console.error(chalk.inverse.bold.red('Failed to build subpackages'), e);
          return;
      }
  
      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;
      } catch (e) {
          console.error(chalk.inverse.bold.red('Failed to build web app'), e);
          return;
      }
  
      console.log('\n' + chalk.inverse.bold('Web app built! '));
  }
  
  buildAll();
  