{"id":16567399,"url":"https://github.com/badgerati/psclass","last_synced_at":"2025-04-13T04:30:19.632Z","repository":{"id":146596042,"uuid":"211964578","full_name":"Badgerati/PSClass","owner":"Badgerati","description":"PowerShell module to help determine class dependencies, and the order that you need to import them","archived":false,"fork":false,"pushed_at":"2019-10-02T18:32:53.000Z","size":9,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T12:54:20.348Z","etag":null,"topics":["class","cyclic","dependency","import","order","powershell"],"latest_commit_sha":null,"homepage":null,"language":"PowerShell","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/Badgerati.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-09-30T21:55:23.000Z","updated_at":"2024-12-06T02:02:50.000Z","dependencies_parsed_at":"2024-01-14T04:44:06.283Z","dependency_job_id":"4ce80385-3d79-4d73-aa48-317912c072f9","html_url":"https://github.com/Badgerati/PSClass","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Badgerati%2FPSClass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Badgerati%2FPSClass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Badgerati%2FPSClass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Badgerati%2FPSClass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Badgerati","download_url":"https://codeload.github.com/Badgerati/PSClass/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248663095,"owners_count":21141687,"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":["class","cyclic","dependency","import","order","powershell"],"created_at":"2024-10-11T21:06:29.886Z","updated_at":"2025-04-13T04:30:19.595Z","avatar_url":"https://github.com/Badgerati.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PSClass\n\nThis is a PowerShell module to help determine class dependencies, and also to determine the order that you need to import classes into your module.\n\n## Install\n\nYou can install PSClass from the PowerShell Gallery\n\n```powershell\nInstall-Module PSClass\n```\n\n## Usage\n\nAll classes/enums need to be within a `/Classes` directory, and references to custom classes referenced as `[ClassA]`. Class names should also match the name of the PowerShell file - so a `ClassA` *must* be within a `ClassA.ps1` file.\n\nFor example, if you have some class `ClassA` and some other class `ClassB`, the PSClass will see `[ClassB]::Method()` and mark that it should be imported before `ClassA` automatically:\n\n```powershell\nclass ClassA\n{\n    static [void] SomeMethod()\n    {\n        [ClassB]::Method()\n    }\n}\n```\n\nHere, PSClass will know that `ClassB` needs to be imported before `ClassA`.\n\nPSClass will see any `[...]` lines and use them to determine the order that classes/enums are required to be imported - as well as detecting cyclic dependencies.\n\n\u003e Classes/enums can be within sub-directories within the `/Classes` directory.\n\n## Functions\n\n### Get-PSClassOrder\n\n```powershell\nGet-PSClassOrder [-Path \u003cstring\u003e]\n```\n\nWhen run, this function will look for the `/Classes` folder at the `-Path` specified (default is the current path).\n\nIt will then return an array of the class/enum paths in the precise order that they should be imported:\n\n```powershell\nGet-PSClassOrder | ForEach-Object { . $_ }\n```\n\n### Show-PSClassGraph\n\n```powershell\nShow-PSClassgraph [-Path \u003cstring\u003e] [-Namespace \u003cstring\u003e]\n```\n\nWill return the full dependency graph of the classes/enums, or just the dependencies of the namespace specified. The namespace is the path to a class (with no extension), and the slashes are replaced for dots - such as `Tools.Helpers` for a class called `Helpers` at `/Classes/Tools/Helpers.ps1`.\n\n### Test-PSClassCyclic\n\n```powershell\nTest-PSClassCyclic [-Path \u003cstring\u003e] [-Namespace \u003cstring\u003e]\n```\n\nWill test for cyclic dependencies on a classes/enums. The namespace is the path to a class (with no extension), and the slashes are replaced for dots - such as `Tools.Helpers` for a class called `Helpers` at `/Classes/Tools/Helpers.ps1`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadgerati%2Fpsclass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbadgerati%2Fpsclass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadgerati%2Fpsclass/lists"}