{"id":22694608,"url":"https://github.com/kaspercools/cookagen","last_synced_at":"2025-09-06T19:36:08.604Z","repository":{"id":157602218,"uuid":"224462961","full_name":"kaspercools/cookagen","owner":"kaspercools","description":"A language-independent code generation tool","archived":false,"fork":false,"pushed_at":"2023-09-26T06:40:40.000Z","size":4379,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T17:32:16.500Z","etag":null,"topics":[],"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/kaspercools.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}},"created_at":"2019-11-27T15:38:58.000Z","updated_at":"2023-04-27T22:10:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"a06e347f-6b94-4060-be0e-b84b542d8782","html_url":"https://github.com/kaspercools/cookagen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kaspercools/cookagen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaspercools%2Fcookagen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaspercools%2Fcookagen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaspercools%2Fcookagen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaspercools%2Fcookagen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaspercools","download_url":"https://codeload.github.com/kaspercools/cookagen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaspercools%2Fcookagen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273954473,"owners_count":25197507,"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-09-06T02:00:13.247Z","response_time":2576,"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":[],"created_at":"2024-12-10T03:08:52.095Z","updated_at":"2025-09-06T19:36:08.583Z","avatar_url":"https://github.com/kaspercools.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Table of contents\n- [COOKAGEN - A quick and dirty code generator](#cookagen---a-quick-and-dirty-code-generator)\n  - [First time usage](#first-time-usage)\n  - [Example usage](#example-usage)\n- [COOKAGEN Config](#cookagen-config)\n  - [Template Folder](#template-folder)\n  - [Generators](#generators)\n    - [Templates](#templates)\n    - [ParseList](#parselist)\n    - [Optional properties](#optional-properties)\n      - [chain](#chain)\n    - [alterations](#alterations)\n  - [Expressions](#expressions)\n    - [Functions](#functions)\n\n# COOKAGEN - A quick and dirty code generator\n\n## First time usage\nrun the following commands to get started on your local environment:\n``` \n    npm i\n    npm run build\n    // Run following command to install cookagen globally\n    npm install -g \n```\n## Example usage\n\nThe following command executes a generator named domain and passes the value `User` to the entity placeholder [more details can be found in the ParseList section](#parselist)\n```\n    cookagen domain entity:user \n```\n\nIf used globally you can run the command from any directory in any type of project. You simply need to provide a `cookagen.json` file which contains the environment settings.\n\n# COOKAGEN Config\nThe **cookagen** config needs to contain at least the following keys:\n```\n{\n    \"templateFolder\": \".templates\"\n    \"generators\": []\n    \"alterations\": []\n}\n```\n\n## Template Folder\nThe Template folder parameter is a relative path definition in respect to the cookagen.json file.\n\n## Generators\nTo add a generator you need to define at least the following key attributes:\n\n```\n{\n    \"cmd\": \"domain\",\n    \"alias\": \"d\",\n    \"targetFolder\": \"Domain\",\n    \"templateRoot\": \"domain\",\n    \"templates\": [\n        {\n            \"file\": \"entity.tpl\",\n            \"resFile\": \"{{$ENTITY}}\"\n        }\n    ],\n    \"ext\": \"cs\",\n    \"parseList\": [\n        {\n            \"val\": \"entity\",\n            \"match\": \"$ENTITY\"\n        }\n    ]\n}\n```\n\n| Property     | Value                                                                                        |\n|--------------|----------------------------------------------------------------------------------------------|\n| cmd          | The command you wish to use to call this generator                                           |\n| alias        | The alias you want to create for this generator                                              |\n| targetFolder | The target folder where the generated files need to be saved                                 |\n| templateRoot | The root folder for this particular generator (a folder within given templateFolder)         |\n| templates    | { \"file\":\"entity.tpl\", \"resFile\": \"{{$ENTITY}}\" }  [more info in the template section](#templates)                                          |\n| ext          | The file suffix (extension) that needs to be used ( you can use any file extension you like) |\n| parseList    | [{\"val\":\"entity\", \"match\":\"$ENTITY\"}] [more info in the ParseList section](#parselist)                                                        |\n\n### Templates\n\n| Property | Value                                                               |\n|----------|---------------------------------------------------------------------|\n| file     | The name of the template file (relative to the tempalteRoot folder) |\n| resFile  | Name of the resulting file                                          |\n\n### ParseList\n\nThe parselist itself lists all possible input variables (command line arguments) that can be processed. \n\n| Property | Value                                                               |\n|----------|---------------------------------------------------------------------|\n| val     | The value that will be injected in the matching placeholder |\n| match  | A placeholder referenced in your tpl files                                          |\n\n### Optional properties\n\n#### chain\nWhen you want to chain multiple commands you can add the \"chain\" property to a generator. \nThe following definition: `\"chain\":[\"repo\"]` will execute the `repo` generator (defined by the cmd property) once the called command has finished and right before the alterations are processed\n\n### alterations\n\nAlterations can be used to add extra functionality to existing files. \n\n```\n\"alterations\": [\n    {\n        \"name\":\"validationFactory\",\n        \"targetFolder\": \"Validation/Factory\",\n        \"autoCreateFolders\": true,\n        \"templateRoot\": \"validation\",\n        \"templates\": [\n            {\"file\":\"ivalidationfactory.tpl\", \"target\":\"IValidatorFactory.cs\"},\n            {\"file\":\"validationfactory.tpl\", \"target\": \"ValidatorFactory.cs\"}\n        ],\n        \"entryPoint\": \"$cookagen$\",\n        \"ext\": \"cs\",\n        \"parseList\": [\n            {\n                \"val\": \"command\",\n                \"match\": \"$CMD\"\n            },\n            {\n                \"val\": \"entity\",\n                \"match\": \"$ENTITY\"\n            }\n        ]\n    }\n]\n```\n\n## Expressions\nWithin a template file you can refer to a placeholder ([see ParseList](#parselist)) as follows:\n```\n{{$ENTITY}}\n```\n\nAll **cookagen** expressions need to be enclosed by 2 identical open and closing brackets on both sides. \n\nThe same expression syntax can be used throughout the **cookagen** config for all references to folderpaths or filenames.\nThe example generator config in the [generator section](#generators) for example will create a file based on the given $ENTITY placeholder value. You could use the same syntax to determine folder locations or other filename references.\n\nThe following command:\n```\n cookagen domain entity:User\n```\n\nWould create a file named `User.cs` in the given target folder\n\n### Functions\nThe following list of function can be used in combiation with placeholder values an may be chained.\n\n| Name       | Description                                           |\n|------------|-------------------------------------------------------|\n| lowerCase  | Converts a given string to lower case                 |\n| pascalCase | Capitalizes the first character of a given string     |\n| camelCase  | Puts the first letter of a given string in lower case |\n| plural     | Pluralizes a given string                             |\n\nExample usage:\n```\n// single function\n{{$ENTITY | camelCase}}\n// multiple function chaining\n{{$ENTITY | camelCase | plural}}\n```\n\n## License\n\nAll source code is made available under a MIT license. You can freely\nuse and modify the code, without warranty, so long as you provide attribution\nto the authors. See `LICENSE` for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaspercools%2Fcookagen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaspercools%2Fcookagen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaspercools%2Fcookagen/lists"}