{"id":51034588,"url":"https://github.com/damiansire/angular-schematics","last_synced_at":"2026-06-22T04:01:32.042Z","repository":{"id":288256217,"uuid":"967338925","full_name":"damiansire/angular-schematics","owner":"damiansire","description":"A collection of Angular schematics (npm-published). First schematic: inline-migration (move inline template/styles to external files).","archived":false,"fork":false,"pushed_at":"2026-06-20T07:41:04.000Z","size":38,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-20T09:20:47.297Z","etag":null,"topics":["angular","angular-cli","codemod","migration","schematics","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/damiansire.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":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-16T09:54:31.000Z","updated_at":"2026-06-20T07:44:20.000Z","dependencies_parsed_at":"2025-04-16T15:02:51.018Z","dependency_job_id":"0685dba0-6668-42da-b462-a0e349a17741","html_url":"https://github.com/damiansire/angular-schematics","commit_stats":null,"previous_names":["damiansire/angular-tools","damiansire/angular-inline-migration-schematic","damiansire/angular-schematics"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/damiansire/angular-schematics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damiansire%2Fangular-schematics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damiansire%2Fangular-schematics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damiansire%2Fangular-schematics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damiansire%2Fangular-schematics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/damiansire","download_url":"https://codeload.github.com/damiansire/angular-schematics/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damiansire%2Fangular-schematics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34633796,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","angular-cli","codemod","migration","schematics","typescript"],"created_at":"2026-06-22T04:01:31.233Z","updated_at":"2026-06-22T04:01:32.021Z","avatar_url":"https://github.com/damiansire.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Schematic: Inline Template and Styles Migration\n\nThis Angular schematic automates the process of migrating inline `template` and `styles` defined within `@Component` decorators to external `.html` and `.scss` files, respectively.\n\n## What it Does\n\nThe schematic (`inline-template-schematic:mt`) performs the following actions in your Angular project:\n\n1.  **Finds Components:** It traverses all `.component.ts` files within the `src/` directory.\n2.  **Identifies Inline Templates:** If a component has a `template` property but no `templateUrl`:\n    - Extracts the content of the `template`.\n    - Creates a new `.html` file (e.g., `my-component.component.html`) in the same directory with that content.\n    - Replaces the `template: '...'` property with `templateUrl: './my-component.component.html'` in the `.ts` file.\n3.  **Identifies Inline Styles:** If a component has a `styles` property but no `styleUrls`:\n    - Extracts the content of `styles`. This can be a single string or an array of strings.\n    - For each style string, it creates a new `.scss` file (e.g., `my-component.component.scss`, `my-component-2.scss`, etc.) in the same directory with that content.\n    - Replaces the `styles: [...]` property with `styleUrls: ['./my-component.component.scss', ...]` in the `.ts` file.\n4.  **Comma Handling:** Attempts to automatically adjust commas when replacing properties in the decorator.\n5.  **Safety:** Does not overwrite existing `.html` or `.scss` files. Logs warnings and errors to the console.\n\n## Usage in a Project\n\nTo use this schematic in your Angular project:\n\n1.  **Installation (If published on npm):**\n\n    ```bash\n    npm install --save-dev your-schematic-package\n    # Or if it's a global or local dev dependency without a package:\n    # Ensure it's accessible (see Development section)\n    ```\n\n2.  **Execution:**\n    Navigate to the root of your Angular project and run:\n\n    ```bash\n    ng generate inline-template-schematic:mt\n    ```\n\n    Or the short form:\n\n    ```bash\n    ng g inline-template-schematic:mt\n    ```\n\n    The schematic will analyze your project and apply the necessary migrations. Review the generated changes before committing them.\n\n## Schematic Development\n\nIf you are modifying or developing this schematic locally, follow these steps to test it in another Angular project:\n\n1.  **Build the Schematic:**\n    Inside the root directory of the _schematic's project_ (e.g., `angular-tools`), run the build command (ensure it's configured in your `package.json`):\n\n    ```bash\n    npm run build\n    ```\n\n    This compiles the TypeScript files to JavaScript (usually into a `dist/` directory or similar).\n\n2.  **Create a Symbolic Link (Link):**\n    From the root directory of the _schematic's project_, run:\n\n    ```bash\n    npm link\n    ```\n\n    This creates a global link on your system to your local schematic package, using the name defined in its `package.json`.\n\n3.  **Use the Link in the Test Project:**\n\n    - Navigate to the root directory of the _Angular project where you want to test_ the schematic.\n    - Run the `npm link` command followed by the package name of your schematic (the name in the schematic's `package.json`, e.g., `inline-template-schematic` if that's the name):\n      ```bash\n      npm link inline-template-schematic\n      ```\n      (Replace `inline-template-schematic` with the actual name of your package).\n      This creates a folder in the test project's `node_modules` that points directly to your local schematic source code.\n\n4.  **Run the Local Schematic:**\n    Now, inside the test project, you can run the schematic as you normally would:\n\n    ```bash\n    ng g inline-template-schematic:mt\n    ```\n\n    Angular will find and execute the linked local version of your schematic.\n\n5.  **Unlink (Optional):**\n    When you're finished testing, you can unlink the packages:\n    - In the _test project_: `npm unlink inline-template-schematic` (or `npm uninstall inline-template-schematic`)\n    - In the _schematic's project_: `npm unlink`\n\nThis workflow allows you to quickly test changes to your schematic without needing to publish it to npm each time.\n\n### Unit Testing\n\n`npm run test` will run the unit tests, using Jasmine as a runner and test framework.\n\n### Publishing\n\nTo publish, simply do:\n\n```bash\nnpm run build\nnpm publish\n```\n\nThat's it!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamiansire%2Fangular-schematics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdamiansire%2Fangular-schematics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamiansire%2Fangular-schematics/lists"}