### Manual Installation of Iron Golem from Git Source: https://github.com/programever/iron-golem-ts/blob/main/README.md These commands allow for manual installation of Iron Golem by cloning its Git repository, installing project dependencies, building the application, and linking it globally for development or testing purposes. ```bash git clone https://github.com/programever/iron-golem-ts cd iron-golem-ts npm install npm build npm link ``` -------------------------------- ### Install Iron Golem CLI via npm Source: https://github.com/programever/iron-golem-ts/blob/main/README.md This command installs the Iron Golem CLI tool as a development dependency in your project using npm, making it available for use in scripts and pre-commit hooks. ```bash npm install --save-dev iron-golem-ts ``` -------------------------------- ### Example Output of iron-golem-ts Folder Report Source: https://github.com/programever/iron-golem-ts/blob/main/README.md This snippet provides an example of the console output generated by `iron-golem-ts` when running a folder report. It displays a hierarchical view of folder and file analysis, indicating percentages relative to their parent folders using a color-coded legend. ```bash 🚀 Iron Golem is running... Legend: 🔴 ≥75% | 🟠 50–74% | 🟢 25–49% | ⚪ <25% (relative to parent folder) Run for: /config with 3 max level depth 🔴 config: 94 - 100% ├── ⚪ axios.ts: 4 - 4% ├── 🔴 catalog: 86 - 91% ├── 🟠 filter-group-configurations.ts: 48 - 56% └── 🟢 hotfilter-group-configurations.ts: 38 - 44% └── ⚪ environment.tsx: 4 - 4% ``` -------------------------------- ### Example output of pre-commit TypeScript check Source: https://github.com/programever/iron-golem-ts/blob/main/README.md This snippet provides an example of the console output when the pre-commit hook detects TypeScript errors, showing the file paths, specific error codes, and messages that prevent the commit from proceeding. ```bash vc-fenx on  develop [⇣+] via ⬢ v22.15.0 ➜ git commit -m "Init commit" 🚀 Checking strict TypeScript is running... 💀 TypeScript errors for files: src/components/orders-sales/main.tsx(43,7): error TS2531: Object is possibly 'null'. src/components/orders-sales/main.tsx(252,21): error TS2322: Type 'SaleReport[] | undefined' is not assignable to type 'SaleReport[]'. src/components/orders-sales/main.tsx(273,11): error TS2322: Type 'SaleData | undefined' is not assignable to type 'SaleData'. husky - pre-commit hook exited with code 1 (error) ``` -------------------------------- ### Run Iron Golem CLI with various options Source: https://github.com/programever/iron-golem-ts/blob/main/README.md These examples demonstrate how to use `iron-golem-ts` for different use cases: auditing TypeScript errors over time, checking errors in current Git changes (useful for pre-commit hooks), and generating reports with specific output paths and depth levels. ```bash iron-golem-ts [options] iron-golem-ts -k audit -s 10 -m 1 -p build -n ~/.nvm/nvm.sh iron-golem-ts -k changes iron-golem-ts -k report -rp / -rd 3 ``` -------------------------------- ### Iron Golem CLI Command-Line Options Source: https://github.com/programever/iron-golem-ts/blob/main/README.md This section details the available command-line options for `iron-golem-ts`, including their purpose, default values, and which `kind` of operation (audit, changes, or report) they apply to. ```APIDOC Option: -k, --kind Description: Kind is `audit` - `changes` - `report` Default: `audit` Option: -s, --sequence Description: Day interval for Git history audit Default: `7` Option: -m, --max-months Description: Maximum age for audit (in months) Default: `3` Option: -p, --path Description: Output path for the generated report Default: `tmp` Option: -n, --nvm-path Description: Determine if should use nvm Eg: `~/.nvm/nvm.sh` Default: `` Option: -rp, --report-path Description: What is the path to run report Eg: `/app` Default: `/` Option: -rd, --report-depth Description: What is the depth level that report should go down Default: `999` ``` -------------------------------- ### Execute iron-golem-ts Folder Report Source: https://github.com/programever/iron-golem-ts/blob/main/README.md This bash command demonstrates how to run the `report:tsc` script defined in your `package.json`. Executing this command will trigger the `iron-golem-ts` report generation process as configured in the script. ```bash npm run report:tsc ``` -------------------------------- ### Manually run pre-commit TypeScript check Source: https://github.com/programever/iron-golem-ts/blob/main/README.md This command demonstrates how to manually execute the `precommit:tsc` script defined in `package.json`, allowing developers to check for TypeScript errors in changed files before attempting a commit. ```bash npm run precommit:tsc ``` -------------------------------- ### Configure iron-golem-ts Report Script in package.json Source: https://github.com/programever/iron-golem-ts/blob/main/README.md This JSON snippet shows how to add a script to your package.json file to generate a report using iron-golem-ts. The script `report:tsc` executes the `iron-golem-ts` command with specific parameters: `-k report` for report generation, `-rp /config` to specify the root path, and `-rd 3` for a maximum depth of 3 levels. ```json "scripts": { "report:tsc": "iron-golem-ts -k report -rp /config -rd 3" } ``` -------------------------------- ### Iron Golem output directory structure Source: https://github.com/programever/iron-golem-ts/blob/main/README.md This snippet illustrates the typical directory structure created by Iron Golem in the specified output path, including a `cache.json` file for parsed error data and the main `report.html` file. ```text tmp/iron-golem-ts/ ├── cache.json # Parsed error data per commit └── report.html # Full HTML report ``` -------------------------------- ### Configure pre-commit hook in package.json Source: https://github.com/programever/iron-golem-ts/blob/main/README.md This JSON snippet shows how to add a `precommit:tsc` script to your `package.json` to automatically run `iron-golem-ts -k changes` before each commit, enforcing zero TypeScript errors for changed files. ```json "scripts": { "precommit:tsc": "iron-golem-ts -k changes" } ``` -------------------------------- ### Accessing the generated HTML report Source: https://github.com/programever/iron-golem-ts/blob/main/README.md This path indicates the default location where Iron Golem saves its comprehensive HTML report, which can be opened in a web browser to view visual charts and detailed tables of TypeScript errors. ```bash tmp/iron-golem-ts/report.html ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.