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
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
).
Learn more about configuration
/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
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 configuration guide.
Learn more about vendor javascript files
integration.js
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 package.json
file.
Learn more about the main module (integration.js)
package.json
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 NPM site.
For the Polarity specific guide learn more about the package.json
file here.
README.md
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 "Mastering Markdown" guide on GitHub.
Last updated