<commit_before>const fs = require('fs');
const path = require('path');
const { loadProject } = require('xod-fs');

const projectDir =
  process.env.XOD_BROWSER_INITIAL_PROJECT_DIR ||
  path.resolve(__dirname, '../../../workspace/welcome-to-xod');
const workspaceDir =
  process.env.XOD_BROWSER_INITIAL_WORKSPACE_DIR ||
  path.resolve(projectDir, '..');
const targetPath = path.resolve(__dirname, '../tutorialProject.json');

loadProject([workspaceDir], projectDir).then(project => {
  const json = JSON.stringify(project, null, 2);
  fs.writeFileSync(targetPath, json);
  process.exit(0);
});<commit_msg>chore(xod-client-browser): catch promise rejection in load tutorial project tool<commit_after>const fs = require('fs');
const path = require('path');
const { loadProject } = require('xod-fs');

const projectDir =
  process.env.XOD_BROWSER_INITIAL_PROJECT_DIR ||
  path.resolve(__dirname, '../../../workspace/welcome-to-xod');
const workspaceDir =
  process.env.XOD_BROWSER_INITIAL_WORKSPACE_DIR ||
  path.resolve(projectDir, '..');
const targetPath = path.resolve(__dirname, '../tutorialProject.json');

loadProject([workspaceDir], projectDir)
  .then(project => {
    const json = JSON.stringify(project, null, 2);
    fs.writeFileSync(targetPath, json);
    process.exit(0);
  })
  .catch(err => {
    process.stderr.write(err.message);
    process.exit(1);
  });
{'fraction_non_alphanumeric': 0.16654492330168005, 'fraction_numerical': 0.003652300949598247, 'mean_word_length': 4.9825327510917035, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5523843', 'n_tokens_mistral': 454, 'n_tokens_neox': 448, 'n_words': 76}