@isdk/templify
v0.5.1
Published
π Instantly convert projects into template.
Readme
Templify: Instantly convert project into template
Turn any project into a reusable template in secondsβkeep your structure, replace variables smartly, and ship templates that just work.
Usage
Install templify
$ npm install -g @isdk/templify
$ templify COMMAND
running command...
$ templify (--version)
@isdk/templify/0.5.1 linux-x64 node-v20.19.4
$ templify --help [COMMAND]
USAGE
$ templify COMMAND
...Turn project into template
Navigate to your project directory and mark the parts of the relevant files that need to be replaced with template placeholders using {{VAR}}. Then, run the templify scan command to initialize the template variable file.
For example, modify the package.json file as follows:
{
"name": "{{name}}",
"description": "{{description}}",
"version": "{{version}}",
"author": "{{author}}",
"bugs": "{{githubUrl}}/issues",
"homepage": "{{githubUrl}}",
"keywords": {{keywords | tojson}},
...
}Run the templify scan command in the project directory:
templify scan
found template file: package.json
Scanned. found 1 template files
Saved ./.templify.yamlOpen the generated .templify.yaml file and make some edits:
files:
- package.json
parameters:
name:
type: string
default: my-package-name
title: Package Name
description: Enter your project name
description:
type: string
title: Package Description
description: Enter your project description
version:
title: Package Version
type: string
default: 0.1.0
author:
type: string
githubUrl:
type: string
default: https://github.com
keywords:
type: array
description: Enter your project keywordsNote:
- The default template format is a simplified version of
jinja2. - The files or folders in the
.gitignorewill be ignored.
Apply template data configuration to the template folder directly
Ok, now you can run templify apply command to apply the template data configuration to the template folder directly:
templify apply
ββ Templify: Instantly convert project into template βββββββββββββββββββββββββββ±
β
β Package Name
β Enter your project name
β my-name
β
β Package Description
β Enter your project description
β my-description
β
β Package Version
β 0.1.0
β
β author
β Riceball LEE @snowyu
β
β githubUrl
β https://github.com
β
ββ keywords ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ±
β
β Add keywords[1] to array (empty to finish)
β good
β
β Add keywords[2] to array (empty to finish)
β better
β
β Add keywords[3] to array (empty to finish)
β best
β
β Add keywords[4] to array (empty to finish)
β
β
β keywords
β°βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ±
β Templify: Instantly convert project into template
β°βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ±
skip: test/fixture/README.md
apply template: test/fixture/package.json done.
Appied. Enjoy your project at .Note:
- By default, the interactive mode is enabled.
- Use the
--no-interactiveflag to disable interactive mode. If a.templify-data.yamlfile exists in the template folder, it will apply the data from that file; otherwise, it will generate a.templify-data.yamldata file in the template folder. - Use the
-d your-data-file.yamlflag to specify the data file to apply.
Commands
templify TEMPLATE_DIR [DATA]
π Apply template data configuration etc to the template folder directly. This is the default command to run.
USAGE
$ templify TEMPLATE_DIR [DATA] [-d <value>] [-i] [-n]
ARGUMENTS
TEMPLATE_DIR [default: .] the template folder to apply
DATA the json data to apply. see also `--data data-file-path`
FLAGS
-d, --data=<value> the data file to apply. see also DATA argument
-i, --[no-]interactive interactive mode
-n, --dryRun dry run mode
DESCRIPTION
π Apply template data configuration etc to the template folder directly. This is the default command to run.
ALIASES
$ templify
EXAMPLES
$ templify .
Appied. Enjoy your project at "."templify apply TEMPLATE_DIR [DATA]
π Apply template data configuration etc to the template folder directly. This is the default command to run.
USAGE
$ templify apply TEMPLATE_DIR [DATA] [-d <value>] [-i] [-n]
ARGUMENTS
TEMPLATE_DIR [default: .] the template folder to apply
DATA the json data to apply. see also `--data data-file-path`
FLAGS
-d, --data=<value> the data file to apply. see also DATA argument
-i, --[no-]interactive interactive mode
-n, --dryRun dry run mode
DESCRIPTION
π Apply template data configuration etc to the template folder directly. This is the default command to run.
ALIASES
$ templify
EXAMPLES
$ templify apply .
Appied. Enjoy your project at "."See code: src/commands/apply/index.ts
templify scan TEMPLATE_DIR
π Scan the template folder and generate or update the template config file(".templify.yaml").
USAGE
$ templify scan TEMPLATE_DIR [-f <value>] [-n]
ARGUMENTS
TEMPLATE_DIR [default: .] the template folder to scan
FLAGS
-f, --files=<value> the file patterns to scan, split by comma
-n, --dryRun dry run mode
DESCRIPTION
π Scan the template folder and generate or update the template config file(".templify.yaml").
EXAMPLES
$ templify scan .
Scanned.See code: src/commands/scan/index.ts
