[NPMCLI-149] create-app and create-content-type commands Created: 13/Dec/17  Updated: 16/May/19  Resolved: 08/Apr/19

Status: Closed
Project: Magnolia CLI
Component/s: None
Affects Version/s: None
Fix Version/s: 3.1.0

Type: New Feature Priority: Major
Reporter: Christopher Zimmermann Assignee: Milan Divilek
Resolution: Fixed Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
dependency
is depended upon by NPMCLI-209 DOC: Describe the create-app and crea... Closed
is depended upon by NPMCLI-210 DOC: A tutorial showcasing creation o... Closed
is depended upon by NPMCLI-218 Create-app, create-content-type with ... Accepted
relation
is related to NPMCLI-204 Don't run commands on incompatible ve... Open
Template:
Acceptance criteria:
Empty
Release notes required:
Yes
Documentation update required:
Yes
Date of First Response:
Epic Link: Content Types finalization
Sprint: Features 8
Story Points: 8

 Description   

As a developer I can quickly create content-types and apps, so that I can get started on a project quickly.

Acceptance criteria

  • I can create a working app (based on a CT) with the CLI

We should create two new commands to assist working with content types.

mgnl create-content-type

Create a standard content type following the conventions established by the "create-component" command. It does not need to be interactive, it can just create a good starting point for a developer.

A "-app" and "-a" option should cause an app definition to be created as well which references the content type.

mgnl create-app

It should work the same as the create-content-type command, but supply the "-a" option automatically.

 

Why two commands?

Some developers will be very focussed on creating an app. It needs to be obvious to them  how to do that.

On the other hand, creating a content type directly also makes sense, and in the future will include additional useful options - such as creating templates and restEndpoints. So it makes sense to have one command which can do all related tasks for you.

 

Suggestions for Prototypes:

App

!content-type:__name__
name: __name__

# Optionally override any of the app configuration supplied by the content type.
# subApps:
#   detail:
#     editor:
#       form:
#         tabs:
#           default:
#
#             fields:
#               - name: title
#                 rows: 5

 

Content type

 

# Automatically generated contentType demonstrates usage of the common properties.
# Modify them to match your requirements.
datasource:
  workspace: __name__

# Optionally configure a custom namespace. (Replace [myNamespace] everywhere.) 
# This namespace can then be used below for the nodetype.
# namespaces:
#   [myNamespace]: https://www.[myDomain.com]/jcr/1.0/[myNamespace]
  autoCreate: true

model:
# Optionally supply a specific nodetype, otherwise 'mgnl:content' will be used.
# nodeType: [myNamespace]:__name__
  properties:
    - name: title
      label: Title
      type: String
      required: true
      i18n: true
    - name: birthday
      label: Birthday
      type: Date
    - name: member
      label: Is a member
      type: Boolean  #Types 'Decimal', 'Long' and 'Double' are also available.    

    - name: phoneNumbers
      label: Phone Numbers
      type: PhoneNumber
      multiple: true
    - name: billingAddress
      label: Billing Address
      type: Address
    - name: shippingAddress
      label: Shipping Address
      type: Address  

  subModels:    
    - name: PhoneNumber
      properties:
        - name: title
          label: Title
        - name: number
          label: Number    

    - name: Address
      properties:
        - name: street
          label: Street
        - name: city
          label: City
        - name: postalCode
          label: Postal Code
        - name: country
          label: Country

 

 



 Comments   
Comment by Richard Gange [ 13/Dec/17 ]

Yes, good idea. Much better than the groovy script.

Comment by Christopher Zimmermann [ 13/Dec/17 ]

Outdated

Unfortunately I dont think the command can setup everything you need to get your app created yet. (Create workspace, Security...)

Comment by Richard Gange [ 13/Dec/17 ]

True, but the groovy script really could not do those things either. It would create the workspace and node type, but you still had to move that by hand to the descriptor.

Comment by Christopher Zimmermann [ 17/Apr/19 ]

As this ticket is introducing new features, it should get a new minor version -> 3.1

Generated at Mon Feb 12 04:47:00 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.