<commit_before>'use strict';

const fs = require('fs');
const shell = require('shelljs');
const chalk = require('chalk');
const config = require('./package-dist');

const PACKAGE = `ngx-ui-scroll`;
const NPM_DIR = `dist`;
const ESM2015_DIR = `${NPM_DIR}/esm2015`;
const ESM5_DIR = `${NPM_DIR}/esm5`;
const FESM2015_DIR = `${NPM_DIR}/fesm2015`;
const FESM5_DIR = `${NPM_DIR}/fesm5`;
const BUNDLES_DIR = `${NPM_DIR}/bundles`;
const OUT_DIR = `${NPM_DIR}/package`;
const OUT_DIR_ESM5 = `${NPM_DIR}/package/esm5`;

/* Package version */
shell.echo(`Setup package version`);
let version = config.version;
const versionContent = `export default '${version}';\\n`;
let result = shell.exec(`printf "${versionContent}" >./src/ui-scroll.version.ts`);
if (result.code !== 0) {
  shell.echo(chalk.red(`Error: Can't define package version`));
  shell.exit(1);
}
shell.echo(chalk.green(`${PACKAGE} v${version}`));

shell.echo(`Start building...`);

shell.rm(`-Rf`, `${NPM_DIR}/*`);
shell.mkdir(`-p`, `./${ESM2015_DIR}`);
shell.mkdir(`-p`, `./${ESM5_DIR}`);
shell.mkdir(`-p`, `./${FESM2015_DIR}`);
shell.mkdir(`-p`, `./${FESM5_DIR}`);
shell.mkdir(`-p`, `./${BUNDLES_DIR}`);
shell.mkdir(`-p`, `./${OUT_DIR}`);

/* TSLint with Codelyzer */
// https://github.com/palantir/tslint/blob/master/src/configs/recommended.ts
// https://github.com/mgechev/codelyzer
shell.echo(`Start TSLint`);
shell.exec(`tslint -p tsconfig.json -t stylish src/**/*.ts`);
shell.echo(chalk.green(`TSLint completed`));

shell.cp(`-Rf`, [`src`, `*.ts`, `*.json`], `${OUT_DIR}`);

/* Try to process scss files  */
shell.echo(`Try to process scss files`);
if (shell.exec(`node-sass -r ${OUT_DIR} -o ${OUT_DIR}`).code === 0) {
  shell.rm(`-Rf`, `${OUT_DIR}/**/*.scss`);
  shell.ls(`${OUT_DIR}/**/*.css`).forEach(function (file) {
    shell.mv(file, file.replace('.css', '.scss'));
  });
}

/* AoT compilation */
shell.echo(`Start AoT compilation`);
if (shell.exec(`ngc -p ${OUT_DIR}/tsconfig-build.json`).code !== 0) {
  shell.echo(chalk.red(`Error: AoT compilation failed`));
  shell.exit(1);
}
shell.echo(chalk.green(`AoT compilation completed`));
<commit_msg>removing scss-files processing<commit_after>'use strict';

const fs = require('fs');
const shell = require('shelljs');
const chalk = require('chalk');
const config = require('./package-dist');

const PACKAGE = `ngx-ui-scroll`;
const NPM_DIR = `dist`;
const ESM2015_DIR = `${NPM_DIR}/esm2015`;
const ESM5_DIR = `${NPM_DIR}/esm5`;
const FESM2015_DIR = `${NPM_DIR}/fesm2015`;
const FESM5_DIR = `${NPM_DIR}/fesm5`;
const BUNDLES_DIR = `${NPM_DIR}/bundles`;
const OUT_DIR = `${NPM_DIR}/package`;
const OUT_DIR_ESM5 = `${NPM_DIR}/package/esm5`;

/* Package version */
shell.echo(`Setup package version`);
let version = config.version;
const versionContent = `export default '${version}';\\n`;
let result = shell.exec(`printf "${versionContent}" >./src/ui-scroll.version.ts`);
if (result.code !== 0) {
  shell.echo(chalk.red(`Error: Can't define package version`));
  shell.exit(1);
}
shell.echo(chalk.green(`${PACKAGE} v${version}`));

shell.echo(`Start building...`);

shell.rm(`-Rf`, `${NPM_DIR}/*`);
shell.mkdir(`-p`, `./${ESM2015_DIR}`);
shell.mkdir(`-p`, `./${ESM5_DIR}`);
shell.mkdir(`-p`, `./${FESM2015_DIR}`);
shell.mkdir(`-p`, `./${FESM5_DIR}`);
shell.mkdir(`-p`, `./${BUNDLES_DIR}`);
shell.mkdir(`-p`, `./${OUT_DIR}`);

/* TSLint with Codelyzer */
// https://github.com/palantir/tslint/blob/master/src/configs/recommended.ts
// https://github.com/mgechev/codelyzer
shell.echo(`Start TSLint`);
shell.exec(`tslint -p tsconfig.json -t stylish src/**/*.ts`);
shell.echo(chalk.green(`TSLint completed`));

shell.cp(`-Rf`, [`src`, `*.ts`, `*.json`], `${OUT_DIR}`);

/* AoT compilation */
shell.echo(`Start AoT compilation`);
if (shell.exec(`ngc -p ${OUT_DIR}/tsconfig-build.json`).code !== 0) {
  shell.echo(chalk.red(`Error: AoT compilation failed`));
  shell.exit(1);
}
shell.echo(chalk.green(`AoT compilation completed`));

{'fraction_non_alphanumeric': 0.2425088877602844, 'fraction_numerical': 0.018537328593194517, 'mean_word_length': 5.203149606299212, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5635787', 'n_tokens_mistral': 1588, 'n_tokens_neox': 1564, 'n_words': 274}