<commit_before>#!/bin/bash

# This is the main build script.
# Make sure to only run this from the project root!

set -e # stop on error

mkdir -p docs/build

node compile-unicode-data.js

# this depends on compile-unicode-data
./node_modules/.bin/tsc

# also depends only on compile-unicode-data
cargo fmt --manifest-path docs/unicode-rustwasm/Cargo.toml
DATA_DIR="$(pwd)/data" wasm-pack build --target no-modules docs/unicode-rustwasm
rm docs/unicode-rustwasm/pkg/.gitignore

# depends on cargo/wasm build
{
	cat docs/unicode-rustwasm/pkg/unicode_rustwasm.js
	cat node_modules/jquery/dist/jquery.min.js
	cat node_modules/bootstrap/dist/js/bootstrap.min.js
	cat node_modules/chosen-js/chosen.jquery.min.js
	cat node_modules/he/he.js
	echo "window.module = {};"
	cat node_modules/punycode/punycode.js
} > docs/build/libs.js

# independent
cp node_modules/bootstrap/dist/css/bootstrap.min.css docs/build/
cp node_modules/bootstrap/dist/css/bootstrap.min.css.map docs/build/
cp node_modules/chosen-js/chosen.min.css docs/build/
<commit_msg>Make build script more robust<commit_after>#!/bin/bash

# This is the main build script.
# Make sure to only run this from the project root!

set -euo pipefail

mkdir -p docs/build

node compile-unicode-data.js

# this depends on compile-unicode-data
./node_modules/.bin/tsc

# also depends only on compile-unicode-data
cargo fmt --manifest-path docs/unicode-rustwasm/Cargo.toml
DATA_DIR="$(pwd)/data" wasm-pack build --target no-modules docs/unicode-rustwasm
rm docs/unicode-rustwasm/pkg/.gitignore

# depends on cargo/wasm build
{
	cat docs/unicode-rustwasm/pkg/unicode_rustwasm.js
	cat node_modules/jquery/dist/jquery.min.js
	cat node_modules/bootstrap/dist/js/bootstrap.min.js
	cat node_modules/chosen-js/chosen.jquery.min.js
	cat node_modules/he/he.js
	echo "window.module = {};"
	cat node_modules/punycode/punycode.js
} > docs/build/libs.js

# independent
cp node_modules/bootstrap/dist/css/bootstrap.min.css docs/build/
cp node_modules/bootstrap/dist/css/bootstrap.min.css.map docs/build/
cp node_modules/chosen-js/chosen.min.css docs/build/

{'fraction_non_alphanumeric': 0.11643507426928605, 'fraction_numerical': 0.0, 'mean_word_length': 4.22, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4238137', 'n_tokens_mistral': 778, 'n_tokens_neox': 727, 'n_words': 158}