Results 1 to 2 of 2

Thread: Invalid format of package.json error for my custom extension in SA 3.2

  1. #1
    Sencha User
    Join Date
    Aug 2015
    Posts
    19
    Answers
    1

    Default Answered: Invalid format of package.json error for my custom extension in SA 3.2

    Hi guys,

    My colleague has created some custom classes that make use of our flexible back-end API, and I wanted to create an extension to use them in Architect. I've been following this post and this reference page to produce these files (values of "js" keys are filenames in folder /src/ of the package):

    package.json:
    Code:
    {    
        "name": "UniversalBackend",
        "type": "code",
        "creator": "A creator",
        "summary": "Front end to Universal Backend",
        "detailedDescription": "A set of Ext JS classes supporting Universal Backend.",
        "version": "1.0.0",
        "compatVersion": "1.0.0",
        "format": "1",
        "local": true,
        "architect": {
            "compatFrameworks" : [
                "ext51"
            ],
            "classes": [{
                "definition": "UniversalBackendStoreDefinition.js",
                "className": "Ext.universal.Store",
                "js": ["Store.js"]
            },{
                "definition": "UniversalBackendGridDefinition.js",
                "className": "Ext.universal.Grid",
                "js": ["Grid.js"]
            },{
                "definition": "UniversalBackendFormDefinition.js",
                "className": "Ext.universal.Form",
                "js": ["Form.js"]
            },{
                "definition": "UniversalBackendComboBoxDefinition.js",
                "className": "Ext.universal.ComboBox",
                "js": ["ComboBox.js"]
            }]
        },
        "css" : [],
        "requires": [],  
    }
    /architect/*.js files:
    Code:
    // UniversalBackendStoreDefinition.js
    {
        "classAlias": "store.universalstore",
        "className": "Ext.universal.Store",
        "inherits": "Ext.data.Store",
        "autoName": "MyUniversalStore",
        "helpText": "A store automatically loading data from Universal Backend.",
        "toolbox": {
            "name": "Universal Backend Grid",
            "category": "Grid",
            "groups": ["Grids"]
        },
        "configs": [{
            "name": "url",
            "type": "string",
            "initialValue": "/php/universal.php"
        },{
            "name": "parameters",
            "type": "object",
        }]
    }
    
    // UniversalBackendGridDefinition.js
    {
        "classAlias": "widget.universalgrid",
        "className": "Ext.universal.Grid",
        "inherits": "Ext.grid.Panel",
        "autoName": "MyUniversalGrid",
        "helpText": "A grid automatically displaying data from Universal Backend.",
        "toolbox": {
            "name": "Universal Backend Grid",
            "category": "Grid",
            "groups": ["Grids"]
        },
        "configs": [{
            "name": "url",
            "type": "string",
            "initialValue": "/php/universal.php"
        },{
            "name": "pageSize",
            "type": "number",
            "initialValue": 25
        },{
            "name": "maxPageSize",
            "type": "number",
            "initialValue": 64000
        },{
            "name": "enablePaging",
            "type": "boolean",
            "initialValue": true
        },{
            "name": "enableEditing",
            "type": "boolean",
            "initialValue": false,
            "hidden": true    // For now...
        },{
            "name": "parameters",
            "type": "object",
        },{
            "name": "groupField",
            "type": "string",
        },{
            "name": "Columns",
            "hidden": true,
        },{
            "name": "autoLoad",
            "hidden": true,
        },{
            "name": "bufferedRender",
            "hidden": true,
        },{
            "name": "store",
            "hidden": true,
        }]
    }
    
    
    // UniversalBackendFormDefinition.js
    {
        "classAlias": "widget.universalform",
        "className": "Ext.universal.Form",
        "inherits": "Ext.panel.Panel",
        "autoName": "MyUniversalForm",
        "helpText": "A form connected to Universal Backend.",
        "toolbox": {
            "name": "Universal Backend Form",
            "category": "Containers",
            "groups": ["Forms"]
        },
        "configs": [{
            "name": "url",
            "type": "string",
            "initialValue": "/php/universal.php"
        },{
            "name": "database",
            "type": "string",
        },{
            "name": "procedure",
            "type": "string",
        },{
            "name": "description",
            "type": "string",
        }]
    }
    
    
    // UniversalBackendComboBoxDefinition.js
    {
        "classAlias": "widget.universalcombobox",
        "className": "Ext.universal.ComboBox",
        "inherits": "Ext.form.field.ComboBox",
        "autoName": "MyUniversalComboBox",
        "helpText": "A Combo Box displaying information from a database accessed by Universal Backend.",
        "toolbox": {
            "name": "Universal Backend Combo Box",
            "category": "Form Fields",
            "groups": ["Forms"]
        },
        "configs": [{
            "name": "url",
            "type": "string",
            "initialValue": "/php/universal.php"
        },{
            "name": "database",
            "type": "string",
        },{
            "name": "label",
            "type": "string",
        }]
    }
    The only error message I get is "Failed to load package from [path to my package] - invalid format of package.json".

    What am I doing wrong?

  2. I sorted it out myself - I renamed all classes according to the Ext Class System Guide, with my company name at the beginning, and that made it work.

    I would still say that the message provided by Architect was not nearly precise enough to help me debug my code and find where the problem is. I mean, how does 'invalid format of package.json' mean 'invalid class name'?

  3. #2
    Sencha User
    Join Date
    Aug 2015
    Posts
    19
    Answers
    1

    Default

    I sorted it out myself - I renamed all classes according to the Ext Class System Guide, with my company name at the beginning, and that made it work.

    I would still say that the message provided by Architect was not nearly precise enough to help me debug my code and find where the problem is. I mean, how does 'invalid format of package.json' mean 'invalid class name'?

Similar Threads

  1. [OPEN] [3.1.0.256] Error 'Package name contains invalid character'
    By ingo.hefti in forum Sencha Cmd
    Replies: 5
    Last Post: 29 Apr 2013, 6:18 AM
  2. Replies: 4
    Last Post: 25 Nov 2011, 8:38 AM
  3. [OPEN] [CLOSED]Error when JSON format is invalid
    By JPfahl in forum Ext:Bugs
    Replies: 1
    Last Post: 3 May 2011, 2:36 AM
  4. Invalid JSON Message format by default?
    By Jack9 in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 17 Jul 2010, 11:48 PM
  5. Replies: 0
    Last Post: 6 Jul 2010, 6:11 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •