<commit_before>#! /bin/bash

set -e

function build() {
	# install dependencies
	npm install --registry=https://registry.npm.taobao.org

	# webpack build
	NODE_ENV=production webpack --config webpack-build.config.js

	# copy files
	cp package.json dist
	cp -rv src/components/styles dist/scss

	# create dist/index.js
	cat > dist/index.js <<- EOT
	require('./ccms-components.css');
	require('./ccms-components.js');
	module.exports = 'ccms.components';
	EOT
}

function publish() {
	# publish to npmjs.org
	npm publish dist

	# cnpm sync ccms-components
	curl -X PUT https://npm.taobao.org/sync/ccms-components
}

function release() {
	version=""
	while [[ "$1" != "" ]]; do
		case $1 in
			--major | --minor | --patch )
				version="${1:2}"
				;;
			* )
				echo "Unknow parameter \"$1\""
				exit 1
				;;
		esac
		shift
	done

	if [[ "$version" == "" ]]; then
		echo "Missing version parameter: --major | --minor | --patch"
		exit 1
	fi

	# release new version
	git checkout dev
	git pull --prune
	git checkout master
	git reset origin/master --hard
	git merge dev --no-ff -m "chore(release): Merge branch 'dev' into master"
	new_version=$(npm version $version -m "chore(release): v%s")
	git checkout dev
	git rebase master
	git push origin master dev $new_version

	# release docs
	if [[ ! -d docs/_gh_pages ]]; then
		jekyll build --source docs
	fi
	git add -f docs/_gh_pages
	git commit -m "chore(docs): generate documents"
	git subtree split --prefix=docs/_gh_pages -b gh-pages
	git push -f origin gh-pages:gh-pages
	git branch -D gh-pages

	build && publish
}

<commit_msg>fix(release): 补充 release docs 流程 (#96)<commit_after>#! /bin/bash

set -e

function build() {
	# install dependencies
	npm install --registry=https://registry.npm.taobao.org

	# webpack build
	NODE_ENV=production webpack --config webpack-build.config.js

	# copy files
	cp package.json dist
	cp -rv src/components/styles dist/scss

	# create dist/index.js
	cat > dist/index.js <<- EOT
	require('./ccms-components.css');
	require('./ccms-components.js');
	module.exports = 'ccms.components';
	EOT
}

function publish() {
	# publish to npmjs.org
	npm publish dist

	# cnpm sync ccms-components
	curl -X PUT https://npm.taobao.org/sync/ccms-components
}

function release() {
	version=""
	while [[ "$1" != "" ]]; do
		case $1 in
			--major | --minor | --patch )
				version="${1:2}"
				;;
			* )
				echo "Unknow parameter \"$1\""
				exit 1
				;;
		esac
		shift
	done

	if [[ "$version" == "" ]]; then
		echo "Missing version parameter: --major | --minor | --patch"
		exit 1
	fi

	# release new version
	git checkout dev
	git pull --prune
	git checkout master
	git reset origin/master --hard
	git merge dev --no-ff -m "chore(release): Merge branch 'dev' into master"
	new_version=$(npm version $version -m "chore(release): v%s")
	git checkout dev
	git rebase master
	git push origin master dev $new_version

	# release docs
	if [[ ! -d docs/_gh_pages ]]; then
		jekyll build --source docs
	fi
	git add -f docs/_gh_pages
	git commit -m "chore(docs): generate documents"
	git subtree split --prefix=docs/_gh_pages -b gh-pages
	git push -f origin gh-pages:gh-pages
	git branch -D gh-pages
	git reset $new_version --hard

	build && publish
}


{'fraction_non_alphanumeric': 0.13944099378881988, 'fraction_numerical': 0.004968944099378882, 'mean_word_length': 3.1136653895274584, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 4, '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': '5242828', 'n_tokens_mistral': 1230, 'n_tokens_neox': 1114, 'n_words': 347}