<commit_before>/**
 * blink.js
 */

/* api */
import { getType, isString } from './common.js';
import { createFile, mkdir, readFile, rm } from './file-util.js';
import path from 'path';
import process from 'process';

/* constants */
const CHAR = 'utf8';
const DIR_CWD = process.cwd();
const DIR_OUT = path.resolve(DIR_CWD, 'bundle');
const DIR_SRC = path.resolve(DIR_CWD, 'src');
const INDENT = 2;

/**
 * create blink specific manifest.json
 *
 * @param {boolean} info - console info
 * @returns {string} - file path
 */
export const createManifest = async info => {
  const srcContent = await readFile(path.join(DIR_SRC, 'manifest.json'), {
    encoding: CHAR,
    flag: 'r'
  });
  const manifest = JSON.parse(srcContent);
  const replaceItems = {
    background: {
      page: 'html/background.html',
      persistent: false
    },
    icons: {
      16: 'img/icon-outline-16.png',
      32: 'img/icon-outline-32.png',
      64: 'img/icon-color.png',
      128: 'img/icon-color-128.png'
    },
    // TODO: refactoring when switching to MV3<commit_msg>Temporary remove persistent<commit_after>/**
 * blink.js
 */

/* api */
import { getType, isString } from './common.js';
import { createFile, mkdir, readFile, rm } from './file-util.js';
import path from 'path';
import process from 'process';

/* constants */
const CHAR = 'utf8';
const DIR_CWD = process.cwd();
const DIR_OUT = path.resolve(DIR_CWD, 'bundle');
const DIR_SRC = path.resolve(DIR_CWD, 'src');
const INDENT = 2;

/**
 * create blink specific manifest.json
 *
 * @param {boolean} info - console info
 * @returns {string} - file path
 */
export const createManifest = async info => {
  const srcContent = await readFile(path.join(DIR_SRC, 'manifest.json'), {
    encoding: CHAR,
    flag: 'r'
  });
  const manifest = JSON.parse(srcContent);
  const replaceItems = {
    icons: {
      16: 'img/icon-outline-16.png',
      32: 'img/icon-outline-32.png',
      64: 'img/icon-color.png',
      128: 'img/icon-color-128.png'
    },
    // TODO: refactoring when switching to MV3
{'fraction_non_alphanumeric': 0.15907978463044542, 'fraction_numerical': 0.01860009789525208, 'mean_word_length': 3.2231404958677685, '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': '2080025', 'n_tokens_mistral': 716, 'n_tokens_neox': 688, 'n_words': 182}