Core functionality for making bundler extensions to compile CEP. All the functionality is exposed through one simple function:
const core = require('cep-bundler-core')
core.compile({
out: '/path/to/dist', // REQUIRED type: string
isDev: false, // OPTIONAL type: boolean, default: false
devPort: 8080, // OPTIONAL type: number, default: 8080
devHost: 'localhost', // OPTIONAL type: string, default: localhost
env: 'production', // OPTIONAL type: string, default: process.env.NODE_ENV
root: '/path/to/project/root', // OPTIONAL type: string, default: process.cwd()
htmlFilename: './index.html', // OPTIONAL type: string, default: 'index.html'
pkg: require('./package.json') // OPTIONAL type: object, default: require(opts.root + '/package.json')
})
The out
option specifies where the manifest.xml
, dev.html
, node_modules
folder and (optionally) .debug
file are saved to, this is usually the folder where your compiled javascript ends up.
When isDev
is true, the bundler will create a dev.html
file that contains a redirect to http://${devHost}:${devPort}
, when isDev
is false, it will not create a dev.html file but will set the MainPath
in the manifest.xml
to the value set through the htmlFilename
option.
See the isDev
option above, these options are used to specify where your bundler dev server is running, when compiling with isDev
set to true, a html file will be created that will redirect to your dev server.
The env
option is used when you want different configurations for other environments, you might for example have development
, staging
, ci
and production
environments that you want to configure differently.
This option is only used when configure the bundler through your package.json
, here is an example of using different extension names for different environments.
"cep": {
"development": {
"name": "My Extension DEVELOPMENT",
"id": "com.mycompany.myextension.development",
},
"beta": {
"name": "My Extension BETA",
"id": "com.mycompany.myextension.beta",
},
"production": {
"name": "My Extension",
"id": "com.mycompany.myextension",
}
}
The root
option determines where the bundler should look for the package.json
and node_modules
folder, when you leave this off the current working directory will be used.
The htmlFilename is the name of your html file, this option is only used when isDev
is false.
This path is relative from the out
folder.
Optionally pass in the package.json object yourself, it will load the json from the package.json
in the root
folder by default.
You can configure CEP a either through environment variables or by a config object under the cep
key in the package.json
of your project.
"cep": {
"name": "My Extension",
"id": "com.mycompany.myextension",
"hosts": "*"
}
Either set
thorugh your terminal or add to the .env
file.
CEP_NAME="My Extension"
CEP_ID="com.mycompany.myextension"
CEP_HOSTS="*"
This is the unique id of the extension.
"id": "com.mycompany.myextension"
Environment variable: CEP_ID
This sets the version of the bundle.
"version": "1.2.0"
Environment variable: CEP_VERSION
This sets the name of extension as it will show in the application.
"name: "My Extension"
Environment variable: CEP_NAME
By default, the extension will target all known Adobe hosts. To target specific hosts, modify the list of the hosts you want to target. For example, to target just Illustrator and After Effects:
"hosts": "ILST, AEFT"
And to target specific versions:
"hosts": "ILST, IDSN@*, PHXS@6.0, AEFT@[5.0,10.0]"
This will target all versions of Illustrator and In Design, Photoshop 6.0, and After Effects 5.0 - 10.0.
Environment variable: CEP_HOSTS
To add a custom panel icon, add all icon files and set their paths in your config:
"iconNormal": "./assets/icon-normal.png",
"iconRollover": "./assets/icon-rollover.png",
"iconDarkNormal": "./assets/icon-dark.png",
"iconDarkRollover": "./assets/icon-dark-rollover.png"
Environment variables:
CEP_ICON_NORMAL="./assets/icon-normal.png",
CEP_ICON_ROLLOVER="./assets/icon-rollover.png",
CEP_ICON_DARK_NORMAL="./assets/icon-dark.png",
CEP_ICON_DARK_ROLLOVER="./assets/icon-dark-rollover.png"
"panelWidth": 500,
"panelHeight": 500,
Environment variables:
CEP_PANEL_WIDTH=500
CEP_PANEL_HEIGHT=500
"panelMinWidth": 500,
"panelMinHeight": 500,
Environment variables:
CEP_PANEL_MIN_WIDTH=500
CEP_PANEL_MIN_HEIGHT=500
"panelMaxWidth": 500,
"panelMaxHeight": 500,
Environment variables:
CEP_PANEL_MAX_WIDTH=500
CEP_PANEL_MAX_HEIGHT=500
"debugPorts": {
"PHXS": 3001,
"IDSN": 3002,
"AICY": 3003,
"ILST": 3004,
"PPRO": 3005,
"PRLD": 3006,
"AEFT": 3007,
"FLPR": 3008,
"AUDT": 3009,
"DRWV": 3010,
"MUST": 3011,
"KBRG": 3012,
},
Environment variables:
CEP_DEBUG_PORT_PHXS="3001"
CEP_DEBUG_PORT_IDSN="3002"
CEP_DEBUG_PORT_AICY="3003"
CEP_DEBUG_PORT_ILST="3004"
CEP_DEBUG_PORT_PPRO="3005"
CEP_DEBUG_PORT_PRLD="3006"
CEP_DEBUG_PORT_AEFT="3007"
CEP_DEBUG_PORT_FLPR="3008"
CEP_DEBUG_PORT_AUDT="3009"
CEP_DEBUG_PORT_DRWV="3010"
CEP_DEBUG_PORT_MUST="3011"
CEP_DEBUG_PORT_KBRG="3012"
Enabling this will create the .debug file, even when building for production.
"debugInProduction": true
Environment variable:
CEP_DEBUG_IN_PRODUCTION="1"
"cefParams": [
"--allow-file-access-from-files",
"--allow-file-access",
"--enable-nodejs"
]
Environment variable:
CEP_CEF_PARAMS="--allow-file-access-from-files,--allow-file-access,--enable-nodejs,--mixed-context"
This code is mostly taken from (an old version of) parcel-plugin-cep by @fusepilot.