takeoff-cli

4.1.0 • Public • Published





$ takeoff

Build Status



Global Install

$ 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

  Usage
    $ takeoff

  A interactive cli prompt will ask you which of the found stations you want to create.

  Examples
    $ takeoff

Create a station

  1. Create a .takeoff folder in your project root
  2. Add a new directory named after your wanted station e.g. node-modules
  3. Create a __station.js in the new directory
  4. Fill:
module.exports = {
  requiredProps: ['content'], // required props, will be required in interactive CLI
  run: props => ({  // run function will be fired with - before - defined props
    files: [{ // return a files array, takeoff will use this information to create the files
      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`
      template: `My Content: ${props.content}`  // template is simply the content of the file
    }]
  })
};

Note that run(props) can be asynchronous (via async or by returning a Promise).

Stations discovery

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.

  • /Users/myuser/Documents/Projects/myCustomer/customerProject/.takeoff
  • /Users/myuser/Documents/Projects/myCustomer/.takeoff
  • /Users/myuser/Documents/Projects/.takeoff

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 example

Advanced

More specific interactive cli questions Pass valid inquirer objects in requiredProps for more specific questions.

Author

Thanks Nikita Tcherednikov for the rocket.

Dependencies (3)

Dev Dependencies (6)

Package Sidebar

Install

npm i takeoff-cli

Weekly Downloads

446

Version

4.1.0

License

MIT

Unpacked Size

14.1 kB

Total Files

13

Last publish

Collaborators

  • bitcloud
  • michaelzoidl