{"id":15631300,"url":"https://github.com/yonaskolb/genesis","last_synced_at":"2025-04-10T05:07:28.589Z","repository":{"id":31694274,"uuid":"128606846","full_name":"yonaskolb/Genesis","owner":"yonaskolb","description":"Templating, scaffolding and generation tool","archived":false,"fork":false,"pushed_at":"2024-02-14T12:20:19.000Z","size":93,"stargazers_count":196,"open_issues_count":5,"forks_count":18,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-10T05:07:22.390Z","etag":null,"topics":["cli","generator","scafolding","swift","templating","tool","yaml"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/yonaskolb.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":"2018-04-08T06:31:19.000Z","updated_at":"2025-03-06T20:33:53.000Z","dependencies_parsed_at":"2024-01-14T04:40:13.894Z","dependency_job_id":"2067fe99-9ca6-46d1-aab4-e66ceaeeb826","html_url":"https://github.com/yonaskolb/Genesis","commit_stats":{"total_commits":63,"total_committers":8,"mean_commits":7.875,"dds":0.4285714285714286,"last_synced_commit":"b293adb1a1e422c4d71c315783bf221ffcdd40b4"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonaskolb%2FGenesis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonaskolb%2FGenesis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonaskolb%2FGenesis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonaskolb%2FGenesis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yonaskolb","download_url":"https://codeload.github.com/yonaskolb/Genesis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248161273,"owners_count":21057555,"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":["cli","generator","scafolding","swift","templating","tool","yaml"],"created_at":"2024-10-03T10:39:53.914Z","updated_at":"2025-04-10T05:07:28.563Z","avatar_url":"https://github.com/yonaskolb.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Genesis\n\n[![SPM](https://img.shields.io/badge/spm-compatible-brightgreen.svg?style=for-the-badge)](https://swift.org/package-manager)\n[![Git Version](https://img.shields.io/github/release/yonaskolb/Genesis.svg?style=for-the-badge)](https://github.com/yonaskolb/Genesis/releases)\n[![license](https://img.shields.io/github/license/yonaskolb/Genesis.svg?style=for-the-badge)](https://github.com/yonaskolb/Genesis/blob/master/LICENSE)\n\nGenesis is a templating and scaffolding tool.\n\nA Genesis template is a manifest of options and files written in yaml or json. Option values can be provided in [various ways](#providing-options) otherwise you will be interactively asked for inputs. Template files are written in [Stencil](https://github.com/stencilproject/Stencil). The list of files can make use of dynamic paths and be generated multiple times depending on the format of the input.\n\n- ✅ Template manifests in easy to read and write **yaml or json**\n- ✅ Template files written in **Stencil** templating language\n- ✅ Provide **options** via ENV, command line, file or interactively\n- ✅ Powerful command line **interactivity** with choices, lists and branching\n- ✅ Write **dynamic** file paths\n\nThe very simple example:\n\n```yaml\noptions:\n  - name: project\n    description: The name of the project\n    question: What is the name of your project?\n    required: true\n    type: string\nfiles:\n  - template: project.stencil\n    path: \"{{ project }}.project\"\n```\n\nAnd then run like this:\n\n```sh\n$ genesis generate template.yml\nWhat is the name of your project? MyProject\nGenerated files:\n  MyProject.project\n```\n\nOr you can provide the required options via arguments\n\n```sh\n$ genesis generate template.yml --options name:MyProject\nGenerated files:\n  MyProject.project\n```\n\nMuch more powerful templates are possible. See more complete documentation [here](#template)\n\n## Installing\nMake sure Xcode 13 is installed first.\n\n#### [Mint](https://github.com/yonaskolb/mint)\n```sh\n$ mint install yonaskolb/genesis\n```\n\n### Make\n\n```sh\n$ git clone https://github.com/yonaskolb/Genesis.git\n$ cd Genesis\n$ make\n```\n\n### Swift Package Manager\n\n**Use CLI**\n\n```sh\n$ git clone https://github.com/yonaskolb/Genesis.git\n$ cd Genesis\n$ swift run mint\n```\n\n**Use as dependency**\n\nAdd the following to your Package.swift file's dependencies:\n\n```swift\n.package(url: \"https://github.com/yonaskolb/Genesis.git\", from: \"0.1.0\"),\n```\n\nAnd then import `GenesisKit`. See [GenesisKit](#genesiskit) for more information.\n\n\n## Usage\n\nRun `genesis help` for usage instructions\n\n```\nUsage: genesis generate \u003ctemplatePath\u003e [options]\n\nOptions:\n  -d, --destination \u003cvalue\u003e    Path to the directory where output will be generated. Defaults to the current directory\n  -h, --help                   Show help information for this command\n  -n, --non-interactive        Do not prompt for required options\n  -o, --options \u003cvalue\u003e        Provide option overrides, in the format --options \"option1: value 2, option2: value 2.\n  -p, --option-path \u003cvalue\u003e    Path to a yaml or json file containing options\n```\n\n## Providing options\nOptions will be passed to the template in the following order, merging along the way, with duplicate options overriding the previous ones.\n\n#### 1. Environment Variables\nSet any environment variables before you call generate, or use already existing ones from your development environment\n\n```\nname=\"My Name\" genesis generate template.yml\n```\n\n#### 2. Options File\nPass a path to a json or yaml file with `--option-file`\nThis can include more structures and complex data. For example:\n\n```yaml\nname: MyProject\ntargets:\n  - name: MyTarget\n    type: application\n  - name: MyFramework\n    type: framework  \n```\n\n#### 3. Options Argument\nPass specific options with `--options` like this\n\n```\n-- options \"option1: value 2, option2: value 2\"\n```\n\n#### 4. Interactive input\nGenesis will ask you for any missing options if they are required. You can turn off interactive input with `--non-interactive`.\n\n#### 5. Default value\nEach option can have a default `value` which be used as a fallback. \n\n#### Missing value\nIf an option is required and still hasn't received a value from anywhere, generation will fail.\n\n## Template\nA genesis template is a yaml or json file that includes a list of `options` and `files`\n\n#### Options\nOptions are structured input for the `Stencil` templates. They serve as documentation and allow for Genesis to interactively ask for input.\n\n- **name**: This is the name that is referenced in the template as well as the command line\n- **value**: This is the default value that will be used if none are provided. This can have Stencil tags in it\n- **question**: The question that is asked when asking for input. This can have Stencil tags in it\n- **description**: An extended description of the option and what it does\n- **required**: Whether this option is required or not for the template to generate. If it is not provided via the command line, option file, or input, generation will fail\n- **type**: This is the type of option. It defaults to `string` but can be any one of the following:\n\t- `string` a simple string\n\t- `boolean` a boolean\n\t- `choice` a string from a list of choices. Requires `choices` to be defined\n\t- `array` an array of other options. If child `options` are defined, if will be an array of options, otherwise it will split a string by command, removing any whitespace between\n- **options**: An array of child options. Used if the `array` type contains objects\n \n#### Files\n\n- **path**: This is the path the file will be generated at. It can include `Stencil` tags to make it dynamic.\n- **contents**: A file template string\n- **template**: A path to a file template\n- **copy**: A path to copy. This can be a file or a directory\n- **context**: An optional context property path that will be passed to the template. If this resolves to an array, a file for each element will be created, using tags in `path` to differentiate them.\n- **include**: Whether the file should be written. This is a Stencil if tag without the braces. For example instead of `{% if type == 'framework' %}` you would write `type == 'framework'`\n\n## Stencil Templates\nEach Stencil template has all the filters available in [StencilSwiftKit](https://github.com/SwiftGen/StencilSwiftKit), and has access to all the [options](#options). See [Stencil](https://github.com/stencilproject/Stencil) for more info about tags.\n\nSmall example:\n\n```\n{% if name %}\nname: {{ name }}\n{% endif %}\n```\n\n## GenesisKit\nThe library `GenesisKit` can be used to easily provide generation in your own tools.\n\n```swift\nimport GenesisKit\n\n// create a context\nlet context: [String: Any] = [\"name\": \"hello\"]\n\n// create a template, either from a file or programmatically\nlet template = try GenesisTemplate(path: \"template.yml\")\n\n// Create the generator\nlet generator = try TemplateGenerator(template: template)\n\n// generate the files\nlet generationResult = try generator.generate(context: context, interactive: false)\n\n// write the files to disk\ntry generationResult.writeFiles(path: \"destination\")\n\n```\n\n## Contributions\nPull requests and issues are welcome\n\n## License\n\nGenesis is licensed under the MIT license. See [LICENSE](LICENSE) for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyonaskolb%2Fgenesis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyonaskolb%2Fgenesis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyonaskolb%2Fgenesis/lists"}