A Grunt plugin that helps debugging and packaging HTML5-based extensions for Adobe Creative Cloud applications.
By using this task you can debug and package HTML5-based extensions for Adobe® Creative Cloud® products directly from Grunt, in a totally automated manner and without the Adobe Extension Builder plugin.
The tool can automatically generate self-signed certificates for extension packaging and automates some error-prone tasks such as bundle and extension manifest files creation. It supports hybrid extensions and lets you create different builds of an extension bundle based on targeted Adobe products.
It is based on the csxs command line tool by Creative Market.
See changelog.md.
Install the plugin:
npm install grunt-cep --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile as usual:
grunt.loadNpmTasks('grunt-cep');
You can use the grunt-init-cep template to easily get started. The template tool will install all the required files automatically and provide you with a basic extension boilerplate, already configured to run inside the chosen target applications.
Please refer to the grunt-init-cep documentation for installation and usage instruction.
Bundle icon, manifest, MXI and update.xml files provided by the template can also be found in the res/bundle folder located inside the plugin installation folder. If you prefer, you can manually copy these files instead of using the grunt-init-cep template.
grunt-cep is setup to use these files by default, so just copy the res/bundle folder to the root of your project (that is, the same folder of your Gruntfile.js) and you should be good to go.
XML and MXI template files are populated at build time using configuration properties. For most extensions the provided templates should work just fine, but for complex extensions it might be necessary to make changes to these files or even provide custom ones.
Note that grunt-cep makes no assumptions about and does no validation on extension files content, so be sure to provide valid files and to modify extension configuration accordingly.
You may run the task with this command:
grunt cep
grunt-cep has several options that you can customize to fit your needs. To avoid cluttering your Gruntfile.js it is more advisable to keep the options in an external Javascript or JSON file for easier editing and import them at run-time using either:
require('cep-config.js');
or:
grunt.file.readJSON('cep-config.json');
Options defined in the external file can be overwritten in child tasks as needed (see the example below). Default values and a more in-depth description for all the properties below can be found in the /options/defaults.js file in the plugin installation folder.
These properties define base task options.
The active build profile. Valid properties include:
debug: builds the extension in debug mode, that includes files such as.debugfor remote extension debugging.Please note: when building using the
debugprofile a.debugsuffix is automatically added to the name and id of the extension.launch: builds the extension in debug mode as above, but also installs it into the host applicationextensionsfolder and starts the host application.package: compiles all the extension builds (see below) in release mode and creates the final .ZXP package ready for distribution.
Path to the input folder containing extension files such as HTML and ExtendScript files that the plugin should compile for debugging and packaging.
This can either be a folder containing raw source files or the result of the automated build process when using other Grunt plugins such as grunt-contrib-requirejs
Contains information about the extension bundle, that is the container for all the extensions specified below. If required data is not specified here, grunt-cep will try to load it from the firstextension specified in the cep.extensions array.
X.X.X).
com.developer_name.bundle_name.
{update_url}/update.xml and automatically download the updated package from {update_url}/{name}_{version}.zxp.
description_href property.
description is not used.
bundle/manifest.bundle.cc.xml) or provide your own. This is usually better specified in the builds array to allow per-product configuration (see example below).
An array containing information about each single extension that will be added to the bundle. Each extension object holds information such as extension name, author, version, etc. The properties defined here are used to fill in manifest and other extension related file templates.
X.X.X).
com.developer_name.bundle_name.extension_name.
index.html or similar.
Extension lifecycle setup. Holds two properties:
- auto_visible (Boolean): true to make the extension's UI visible automatically when launched.
- events (Array): an array of strings containing the events that can start the extension.
/options/defaults.js source file for a full description of the object.
/options/defaults.js source file for a full description of the object.
bundle/manifest.extension.xml) or provide your own. This is usually better specified in the builds array to allow per-product configuration (see example below).
The ability to specify single builds is one of the most powerful feature of grunt-cep when dealing with complex extension bundles.
The cep.builds property is an array of objects describing the various builds that should be executed, each one resulting in a separate ZXP file that will be bundled with the final ZXP installer.
Each build object contains the following properties and extends the main task configuration, giving you the ability to override base configuration values on a per-build basis.
photoshop, illustrator, indesign, flash, dreamweaver, premiere, prelude.
CC, CC2014.
Only used when the launch profile is active, holds information needed to launch a target host application.
builds.products.
CC, CC2014.
Default host port used for debug.
In order to support debugging an extension inside multiple products at the same time, each supported product will have an unique debug port assigned:
- Photoshop: 8000
- Illustrator: 8001
- Etc. For a complete list, see the
.debugfile.
If bundling multiple extensions, each extension will have its debug port incremented by 100 (i.e. 8000, 8100, 8200, etc.)
Only used with the package profile, holds information related to bundle packaging and distribution.
bundle/template.mxi) or provide your own.
-tsa option to ZXPSignCmd.
Holds information about the certificate used to sign the extension. It has two sub-properties:
- file (String): path to the certificate file. If a valid certificate is not found at the specified location, a self-signed one is automatically generated using the password below.
- password (String): certificate password.
When packaging an extension bundle, the task tries to find a changelog file named as the current extension version (x.x.x.txt) in the changelog_folder folder. This file is used to fill in the update.xml template file which can be used to support automatic updates for your extension through the Adobe Extension Manager CC application.
- file (String): path to the
update.xmlfile template (see below). - changelog_folder (String): path to the folder containing changelog files.
- changelog_extension (String): changelog files extension.
The example configuration below is based on the grunt-init-cep project template and defines an extension for Adobe Photoshop CC. It registers two tasks (debug and release) which respectively launch debug inside Adobe Photoshop CC and package the full extension.
All the icons and file templates referenced in the configuration are available in the project template (see the Getting Started section).
// cep-config.js module.exports = { bundle: { version: '0.1.0', id: 'com.foo.exampleBundle', name: 'Example Bundle', author_name: 'Foo', mxi_icon: 'bundle/icon-mxi.png', }, extensions: [{ version: '0.1.0', id: 'com.foo.exampleBundle.examplePanel', name: 'Example Panel', author_name: 'Foo', icons: { panel: { light: { normal: 'icons/icon-light.png', hover: 'icons/icon-light-hover.png', disabled: 'icons/icon-light-disabled.png' }, dark: { normal: 'icons/icon-dark.png', hover: 'icons/icon-dark-hover.png', disabled: 'icons/icon-dark-disabled.png' }, } }, size: { normal: { width: 320, height: 440 }, min: { width: 320, height: 440 }, max: { width: 600, height: 600 }, }, main_path: 'example.html', script_path: 'extendscript/example.jsx', }], builds: [ // Adobe Photoshop CC { bundle: { manifest: 'bundle/manifest.bundle.cc.xml' }, extensions: [{ manifest: 'bundle/manifest.extension.xml' }], products: ['photoshop'], source: 'src', }, ], 'package': { certificate: { password: 'example_password', } }, };
// Grunfile.js grunt.initConfig({ // ... cep: { options: require('./cep-config.js'), debug: { options: { profile: 'launch', launch: { product: 'photoshop', }, } }, release: { options: { profile: 'package' } }, }, // ... });
By running:
grunt cep:debug
grunt-cep will compile all the files in the src folders along with other extension files, install the resulting extension and launch Photoshop for testing.
If you want to package the Example extension just run:
grunt cep:release
and a compiled .ZXP file will be created in the staging folder.
Something that I find particularly useful is the ability to automatically deploy the compiled extension to a website. This can be easily achieved using the grunt-ftp-deploy plugin:
grunt.initConfig({ // grunt-cep cep: { // Your config here... }, // FTP deploy "ftp-deploy": { release: { auth: { host: 'foo.it', port: 21, authKey: 'foo' }, src: 'staging', dest: '/release', exclusions: ['debug', 'package', 'release'] // Exclude work directories }, }, }); // Load plugins grunt.loadNpmTasks('grunt-cep'); grunt.loadNpmTasks('grunt-ftp-deploy'); // Integrated packaging and deploying grunt.registerTask('deploy', ['cep:release', 'ftp-deploy:release']);
When the deploy task is run, the cep:release task will package your extension and ftp-deploy will upload the relevant files (ZXP installer and "update.xml") to the foo.it website.
Contributions are extremely welcome! Extension development for Adobe applications is a complex subject and has a lot of scarcely documented features and issues. Feel free to file issues or contribute fixes to code or documentation.
Copyright © 2014 Francesco Camarlinghi
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Based on code created by Creative Market. The included binaries are copyright Adobe Systems Incorporated. "Creative Suite" and "Creative Cloud" are registered trademarks of Adobe Systems Incorporated.