https://github.com/hans00/initial-cli
Initialize project command
https://github.com/hans00/initial-cli
cli initial-cli initialize template
Last synced: 4 months ago
JSON representation
Initialize project command
- Host: GitHub
- URL: https://github.com/hans00/initial-cli
- Owner: hans00
- Created: 2018-12-01T07:30:10.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-29T23:37:19.000Z (almost 3 years ago)
- Last Synced: 2025-04-02T23:35:46.307Z (10 months ago)
- Topics: cli, initial-cli, initialize, template
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/initial-cli
- Size: 3.62 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# initial-cli
A project initializer.
---
## How to use
### from GitHub
```sh
initial [github/]/[#branch]
```
### from GitLab
```sh
initial gitlab//[#branch]
```
### from other git repo
```sh
initial [#branch]
// or pre-set short name
initial //[#branch]
```
### alias git repo
> Edit the configure file before use this.
```sh
initial
```
### Configure file
#### `$HOME`/.init/config.json
```json
{
"short_name": {
"private-git": "https://example.com/{owner}/{slug}.git"
},
"alias": {
"example": "private-git/owner/template"
}
}
```
## How create template
### Assets file
> The asset files will remove after initialized.
> You can put the option files in it.
>
> The directory name is `.init-assets`.
### Initialize file
> File name: `.init.js`
>
> Inquire uses module who names `Inquirer.js`.
```js
// you can require: fs, path, glob, rimraf, and other core modules
exports.questions = [
{} // your questions, see: Inquirer.js
];
exports.preprocess = function (answer, module) {
// the JS codes
// you can copy the file from assets
// module.rm => rimraf.sync
// module.copy => fs.copySync
}
```
### Template files
> All `*.*` file except `.init.js` or under `.init-assets`
>
> All question answer and project_name will pass into the template processor.
Usage
```js
// direct output variable using syntax as %var_name%
title = "%project_name%"
// boolean condition
#if boolVal#
#endif#
#if boolVar eq true#
#endif#
// string condition
#if strVar eq 'value'#
#endif#
#if strVar ne 'value'#
#endif#
// list condition
#if listVar has 'value'#
#endif#
```