<commit_before>const shell = require('shelljs');
const path = require('path');
const fs = require('fs');
const commandLineArgs = require('command-line-args');
const options = commandLineArgs([
	{
		name: 'base-branch',
		alias: 'b',
		type: String,
		defaultValue: 'master'
	},
	{
		name: 'release-branch',
		alias: 'r',
		type: String,
		defaultValue: '1.0.x'
	},
	{
		name: 'version',
		alias: 'v',
		type: String,
		defaultValue: ''
	}
]);
const getNextVersion = require('./version');

const cwd = path.resolve('.');
const pkgPath = path.join(cwd, 'package.json');
const bowerPath = path.join(cwd, 'bower.json');
const pkg = require(pkgPath);
const bower = require(bowerPath);

main(options['base-branch'], options['release-branch'], getNextVersion(pkg.version, options['version']));

function main(baseBranch, releaseBranch, version) {
	shell.exec(`git stash`);
	shell.exec(`git checkout ${releaseBranch}`);
	shell.exec(`git pull origin ${baseBranch}`);

	const tag = `v${version}`;
	updateVersion(version);

	shell.exec(`npm run build:prod`);
	shell.exec(`npm run build:prod:min`);

	shell.exec(`git add ${path.join(cwd, 'dist')}`);
	shell.exec(`git add ${pkgPath}`);
	shell.exec(`git add ${bowerPath}`);
	shell.exec(`git commit -m "Release ${tag}"`);
	shell.exec(`git tag ${tag}`);

	shell.exec(`git push`);
	shell.exec(`git push origin ${tag}`);

	shell.exec(`npm publish`);

	shell.exec('git checkout master');
}

function updateVersion(version) {
	pkg.version = version;
	bower.version = version;

	fs.writeFileSync(bowerPath, JSON.stringify(bower, null, '\t'));
	fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, '\t'));
}<commit_msg>take release branch version as base.<commit_after>const shell = require('shelljs');
const path = require('path');
const fs = require('fs');
const commandLineArgs = require('command-line-args');
const options = commandLineArgs([
	{
		name: 'base-branch',
		alias: 'b',
		type: String,
		defaultValue: 'master'
	},
	{
		name: 'release-branch',
		alias: 'r',
		type: String,
		defaultValue: '1.0.x'
	},
	{
		name: 'version',
		alias: 'v',
		type: String,
		defaultValue: ''
	}
]);
const getNextVersion = require('./version');

const cwd = path.resolve('.');
const pkgPath = path.join(cwd, 'package.json');
const bowerPath = path.join(cwd, 'bower.json');

main(options['base-branch'], options['release-branch']);

function main(baseBranch, releaseBranch) {
	shell.exec(`git stash`);
	shell.exec(`git checkout ${releaseBranch}`);
	shell.exec(`git pull origin ${baseBranch}`);

	const pkg = require(pkgPath);
	const bower = require(bowerPath);
	const version = getNextVersion(pkg.version, options['version']);

	pkg.version = version;
	bower.version = version;
	fs.writeFileSync(bowerPath, JSON.stringify(bower, null, '2'));
	fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));

	const tag = `v${version}`;

	shell.exec(`npm run build:prod`);
	shell.exec(`npm run build:prod:min`);

	shell.exec(`git add ${path.join(cwd, 'dist')}`);
	shell.exec(`git add ${pkgPath}`);
	shell.exec(`git add ${bowerPath}`);
	shell.exec(`git commit -m "Release ${tag}"`);
	shell.exec(`git tag ${tag}`);

	shell.exec(`git push`);
	shell.exec(`git push origin ${tag}`);

	shell.exec(`npm publish`);

	shell.exec('git checkout master');
}
{'fraction_non_alphanumeric': 0.1950920245398773, 'fraction_numerical': 0.0018404907975460123, 'mean_word_length': 5.344357976653696, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5801191', 'n_tokens_mistral': 1161, 'n_tokens_neox': 1143, 'n_words': 259}