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"
    ]
  },

  "transformation": {
    "prefix": "Ox",
    "static": [],
    "ignore": ["node_modules"],
    "pool": []
  },
  "debug": {
    "stats": true
  },
  "parser": {
    "regexList": [
      {
        "name": "main",
        "value": "([a-zA-Z]+(_[a-zA-Z0-9]+)+)"
      },
      {
        "name": "file",
        "value": "((cmp|lib)+(-[a-zA-Z0-9]+)+)"
      }
    ]
  }
}
Generation
inputDirFolder that should be copied and obfuscated by Codefend. It can be kept as . to clone and obfuscate the entire project
outputDirFolder where Codefend will generate the cloned obfuscated version of the project
ignoreFiles and folders that shouldn't be copied by Codefend to the output folder
Transformation
prefixPrefix of each variable generated by Codefend String Ox
staticWords that should be obfuscated in a special determined output { from:string, to:string } [] []
ignoreWords 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 String [] ["node_modules"]
poolA 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 String / String [] []
Parser
regexListRegex for detecting the words to be obfuscated. 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
statsEnabling 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. Boolean true