$ npm install takeoff-cli -g
Project Local Install
$ npm install takeoff-cli
If you add takeoff then as an npm script, keep in mind that
npm run changes the execution directory to the root of the project before execution. So you won't take advantage of multiple
.takeoff folders inside your project then.
Usage $ takeoff A interactive cli prompt will ask you which of the found stations you want to create. Examples $ takeoff
Create a station
- Create a
.takeofffolder in your project root
- Add a new directory named after your wanted
- Create a
__station.jsin the new directory
moduleexports =requiredProps: 'content' // required props, will be required in interactive CLI// run function will be fired with - before - defined propsfiles: // return a files array, takeoff will use this information to create the filesfilename: '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`template: `My Content: ` // template is simply the content of the file;
run(props) can be asynchronous (via
async or by returning a Promise).
takeoff discovers all stations (.takeoff folders) beginning from the execution directory up to the root path. This makes it possible to have different stations in different contextes. E.g. you could have some Project specific, some Customer specific and some global stations defined.
Invoking takeoff in
/Users/myuser/Documents/Projects/myCustomer/customerProject would result in:
? What do you want to create? (Use arrow keys) Stations from "/Users/myuser/Documents/Projects/myCustomer/customerProject/.takeoff" ❯ projectStation Stations from "/Users/myuser/Documents/Projects/myCustomer/.takeoff" customerStation Stations from "/Users/myuser/Documents/Projects/.takeoff" globalStation
Checkout the example stations in
More specific interactive cli questions
inquirer objects in
requiredProps for more specific questions.
Thanks Nikita Tcherednikov for the rocket.