<commit_before>/**
 * @license Typescript-Library-Bundler v0.0.11
 * (c) 2017 <NAME> <<EMAIL>>
 * License: MIT
 */

import * as path from 'path';
import * as uglify from 'rollup-plugin-uglify';
import { main as ngcCompiler } from '@angular/tsc-wrapped';

import { preprocessTSFiles } from './preprocess-files';
import { getTranspileOptions, transpileModule } from './tsc';
import { defaultConfigs as rollupConfig, rollupBy } from './rollup';
import { createNGCConfig, getSafePackageName, parseConfigFile, readPackage, validatePkgModuleEntries } from './config-helpers';
import {
  copyFromTo,
  ensureMakeDir,
  ensureRemoveDir,
  isArray,
  isEmpty,
  isFile,
  isNil,
  isString,
} from './utils';


export async function main(projectPath: string, configFilePath?: string): Promise<void> {

  if (isNil(configFilePath)) {
    configFilePath = path.resolve(projectPath, 'tsconfig.json');
  }
  const configFileDir = path.dirname(configFilePath);
  const { configs, error } = parseConfigFile(configFilePath);

  if (!isNil(error)) {
    throw new Error(error.messageText.toString());
  }

  let entryFile: string;
  const { files = [], compilerOptions = {}, bundlerOptions = {} } = configs;
  const { entry: possibleEntry } = bundlerOptions;

  if (isNil(possibleEntry) && isNil(files)) {
    throw new Error('Project tsconfig must have an entry barrel file to export the library implementations!');<commit_msg>Fixes issue of project path is not absolute<commit_after>/**
 * @license Typescript-Library-Bundler v0.0.11
 * (c) 2017 <NAME> <<EMAIL>>
 * License: MIT
 */

import * as path from 'path';
import * as uglify from 'rollup-plugin-uglify';
import { main as ngcCompiler } from '@angular/tsc-wrapped';

import { preprocessTSFiles } from './preprocess-files';
import { getTranspileOptions, transpileModule } from './tsc';
import { defaultConfigs as rollupConfig, rollupBy } from './rollup';
import { createNGCConfig, getSafePackageName, parseConfigFile, readPackage, validatePkgModuleEntries } from './config-helpers';
import {
  copyFromTo,
  ensureMakeDir,
  ensureRemoveDir,
  isArray,
  isEmpty,
  isFile,
  isNil,
  isString,
} from './utils';


export async function main(projectPath: string, configFilePath?: string): Promise<void> {

  if (!path.isAbsolute(projectPath)) {
    projectPath = path.resolve(process.cwd(), projectPath);
  }

  if (isNil(configFilePath)) {
    configFilePath = path.resolve(projectPath, 'tsconfig.json');
  }
  const configFileDir = path.dirname(configFilePath);
  const { configs, error } = parseConfigFile(configFilePath);

  if (!isNil(error)) {
    throw new Error(error.messageText.toString());
  }

  let entryFile: string;
  const { files = [], compilerOptions = {}, bundlerOptions = {} } = configs;
  const { entry: possibleEntry } = bundlerOptions;

  if (isNil(possibleEntry) && isNil(files)) {
    throw new Error('Project tsconfig must have an entry barrel file to export the library implementations!');
{'fraction_non_alphanumeric': 0.12889039242219216, 'fraction_numerical': 0.005412719891745603, 'mean_word_length': 4.73062015503876, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4570743', 'n_tokens_mistral': 917, 'n_tokens_neox': 887, 'n_words': 243}