LogoLogo
Enterprise GuideCommunity Edition GuideDeveloper Guide
  • Using The Polarity Developer Guide
  • Quick Start
    • What's New
    • Installing Integrations
    • Quick Start Guide
    • Learning Resources
  • Building an Integration
    • Directory Layout
    • package.json
    • Configuration File
    • Integration Main Module
      • startup
      • doLookup
        • Entity Objects
        • Result Objects
        • Error Objects
      • onDetails
      • onMessage
      • validateOptions
    • Customizing the Overlay Window
      • Templates
        • Conditionals
        • Displaying a List of Items
        • Display Object Properties
        • Built-in Helpers
        • Displaying Icons
      • Component File
        • Aliased Properties
        • Computed Properties
        • Event Hooks
      • CSS Styles
    • Vendor Javascript
      • Inserting Javascript into DOM
    • README Guide
    • Debugging Integrations
      • Web Inspector
      • Using Integration Logs
      • Testing Main Module
  • Recipes
    • Enabling User Actions
    • Throttling Lookups
    • Using Custom Entity Types
    • Custom Summary Tags
    • Creating a Tabbed Interface
    • Accessing Username of Requestor
Powered by GitBook
On this page
  • Suggested Directory Layout
  • Subdirectories
  • /components
  • /config
  • /styles
  • /templates
  • /test
  • /vendor
  • integration.js
  • package.json
  • README.md
  1. Building an Integration

Directory Layout

Integrations should follow the suggested directory layout to improve readability

Suggested Directory Layout

The following shows a recommended directory layout for a Polarity integration called sample-integration

sample-integration/
├── components/
│   └── sample-integration-block.js
├── config/
│   └── config.js
├── styles/
|   └── sample-integration.less
├── templates/
|   └── sample-integration.hbs
├── test/
|   └── sample-integration-test.js
├── vendor/
|    └── google.js
├── integration.js    
├── package.json    
└── README.md

Subdirectories

/components

The components directory contains a component file that allows logic to be implemented and data to be manipulated on the client side of the integration (i.e., within the notification window). Components are typically used to format data on the client, or to receive user actions from the notification window.

/config

The config file allows you to specify a large range of properties for your integration including logging and user options. The config filename and path cannot be modified (the config file must always be /config/config.js).

/styles

The styles directory is where you place your CSS or LESS file that can be used to apply custom styles to your integration template.

/templates

The templates directory contains your integration template written using the Handlebars templating language. Handlebars enhances HTML by providing intuitive syntax for mixing static HTML content with dynamic integration content inside curly braces {{ }}. Handlebars also provides basic programming logic such as if/then/else statements and loops.

/test

The test directory is where unit, integration, and acceptance tests should be placed. The test directory name should not be modified (i.e., it should always be called test).

/vendor

integration.js

package.json

README.md

PreviousLearning ResourcesNextpackage.json

Last updated 3 years ago

The vendor directory is where you should place any javascript files you want loaded with the integration. Any files placed here should be listed under the javascript property of the configuration file as specified in the .

The integration.js file is the main module file and entry point for your integration. The name of this file must match the main property set in your file.

The package.json file is used to configure the dependencies of your integration. The package.json file follows the same rules and conventions followed by the NPM package.json file (integration dependencies are actually installed using NPM). You can learn more about NPM package.json files on the official

For the Polarity specific guide

The README.md file is a markdown file that documents your integration. You should provide an overview of what your integration does and the different configuration options. The markdown file should be written using GitHub flavored markdown. You can learn more about the markdown syntax by reading the "" guide on GitHub.

Learn more about components
Learn more about configuration
Learn more about styles
Learn more about templates
configuration guide
Learn more about vendor javascript files
package.json
Learn more about the main module (integration.js)
NPM site.
learn more about the package.json file here.
Mastering Markdown
Learn more about the README.md file