Skip to content

Commit 0af4a74

Browse files
committed
update readme
1 parent 98492b3 commit 0af4a74

File tree

1 file changed

+37
-28
lines changed

1 file changed

+37
-28
lines changed

README.md

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
44

5-
Scaffold structures - pre-defined or custom
5+
Scaffold structures - predefined or custom
66

77
### Install
88
```
@@ -11,48 +11,57 @@ npm install takeoff-cli -g
1111

1212
### Usage
1313
```
14-
$ takeoff --help
14+
$ takeoff
1515
1616
Usage
17-
$ takeoff <command>
17+
$ takeoff
1818
19-
Command can be:
20-
stations: node-module | react-app
21-
global: init | help
22-
23-
init
24-
You can create a .takeoff folder in your project and takeoff will use your custom scaffoldings
25-
26-
Each station requires different parameters, the interactive
27-
28-
Global Options
29-
--no-git The takeoff will not contain a git-setup
19+
Interactive Command-Line-Interface starts
3020
3121
Examples
32-
$ takeoff node-module --without
22+
$ takeoff
3323
```
3424

3525
### Interactive UI
36-
_Todo__
26+
_Todo_
27+
28+
### Predefined Stations
29+
#### `node-module`
30+
**requiredProps**
31+
- package-name
32+
- license
3733

38-
### Create a custom station
34+
**What you get**
35+
- `package.json`
36+
- full `.gitignore`
37+
- preformated `README`
38+
- selected `LICENSE`
39+
- empty `yarn.lock`
40+
41+
### Create a custom station for your own project
3942
1. Create a `.takeoff` folder in your project root
4043
2. Add a new directory named after your wanted `station` e.g. `node-modules`
41-
3. Create a `__station.js`
42-
4. Use the format:
44+
3. Create a `__station.js` in the new directory
45+
4. Fill:
4346
```js
4447
module.exports = {
45-
requiredProps: ['content'],
46-
targetRoute: '',
47-
run: props => ({
48-
files: [{
49-
filename: 'my-file.txt',
50-
template: 'This is the content my file has: ' + props.content
51-
}})
48+
requiredProps: ['content'], // required props, will be required in interactive CLI
49+
run: props => ({ // run function will be fired with - before - defined props
50+
files: [{ // return a files array, takeoff will use this information to create the files
51+
filename: 'my-file.txt', // choose here the filename, if you want to create a file in a deeper folder just add the path `my/folder/my-file.txt`
52+
template: `My Content: ${props.content}` // template is simply the content of the file
53+
}]
54+
})
5255
};
5356
```
54-
You see, there is a array with `requiredProps`, this information uses the interface to get the specific props.
55-
When the user has given us all prop-informations and everything passed, the `run()` function executes, here we expect a returned object within a `files` array, each item (a object) holds the information about the filename and the content of the file.
57+
Checkout the example stations in [`example`](https://github.com/entwicklerstube/takeoff/tree/master/example)
58+
59+
#### Advanced
60+
**More specific interactive cli questions**
61+
Pass valid [`inquirer objects`](https://github.com/SBoudrias/Inquirer.js#objects) in `requiredProps` for more specific questions.
62+
63+
**Run script after creating files**
64+
Add a `postTakeoff` function to your `__station.js` configuration, after successfully creating the files this will be executed
5665

5766
#
5867

0 commit comments

Comments
 (0)