{"id":13505502,"url":"https://github.com/vala-lang/valdo","last_synced_at":"2025-02-26T02:42:51.053Z","repository":{"id":41893648,"uuid":"373027582","full_name":"vala-lang/valdo","owner":"vala-lang","description":"Create new Vala projects from templates","archived":false,"fork":false,"pushed_at":"2023-07-02T20:47:28.000Z","size":149,"stargazers_count":52,"open_issues_count":9,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-08T16:24:20.897Z","etag":null,"topics":["templates","vala","vala-developers"],"latest_commit_sha":null,"homepage":"","language":"Vala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vala-lang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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":"2021-06-02T03:25:21.000Z","updated_at":"2024-10-08T14:24:02.000Z","dependencies_parsed_at":"2024-05-03T02:57:20.534Z","dependency_job_id":"fe39db06-1814-4a28-999b-fd3932225313","html_url":"https://github.com/vala-lang/valdo","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vala-lang%2Fvaldo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vala-lang%2Fvaldo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vala-lang%2Fvaldo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vala-lang%2Fvaldo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vala-lang","download_url":"https://codeload.github.com/vala-lang/valdo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240783111,"owners_count":19856776,"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":["templates","vala","vala-developers"],"created_at":"2024-08-01T00:01:09.141Z","updated_at":"2025-02-26T02:42:50.894Z","avatar_url":"https://github.com/vala-lang.png","language":"Vala","funding_links":[],"categories":["CLI Tools"],"sub_categories":["Weather"],"readme":"# Valdo\n\n_(like \"**Val**a **Do**\", pronounced like \"Waldo\")_\n\nCreate a new Vala project from a repository of templates.\n\n## Installation\n\nPackages are available for Fedora, Ubuntu, Debian, and more via\n[OBS](https://software.opensuse.org//download.html?project=home%3APrince781\u0026package=valdo).\n\nTo install from source, clone this repository and run:\n`meson build \u0026\u0026 meson install -C build`\n\n## Example use\n\n`valdo new` - initializes a new project (from a template `new`) in the current directory\n\n`valdo gtk` - initializes a new GTK app\n\n`valdo lib` - initializes a new library\n\n`valdo` - lists all available templates\n\n## Creating a new a template\n\nTemplates should be added here so that they can be used by everyone.\n\nFork this repository and add a new directory under `templates/`. The name of\nthe directory is the template name. Then you need to add a `template.json`\ndescribing the template, the variables it uses, and the files that need to be\nsubstituted.\n\nHere is what a template might look like:\n\n```\n.\n├── meson.build\n├── README.md\n├── src\n│   ├── main.vala\n│   └── meson.build\n└── template.json\n\n1 directory, 5 files\n```\n\nYour `template.json` may start off looking like:\n\n```json\n{\n    \"description\": \"a bare app, with minimal dependencies\",\n    \"variables\": {\n        \"PROGRAM_NAME\": {\n            \"summary\": \"the name of the program\",\n            \"default\": \"main\"\n        }\n    },\n    \"templates\": [\n        \"src/meson.build\",\n        \"meson.build\",\n        \"README.md\"\n    ]\n}\n```\n\n`\"templates\"` is a list of template files, containing variables to be\nsubstituted.\n\n`\"variables\"` is a dictionary mapping each variable name to a short\ndescription. Having a default value for a variable is optional. There are at\nleast two variables every template uses, `PROJECT_NAME` and `PROJECT_VERSION`,\nwhich you don't have to specify.\n\nFor every variable listed, the template engine will substitute\n`${VARIABLE_NAME}` in each templated file. If a variable does not have a\ndefault value, Valdo will prompt the user. The rest of the files in the\ntemplate directory will be copied over unmodified.\n\n**Once you're done, submit a PR to https://github.com/vala-lang/valdo**\n\n### Advanced template features\n\n#### Variable substitution\n\nYou can define a variable's default value in terms of another variable like so:\n\n```json\n{\n    \"variables\": {\n        \"API_NAMESPACE\": {\n            \"summary\": \"the API namespace\",\n            \"default\": \"MyLib\",\n            \"pattern\": \"^[A-Za-z][[:word:]]*$\"\n        },\n        \"LIBRARY_NAME\": {\n            \"summary\": \"the name of the library\",\n            \"default\": \"/${API_NAMESPACE}/\\\\w+/\\\\L\\\\g\u003c0\u003e\\\\E/\",\n            \"pattern\": \"^[[:word:]][[:word:]-]*$\"\n        },\n        \"APP_ID\": {\n            \"summary\": \"the application ID\",\n            \"default\": \"com.${USERNAME}.${API_NAMESPACE}\",\n            \"pattern\": \"^\\\\w+(\\\\.\\\\w+)*$\"\n        }\n    }\n}\n```\n\nHere, this means that `LIBRARY_NAME` will be auto-generated from the namespace\nname, unless the user enters something different in a prompt [^1]. In this case, if\nthe user enters nothing for `API_NAMESPACE` and `LIBRARY_NAME`, the result will\nbe `mylib`.\n\nThe syntax is to write the variable name, then a regular expression that\nmatches something you want to replace, then a regular expression for the\nreplacement. Here, `\\L` says \"make lowercase\", `\\g\u003c0\u003e` matches group 0 or the\nentire string matched, and `\\E` ends the conversion. Consult the [docs for\nGLib.Regex.replace()](https://valadoc.org/glib-2.0/GLib.Regex.replace.html) for\nmore information about how regex syntax is used in GLib.\n\nIf you wanted to substitute another pattern in the text, you just have to add\nanother pair of regexes separated by a `/`. For example:\n\n```\n\"default\": \"/${API_NAMESPACE}/\\\\w+/\\\\L\\\\g\u003c0\u003e\\\\E/bob/greta/\"\n```\n\nAfter converting everything to lowercase, then substitute \"bob\" for \"greta\".\nThe substitutions will be applied in the order they appear, one after another.\n\n[^1]: You can specify `\"auto\": true` for the variable to make it completely\n  automatic, so there's no prompting the user. This is useful when generating\n  variable names in build scripts, for example.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvala-lang%2Fvaldo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvala-lang%2Fvaldo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvala-lang%2Fvaldo/lists"}