Skip to content

Configuration

Below is the default configuration generated inside .codefendrc.json when executing the command: codefend -i:

json
// .codefendrc.json

{
  "generation": {
    "inputDir": ".",
    "outputDir": "codefend-output",
    "ignore": [
      "codefend-output",
      ".rc.json",
      "node_modules",
      ".git",
      ".github",
      ".gitignore",
      ".vscode",
      "build",
      "dist",
      "README.md",
      "package-lock.json"
    ]
  },
  "transformation": {
    "prefix": "Ox",
    "static": [],
    "ignore": ["node_modules"],
    "pool": []
  },
  "debug": {
    "stats": true,
    "ignoredWarnings": []
  },
  "parser": {
    "name": "default"
  }
}

Configuration

Below is the default configuration generated inside .codefendrc.json when executing the command: codefend -i:

generation

  • inputDir string (default: .)

    Folder that should be copied and obfuscated by Codefend. It can be kept as . to clone and obfuscate the entire project.

  • outputDir string (default: "codefend-output")

    Folder where Codefend will generate the cloned obfuscated version of the project.

  • ignore string[] (default: ["codefend-output", ".rc.json", "node_modules", ".git", ".github", ".gitignore", ".vscode", "build", "dist", "README.md", "package-lock.json"])

    Files and folders that shouldn't be copied by Codefend to the output folder.

transformation

  • prefix string (default: "Ox")

    Prefix of each variable generated by Codefend.

  • static { from: string, to: string }[] (default: [])

    Words that should be obfuscated in a specific determined output.

  • ignore string[] (default: ["node_modules"])

    Words that match the pattern to be obfuscated but should be kept as is without being obfuscated. Useful for words that are being obfuscated and causing errors when running or building the project.

  • pool string | string[] (default: [])

    A unique list or a space-separated string from which Codefend will generate the variable names. It will fallback to prefix when the list is totally consumed.

parser

  • name string (default: default, can be: default, codeOnly, fileOnly, custom) Specifies the parser to use for obfuscation.

    Only when the parser is set to custom, you will need to specify the regexList.

  • regexList string[] (default: [])

    Regex for detecting the words to be obfuscated. The default regex accepts words in the format: l_John, node_John, node_John_Doe, and for file names: cmp-*, lib-*, e.g., cmp-input, lib-navigator etc.

debug

  • stats boolean (default: true)

    Enabling the stats option provides detailed statistics regarding the obfuscated folders, files, and words. These statistics offer insights into the obfuscation process and the frequency of obfuscated elements within your codebase.

  • ignoredWarnings 'all' | string[] (default: [])

    This option allows you to specify which warnings should be ignored during the obfuscation process. You can provide a list of warning codes to be ignored, or use 'all' to ignore all warnings. This helps in customizing the warnings you receive and prevents unnecessary alerts.