0.0.3 • Published 4 years ago

@capsulajs/capsulahub-cli v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Build Status

Capsula Hub

Description

CapsulaHub is part of CapsulaJS project, it is one of CapsulaJS pillars but it can be used stand alone. It is an CLI tool to help you to develop and test your micro-frontend services !

Local development

# from the root
npm link packages/cli
cd packages/cli/node_modules
find . -maxdepth 1 -type d \! \( -name ".bin" -o -name ".cache" \) -exec rm -rf "{}" \;
# now you can use capsulahub binary anywhere in the repository
# for example:
capsulahub --help
capsulahub run --token=http://localhost:3000/configuration --configProvider=httpFile --port=8888

Install

In your project, run $ npm install --save-dev @capsulajs/capsula-hub or $ yarn add -D @capsulajs/capsula-hub.
If you want to use capsulahub command directly, you can install it globally.

Usage

capsulahub --help
Usage: capsulahub [options] [command]

Options:
  -h, --help       output usage information

Commands:
  run [options]    Run a Capsulahub application locally in development mode
  build [options]  Build Capsulahub application files in a specific folder (ready to deploy)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

capsulahub run --help
 Usage: run [options]
 
 Run a Capsulahub application locally in development mode
 
 Options:
   -t, --token <token>                    The token that will be used to get the configuration (required)
   -c, --configProvider <configProvider>  The type of configuration provider (optional - default is "httpFile"). Possible options: 'localFile', 'httpFile', 'scalecube', 'httpServer', 'localStorage'
   -p, --port <port>                      The port on which the application will run locally (for instance, http://localhost:55555/) (optional - default is "55555")
   -d, --dispatcherUrl <dispatcherUrl>    The url of the dispatcher for those providers that use dispatcher (optional)
   -h, --help                             output usage information

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

capsulahub build --help
    Usage: build [options]
    
    Build Capsulahub application files in a specific folder (ready to deploy)
    
    Options:
      -t, --token <token>                    The token that will be used to get the configuration (required)
      -c, --configProvider <configProvider>  The type of configuration provider (optional - default is "httpFile"). Possible options: 'localFile', 'httpFile', 'scalecube', 'httpServer', 'localStorage'
      -o, --output <output>                  Relative path to the output folder (optional - default is "./dist")
      -d, --dispatcherUrl <dispatcherUrl>    The url of the dispatcher for those providers that use dispatcher (optional)
      -h, --help                             output usage information

Configuration

The configuration should be a .json file which match this API.

This file should be accessible following the configProvider that you choose to use (docs).
The url to reach it is passed as the token.

Example: config.json

{
  "name": "baseWorkspace",
  "services": [
    {
      "serviceName": "ServiceA",
      "path": "http://localhost:1111/services/serviceA.js",
      "definition": {
        "serviceName": "ServiceA",
        "methods": {
          "getMessage": { "asyncModel": "requestResponse" }
        }
      },
      "config": { "message": "Message from ServiceA from PORT 1111 HTTP File" }
    },
    {
      "serviceName": "ServiceFlows",
      "path": "http://localhost:1111/services/serviceFlows.js",
      "definition": {
        "serviceName": "ServiceFlows",
        "methods": {}
      },
      "config": {
        "componentName": "web-component-a"
      }
    },
    {
      "serviceName": "RendererService",
      "path": "https://capsulajs.s3.amazonaws.com/develop/capsulahub-service-renderer/index.js",
      "definition": {
        "serviceName": "RendererService",
        "methods": {
          "renderLayouts": { "asyncModel": "requestResponse" },
          "renderItems": { "asyncModel": "requestResponse" },
          "renderItem": { "asyncModel": "requestResponse" }
        }
      },
      "config": {}
    }
  ],
  "components": {
    "layouts": {
      "web-grid": {
        "componentName": "web-grid",
        "nodeId": "web-grid",
        "path": "http://localhost:1111/widgets/Grid.js",
        "config": {
          "title": "Base Grid from PORT 1111 HTTP File",
          "innerComponentId": "web-component-a"
        }
      }
    },
    "items": {
      "web-component-a": {
        "componentName": "web-component-a",
        "nodeId": "web-component-a",
        "path": "http://localhost:1111/widgets/ComponentA.js",
        "config": { "name": "ComponentA(PORT 1111 HTTP File)" }
      }
    }
  }
}

License

CapsulaHub is released under MIT License.

0.0.2-next.35

4 years ago

0.0.3

4 years ago

0.0.2-next.34

4 years ago

0.0.2-next.32

4 years ago

0.0.2-next.14

5 years ago

0.0.2-next.11

5 years ago

0.0.2-next.9

5 years ago

0.0.2-next.8

5 years ago

0.0.2-next.7

5 years ago

0.0.2-next.6

5 years ago

0.0.2-next.3

5 years ago

0.0.2-next.2

5 years ago

0.0.2-next.1

5 years ago

0.0.2-next.0

5 years ago

0.0.2-alpha.2

5 years ago

0.0.2-alpha.1

5 years ago

0.0.2-alpha.0

5 years ago

0.0.1

5 years ago