<commit_before>/* eslint-disable no-console */

import fs from 'fs';
import path from 'path';
import mversion from 'mversion';
import semver from 'semver';
import currentVersion from '../../src/lib/version';

if (!process.env.VERSION) {
  throw new Error(
    'release: Usage is VERSION=MAJOR.MINOR.PATCH npm run release'
  );
}
const newVersion = process.env.VERSION;

if (!semver.valid(newVersion)) {
  throw new Error(
    `release: Provided new version (${newVersion}) is not a valid version per semver`
  );
}

if (semver.gte(currentVersion, newVersion)) {
  throw new Error(`release:
    Provided new version is not higher than current version (${newVersion} <= ${currentVersion})`);
}

console.log(`Releasing ${newVersion}`);

console.log('..Updating src/lib/version.ts');

const versionFile = path.join(__dirname, '../../src/lib/version.ts');
const newContent = `export default '${newVersion}';\n`;<commit_msg>chore(release): bump package version from package.json<commit_after>/* eslint-disable no-console */

import fs from 'fs';
import path from 'path';
import mversion from 'mversion';
import semver from 'semver';
import { version as currentVersion } from '../../package.json';

if (!process.env.VERSION) {
  throw new Error(
    'release: Usage is VERSION=MAJOR.MINOR.PATCH npm run release'
  );
}
const newVersion = process.env.VERSION;

if (!semver.valid(newVersion)) {
  throw new Error(
    `release: Provided new version (${newVersion}) is not a valid version per semver`
  );
}

if (semver.gte(currentVersion, newVersion)) {
  throw new Error(`release:
    Provided new version is not higher than current version (${newVersion} <= ${currentVersion})`);
}

console.log(`Releasing ${newVersion}`);

console.log('..Updating src/lib/version.ts');

const versionFile = path.join(__dirname, '../../src/lib/version.ts');
const newContent = `export default '${newVersion}';\n`;
{'fraction_non_alphanumeric': 0.1540497617787189, 'fraction_numerical': 0.0, 'mean_word_length': 4.591715976331361, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '2258465', 'n_tokens_mistral': 586, 'n_tokens_neox': 590, 'n_words': 176}