Skip to content

Makes it possible to create components with a cli

License

Notifications You must be signed in to change notification settings

Jokinen/create-from-blueprint

Repository files navigation

Create from Blueprint CircleCI

BETA version disclaimer: This package is still very volatile, use with caution.

Gives ability to copy a file structure into a certain path renaming the file paths and the files' content.

Can be used with React to provide component and container blueprints, in which case creating a new component is done with a single command instead of manually creating and filling all the files. This has the added benefit of providing teams the ability to offer and enforce common patterns for developers.

Getting started

Install

yarn add -D create-from-blueprint
npm i --save-dev create-from-blueprint

Usage

1. Define blueprints in your package.json

{
  "createFromBlueprint": {
    "component": "blueprints/component/",
    "container": "blueprints/container/"
  }
}

key
Type of the blueprint (component, container)

value
A path pointing to an existing folder (blueprints/component/, ...)

2. Run the command

create-from-blueprint <destination>

2.1. You'll be asked to choose a type from a list1
2.2. And input a name

Instances of type, beginning with a lowercase or uppercase letter, will be replaced with name

  • In file paths: Every instance of {% type %} will be replaced with name for the files within the folder the blueprint config targets
  • In file contents: Every instance of type will be replaced with name

1 The list consists of keys from the config field

Further details

Commander --help output

  $ create-from-blueprint --help

  Usage: create-from-blueprint [options] <destination>

  Options:

    -n, --name <name>  The name of the created component
    -t, --type <type>  The name of the component type defined in the config
    -h, --help         output usage information

When type or name is missing, both will be asked for with inquirer. You can input everything in one go as well by providing both (type, name) of the options.

create-from-blueprint -t component -n InvoiceItem components

Inspiration

Django's startapp which automatically generates a base for a new application.

Built with

License

This project is licensed under the MIT License - see the license file for details

TODO

  • Single file blueprint support

About

Makes it possible to create components with a cli

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published