{"id":18111569,"url":"https://github.com/metroxe/relative-to-alias-resolver","last_synced_at":"2026-03-01T14:02:15.614Z","repository":{"id":259334129,"uuid":"877629312","full_name":"Metroxe/relative-to-alias-resolver","owner":"Metroxe","description":"Transform your TypeScript project with ease using the relative-to-alias-resolver. This powerful tool converts cumbersome relative imports into clean, maintainable alias imports, enhancing code readability and maintainability.","archived":false,"fork":false,"pushed_at":"2024-10-24T06:30:45.000Z","size":173,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-22T11:53:21.039Z","etag":null,"topics":["aliases","build-process","cli-tool","code-maintainability","code-readability","developer-tools","npm-package","tsconfig","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/relative-to-alias-resolver","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Metroxe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-10-24T00:57:18.000Z","updated_at":"2024-10-24T06:34:49.000Z","dependencies_parsed_at":"2024-10-24T14:16:03.418Z","dependency_job_id":"a68e4280-2942-4796-ba1e-6671e8811171","html_url":"https://github.com/Metroxe/relative-to-alias-resolver","commit_stats":null,"previous_names":["metroxe/relative-to-alias-resolver"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/Metroxe/relative-to-alias-resolver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Metroxe%2Frelative-to-alias-resolver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Metroxe%2Frelative-to-alias-resolver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Metroxe%2Frelative-to-alias-resolver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Metroxe%2Frelative-to-alias-resolver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Metroxe","download_url":"https://codeload.github.com/Metroxe/relative-to-alias-resolver/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Metroxe%2Frelative-to-alias-resolver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281976634,"owners_count":26592972,"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","status":"online","status_checked_at":"2025-10-31T02:00:07.401Z","response_time":57,"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":["aliases","build-process","cli-tool","code-maintainability","code-readability","developer-tools","npm-package","tsconfig","typescript"],"created_at":"2024-11-01T01:06:18.675Z","updated_at":"2025-10-31T10:50:51.185Z","avatar_url":"https://github.com/Metroxe.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Relative to Alias Resolver\n\n[![npm version](https://badge.fury.io/js/relative-to-alias-resolver.svg)](https://www.npmjs.com/package/relative-to-alias-resolver)\n\n## Overview\n\nThe **Relative to Alias Resolver** is a tool designed to convert a TypeScript project from using relative imports to alias imports. This can help improve the readability and maintainability of your codebase by using more descriptive import paths.\n\nFor example, it can transform your imports from this:\n\n```typescript\n// Before conversion\nimport { MyComponent } from '../../../components/MyComponent';\nimport { utilFunction } from '../../utils/utilFunction';\n```\n\nto this:\n\n```typescript\n// After conversion\nimport { MyComponent } from '@/components/MyComponent';\nimport { utilFunction } from '@/utils/utilFunction';\n```\n\nThis makes your code cleaner and easier to maintain, especially in larger projects.\n\n## Why Use This Package?\n\n- **Improved Code Readability**: Alias imports make your code cleaner and easier to navigate.\n- **Enhanced Maintainability**: Simplifies refactoring and reduces the risk of import path errors.\n- **Seamless Integration**: Easily integrates with existing TypeScript projects and build processes.\n\n## Features\n\n- Converts relative imports to alias imports based on your `tsconfig.json` configuration.\n- Supports both CommonJS and ES Module formats.\n- Provides a CLI for easy integration into your build process.\n- Includes options for dry runs before modifying your project.\n\n## Installation\n\nTo install the package cli, use npm:\n\n```bash\nnpm install -g relative-to-alias-resolver\n```\n\nif you intend to use the library in your project, you can install it locally:\n\n```bash\nnpm install relative-to-alias-resolver\n```\n\n## Usage\n\n### CLI\n\nThe package provides a command-line interface to perform the conversion. You can use it as follows:\n\n```bash\nrelative-to-alias-resolver --project \u003cpath-to-project\u003e --tsconfig \u003cpath-to-tsconfig\u003e\n```\n\n#### Options\n\n- `-p, --project \u003cpath\u003e`: The path to the project to generate alias imports for. Defaults to `.`.\n- `-t, --tsconfig \u003cpath\u003e`: The path to the `tsconfig.json` file to use for the project. Defaults to `./tsconfig.json`.\n- `-d, --dry-run`: Whether to run the command in dry run mode. Defaults to `false`.\n- `-i, --ignore \u003cpatterns\u003e`: A comma-separated list of regex patterns for paths to ignore. Defaults to `[\"node_modules\"]`.\n- `-v, --verbose`: Enable verbose logging. Defaults to `false`.\n\n#### Example\n\n```bash\nrelative-to-alias-resolver --project ./project --tsconfig ./project/tsconfig.json\n```\n\n### Library\n\nThe library can be used to convert relative imports to alias imports in a TypeScript project.\n\n```typescript\nimport { resolveRelativeToAlias } from \"relative-to-alias-resolver\";\n\nresolveRelativeToAlias({\n  projectPath: \"./src\",\n  tsconfigPath: \"./tsconfig.json\",\n  dryRun: true,\n  ignore: [\"node_modules\"],\n});\n```\n\n## Configuration\n\nThe tool relies on the `tsconfig.json` file to determine the base URL and paths for aliasing. Ensure your `tsconfig.json` is correctly configured with the `baseUrl` and `paths` properties.\n\nExample `tsconfig.json`:\n\n```json\n{\n  \"compilerOptions\": {\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"@/*\": [\"src/*\"]\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetroxe%2Frelative-to-alias-resolver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetroxe%2Frelative-to-alias-resolver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetroxe%2Frelative-to-alias-resolver/lists"}