{"id":21691530,"url":"https://github.com/scientific-dev/templatify","last_synced_at":"2025-04-12T09:52:15.069Z","repository":{"id":64303245,"uuid":"355953865","full_name":"scientific-dev/templatify","owner":"scientific-dev","description":"A cli to create local templates and copy templates from github which is saved within your pc and used easily!","archived":false,"fork":false,"pushed_at":"2021-08-16T11:03:40.000Z","size":1923,"stargazers_count":5,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T09:52:04.605Z","etag":null,"topics":["cli","golang","templates","templatify","terminal"],"latest_commit_sha":null,"homepage":"","language":"Go","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/scientific-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-08T15:08:00.000Z","updated_at":"2022-01-16T09:58:26.000Z","dependencies_parsed_at":"2023-01-15T10:00:46.129Z","dependency_job_id":null,"html_url":"https://github.com/scientific-dev/templatify","commit_stats":null,"previous_names":["scientific-guy/templatify"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scientific-dev%2Ftemplatify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scientific-dev%2Ftemplatify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scientific-dev%2Ftemplatify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scientific-dev%2Ftemplatify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scientific-dev","download_url":"https://codeload.github.com/scientific-dev/templatify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248550635,"owners_count":21122932,"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","golang","templates","templatify","terminal"],"created_at":"2024-11-25T17:38:56.822Z","updated_at":"2025-04-12T09:52:15.046Z","avatar_url":"https://github.com/scientific-dev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Templatify\n\n[![](https://www.codefactor.io/repository/github/scientific-guy/templatify/badge?style=for-the-badge)](https://www.codefactor.io/repository/github/scientific-guy/templatify)\n[![](https://img.shields.io/badge/INSTALL-TEMPLATIFY-white?style=for-the-badge)](https://github.com/Scientific-Guy/templatify/wiki/Installation)\n[![](https://img.shields.io/github/v/tag/Scientific-Guy/templatify?style=for-the-badge\u0026label=version)](https://github.com/Scientific-Guy/templatify)\n\nA cli to create local templates and copy templates from github which is saved within your pc and used easily! You can view the installation guide for templatify [here](https://github.com/Scientific-Guy/templatify/wiki/Installation).\n\n\u003e This project is currently under development. Incase if you want to help create a pr or an issue. ~~The code might look unorganized~~.\n\n## Quick guide\n\n### Version\n\nYou can view up the version by\n\n```sh\n\u003e templatify --version\nCurrent templatify version: 1.1.0\n```\n\n### Saving templates\n\nYou can save the current working directory as a template!\n\n```sh\n\u003e templatify save TestTemplate\nSUCCESS: Successfully copied template with name as \"TestTemplate\"\n```\n\nSo here `TestTemplate` is the name of the template to save. If none provided will save with the name of directory. \n\u003e Name of the template should not contain spaces!\n\nYou can also use configuration file like `templatify.config.json`! An example of the config file is\n\n```json\n{\n    \"name\": \"TestTemplate\",\n    \"description\": \"This is my test template\",\n    \"delimiter\": \"%\",\n    \"parseFiles\": \"*.js\",\n    \"preScripts\": [\n        \"echo \\\"I have been ran by templatify!\\\"\"\n    ],\n    \"ignore\": [\n        \"node_modules\",\n        \"package-lock.json\",\n        \"test/*.js\"\n    ],\n    \"scripts\": {\n        \"test\": \"echo Test script executed\"\n    }\n}\n```\n\nThere are more configuration can be done with that! Here is are list of fields. **All are optional fields**.\n\n- **name** - Name of the template to save.\n- **description** - Not useful. But will help you to remember what the template is for.\n- **preScripts** - Array of subprocess scripts to execute while creating the template.\n- **ignore** - Array of files to ignore when saving as a template.\n- **delimiter** - The delimiter for parsing files, by default it will be as `%` which will be used as `%{key}`. If you set it as `$` then it would be `${key}` to be parsed.\n- **parseFiles** - A glob string for the files to be parsed. This will be required to enable parsing else it would not. Remember if the template consists of any binary files, it might throw error while parsing files so use a perfect glob string for it.\n- **scripts** - Scripts to work with the template.\n\n\u003e You can directly use `templatify init` to create a default config file!\n\nNormally this template overwrite over the old changes if exists. If you want to completely delete and save as a fresh template you have to use `--clean` flag\n\n```sh\n\u003e templatify save TestTemplate --clean\nINFO: Successfully cleaned directory.\nSUCCESS: Successfully copied template with name as \"TestTemplate\"\n```\n\nYou can also use templates stored in github\n\n```sh\n\u003e templatify get repo\nCONFIRM Perform template configuration? (y/n) y\nINFO Performing termplate configuration.\nSUCCESS Saved \"repo\" as a template.\n```\n\nSo here repo should be something like `username/reponame`. But any github repo cannot be a templatify template it must have a `templatify.config.json` file in the root of it. You can view how to convert your github repository to a templatify template [here](https://github.com/Scientific-Guy/templatify/wiki/Github-repository-to-a-template)   Currently there is no support to import from branches. While downloading the repo as a template it might ask you to allow template configuration, this will remove ignore files. And also it would have the `.git` folder with it but if you want to prevent it while using the template you can use the `--no-git` flag while using it. \n\n\u003e Using the `name` field in the config file in the repo is useless because when storing the template it would be `username/reponame`. You can still keep the name field.\n\n\u003e Templates are stored in `templates` directory in the directory where templatify exists\n\n### Using templates\n\nYou can use a template into a directory like this\n\n```sh\n\u003e templatify use TestTemplate\nINFO Copying template \"TestTemplate\" to \"E:\\Projects\\test\".\nINFO Cloned files.\nPRE-SCRIPT echo \"I have been ran by templatify!\"\nI have been ran by templatify!\nINFO Ran all preScripts.\nSUCCESS Finished in 0s\n```\n\nIn any case you want to store it in a custom path within the current working directory lets say you want to store it in `my-template` subdir you can do something like this\n\n```sh\n\u003e templatify use TestTemplate --custom-path=my-template\nINFO Copying template \"TestTemplate\" to \"E:\\Projects\\test/my-template\".\nINFO Cloned files.\nPRE-SCRIPT: echo \"I have been ran by templatify!\"\nI have been ran by templatify!\nINFO Ran all preScripts.\nSUCCESS Finished in 0s\n```\n\n\u003e There might be problems with forward slashes and backward slashes on file paths which will not matter alot because they are only for representation.\n\nWhile using the template you might see a additional file named `templatify.lock.json` which is a lock file saving all configurations. You can remove it though by using `--remove-lock` flag.\n\n```sh\n\u003e templatify use TestTemplate --custom-path=my-template --remove-lock\nINFO Copying template \"TestTemplate\" to \"E:\\Projects\\test/my-template\".\nINFO Cloned files.\nPRE-SCRIPT echo \"I have been ran by templatify!\"\nI have been ran by templatify!\nINFO Ran all preScripts.\nSUCCESS Finished in 0s\n```\n\nWhen saving any template with the `.git` directory with it might confuse with the current git in the path to use the template in that case you can use the `--no-git` flag. This might be useful to use a template from github and not use the git.\n\nIf you think pre scripts of a project is suspicious (imported from github or anywhere). You can run the `use` command with the `--disable-pre-scripts` flag.\n\n### Using scripts\n\nWith templatify v1.1, you can use templatify scripts by adding the `scripts` field inspired from npm's `package.json`. For example if your config file has the following:\n\n```json\n{\n    \"scripts\": {\n        \"test\": \"echo Test script executed.\",\n        \"build\": \"some build script\"\n    }\n}\n```\n\nThe following script below \n\n```sh\n\u003e templatify exec build\n# Some build script execution\n```\n\nAnd there is an alias to execute the test script\n\n```sh\n\u003e templatify test\nTest script executed.\n```\n\n### Get all templates\n\nYou can view what and all templates you have stored by\n\n```sh\n\u003e templatify all\nAll the templates saved.\n\n1. TestTemplate\n\nYou can use `templatify info \u003ctemplate-name\u003e` to show the information!\n```\n\n### Get paticular template\n\nYou can view the information about a template\n\n```sh\n\u003e templatify info TestTemplate\nTemplate information of \"TestTemplate\"\n\n- Name:             TestTemplate\n- Description:      This is my test template\n- Pre-Scripts:      echo \"I have been ran by templatify!\"\n- Ignored files:    node_modules, package-lock.json, test/*.js\n```\n\nTo view the files of a template you can do something like\n\n```sh\n\u003e templatify list TestTemplate\nTemplate structure for \"TestTemplate\"\n\n- templatify.lock.json\n- package.json\n- index.js\n- templatify.config.json\n- test/\n    - main_test.go\n    - main.go\n```\n\n\u003e You will be viewing a `templatify.lock.json` file in the template structure. You can remove it while using the template using `--remove-lock`.\n\n### Removing templates\n\nIf you want to remove template you have to do:\n\n```sh\n\u003e templatify remove TestTemplate\nCONFIRM Are you sure? (y/n) y\nSUCCESS Deleted template successfully.\n```\n\nYou can also remove all templates\n\n```sh\n\u003e templatify removeall\nCONFIRM Are you sure? (y/n) y\nSUCCESS Deleted all templates successfully.\n```\n\n## Contributors\n\n- [@abh80](https://github.com/abh80) *For testing and reporting bugs*","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscientific-dev%2Ftemplatify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscientific-dev%2Ftemplatify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscientific-dev%2Ftemplatify/lists"}