Custom use case: scaffolding a npm package¶
As mentioned in previous section, yehua would take a yehua.yml from command line options. This section walk you through creating a npm package, non-python package.
If you are familiar with npm, you can try and compare with yehua:
$ npm init
Evaluation¶
Please first checkout yehua repository so that you will have the access to example directory. Then make sure you have yehua installed.
yehua.yml for npm package¶
Let us go through the variant yehua file.
configuration section¶
configuration:
template_path: .
static_path: .
questions:
the current directory where yehua.yml file is, is configured as the folder for templates and static files.
user questions section¶
questions:
- project_name: "name:"
- version: "version:"
- description: "description:"
- entry_point: "entry point:"
- test_command: "test command:"
- git_repo: "git repository:"
- keywords: "keywords:"
- author: "author:"
- license: "license:"
the questions here are prompted to collect user inputs.
templates section¶
templates:
- package.json: package.json.jj2
Now the variables are used in template package.json.jj2 into package.json.
static section¶
static:
- index.js: index.js
Now, yehua simply copies index.js to target package folder.