montagejs / minit

Tool: Helps you build Montage applications by generating template applications and components for you.
Other
8 stars 22 forks source link

Add template for sample .info applications #95

Open tejaede opened 4 years ago

tejaede commented 4 years ago

The goal of this template is to quickly stub a prototype application for a single component. This template adheres to the standard montage pattern of creating a .info directory as a direct sibling of its associated component.

Example Component Command Output
ui/list-item.reel minit create:sample -n list-item ui/list-item.info
ui/button/custom-button.reel minit create:sample -n custom-button -d ui/button ui/button/custom-button.info

Structure The output is based on the app.js template with a few key differences:

  1. test and run-tests.html are removed

  2. The package dependencies are replaced with mappings back to montage and the main package.

    {
    "name": "list-item-sample",
    "version": "0.1.0",
    "description": "sample",
    "mappings": {
        "montage": "../../../node_modules/montage",
        "acme-framework": "../../../"
    }
    }
  3. The montageVersion component serialized in ui/main.reel is replaced with an instance of the component being prototyped.

        {
            "owner": {
                "values": {
                    "element": {"#": "main"}
                }
            },
    
            "listItem": {
                "prototype": "acme-framework/ui/list-item.reel",
                "values": {
                    "element": {"#": "listItem"}
                }
            }
        }