{"id":14862489,"url":"https://github.com/IKatsuba/mutates","last_synced_at":"2025-09-18T15:31:13.156Z","repository":{"id":242946456,"uuid":"632791743","full_name":"IKatsuba/mutates","owner":"IKatsuba","description":"Still afraid to do something with AST? Mutates the AST, not your brain.","archived":false,"fork":false,"pushed_at":"2024-09-09T18:14:04.000Z","size":1286,"stargazers_count":15,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-09T22:27:41.447Z","etag":null,"topics":["angular","ast","code-migration","generators","nx","schematics","ts-morph","typescript"],"latest_commit_sha":null,"homepage":"https://mutates.katsuba.dev/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IKatsuba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-26T06:24:52.000Z","updated_at":"2024-09-09T18:12:24.000Z","dependencies_parsed_at":"2024-09-09T21:44:43.786Z","dependency_job_id":"c087e7b2-fd04-4484-b565-0e4500da3ba7","html_url":"https://github.com/IKatsuba/mutates","commit_stats":null,"previous_names":["ikatsuba/mutates"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IKatsuba%2Fmutates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IKatsuba%2Fmutates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IKatsuba%2Fmutates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IKatsuba%2Fmutates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IKatsuba","download_url":"https://codeload.github.com/IKatsuba/mutates/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219857720,"owners_count":16553634,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","ast","code-migration","generators","nx","schematics","ts-morph","typescript"],"created_at":"2024-09-19T20:01:38.217Z","updated_at":"2025-09-18T15:31:07.702Z","avatar_url":"https://github.com/IKatsuba.png","language":"TypeScript","readme":"# Mutates\n\n[![](https://raw.githubusercontent.com/IKatsuba/mutates/main/docs/src/app/opengraph-image.png)](https://mutates.katsuba.dev)\n\n🚀 **Mutates** is a powerful toolset for mutating the Abstract Syntax Tree (AST) of TypeScript\nfiles. It is a fork of `ng-morph`, with a broader focus beyond Angular-specific transformations,\nallowing for extensive AST modifications in any TypeScript project.\n\n## Features\n\n✨ **AST Mutations:** Modify the AST of any TypeScript file.  \n🌐 **Framework-Agnostic:** Not limited to Angular; can be used with any TypeScript-based project.  \n🔧 **Extensible:** Framework-specific transformations are available through separate packages.\n\n## Packages\n\n### Core Package\n\n#### @mutates/core\n\nThe core package provides the essential functionalities needed to manipulate the AST of TypeScript\nfiles. It serves as the foundation for other specialized packages.\n\n### Framework-Specific Packages\n\nFramework-specific transformations have been decoupled from the core package and are available as\nseparate packages. For example:\n\n#### @mutates/angular\n\nThis package includes transformations specific to Angular projects, leveraging the capabilities of\n`@mutates/core` to provide Angular-focused AST modifications.\n\n#### @mutates/nx\n\nThis package includes transformations specific to Nx workspaces, allowing for Nx-specific filesystem\noperations and AST modifications.\n\n## Installation\n\nTo install the core package, use the following command:\n\n```sh\nnpm install @mutates/core\n```\n\nFor Angular-specific transformations, install the Angular package as well:\n\n```sh\nnpm install @mutates/angular @mutates/core\n```\n\nFor Nx-specific transformations, install the Nx package:\n\n```sh\nnpm install @mutates/nx @mutates/core\n```\n\n## Usage\n\n### Basic Example\n\nHere is a simple example demonstrating how to use `@mutates/core` to modify a TypeScript file:\n\n```typescript\nimport { addFunctions, creataProject, createSourceFile, saveProject } from '@mutates/core';\n\n// Initialize a new project\ncreateProject();\n\n// Add a TypeScript file to the project\ncreateSourceFile(\n  'example.ts',\n  `\n  const greet = (name: string) =\u003e {\n    return 'Hello, ' + name;\n  };\n`,\n);\n\n// Perform some transformations\naddFunctions('example.ts', {\n  name: 'farewell',\n  isExported: true,\n  statements: \"return 'buy!'\",\n});\n\n// Save the modified file\nsaveProject();\n```\n\n### Angular Example\n\nTo perform Angular-specific transformations, use `@mutates/angular` along with `@mutates/core`:\n\n```typescript\nimport { addProviders, getComponents } from '@mutates/angular';\nimport { createProject, createSourceFile, saveProject } from '@mutates/core';\n\n// Initialize a new Angular project\ncreateProject();\n\n// Add an Angular component file to the project\ncreateSourceFile(\n  'app.component.ts',\n  `\n  import { Component } from '@angular/core';\n\n  @Component({\n    selector: 'app-root',\n    template: '\u003ch1\u003eHello, World!\u003c/h1\u003e'\n  })\n  export class AppComponent {}\n`,\n);\n\n// Perform some Angular-specific transformations\naddProviders(getComponents('app.component.ts').at(0)!, ['AppService']);\n\n// Save the modified file\nsaveProject();\n```\n\n## Contributing\n\n🤝 Contributions are welcome! If you have any improvements or suggestions, feel free to open an\nissue or submit a pull request.\n\n## License\n\n📄 Mutates is licensed under the Apache-2.0 License. See the [LICENSE](./LICENSE) file for more\ninformation.\n\n---\n\nFor more detailed documentation, please visit the\n[official documentation](https://mutates.katsuba.dev).\n\nFor further assistance or to report issues, please visit\n[GitHub repository](https://github.com/ikatsuba/mutates).\n","funding_links":[],"categories":["Underlying Technologies"],"sub_categories":["TypeScript"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIKatsuba%2Fmutates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FIKatsuba%2Fmutates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIKatsuba%2Fmutates/lists"}