Nightly Perpetrated Mischief

    clean-blacksmith

    1.0.5 • Public • Published

    Generate a clean-architecture skeleton project easy and fast!.

    Clean Blacksmith CircleCI

    Synopsis

    Clean Blacksmith will help you create the base of your domain, so you can only focus on the implementation! just tell the CleanBlacksmith where you want to create your files and give him a blueprint(only JSON format supported at the moment) and he will take care of the rest.

    Installation

    As a node dependency

    npm install --save-dev clean-blacksmith

    Or as a CLI tool

    npm install [-g] clean-blacksmith

    Usage

    You have two options of usage:

    As a node module

    After instalation, just require clean-blacksmith and then give a command and details as parameters:

    var cleanBlacksmith = require('clean-blacksmith');
    
    var command = 'forge';
    var details = { target: '/some/url', blueprint: '/some/url/blueprint.json' };
    
    cleanBlacksmith(command, details)
      .then(result => { console.log('success') })
      .catch(error => { console.log('ups!') });
    

    The blacksmith will give you some feedback through log messages to see what has been created:

    Sample console output:
    createdDomainFiles: '<TARGET PATH>/domain/entities/Sword.js'
    createdDomainFiles: '<TARGET PATH>/domain/entities/index.js'
    createdDomainFiles: '<TARGET PATH>/domain/interactors/swordInteractor.js'
    createdDomainFiles: '<TARGET PATH>/domain/interactors/index.js'
    createdDomainFiles: '<TARGET PATH>/domain/stores/swordStore.js'
    createdDomainFiles: '<TARGET PATH>/domain/stores/index.js'
    createdDomainFiles: '<TARGET PATH>/domain/useCases/forgeSword.js'
    createdDomainFiles: '<TARGET PATH>/domain/useCases/index.js'
    createdDomainFiles: '<TARGET PATH>/domain/domain/index.js'
    forge: Finished forging! Happy coding :)
    

    As CLI tool

    If you like to use your terminal to create your domain, this module offers as well a CLI tool called vulcan. Vulcan recieves a command and some parameters in order to create your service domain.

    Example:

    vulcan <COMMAND> --target <PATH> --blueprint <PATH>
    
    vulcan forge --target "/path-to-project/" --blueprint "/path-to-blueprint/blueprint.json"
    

    If you need to learn what is the current available commands, you can display the help:

    vulcan --help [-h]
    

    Blueprint file

    The blueprint file defines the way our domain is constructed, this is required in order to know how layers are defined. The file at the moment only supports JSON format but it will be target later to support more formats.

    NOTE: This project contains two full blueprint examples definitions in the /examples folder.

    for example:
    {
      "entities": [
        {
          "name": "Sword",
          "props": ["type","weight"]
        }
      ],
      "interactors": [
        {
          "name": "swordInteractor",
          "dependencies": ["entities", "stores"],
          "functions": {
            "requestMaterials": { "args": [] },
            "meltSilver": { "args": [], "isAsync": true }
          }
        }
      ],
      "stores": [...],
      "useCases": [
        {
          "name": "forgeKatana",
          "dependencies": ["swordInteractor"],
          "args": ["swordMaterials"]
        }
      ]
    }
    

    Further plans

    • Inlude more command options: ammend, enhance, destroy.
    • Add a way to create the blueprint in a more friendly way. UI will be ideal

    Install

    npm i clean-blacksmith

    DownloadsWeekly Downloads

    1

    Version

    1.0.5

    License

    ISC

    Unpacked Size

    54.5 kB

    Total Files

    68

    Last publish

    Collaborators

    • graned